Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cf55f20

Browse files
Create dweb-secret-key-storage.md
1 parent 3816619 commit cf55f20

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# dWeb Secret Key Storage
2+
3+
## Install
4+
5+
```
6+
npm install @dpack/secret-storage
7+
```
8+
9+
## Usage
10+
11+
Return for the `secret_key` storage in dDrive/dDatabase. To avoid local ownership conflicts, pass the local directory as the first argument. `@dpack/secret-storage` will check for a non-empty ownership file in the source directory storage.
12+
13+
```js
14+
var secretStore = require('@dpack/secret-storage')
15+
16+
var storage = {
17+
metadata: function (name, opts) {
18+
if (name === 'secret_key') return secretStore()(path.join(dir, '.dweb/metadata.ogd'), opts)
19+
return // other storage
20+
},
21+
content: function (name, opts) {
22+
return // other storage
23+
}
24+
}
25+
26+
// store secret key in ~/.dweb/secret_keys
27+
var vault = ddrive(storage)
28+
```
29+
30+
## API
31+
32+
### `secretStorage([dir])(ownershipFile, opts)`
33+
34+
* `dir`: directory to store keys under `dir/.dweb/secret_keys`. Defaults to users home directory.
35+
* `ownershipFile`: non-empty file that denotes ownership. This helps avoid local ownership conflicts of the same dPack.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /