Skip to content

Commit

Permalink
feat!: Create private node using exchange key pair
Browse files Browse the repository at this point in the history
  • Loading branch information
icidasset committed Mar 31, 2024
1 parent 055e351 commit 0f322fe
Show file tree
Hide file tree
Showing 5 changed files with 548 additions and 182 deletions.
15 changes: 13 additions & 2 deletions packages/nest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const fs = await FileSystem.create({
})

// Create the private node of which we'll keep the encryption key around.
const { capsuleKey } = await fs.mountPrivateNode({
const { capsuleKey } = await fs.createPrivateNode({
path: Path.root(), // ie. root private directory
})

Expand Down Expand Up @@ -146,11 +146,22 @@ const receiverDataRoot = dataRoot
const { dataRoot } = await fs.share(pathToPrivateItem, receiverDataRoot)
const sharerDataRoot = dataRoot
// Step 5
const { share } = await fs.receive(sharerDataRoot, publicKey, privateKey)
const { share } = await fs.receive(sharerDataRoot, { publicKey, privateKey })

await share.read('utf8')
```

## Manage private node using exchange key pair

Instead of keeping the symmetric capsule key around we can use an exchange key pair to mount a private node. This basically creates a share for ourselves.

```ts
await fs.createPrivateNode({
path: Path.root(),
exchangeKeyPair: { publicKey, privateKey }, // 🔑 Pass in key pair here
})
```

## Transactions

```ts
Expand Down
Loading

0 comments on commit 0f322fe

Please sign in to comment.