diff --git a/README.md b/README.md index a76b38d..9ae84f5 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ Connect two devices, a phone and computer, for example. They must both know `cod ```js import { program as Program } from '@oddjs/odd' import { create as createID } from '@bicycle-codes/identity' +import { Parent } from '@bicycle-codes/link' const program = await Program({ namespace: { @@ -63,7 +64,10 @@ const newIdentity = await Parent(myId, crypto, { ...On a different machine... -```js +```js +import { program as Program } from '@oddjs/odd' +import { Child } from '@bicycle-codes/link' + const program = await Program({ namespace: { name: 'link-example', @@ -81,7 +85,29 @@ const { identity, certificate } = await Child(crypto, { Both machines now have an ID that looks like this: -![Screenshot of identity](image.png) +```js +{ + "username": "vnhq32ybnanplsklhfd2cd6cdqaoeygl", + "humanName": "alice", + "rootDID": "did:key:z13V3Sog2YaU...", + "devices": { + "vnhq32ybnanplsklhfd2cd6cdqaoeygl": { + "aes": "Cj1XnlPQA35VroF...", + "name": "vnhq32ybnanplsklhfd2cd6cdqaoeygl", + "humanReadableName": "phone", + "did": "did:key:z13V3Sog2Y...", + "exchange": "MIIBIjANBgkqhkiG..." + }, + "5ngvlbhsrfvpua3qnhllakwnnd2tzwzo": { + "name": "5ngvlbhsrfvpua3qnhllakwnnd2tzwzo", + "humanReadableName": "computer", + "aes": "oAbLoAtJawSbA3r2tI4BDEmb...", + "did": "did:key:z13V3Sog2YaUKhdGCmg...", + "exchange": "MIIBIjANBgkqhkiG9w0BAQEFA..." + } + } +} +``` ### serverside This depends on a websocket server existing. We provide the export diff --git a/image.png b/image.png deleted file mode 100644 index 405108d..0000000 Binary files a/image.png and /dev/null differ diff --git a/package.json b/package.json index f56f23a..d50ca5c 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "lint": "eslint \"./**/*.{ts,js}\"", "build-tests": "esbuild test/index.ts --target=es2020 --bundle --keep-names > test/test-bundle.js", "test": "npm run lint && npm run build && npm run build-tests && npm run test-tape-run", - "test-tape-run": "concurrently --kill-others \"npx partykit dev\" \"cat test/index.html | npx tape-run --input=html --static=test | npx tap-spec\"", + "test-tape-run": "concurrently --kill-signal=SIGINT --kill-others \"npx partykit dev\" \"cat test/index.html | npx tape-run --input=html --static=test | npx tap-spec\"", "build-cjs": "esbuild src/*.ts --format=cjs --keep-names --tsconfig=tsconfig.build.json --outdir=./dist --out-extension:.js=.cjs --sourcemap=inline", "build-esm": "tsc --project tsconfig.build.json", "build": "mkdir -p ./dist && rm -rf ./dist/* && npm run build-cjs && npm run build-esm",