@cef-ai/vault-sdk 3.2.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +26 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +40 -3
- package/dist/client.js.map +1 -1
- package/dist/core/canonical.d.ts +17 -1
- package/dist/core/canonical.d.ts.map +1 -1
- package/dist/core/canonical.js +26 -1
- package/dist/core/canonical.js.map +1 -1
- package/dist/core/endpoints.d.ts +5 -1
- package/dist/core/endpoints.d.ts.map +1 -1
- package/dist/core/endpoints.js +13 -1
- package/dist/core/endpoints.js.map +1 -1
- package/dist/core/grant-doc.d.ts +345 -0
- package/dist/core/grant-doc.d.ts.map +1 -0
- package/dist/core/grant-doc.js +603 -0
- package/dist/core/grant-doc.js.map +1 -0
- package/dist/core/types.d.ts +189 -23
- package/dist/core/types.d.ts.map +1 -1
- package/dist/fluent/vault.d.ts +6 -0
- package/dist/fluent/vault.d.ts.map +1 -1
- package/dist/fluent/vault.js +7 -0
- package/dist/fluent/vault.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/memberships.d.ts +360 -0
- package/dist/internal/memberships.d.ts.map +1 -0
- package/dist/internal/memberships.js +403 -0
- package/dist/internal/memberships.js.map +1 -0
- package/dist/internal/vaults.d.ts +22 -0
- package/dist/internal/vaults.d.ts.map +1 -1
- package/dist/internal/vaults.js +11 -0
- package/dist/internal/vaults.js.map +1 -1
- package/dist/internal-exports.d.ts +2 -1
- package/dist/internal-exports.d.ts.map +1 -1
- package/dist/internal-exports.js +1 -1
- package/dist/internal-exports.js.map +1 -1
- package/package.json +3 -3
- package/dist/internal/orgs.d.ts +0 -9
- package/dist/internal/orgs.d.ts.map +0 -1
- package/dist/internal/orgs.js +0 -12
- package/dist/internal/orgs.js.map +0 -1
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import type { SignedGrant, SignedRoster } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The schema string carried INSIDE the signed bytes (`authz.GrantSchema`).
|
|
4
|
+
*
|
|
5
|
+
* A v2 changes this string, so a v1 signature can never be replayed as a v2
|
|
6
|
+
* grant — which is why `decodeGrantDoc` refuses any other value instead of
|
|
7
|
+
* handing a v2 document's fields to a v1 reader under a signature that is
|
|
8
|
+
* perfectly valid for the v2 meaning.
|
|
9
|
+
*/
|
|
10
|
+
export declare const GRANT_SCHEMA = "cere.vault.grant.v1";
|
|
11
|
+
/**
|
|
12
|
+
* The header a membership write carries the vault owner's grant signature in
|
|
13
|
+
* (`authz.GrantSignatureHeader`), hex, with or without an `0x` prefix.
|
|
14
|
+
*
|
|
15
|
+
* A HEADER OF ITS OWN, not the wallet auth's `X-Signature`, because the two
|
|
16
|
+
* cover different bytes: `X-Signature` covers the request BODY and
|
|
17
|
+
* authenticates the CALLER (who may be an admin acting for the owner), while
|
|
18
|
+
* this covers the canonical grant document and attests the OWNER's
|
|
19
|
+
* authorisation of that exact grant. The body of `PUT .../members` is
|
|
20
|
+
* `{"role":…,"timestamp":…}` — the vault id and the member's key are URL
|
|
21
|
+
* parameters and never enter the signed bytes — so one owner-signed
|
|
22
|
+
* `{"role":"admin",…}` would otherwise verify identically for every member of
|
|
23
|
+
* every vault that owner holds.
|
|
24
|
+
*/
|
|
25
|
+
export declare const GRANT_SIGNATURE_HEADER = "X-Grant-Signature";
|
|
26
|
+
/**
|
|
27
|
+
* The header carrying the `issuedAt` the signed document was minted with
|
|
28
|
+
* (`pkgvault.GrantIssuedAtHeader`).
|
|
29
|
+
*
|
|
30
|
+
* vault-api does not RECEIVE the grant document, it REBUILDS it — from the URL
|
|
31
|
+
* parameters, the body, and the other half read back from its store — and then
|
|
32
|
+
* checks your signature over what it built. Every field must therefore be
|
|
33
|
+
* something the server can reproduce, and a mint time is the one thing it
|
|
34
|
+
* cannot: a server-chosen `now` would never equal yours. So it travels beside
|
|
35
|
+
* the signature.
|
|
36
|
+
*
|
|
37
|
+
* NOT the body's `timestamp`, even though every mutation body already carries
|
|
38
|
+
* one and the wallet middleware already bounds its skew. The signer and the
|
|
39
|
+
* sender are different parties: the route admits an admin, but the document
|
|
40
|
+
* must be signed by the VAULT's wallet, so an admin presents a grant their
|
|
41
|
+
* owner signed out of band. Binding the mint time to the request body would
|
|
42
|
+
* make the owner predict the admin's exact timestamp string, and the skew
|
|
43
|
+
* window would expire their pre-signed grant in five minutes.
|
|
44
|
+
*/
|
|
45
|
+
export declare const GRANT_ISSUED_AT_HEADER = "X-Grant-Issued-At";
|
|
46
|
+
/**
|
|
47
|
+
* `auth.CanonicalPubKeyHex`, reproduced: `0x`-prefixed lowercase hex, or the
|
|
48
|
+
* input UNCHANGED when it is not hex at all.
|
|
49
|
+
*
|
|
50
|
+
* THE SERVER APPLIES THIS TO THE URL PARAMETER BEFORE IT BUILDS THE DOCUMENT
|
|
51
|
+
* (`memberPubkeyParam`), so a signer that skips it produces a perfectly valid
|
|
52
|
+
* signature over bytes the server never derives — the failure that presents
|
|
53
|
+
* as a key problem rather than a spelling one. Callers have always been
|
|
54
|
+
* allowed to pass a bare or upper-case key (the store canonicalises on the
|
|
55
|
+
* way in), so signing their exact spelling would break the writes that work
|
|
56
|
+
* today.
|
|
57
|
+
*
|
|
58
|
+
* A non-hex value passes through untouched, exactly as Go's does: a malformed
|
|
59
|
+
* key must reach the server as the caller wrote it and be refused there,
|
|
60
|
+
* rather than be silently rewritten into a different key here.
|
|
61
|
+
*/
|
|
62
|
+
export declare function canonicalPubkeyHex(s: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* The vault id a wallet key owns — `pkgvault.IDFor`, reproduced.
|
|
65
|
+
*
|
|
66
|
+
* `"v-"` + blake2b-128 of the key's CANONICAL HEX SPELLING, as 32 lowercase
|
|
67
|
+
* hex characters.
|
|
68
|
+
*
|
|
69
|
+
* # This is a one-way function, and that is the whole point
|
|
70
|
+
*
|
|
71
|
+
* It runs pubkey -> id. It does NOT run backwards, and no amount of holding
|
|
72
|
+
* an id recovers the key that made it: blake2b-128 is a hash. What a caller
|
|
73
|
+
* holding only a vault id CAN do is the inverse QUESTION rather than the
|
|
74
|
+
* inverse function — take a candidate key and ask whether it derives that id.
|
|
75
|
+
* That single check is what turns `verifySignedRoster` from a consistency
|
|
76
|
+
* test into a verification, because the id came from outside the response
|
|
77
|
+
* and the key inside it now has to match something the attacker cannot
|
|
78
|
+
* choose.
|
|
79
|
+
*
|
|
80
|
+
* # Two ways to get this wrong, both of which produce a plausible id
|
|
81
|
+
*
|
|
82
|
+
* 1. The key is hashed as its hex TEXT (Go writes `[]byte(walletPubkeyHex)`),
|
|
83
|
+
* never as the 32 bytes that text denotes. `@polkadot`'s `blake2AsHex`
|
|
84
|
+
* decodes a `0x`-prefixed STRING as hex, so it must be handed encoded
|
|
85
|
+
* bytes — passing the spelling straight in silently hashes the wrong
|
|
86
|
+
* input.
|
|
87
|
+
* 2. Because the text is the input, the SPELLING is part of it: `deadbeef`,
|
|
88
|
+
* `0xdeadbeef` and `0xDEADBEEF` are three different vault ids in Go.
|
|
89
|
+
* Callers have always been allowed any of those spellings, so the
|
|
90
|
+
* canonical form is applied first — the same rule the server derives with.
|
|
91
|
+
*
|
|
92
|
+
* Both are pinned by golden vectors taken from the running Go function.
|
|
93
|
+
*/
|
|
94
|
+
export declare function vaultIdFor(walletPubkeyHex: string): string;
|
|
95
|
+
/**
|
|
96
|
+
* A grant document's signed expiry: the moment the membership stops standing,
|
|
97
|
+
* as the opaque string its signer wrote — or {@link NO_GRANT_EXPIRY} when it
|
|
98
|
+
* never stops.
|
|
99
|
+
*
|
|
100
|
+
* A BRANDED string rather than a bare one, mirroring Go's `GrantExpiry`
|
|
101
|
+
* defined type and for exactly the same reason. `canonicalGrantBytes` takes
|
|
102
|
+
* `issuedAt` and `expiresAt` as its last two parameters; they are two
|
|
103
|
+
* timestamps of the same shape, side by side, so transposing them is the most
|
|
104
|
+
* likely slip at a call site — and with two plain `string`s that transposition
|
|
105
|
+
* COMPILES and signs valid bytes for the wrong document, a defect that
|
|
106
|
+
* presents as a key problem.
|
|
107
|
+
*
|
|
108
|
+
* Go gets that property from the scopes map for its other three strings; there
|
|
109
|
+
* is no such separator for this pair, so a distinct type is the whole defence
|
|
110
|
+
* on both sides. Use {@link grantExpiry} to make one.
|
|
111
|
+
*/
|
|
112
|
+
export type GrantExpiry = string & {
|
|
113
|
+
readonly __grantExpiry: unique symbol;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* The ONE spelling of "this membership does not expire": the empty string,
|
|
117
|
+
* always emitted, never an absent key and never `null`.
|
|
118
|
+
*
|
|
119
|
+
* A FIXED SENTINEL so the canonical document has exactly one shape. Two shapes
|
|
120
|
+
* is how a signature comes to verify against bytes the other side never
|
|
121
|
+
* builds, and here conditional omission would be worse than ambiguous: a
|
|
122
|
+
* document that DROPPED `expiresAt` when there is no expiry is byte-identical
|
|
123
|
+
* to a document minted before the field existed, so every signature already
|
|
124
|
+
* stored would verify as a brand-new never-expires grant. Emitting `""` makes
|
|
125
|
+
* those older bytes unbuildable, which is the version gate this change would
|
|
126
|
+
* otherwise have to spend a new {@link GRANT_SCHEMA} string on.
|
|
127
|
+
*
|
|
128
|
+
* The empty string also cannot be mistaken for a moment — no RFC 3339 spelling
|
|
129
|
+
* is empty — so, unlike a far-future sentinel instant, nothing downstream can
|
|
130
|
+
* parse it into a date and silently act on the year 9999.
|
|
131
|
+
*/
|
|
132
|
+
export declare const NO_GRANT_EXPIRY: GrantExpiry;
|
|
133
|
+
/**
|
|
134
|
+
* Tags a timestamp string as the grant's expiry.
|
|
135
|
+
*
|
|
136
|
+
* It does NOT validate: the string is carried into the signed bytes verbatim
|
|
137
|
+
* and neither side parses or re-formats it, so a check here would be a second
|
|
138
|
+
* opinion about a value the server rebuilds from what you sent. vault-api DOES
|
|
139
|
+
* validate — `PUT …/members` 400s an `expiresAt` that is not RFC 3339, because
|
|
140
|
+
* that value also has to reach a `timestamptz` column — so a malformed expiry
|
|
141
|
+
* is refused at the one place that can refuse it usefully.
|
|
142
|
+
*
|
|
143
|
+
* Pass the SAME string you put in the request body. Formatting a `Date` twice
|
|
144
|
+
* is how the two copies drift by a trimmed fractional zero.
|
|
145
|
+
*/
|
|
146
|
+
export declare function grantExpiry(rfc3339: string): GrantExpiry;
|
|
147
|
+
/**
|
|
148
|
+
* A canonical grant document, read back apart.
|
|
149
|
+
*
|
|
150
|
+
* `role` and `scopes`'s values are `string`, NOT `MemberRole` / `ScopeLevel`,
|
|
151
|
+
* and that is deliberate in both directions:
|
|
152
|
+
*
|
|
153
|
+
* - The signed document is the authority. A level this SDK version does not
|
|
154
|
+
* know is a document this SDK should not silently rewrite or narrow — the
|
|
155
|
+
* server passes it through unvalidated for the same reason. Refusing it is
|
|
156
|
+
* the consumer's decision to make explicitly.
|
|
157
|
+
* - Go's `authz.Grant` is `Role string` / `Scopes map[string]string`. This is
|
|
158
|
+
* its mirror, not a richer restatement of it.
|
|
159
|
+
*/
|
|
160
|
+
export interface Grant {
|
|
161
|
+
schema: string;
|
|
162
|
+
vaultId: string;
|
|
163
|
+
memberPubkey: string;
|
|
164
|
+
role: string;
|
|
165
|
+
scopes: Record<string, string>;
|
|
166
|
+
/**
|
|
167
|
+
* When the SIGNER minted this document, as the string it was signed as —
|
|
168
|
+
* by convention RFC3339 UTC, but UNPARSED here, so
|
|
169
|
+
* `canonicalGrantBytes(…, scopes, issuedAt)` reproduces the bytes exactly.
|
|
170
|
+
* Parse it yourself if you want the instant.
|
|
171
|
+
*
|
|
172
|
+
* Holding it is not permission to enforce on it. Nothing in this SDK or in
|
|
173
|
+
* vault-api checks an expiry against it, and a recent `issuedAt` on a
|
|
174
|
+
* PRESENTED document still says nothing about revocation — see the header.
|
|
175
|
+
*/
|
|
176
|
+
issuedAt: string;
|
|
177
|
+
/**
|
|
178
|
+
* When the membership this document describes stops standing, as the string
|
|
179
|
+
* it was signed as — or `""` ({@link NO_GRANT_EXPIRY}) when it never does.
|
|
180
|
+
* Unparsed, like `issuedAt`, so re-encoding reproduces the bytes exactly.
|
|
181
|
+
*
|
|
182
|
+
* THIS IS A CLAIM, NOT AN ENFORCEMENT. Nothing here compares it to a clock.
|
|
183
|
+
* A roster you FETCHED already excludes expired memberships — vault-api
|
|
184
|
+
* filters them in SQL — which is the signal that actually carries expiry. On
|
|
185
|
+
* a document somebody HANDED you it is worth no more than `issuedAt` is:
|
|
186
|
+
* see the header's rule.
|
|
187
|
+
*/
|
|
188
|
+
expiresAt: GrantExpiry;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* A signed grant that could not be trusted: the signature does not verify,
|
|
192
|
+
* the document does not decode, its schema is unknown, or it describes a
|
|
193
|
+
* different membership from the one it was served under.
|
|
194
|
+
*
|
|
195
|
+
* A THROWN error rather than a filtered-out entry, because every one of those
|
|
196
|
+
* states on an authorization artifact means the response is not what it
|
|
197
|
+
* claims to be. Silently dropping the bad entry and returning the rest would
|
|
198
|
+
* hand a caller a shorter roster that looks complete. `memberPubkey` names
|
|
199
|
+
* the entry so an operator can find it.
|
|
200
|
+
*/
|
|
201
|
+
export declare class GrantVerificationError extends Error {
|
|
202
|
+
/**
|
|
203
|
+
* The member the failure is about, or `""` when it is about the ENVELOPE
|
|
204
|
+
* — a missing anchor, a roster for the wrong vault, a malformed shape —
|
|
205
|
+
* which belongs to no single entry.
|
|
206
|
+
*/
|
|
207
|
+
readonly memberPubkey: string;
|
|
208
|
+
constructor(message: string,
|
|
209
|
+
/**
|
|
210
|
+
* The member the failure is about, or `""` when it is about the ENVELOPE
|
|
211
|
+
* — a missing anchor, a roster for the wrong vault, a malformed shape —
|
|
212
|
+
* which belongs to no single entry.
|
|
213
|
+
*/
|
|
214
|
+
memberPubkey?: string);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The exact bytes a grant signature covers, mirroring
|
|
218
|
+
* `authz.CanonicalGrantBytes`.
|
|
219
|
+
*
|
|
220
|
+
* Every bound value is inside the output: a document proves ONE member's
|
|
221
|
+
* standing on ONE vault and nothing else. `scopes` is emitted as an ARRAY
|
|
222
|
+
* sorted by name — not as an object — because the ordering is then this
|
|
223
|
+
* function's own step and can be tested, where a JSON object would have the
|
|
224
|
+
* encoder sort the keys and a stability test would pass whatever this code
|
|
225
|
+
* did.
|
|
226
|
+
*
|
|
227
|
+
* An incomplete grant throws rather than producing shorter bytes: a document
|
|
228
|
+
* naming no vault or no member would verify perfectly and authorise nobody in
|
|
229
|
+
* particular. `issuedAt` is required on the same grounds — an empty one is a
|
|
230
|
+
* document with no mint time that verifies exactly as well as one with a mint
|
|
231
|
+
* time.
|
|
232
|
+
*
|
|
233
|
+
* `issuedAt` is LAST BUT ONE and `expiresAt` is LAST, mirroring Go's field and
|
|
234
|
+
* parameter order. In Go the map between `issuedAt` and the other strings is
|
|
235
|
+
* what makes a transposition a compile error instead of a valid signature over
|
|
236
|
+
* the wrong bytes; the one pair the map cannot sit between is `issuedAt` and
|
|
237
|
+
* `expiresAt`, which Go separates with a defined type and this file mirrors
|
|
238
|
+
* with {@link GrantExpiry}'s brand.
|
|
239
|
+
*
|
|
240
|
+
* `issuedAt` has NO DEFAULT on purpose: a `new Date().toISOString()` fallback
|
|
241
|
+
* would be a hidden clock inside the encoder, and a caller who forgot to pass
|
|
242
|
+
* one would silently sign a different moment from the one they sent. `scopes`
|
|
243
|
+
* loses its `= {}` default with it — a default that can never be used, because
|
|
244
|
+
* a required parameter follows, reads as an option and is not one. `expiresAt`
|
|
245
|
+
* has none for the sharper version of the same reason: its default would be
|
|
246
|
+
* "never expires", the one wrong answer that looks right.
|
|
247
|
+
*
|
|
248
|
+
* `expiresAt` is the ONE parameter with no emptiness check, because `""` is
|
|
249
|
+
* {@link NO_GRANT_EXPIRY} — a legal, common, deliberate value rather than a
|
|
250
|
+
* missing one.
|
|
251
|
+
*/
|
|
252
|
+
export declare function canonicalGrantBytes(vaultId: string, memberPubkey: string, role: string, scopes: Record<string, string>, issuedAt: string, expiresAt: GrantExpiry): Uint8Array;
|
|
253
|
+
/**
|
|
254
|
+
* Reads a canonical grant document back into its parts, mirroring
|
|
255
|
+
* `authz.DecodeGrantDoc`. Never re-encodes; the bytes stay the authority.
|
|
256
|
+
*
|
|
257
|
+
* Throws on an unknown schema (see `GRANT_SCHEMA`) and on the same three
|
|
258
|
+
* required fields the encoder refuses to omit.
|
|
259
|
+
*/
|
|
260
|
+
export declare function decodeGrantDoc(doc: Uint8Array): Grant;
|
|
261
|
+
/**
|
|
262
|
+
* Is `sigHex` `orgWalletPubkeyHex`'s ed25519 signature over `doc`?
|
|
263
|
+
*
|
|
264
|
+
* A boolean, not a throw, because nothing here can be undecided: both inputs
|
|
265
|
+
* are in hand and the check is arithmetic. Malformed inputs (a key or
|
|
266
|
+
* signature of the wrong length, non-hex) are `false` rather than an
|
|
267
|
+
* exception, mirroring `authz.VerifyGrantSig` — the caller that needs to tell
|
|
268
|
+
* "nothing was sent" from "it does not verify" looks at the inputs itself.
|
|
269
|
+
*
|
|
270
|
+
* Hex is accepted with or without an `0x` prefix, in either case, because
|
|
271
|
+
* wallets and SDKs disagree about both.
|
|
272
|
+
*/
|
|
273
|
+
export declare function verifyGrantSig(orgWalletPubkeyHex: string, doc: Uint8Array, sigHex: string): Promise<boolean>;
|
|
274
|
+
/**
|
|
275
|
+
* Verifies EVERY grant in a signed roster against the vault owner's key and
|
|
276
|
+
* returns the grants decoded from the verified bytes.
|
|
277
|
+
*
|
|
278
|
+
* This is the whole point of the signed roster: after this call you hold
|
|
279
|
+
* values that came out of bytes the vault owner signed, and you can throw the
|
|
280
|
+
* response away. Enforce on the returned `Grant`s — never on
|
|
281
|
+
* `SignedGrant.role` / `SignedGrant.scopes`, which are vault-api's rendering
|
|
282
|
+
* of the same document and are not covered by anything you checked.
|
|
283
|
+
*
|
|
284
|
+
* Three bindings are checked per entry, and the last two matter as much as
|
|
285
|
+
* the signature: the document must carry the schema this SDK understands, it
|
|
286
|
+
* must name the vault the roster is FOR, and it must name the member it was
|
|
287
|
+
* served UNDER. A document that verifies but describes a different membership
|
|
288
|
+
* is a valid signature over somebody else's grant — the substitution the
|
|
289
|
+
* canonical bytes bind all four values to prevent.
|
|
290
|
+
*
|
|
291
|
+
* Fail-closed: the FIRST unverifiable entry throws
|
|
292
|
+
* `GrantVerificationError` and no partial list is returned. An authorization
|
|
293
|
+
* artifact with one entry you cannot prove is not a shorter roster, it is a
|
|
294
|
+
* roster you cannot trust.
|
|
295
|
+
*
|
|
296
|
+
* # `expectedVaultId` is the trust anchor, and it is why this is a
|
|
297
|
+
* # verification rather than a consistency check
|
|
298
|
+
*
|
|
299
|
+
* PASS THE ID YOU ASKED FOR — the same one handed to
|
|
300
|
+
* `sdk.memberships.signedRoster()`. It is required, and the requirement is
|
|
301
|
+
* the fix for the hole it closes:
|
|
302
|
+
*
|
|
303
|
+
* Every other value used here arrives INSIDE the response. Given only a
|
|
304
|
+
* roster, "verify it" can mean no more than "does this agree with itself?" —
|
|
305
|
+
* and it always does, because whoever composed it chose every field. Anyone
|
|
306
|
+
* able to answer on this address could sign a roster with a key of their own,
|
|
307
|
+
* name that key as `orgWalletPubkey`, and watch it verify.
|
|
308
|
+
*
|
|
309
|
+
* One externally-held value breaks the circle. `vaultIdFor` is a one-way
|
|
310
|
+
* derivation, so a key that derives `expectedVaultId` cannot be picked; it
|
|
311
|
+
* can only be the vault's actual owner. The two checks are therefore:
|
|
312
|
+
*
|
|
313
|
+
* 1. the roster must be FOR the vault asked about (`roster.vaultId`), which
|
|
314
|
+
* is the binding the two separate calls otherwise leave open — a
|
|
315
|
+
* response about somebody else's vault used to verify perfectly; and
|
|
316
|
+
* 2. `orgWalletPubkey` must DERIVE that vault, which pins the signing key
|
|
317
|
+
* to an identity the response did not get to choose.
|
|
318
|
+
*
|
|
319
|
+
* Both run BEFORE any signature is checked, mirroring
|
|
320
|
+
* `RosterAuthority.verifyRoster` in ddc-node: until the anchor holds, every
|
|
321
|
+
* byte of the envelope is attacker-supplied, including the key the
|
|
322
|
+
* signatures would be checked against.
|
|
323
|
+
*
|
|
324
|
+
* A caller who holds the OWNER KEY rather than the id needs nothing extra —
|
|
325
|
+
* `vaultIdFor(ownerKey)` is the id. That direction works; the reverse does
|
|
326
|
+
* not exist.
|
|
327
|
+
*
|
|
328
|
+
* This anchors the roster to a vault, which is all a hash can do. It does not
|
|
329
|
+
* tell you the id itself is the vault you meant: if `expectedVaultId` was
|
|
330
|
+
* itself learned from an untrusted party, the result is trust in THAT party's
|
|
331
|
+
* choice of vault. Anchor it to something you already knew.
|
|
332
|
+
*/
|
|
333
|
+
export declare function verifySignedRoster(roster: SignedRoster, expectedVaultId: string): Promise<Grant[]>;
|
|
334
|
+
/**
|
|
335
|
+
* One entry of `verifySignedRoster`, exposed for a caller holding a single
|
|
336
|
+
* grant (a member proving their own standing, say) rather than a whole
|
|
337
|
+
* roster. Same bindings, same fail-closed throw.
|
|
338
|
+
*
|
|
339
|
+
* `vaultId` and `orgWalletPubkey` must CORRESPOND — the same anchor
|
|
340
|
+
* `verifySignedRoster` applies, checked here too because both arguments are
|
|
341
|
+
* the caller's and the natural way to fill them is straight off a response,
|
|
342
|
+
* which is exactly the unanchored call this check refuses.
|
|
343
|
+
*/
|
|
344
|
+
export declare function verifyGrant(vaultId: string, orgWalletPubkey: string, grant: SignedGrant): Promise<Grant>;
|
|
345
|
+
//# sourceMappingURL=grant-doc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant-doc.d.ts","sourceRoot":"","sources":["../../src/core/grant-doc.ts"],"names":[],"mappings":"AA0FA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAK5D;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,wBAAwB,CAAC;AAElD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;GAkBG;AAC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