OverviewFilesCommitsIssuesDocsReleasesPeers

trust-map commits / ef86b67

README: the repo had none
Written from the source, not from memory: exports and method names come from index.js and lib/, the usage example mirrors examples/cli.js, and the test count is one I ran. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ef86b67732d0525ffaf0b2a0ef8e22a274498ad4
by plankatron <fleeky@gmail.com> · 2026-09-10T15:40:20.000Z

Changed files (1) +71 -0

README.md +71 -0
……@@ -0,0 +1,71 @@
1# trust-map
2
3A pubkey → permissions store, with optional [hyperident](../hyperident) chain verification.
4
5Answers one question — *may this key do this thing to this resource?* — and answers it either
6directly or by walking a device-attestation chain back to an identity root.
7
8## Install
9
10```sh
11npm install trust-map
12```
13
14## Usage
15
16```js
17import { TrustMap } from 'trust-map'
18
19const trust = new TrustMap('./storage')
20await trust.ready()
21
22await trust.grant(pubkey, 'repo:myrepo', ['read', 'write'])
23await trust.check(pubkey, 'repo:myrepo', 'write') // true
24await trust.revoke(pubkey, 'repo:myrepo', ['write'])
25await trust.check(pubkey, 'repo:myrepo', 'write') // false
26
27await trust.close()
28```
29
30## API
31
32#### `new TrustMap(storage, [options])`
33
34Backed by a Corestore. **RocksDB holds a single-writer lock**, so two processes cannot open the
35same storage path at once — embed this in one daemon and have clients talk to that, rather than
36opening it from several places.
37
38#### `await trust.grant(pubkey, resource, perms)`
39#### `await trust.revoke(pubkey, resource, [perms])`
40
41Revoking with no `perms` removes every permission on that resource.
42
43#### `await trust.check(pubkey, resource, perm) -> bool`
44
45Direct check: is this exact pubkey granted this permission?
46
47#### `await trust.checkChain(pubkey, resource, perm) -> bool`
48
49The same question, but walks a hyperident device-attestation chain — so a grant to an identity
50root answers for every device that root has attested, without granting each device separately.
51
52#### `await trust.list()`
53#### `await trust.listForPubkey(pubkey)`
54
55## Examples
56
57- `examples/cli.js` — grant / revoke / check from a terminal
58- `examples/web.js` — the same over HTTP
59
60⚠ They use **different** storage paths by default (`.trust-map-cli/` and `.trust-map-web/`) and
61do not share state, for the single-writer reason above.
62
63## Test
64
65```sh
66npm test # 11/11
67```
68
69## License
70
71Not yet declared.