https://github.com/rhodey/lock.host-node
Lock.host nodejs example
https://github.com/rhodey/lock.host-node
crypto enclave ipfs
Last synced: 4 months ago
JSON representation
Lock.host nodejs example
- Host: GitHub
- URL: https://github.com/rhodey/lock.host-node
- Owner: rhodey
- License: mit
- Created: 2025-07-08T19:45:43.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2025-09-11T21:50:46.000Z (4 months ago)
- Last Synced: 2025-09-21T23:58:18.970Z (4 months ago)
- Topics: crypto, enclave, ipfs
- Language: JavaScript
- Homepage: https://lock.host
- Size: 3.15 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Lock.host-node
Lock.host nodejs example, see: [lock.host](https://github.com/rhodey/lock.host)
This demonstration uses OpenAI to control a Solana wallet:
+ Unmodified OpenAI lib
+ Unmodified Solana web3.js lib
+ Hit /api/ask?message=your best joke&addr=abc123
+ OAI is asked "You are to decide if a joke is funny or not"
+ If so 0.001 SOL is sent to addr
## Build app
This is how PCR hashes are checked:
```
just serve-alpine
just build-app
...
{
"Measurements": {
"HashAlgorithm": "Sha384 { ... }",
"PCR0": "1dec12cc87b9bb44cf66cd770f3cddeb7fe62cd622034b6dfb3f9f4473e289a506bd585020d54b2350431f94fae38f2f",
"PCR1": "4b4d5b3661b3efc12920900c80e126e4ce783c522de6c02a2a5bf7af3a2b9327b86776f188e4be1c1c404a129dbda493",
"PCR2": "29c92b2d29637f1347332b18fef6bb149890ed8abeddaad81f6c8f5b51138bef5a962b019a8b569045569b00cb95ab7b"
}
}
```
See that [run.yml](.github/workflows/run.yml) step "PCR" is testing that PCRs in this readme match the build
## Prod
+ In prod all TEE I/O passes through /dev/vsock
+ Think of /dev/vsock as a file handle
+ How to run:
```
just serve-alpine
just build-app
cp example.env .env
just run-app
just run-host
```
## Test
+ In test a container emulates a TEE
+ Uses two fifos /tmp/read /tmp/write to emulate vsock
+ How to run:
```
just serve-alpine
just build-test-app
cp example.env .env
just run-test-app
just run-test-host
just add-funds
just ask-funds
...
addr = wJQASiSgaqVJBP8iQUpyTpNcpQinMWg17unrNTbbYoC
sol = 0
json = {
signatute: 'mHPgWppbhKujn8deozVGQurtpqPAcQ1nMg99uSmwmrmSp8m8GPRiXha36D2AJ42bNRzTG9xbhar1w7MRf2mUoLp',
from: 'AkHqQ324DvygPxuhyYs9BTVG8b1BXzTnpbCxqG8zousm',
to: 'wJQASiSgaqVJBP8iQUpyTpNcpQinMWg17unrNTbbYoC'
}
sol = 0.001
```
## Web
The webapp [IPFS-boot-choo](https://github.com/rhodey/IPFS-boot-choo) demonstrates lock.host in a client-to-server environment
The webapp when hitting dev (not prod) requires an HTTPS certificate to be installed with the OS
This is because of a combination of Lock.host using HTTP2 and IPFS-boot using a service worker
+ just mkcert
+ chrome > settings > privacy & security
+ security > manage certificates > authorities
+ import > ca.crt
## Apks
Modify apk/Dockerfile.fetch to include all apks then run:
```
just proxy-alpine
just fetch-alpine
```
## License
MIT