@interop/wallet-core 0.49.0 → 0.51.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/README.md +5 -2
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +127 -0
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -0
- package/dist/clientAnnex/credentialAnchoredGenesis.js +195 -0
- package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -0
- package/dist/clientAnnex/forget.d.ts +138 -0
- package/dist/clientAnnex/forget.d.ts.map +1 -0
- package/dist/clientAnnex/forget.js +133 -0
- package/dist/clientAnnex/forget.js.map +1 -0
- package/dist/clientAnnex/forgetLast.d.ts +291 -0
- package/dist/clientAnnex/forgetLast.d.ts.map +1 -0
- package/dist/clientAnnex/forgetLast.js +408 -0
- package/dist/clientAnnex/forgetLast.js.map +1 -0
- package/dist/{webvh/companionGc.d.ts → clientAnnex/gc.d.ts} +50 -16
- package/dist/clientAnnex/gc.d.ts.map +1 -0
- package/dist/{webvh/companionGc.js → clientAnnex/gc.js} +103 -71
- package/dist/clientAnnex/gc.js.map +1 -0
- package/dist/clientAnnex/index.d.ts +60 -0
- package/dist/clientAnnex/index.d.ts.map +1 -0
- package/dist/clientAnnex/index.js +60 -0
- package/dist/clientAnnex/index.js.map +1 -0
- package/dist/{unlock → clientAnnex}/ladder.d.ts +89 -15
- package/dist/clientAnnex/ladder.d.ts.map +1 -0
- package/dist/clientAnnex/ladder.js +474 -0
- package/dist/clientAnnex/ladder.js.map +1 -0
- package/dist/clientAnnex/ladderAnchored.d.ts +276 -0
- package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -0
- package/dist/clientAnnex/ladderAnchored.js +631 -0
- package/dist/clientAnnex/ladderAnchored.js.map +1 -0
- package/dist/{webvh/companion.d.ts → clientAnnex/log.d.ts} +333 -119
- package/dist/clientAnnex/log.d.ts.map +1 -0
- package/dist/{webvh/companion.js → clientAnnex/log.js} +583 -199
- package/dist/clientAnnex/log.js.map +1 -0
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts +103 -0
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -0
- package/dist/clientAnnex/recoveryLadderAnchored.js +263 -0
- package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -0
- package/dist/{unlock → clientAnnex}/selfEnroll.d.ts +1 -1
- package/dist/clientAnnex/selfEnroll.d.ts.map +1 -0
- package/dist/{unlock → clientAnnex}/selfEnroll.js +1 -1
- package/dist/clientAnnex/selfEnroll.js.map +1 -0
- package/dist/clientAnnex/zcap.d.ts +49 -0
- package/dist/clientAnnex/zcap.d.ts.map +1 -0
- package/dist/clientAnnex/zcap.js +101 -0
- package/dist/clientAnnex/zcap.js.map +1 -0
- package/dist/clients/index.d.ts +9 -6
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js +8 -5
- package/dist/clients/index.js.map +1 -1
- package/dist/clients/listing.d.ts +32 -0
- package/dist/clients/listing.d.ts.map +1 -1
- package/dist/clients/listing.js +47 -1
- package/dist/clients/listing.js.map +1 -1
- package/dist/clients/revocation.d.ts +33 -1
- package/dist/clients/revocation.d.ts.map +1 -1
- package/dist/clients/revocation.js +16 -4
- package/dist/clients/revocation.js.map +1 -1
- package/dist/enrollment/index.d.ts +6 -4
- package/dist/enrollment/index.d.ts.map +1 -1
- package/dist/enrollment/index.js +6 -4
- package/dist/enrollment/index.js.map +1 -1
- package/dist/enrollment/onboardingInvite.d.ts +5 -88
- package/dist/enrollment/onboardingInvite.d.ts.map +1 -1
- package/dist/enrollment/onboardingInvite.js +5 -168
- package/dist/enrollment/onboardingInvite.js.map +1 -1
- package/dist/genesis/accountGenesis.d.ts +12 -0
- package/dist/genesis/accountGenesis.d.ts.map +1 -1
- package/dist/genesis/accountGenesis.js.map +1 -1
- package/dist/genesis/index.d.ts +5 -0
- package/dist/genesis/index.d.ts.map +1 -1
- package/dist/genesis/index.js +5 -0
- package/dist/genesis/index.js.map +1 -1
- package/dist/keys/index.d.ts +1 -1
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +1 -1
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/spaceEpochs.d.ts +7 -2
- package/dist/keys/spaceEpochs.d.ts.map +1 -1
- package/dist/keys/spaceEpochs.js +8 -2
- package/dist/keys/spaceEpochs.js.map +1 -1
- package/dist/keys/userKeyRoster.d.ts +39 -0
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +43 -1
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/recovery/index.d.ts +5 -3
- package/dist/recovery/index.d.ts.map +1 -1
- package/dist/recovery/index.js +4 -2
- package/dist/recovery/index.js.map +1 -1
- package/dist/recovery/recoveryDelegation.d.ts +35 -12
- package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
- package/dist/recovery/recoveryDelegation.js +84 -86
- package/dist/recovery/recoveryDelegation.js.map +1 -1
- package/dist/recovery/recoveryWebvh.d.ts +32 -1
- package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
- package/dist/recovery/recoveryWebvh.js +2 -2
- package/dist/recovery/recoveryWebvh.js.map +1 -1
- package/dist/request/capabilityRequest.d.ts +33 -0
- package/dist/request/capabilityRequest.d.ts.map +1 -0
- package/dist/request/capabilityRequest.js +35 -0
- package/dist/request/capabilityRequest.js.map +1 -0
- package/dist/request/ephemeralExchange.d.ts +118 -0
- package/dist/request/ephemeralExchange.d.ts.map +1 -0
- package/dist/request/ephemeralExchange.js +224 -0
- package/dist/request/ephemeralExchange.js.map +1 -0
- package/dist/request/index.d.ts +6 -0
- package/dist/request/index.d.ts.map +1 -1
- package/dist/request/index.js +6 -0
- package/dist/request/index.js.map +1 -1
- package/dist/space/activity.d.ts +2 -2
- package/dist/space/activity.js +3 -3
- package/dist/space/activity.js.map +1 -1
- package/dist/unlock/index.d.ts +11 -23
- package/dist/unlock/index.d.ts.map +1 -1
- package/dist/unlock/index.js +10 -21
- package/dist/unlock/index.js.map +1 -1
- package/dist/unlock/retire.d.ts +47 -3
- package/dist/unlock/retire.d.ts.map +1 -1
- package/dist/unlock/retire.js +21 -5
- package/dist/unlock/retire.js.map +1 -1
- package/dist/unlock/standingWebvh.d.ts +37 -82
- package/dist/unlock/standingWebvh.d.ts.map +1 -1
- package/dist/unlock/standingWebvh.js +64 -247
- package/dist/unlock/standingWebvh.js.map +1 -1
- package/dist/unlock/unlockRecord.d.ts +13 -6
- package/dist/unlock/unlockRecord.d.ts.map +1 -1
- package/dist/unlock/unlockRecord.js +14 -8
- package/dist/unlock/unlockRecord.js.map +1 -1
- package/dist/webvh/delegatedLogStore.d.ts +5 -5
- package/dist/webvh/delegatedLogStore.js +1 -1
- package/dist/webvh/didWebvh.d.ts +19 -9
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +16 -16
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/index.d.ts +9 -25
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +9 -23
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/revokeClient.d.ts +77 -5
- package/dist/webvh/revokeClient.d.ts.map +1 -1
- package/dist/webvh/revokeClient.js +154 -61
- package/dist/webvh/revokeClient.js.map +1 -1
- package/dist/webvh/standingZcap.d.ts +11 -1
- package/dist/webvh/standingZcap.d.ts.map +1 -1
- package/dist/webvh/standingZcap.js +13 -14
- package/dist/webvh/standingZcap.js.map +1 -1
- package/dist/webvh/wasIdStore.d.ts +13 -7
- package/dist/webvh/wasIdStore.d.ts.map +1 -1
- package/dist/webvh/wasIdStore.js +8 -4
- package/dist/webvh/wasIdStore.js.map +1 -1
- package/dist/webvh/zcap.d.ts +0 -24
- package/dist/webvh/zcap.d.ts.map +1 -1
- package/dist/webvh/zcap.js +0 -42
- package/dist/webvh/zcap.js.map +1 -1
- package/package.json +41 -35
- package/dist/unlock/ladder.d.ts.map +0 -1
- package/dist/unlock/ladder.js +0 -258
- package/dist/unlock/ladder.js.map +0 -1
- package/dist/unlock/selfEnroll.d.ts.map +0 -1
- package/dist/unlock/selfEnroll.js.map +0 -1
- package/dist/webvh/companion.d.ts.map +0 -1
- package/dist/webvh/companion.js.map +0 -1
- package/dist/webvh/companionGc.d.ts.map +0 -1
- package/dist/webvh/companionGc.js.map +0 -1
|
@@ -2,6 +2,7 @@ import type { IZcap } from '@interop/data-integrity-core';
|
|
|
2
2
|
import type { ZcapClient } from '@interop/ezcap';
|
|
3
3
|
import type { PublishedKeyDocument } from '../webvh/listClients.js';
|
|
4
4
|
import type { AccountPointer, RecordSigner } from '../keyring/record.js';
|
|
5
|
+
import { delegationProofKeyId } from '../webvh/standingZcap.js';
|
|
5
6
|
/**
|
|
6
7
|
* The recovery delegation's lifetime: the house standing-zcap value
|
|
7
8
|
* ({@link STANDING_ZCAP_TTL_MS} -- one year, per NIST SP 800-57's
|
|
@@ -36,15 +37,7 @@ export declare function delegateLogWrite({ zcapClient, pointer, recoveryClientDi
|
|
|
36
37
|
pointer: AccountPointer;
|
|
37
38
|
recoveryClientDid: string;
|
|
38
39
|
}): Promise<IZcap>;
|
|
39
|
-
|
|
40
|
-
* The verification method that signed a delegation's proof -- recorded in the
|
|
41
|
-
* registry entry so the health check and the re-mint's rot check can test it
|
|
42
|
-
* against the current document without holding the code.
|
|
43
|
-
*
|
|
44
|
-
* @param delegation {IZcap}
|
|
45
|
-
* @returns {string | undefined}
|
|
46
|
-
*/
|
|
47
|
-
export declare function delegationProofKeyId(delegation: IZcap): string | undefined;
|
|
40
|
+
export { delegationProofKeyId };
|
|
48
41
|
/**
|
|
49
42
|
* The members of a recovery-code registry entry the re-mint reads: where the
|
|
50
43
|
* code's unlock Space and record are (`unlockSpaceId`, `manageCapability`),
|
|
@@ -53,7 +46,7 @@ export declare function delegationProofKeyId(delegation: IZcap): string | undefi
|
|
|
53
46
|
* predating its field, which the staleness checks conservatively flag), and
|
|
54
47
|
* the re-mint fields: the code-derived signing DID the fresh delegation names
|
|
55
48
|
* and the unlock KAK public half the record is re-wrapped to. A standing
|
|
56
|
-
* credential's entry additionally tracks its
|
|
49
|
+
* credential's entry additionally tracks its annex Space sibling
|
|
57
50
|
* delegation as a second scalar pair (`delegatedClientsKeyId` /
|
|
58
51
|
* `delegatedClientsExpires` -- absent for recovery codes, mirroring the
|
|
59
52
|
* record member's optionality); the sibling rots on exactly the bridge's
|
|
@@ -74,6 +67,24 @@ export interface RecoveryDelegationEntry {
|
|
|
74
67
|
unlockKeyAgreementKeyId?: string;
|
|
75
68
|
unlockKeyAgreementKeyMultibase?: string;
|
|
76
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* One registry entry's fate in a re-mint pass: `current` (both members stand
|
|
72
|
+
* and are outside the renewal window -- nothing written), `reminted` (the
|
|
73
|
+
* record re-sealed and the entry handed back fresh; `siblingCarriedVerbatim`
|
|
74
|
+
* flags a recorded sibling the pass could not rebuild because the document
|
|
75
|
+
* points at no generation, which stays flagged for the health check),
|
|
76
|
+
* `incomplete-entry` (an entry predating the re-mint fields, skipped until
|
|
77
|
+
* the credential is re-bound), or `failed` (the record could not be read,
|
|
78
|
+
* re-sealed, or re-PUT -- `error` carries the cause). A skipped or failed
|
|
79
|
+
* entry is named here so no caller can lose it silently.
|
|
80
|
+
*/
|
|
81
|
+
export interface RecordRemintOutcome {
|
|
82
|
+
label: string;
|
|
83
|
+
unlockSpaceId: string;
|
|
84
|
+
outcome: 'current' | 'reminted' | 'incomplete-entry' | 'failed';
|
|
85
|
+
siblingCarriedVerbatim?: boolean;
|
|
86
|
+
error?: unknown;
|
|
87
|
+
}
|
|
77
88
|
/**
|
|
78
89
|
* Re-mints the recovery delegations the current document no longer backs --
|
|
79
90
|
* the recovery-code delta riding the revocation cascade (see the module doc
|
|
@@ -83,7 +94,7 @@ export interface RecoveryDelegationEntry {
|
|
|
83
94
|
* re-mint reads the standing record through the entry's management zcap and
|
|
84
95
|
* replaces only its delegation members
|
|
85
96
|
* ({@link remintUnlockRecordDelegations}) -- the bridge always, and the
|
|
86
|
-
*
|
|
97
|
+
* annex Space sibling where the entry records one (the two rot on one
|
|
87
98
|
* axis, so both reseal in the same atomic pass and one registry-entry
|
|
88
99
|
* rewrite records both fresh pairs). The
|
|
89
100
|
* shell, the ladder member (where one rides), and the binding tag all travel
|
|
@@ -116,9 +127,15 @@ export interface RecoveryDelegationEntry {
|
|
|
116
127
|
* ZcapClient` -- the client an entry's management zcap is invoked with
|
|
117
128
|
* @param options.recordEntry {Function} `({ entry }) => Promise<void>` --
|
|
118
129
|
* persists one updated registry entry (matching on the app's entry key)
|
|
130
|
+
* @param [options.mintDelegatedClientsDelegation] {Function} `({ controller })
|
|
131
|
+
* => Promise<IZcap | undefined>` -- the annex-side mint of a fresh
|
|
132
|
+
* `delegatedClients` sibling delegation, injected by the caller (the
|
|
133
|
+
* annex subpath's `delegatedClientsDelegationMinter` builds one over the
|
|
134
|
+
* verified document); `undefined` when the document points at no
|
|
135
|
+
* generation, in which case the old sealed member travels verbatim
|
|
119
136
|
* @returns {Promise<{ reminted: number; skipped: number }>}
|
|
120
137
|
*/
|
|
121
|
-
export declare function remintRecoveryDelegations<Entry extends RecoveryDelegationEntry>({ doc, entries, pointer, storageServerUrl, zcapClient, recordSigner, managementZcapClient, recordEntry }: {
|
|
138
|
+
export declare function remintRecoveryDelegations<Entry extends RecoveryDelegationEntry>({ doc, entries, pointer, storageServerUrl, zcapClient, recordSigner, managementZcapClient, recordEntry, mintDelegatedClientsDelegation, retiringKeyMultibases, now }: {
|
|
122
139
|
doc: PublishedKeyDocument;
|
|
123
140
|
entries: Entry[];
|
|
124
141
|
pointer: AccountPointer;
|
|
@@ -131,8 +148,14 @@ export declare function remintRecoveryDelegations<Entry extends RecoveryDelegati
|
|
|
131
148
|
recordEntry: (options: {
|
|
132
149
|
entry: Entry;
|
|
133
150
|
}) => Promise<void>;
|
|
151
|
+
mintDelegatedClientsDelegation?: (options: {
|
|
152
|
+
controller: string;
|
|
153
|
+
}) => Promise<IZcap | undefined>;
|
|
154
|
+
retiringKeyMultibases?: string[];
|
|
155
|
+
now?: number;
|
|
134
156
|
}): Promise<{
|
|
135
157
|
reminted: number;
|
|
136
158
|
skipped: number;
|
|
159
|
+
outcomes: RecordRemintOutcome[];
|
|
137
160
|
}>;
|
|
138
161
|
//# sourceMappingURL=recoveryDelegation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryDelegation.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"recoveryDelegation.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"AA8CA,OAAO,KAAK,EAAoB,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAKhD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAKnE,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExE,OAAO,EACL,oBAAoB,EAGrB,MAAM,0BAA0B,CAAA;AAEjC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,0BAA0B,QAAuB,CAAA;AAI9D,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAqB/E;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,UAAU,EACV,OAAO,EACP,iBAAiB,EAClB,EAAE;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,OAAO,EAAE,cAAc,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;CAC1B,GAAG,OAAO,CAAC,KAAK,CAAC,CAOjB;AAID,OAAO,EAAE,oBAAoB,EAAE,CAAA;AAE/B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,C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KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACzD,8BAA8B,CAAC,EAAE,CAAC,OAAO,EAAE;QACzC,UAAU,EAAE,MAAM,CAAA;KACnB,KAAK,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAAA;IAChC,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAA;IAChC,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,mBAAmB,EAAE,CAAA;CAChC,CAAC,CA2KD"}
|
|
@@ -23,25 +23,34 @@
|
|
|
23
23
|
* the record carries no secrets, so re-encryption needs none), re-PUTs it
|
|
24
24
|
* through the entry's management zcap, and updates the registry's
|
|
25
25
|
* `delegationKeyId` and `delegationExpires`. A standing credential's
|
|
26
|
-
*
|
|
26
|
+
* client-annex Space sibling delegation rides the same pass (its scalar pair is
|
|
27
27
|
* `delegatedClientsKeyId` / `delegatedClientsExpires`): either member going
|
|
28
28
|
* stale reseals both, and the one registry rewrite records both fresh pairs
|
|
29
29
|
* -- a re-mint handling only the bridge is incomplete. The skip policy is
|
|
30
30
|
* cross-replica correctness and is
|
|
31
31
|
* decided here once: an entry that predates the re-mint fields, or whose
|
|
32
32
|
* standing record cannot be read or carries no binding, is skipped and stays
|
|
33
|
-
* flagged by the login-time health check.
|
|
34
|
-
*
|
|
33
|
+
* flagged by the login-time health check. Every entry's fate is reported
|
|
34
|
+
* (`RecordRemintOutcome`), so a record the pass could not reach is named
|
|
35
|
+
* rather than silently left with a rotted bridge. What stays app-side is the
|
|
36
|
+
* seams: the management-zcap client factory, the storage server URL, and the
|
|
35
37
|
* registry read/record halves.
|
|
38
|
+
*
|
|
39
|
+
* The same pass serves the last-client forget ceremony, whose acting signer
|
|
40
|
+
* is the ladder VM rather than an enrolled client: there the rot check runs
|
|
41
|
+
* against the post-install document, in which the client about to be removed
|
|
42
|
+
* still stands, so the ceremony names it as retiring
|
|
43
|
+
* (`retiringKeyMultibases`) and every delegation it signed counts as rotted
|
|
44
|
+
* ahead of the removal entry.
|
|
36
45
|
*/
|
|
37
46
|
import { X25519KeyAgreementKey2020 } from '@interop/x25519-key-agreement-key';
|
|
38
47
|
import { resourcePath, toUrl } from '@interop/was-client/paths';
|
|
39
48
|
import { DID_LOG_RESOURCE, ID_COLLECTION } from '../space/collections.js';
|
|
40
49
|
import { delegationKeyInDocument } from '../webvh/listClients.js';
|
|
50
|
+
import { vmFragmentOf } from '../resourceLog/index.js';
|
|
41
51
|
import { getUnlockKeyringWithCapability, putUnlockKeyringWithCapability } from '../keyring/unlockSpace.js';
|
|
42
52
|
import { remintUnlockRecordDelegations } from '../unlock/unlockRecord.js';
|
|
43
|
-
import { STANDING_ZCAP_TTL_MS, zcapExpiring } from '../webvh/standingZcap.js';
|
|
44
|
-
import { companionDidParts, delegatedClientsPointer, mintDelegatedClientsDelegation } from '../webvh/companion.js';
|
|
53
|
+
import { delegationProofKeyId, STANDING_ZCAP_TTL_MS, zcapExpiring } from '../webvh/standingZcap.js';
|
|
45
54
|
/**
|
|
46
55
|
* The recovery delegation's lifetime: the house standing-zcap value
|
|
47
56
|
* ({@link STANDING_ZCAP_TTL_MS} -- one year, per NIST SP 800-57's
|
|
@@ -99,46 +108,9 @@ export async function delegateLogWrite({ zcapClient, pointer, recoveryClientDid
|
|
|
99
108
|
expires: new Date(Date.now() + RECOVERY_DELEGATION_TTL_MS)
|
|
100
109
|
});
|
|
101
110
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
* against the current document without holding the code.
|
|
106
|
-
*
|
|
107
|
-
* @param delegation {IZcap}
|
|
108
|
-
* @returns {string | undefined}
|
|
109
|
-
*/
|
|
110
|
-
export function delegationProofKeyId(delegation) {
|
|
111
|
-
const { proof } = delegation;
|
|
112
|
-
const single = Array.isArray(proof) ? proof[0] : proof;
|
|
113
|
-
return single?.verificationMethod;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* The auxiliary companion Space id the account document currently points at,
|
|
117
|
-
* read off its delegated-clients service entry (the companion DID string
|
|
118
|
-
* embeds the Space id) -- what the re-mint rebuilds a sibling delegation's
|
|
119
|
-
* target from. `undefined` while the account points at no generation.
|
|
120
|
-
*
|
|
121
|
-
* @param options {object}
|
|
122
|
-
* @param options.doc {PublishedKeyDocument} the locally verified document
|
|
123
|
-
* @returns {string | undefined}
|
|
124
|
-
*/
|
|
125
|
-
function companionSpaceIdFromDocument({ doc }) {
|
|
126
|
-
// The verified document callers pass is the full resolved DID document;
|
|
127
|
-
// `PublishedKeyDocument` is its structural narrowing, and the companion
|
|
128
|
-
// helper runtime-checks the service list it reads.
|
|
129
|
-
const companionDid = delegatedClientsPointer({
|
|
130
|
-
doc: doc
|
|
131
|
-
});
|
|
132
|
-
if (!companionDid) {
|
|
133
|
-
return undefined;
|
|
134
|
-
}
|
|
135
|
-
try {
|
|
136
|
-
return companionDidParts({ did: companionDid }).spaceId;
|
|
137
|
-
}
|
|
138
|
-
catch {
|
|
139
|
-
return undefined;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
111
|
+
// Re-exported from its shared leaf home (`webvh/standingZcap.ts`), so this
|
|
112
|
+
// module's public surface is unchanged.
|
|
113
|
+
export { delegationProofKeyId };
|
|
142
114
|
/**
|
|
143
115
|
* Re-mints the recovery delegations the current document no longer backs --
|
|
144
116
|
* the recovery-code delta riding the revocation cascade (see the module doc
|
|
@@ -148,7 +120,7 @@ function companionSpaceIdFromDocument({ doc }) {
|
|
|
148
120
|
* re-mint reads the standing record through the entry's management zcap and
|
|
149
121
|
* replaces only its delegation members
|
|
150
122
|
* ({@link remintUnlockRecordDelegations}) -- the bridge always, and the
|
|
151
|
-
*
|
|
123
|
+
* annex Space sibling where the entry records one (the two rot on one
|
|
152
124
|
* axis, so both reseal in the same atomic pass and one registry-entry
|
|
153
125
|
* rewrite records both fresh pairs). The
|
|
154
126
|
* shell, the ladder member (where one rides), and the binding tag all travel
|
|
@@ -181,45 +153,57 @@ function companionSpaceIdFromDocument({ doc }) {
|
|
|
181
153
|
* ZcapClient` -- the client an entry's management zcap is invoked with
|
|
182
154
|
* @param options.recordEntry {Function} `({ entry }) => Promise<void>` --
|
|
183
155
|
* persists one updated registry entry (matching on the app's entry key)
|
|
156
|
+
* @param [options.mintDelegatedClientsDelegation] {Function} `({ controller })
|
|
157
|
+
* => Promise<IZcap | undefined>` -- the annex-side mint of a fresh
|
|
158
|
+
* `delegatedClients` sibling delegation, injected by the caller (the
|
|
159
|
+
* annex subpath's `delegatedClientsDelegationMinter` builds one over the
|
|
160
|
+
* verified document); `undefined` when the document points at no
|
|
161
|
+
* generation, in which case the old sealed member travels verbatim
|
|
184
162
|
* @returns {Promise<{ reminted: number; skipped: number }>}
|
|
185
163
|
*/
|
|
186
|
-
export async function remintRecoveryDelegations({ doc, entries, pointer, storageServerUrl, zcapClient, recordSigner, managementZcapClient, recordEntry }) {
|
|
164
|
+
export async function remintRecoveryDelegations({ doc, entries, pointer, storageServerUrl, zcapClient, recordSigner, managementZcapClient, recordEntry, mintDelegatedClientsDelegation, retiringKeyMultibases = [], now = Date.now() }) {
|
|
187
165
|
let reminted = 0;
|
|
188
166
|
let skipped = 0;
|
|
167
|
+
const outcomes = [];
|
|
168
|
+
// Retiring keys arrive as bare multibases or as verification-method ids;
|
|
169
|
+
// either way the comparison is on the multibase.
|
|
170
|
+
const retiring = new Set(retiringKeyMultibases.map(key => vmFragmentOf(key) ?? key));
|
|
171
|
+
// The current-key-set rule, decided once in `webvh`: a recorded signing key
|
|
172
|
+
// the document no longer publishes -- or no recorded key at all -- is
|
|
173
|
+
// rotted; so is a key the caller names as retiring, which the document
|
|
174
|
+
// still lists only until the entry that removes it lands.
|
|
175
|
+
const keyStands = (keyId) => delegationKeyInDocument({
|
|
176
|
+
doc,
|
|
177
|
+
...(keyId ? { delegationKeyId: keyId } : {})
|
|
178
|
+
}) && !(keyId !== undefined && retiring.has(vmFragmentOf(keyId) ?? keyId));
|
|
189
179
|
for (const entry of entries) {
|
|
190
|
-
|
|
191
|
-
//
|
|
192
|
-
//
|
|
193
|
-
//
|
|
194
|
-
// (or recording no expiry at all) is re-minted even though its key
|
|
195
|
-
// still stands.
|
|
196
|
-
const stands = delegationKeyInDocument({
|
|
197
|
-
doc,
|
|
198
|
-
...(entry.delegationKeyId
|
|
199
|
-
? { delegationKeyId: entry.delegationKeyId }
|
|
200
|
-
: {})
|
|
201
|
-
});
|
|
180
|
+
const stands = keyStands(entry.delegationKeyId);
|
|
181
|
+
// Expiry is the other staleness axis: a delegation expired or inside the
|
|
182
|
+
// renewal window (or recording no expiry at all) is re-minted even
|
|
183
|
+
// though its key still stands.
|
|
202
184
|
const expiring = zcapExpiring({
|
|
203
|
-
...(entry.delegationExpires ? { expires: entry.delegationExpires } : {})
|
|
185
|
+
...(entry.delegationExpires ? { expires: entry.delegationExpires } : {}),
|
|
186
|
+
now
|
|
204
187
|
});
|
|
205
|
-
// The
|
|
188
|
+
// The annex Space sibling, where the entry records one, is checked
|
|
206
189
|
// on the same two axes; either member going stale re-mints BOTH in one
|
|
207
190
|
// atomic pass (both resealed, one registry-entry rewrite).
|
|
208
191
|
const siblingRecorded = entry.delegatedClientsKeyId !== undefined ||
|
|
209
192
|
entry.delegatedClientsExpires !== undefined;
|
|
210
193
|
const siblingStale = siblingRecorded &&
|
|
211
|
-
(!
|
|
212
|
-
doc,
|
|
213
|
-
...(entry.delegatedClientsKeyId
|
|
214
|
-
? { delegationKeyId: entry.delegatedClientsKeyId }
|
|
215
|
-
: {})
|
|
216
|
-
}) ||
|
|
194
|
+
(!keyStands(entry.delegatedClientsKeyId) ||
|
|
217
195
|
zcapExpiring({
|
|
218
196
|
...(entry.delegatedClientsExpires
|
|
219
197
|
? { expires: entry.delegatedClientsExpires }
|
|
220
|
-
: {})
|
|
198
|
+
: {}),
|
|
199
|
+
now
|
|
221
200
|
}));
|
|
222
201
|
if (stands && !expiring && !siblingStale) {
|
|
202
|
+
outcomes.push({
|
|
203
|
+
label: entry.label,
|
|
204
|
+
unlockSpaceId: entry.unlockSpaceId,
|
|
205
|
+
outcome: 'current'
|
|
206
|
+
});
|
|
223
207
|
continue;
|
|
224
208
|
}
|
|
225
209
|
if (!entry.recoveryClientDid ||
|
|
@@ -229,6 +213,11 @@ export async function remintRecoveryDelegations({ doc, entries, pointer, storage
|
|
|
229
213
|
// An entry issued before the re-mint fields existed: the health check
|
|
230
214
|
// keeps flagging it until the code is regenerated.
|
|
231
215
|
skipped += 1;
|
|
216
|
+
outcomes.push({
|
|
217
|
+
label: entry.label,
|
|
218
|
+
unlockSpaceId: entry.unlockSpaceId,
|
|
219
|
+
outcome: 'incomplete-entry'
|
|
220
|
+
});
|
|
232
221
|
continue;
|
|
233
222
|
}
|
|
234
223
|
try {
|
|
@@ -249,25 +238,22 @@ export async function remintRecoveryDelegations({ doc, entries, pointer, storage
|
|
|
249
238
|
pointer,
|
|
250
239
|
recoveryClientDid: entry.recoveryClientDid
|
|
251
240
|
});
|
|
252
|
-
// The fresh
|
|
253
|
-
//
|
|
254
|
-
//
|
|
255
|
-
//
|
|
256
|
-
//
|
|
257
|
-
// the login-time health
|
|
241
|
+
// The fresh annex Space sibling, for an entry that records one --
|
|
242
|
+
// minted through the injected annex-side closure, so this durable
|
|
243
|
+
// orchestrator never imports the annex module. A document not (yet)
|
|
244
|
+
// pointing at a generation (or a caller wiring no minter) leaves
|
|
245
|
+
// nothing to rebuild the target from, so the old sealed member travels
|
|
246
|
+
// verbatim and the pair stays stale-flagged for the login-time health
|
|
247
|
+
// check.
|
|
258
248
|
let delegatedClients;
|
|
249
|
+
let siblingCarriedVerbatim = false;
|
|
259
250
|
if (siblingRecorded) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
controller: entry.recoveryClientDid
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
console.warn(`The account document names no companion generation; the ` +
|
|
251
|
+
delegatedClients = await mintDelegatedClientsDelegation?.({
|
|
252
|
+
controller: entry.recoveryClientDid
|
|
253
|
+
});
|
|
254
|
+
if (!delegatedClients) {
|
|
255
|
+
siblingCarriedVerbatim = true;
|
|
256
|
+
console.warn(`The account document names no client-annex generation; the ` +
|
|
271
257
|
`delegatedClients delegation for "${entry.label}" is carried ` +
|
|
272
258
|
'verbatim.');
|
|
273
259
|
}
|
|
@@ -316,12 +302,24 @@ export async function remintRecoveryDelegations({ doc, entries, pointer, storage
|
|
|
316
302
|
}
|
|
317
303
|
});
|
|
318
304
|
reminted += 1;
|
|
305
|
+
outcomes.push({
|
|
306
|
+
label: entry.label,
|
|
307
|
+
unlockSpaceId: entry.unlockSpaceId,
|
|
308
|
+
outcome: 'reminted',
|
|
309
|
+
...(siblingCarriedVerbatim ? { siblingCarriedVerbatim } : {})
|
|
310
|
+
});
|
|
319
311
|
}
|
|
320
312
|
catch (err) {
|
|
321
313
|
console.warn(`Could not re-mint the recovery delegation for "${entry.label}":`, err);
|
|
322
314
|
skipped += 1;
|
|
315
|
+
outcomes.push({
|
|
316
|
+
label: entry.label,
|
|
317
|
+
unlockSpaceId: entry.unlockSpaceId,
|
|
318
|
+
outcome: 'failed',
|
|
319
|
+
error: err
|
|
320
|
+
});
|
|
323
321
|
}
|
|
324
322
|
}
|
|
325
|
-
return { reminted, skipped };
|
|
323
|
+
return { reminted, skipped, outcomes };
|
|
326
324
|
}
|
|
327
325
|
//# sourceMappingURL=recoveryDelegation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryDelegation.js","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"recoveryDelegation.js","sourceRoot":"","sources":["../../src/recovery/recoveryDelegation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;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AAC,CAAC,CAAC,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC3D,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBAChE;aACF,CAAC,CAAA;YACF,QAAQ,IAAI,CAAC,CAAA;YACb,QAAQ,CAAC,IAAI,CAAC;gBACZ,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,aAAa,EAAE,KAAK,CAAC,aAAa;gBAClC,OAAO,EAAE,UAAU;gBACnB,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE,sBAAsB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC9D,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CACV,kDAAkD,KAAK,CAAC,KAAK,IAAI,EACjE,GAAG,CACJ,CAAA;YACD,OAAO,IAAI,CAAC,CAAA;YACZ,QAAQ,CAAC,IAAI,CAAC;gBACZ,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,aAAa,EAAE,KAAK,CAAC,aAAa;gBAClC,OAAO,EAAE,QAAQ;gBACjB,KAAK,EAAE,GAAG;aACX,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;AACxC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DIDDoc, DIDLog } from '@interop/did-method-webvh';
|
|
2
|
-
import type { ClientWebvhUpdateKeys, WebvhEnrollmentKeys, WebvhIdStore } from '../webvh/didWebvh.js';
|
|
2
|
+
import type { ClientWebvhUpdateKeys, PublishedWebvhLog, WebvhEnrollmentKeys, WebvhIdStore } from '../webvh/didWebvh.js';
|
|
3
3
|
/**
|
|
4
4
|
* The verification-method id a code's key-agreement key publishes under --
|
|
5
5
|
* the ordinary `<did>#<multibase>` form, indistinguishable by id from any
|
|
@@ -39,6 +39,37 @@ export declare class RecoveryKeyNotCommittedError extends Error {
|
|
|
39
39
|
* {@link WebvhIdStore}, so an app's remote-store class satisfies it too.
|
|
40
40
|
*/
|
|
41
41
|
export type RecoveryLogStore = Pick<WebvhIdStore, 'getIdResourceRaw' | 'putIdResource'>;
|
|
42
|
+
/**
|
|
43
|
+
* Reads and resolves the published log through the narrow recovery seam.
|
|
44
|
+
*
|
|
45
|
+
* @param options {object}
|
|
46
|
+
* @param options.store {RecoveryLogStore}
|
|
47
|
+
* @param [options.expectedDid] {string} the account DID the log must resolve
|
|
48
|
+
* to, where the caller holds one
|
|
49
|
+
* @returns {Promise<PublishedWebvhLog>}
|
|
50
|
+
*/
|
|
51
|
+
export declare function readLogOrThrow({ store, expectedDid }: {
|
|
52
|
+
store: RecoveryLogStore;
|
|
53
|
+
expectedDid?: string;
|
|
54
|
+
}): Promise<PublishedWebvhLog>;
|
|
55
|
+
/**
|
|
56
|
+
* Publishes `did.jsonl` through the narrow recovery seam -- the log only,
|
|
57
|
+
* never `did.json` (the delegation covers nothing else; the recovered
|
|
58
|
+
* session republishes the projection once it is the controller). The write is
|
|
59
|
+
* conditional on the read the entry was built on, and a lost race surfaces as
|
|
60
|
+
* a `WebvhLogConflictError` (the mapping lives in `putLogResource`).
|
|
61
|
+
*
|
|
62
|
+
* @param options {object}
|
|
63
|
+
* @param options.store {RecoveryLogStore}
|
|
64
|
+
* @param options.log {DIDLog}
|
|
65
|
+
* @param [options.ifMatch] {string} publish only if `did.jsonl` is unchanged
|
|
66
|
+
* @returns {Promise<void>}
|
|
67
|
+
*/
|
|
68
|
+
export declare function publishLogOnly({ store, log, ifMatch }: {
|
|
69
|
+
store: RecoveryLogStore;
|
|
70
|
+
log: DIDLog;
|
|
71
|
+
ifMatch?: string;
|
|
72
|
+
}): Promise<void>;
|
|
42
73
|
/**
|
|
43
74
|
* ISSUANCE (run by an enrolled client, root authority): publishes a recovery
|
|
44
75
|
* code's split posture into the document -- one entry adding the code's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryWebvh.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryWebvh.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EACV,MAAM,EACN,MAAM,EAEP,MAAM,2BAA2B,CAAA;AAWlC,OAAO,KAAK,EACV,qBAAqB,
|
|
1
|
+
{"version":3,"file":"recoveryWebvh.d.ts","sourceRoot":"","sources":["../../src/recovery/recoveryWebvh.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EACV,MAAM,EACN,MAAM,EAEP,MAAM,2BAA2B,CAAA;AAWlC,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACb,MAAM,sBAAsB,CAAA;AAG7B;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,EAC3B,GAAG,EACH,wBAAwB,EACzB,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,wBAAwB,EAAE,MAAM,CAAA;CACjC,GAAG,MAAM,CAET;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,wBAAwB,EAAE,MAAM,CAAA;IAChC,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;gBAEnD,OAAO,SACuC;CAKjD;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,YAAY,EACZ,kBAAkB,GAAG,eAAe,CACrC,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,EACnC,KAAK,EACL,WAAW,EACZ,EAAE;IACD,KAAK,EAAE,gBAAgB,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAU7B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAAC,EACnC,KAAK,EACL,GAAG,EACH,OAAO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,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAE5C"}
|
|
@@ -72,7 +72,7 @@ export class RecoveryKeyNotCommittedError extends Error {
|
|
|
72
72
|
* to, where the caller holds one
|
|
73
73
|
* @returns {Promise<PublishedWebvhLog>}
|
|
74
74
|
*/
|
|
75
|
-
async function readLogOrThrow({ store, expectedDid }) {
|
|
75
|
+
export async function readLogOrThrow({ store, expectedDid }) {
|
|
76
76
|
// readPublishedLog only calls getIdResourceRaw, so the narrow seam is safe.
|
|
77
77
|
const published = await readPublishedLog({
|
|
78
78
|
idStore: store,
|
|
@@ -96,7 +96,7 @@ async function readLogOrThrow({ store, expectedDid }) {
|
|
|
96
96
|
* @param [options.ifMatch] {string} publish only if `did.jsonl` is unchanged
|
|
97
97
|
* @returns {Promise<void>}
|
|
98
98
|
*/
|
|
99
|
-
async function publishLogOnly({ store, log, ifMatch }) {
|
|
99
|
+
export async function publishLogOnly({ store, log, ifMatch }) {
|
|
100
100
|
await putLogResource({ store, log, ifMatch });
|
|
101
101
|
}
|
|
102
102
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recoveryWebvh.js","sourceRoot":"","sources":["../../src/recovery/recoveryWebvh.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAMxE,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,oBAAoB,EACrB,MAAM,sBAAsB,CAAA;AAO7B,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE9E;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAA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BAAoB,EAAE,WAAW,CAAC;QAC1E,oBAAoB,EAAE,aAAa,CAAC,GAAG,CAAC,oBAAoB,EAAE,WAAW,CAAC;KAC3E,CAAC,CAAA;IACF,0EAA0E;IAC1E,iEAAiE;IACjE,MAAM,cAAc,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC,CAAA;IAC1E,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAA;AACrD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The zcap-only Verifiable Presentation Request: the request a relying party
|
|
6
|
+
* stores on an ephemeral exchange (`ephemeralExchange.ts`) when all it wants
|
|
7
|
+
* from the wallet is delegated capabilities on the user's Space. One
|
|
8
|
+
* `AuthorizationCapabilityQuery` (the canonical VCALM type string; the wallet
|
|
9
|
+
* side's `zcapQueriesOf` reads it back) carrying the requested capability
|
|
10
|
+
* details verbatim. Deliberately no `DIDAuthentication` query and no
|
|
11
|
+
* `domain`: the requester is asking for authority, not proving who it is to a
|
|
12
|
+
* verifier, and a requester without an attested origin (a CLI) has no domain
|
|
13
|
+
* a wallet could check.
|
|
14
|
+
*/
|
|
15
|
+
import type { ICapabilityQueryDetail, IVPRDetails } from './types.js';
|
|
16
|
+
/**
|
|
17
|
+
* REQUESTER: builds the zcap-only VPR details for a set of capability
|
|
18
|
+
* requests. Each detail must name its `controller` (the grantee DID) and its
|
|
19
|
+
* `invocationTarget` (a URL under the user's Space, or a wallet-defined
|
|
20
|
+
* descriptor object); an empty set, or a detail missing either, throws --
|
|
21
|
+
* there would be nothing for the wallet to ask consent for.
|
|
22
|
+
*
|
|
23
|
+
* @param options {object}
|
|
24
|
+
* @param options.capabilityQueries {ICapabilityQueryDetail[]}
|
|
25
|
+
* @param [options.challenge] {string} a requester-chosen nonce the wallet
|
|
26
|
+
* echoes in its response presentation
|
|
27
|
+
* @returns {IVPRDetails}
|
|
28
|
+
*/
|
|
29
|
+
export declare function composeCapabilityRequest({ capabilityQueries, challenge }: {
|
|
30
|
+
capabilityQueries: ICapabilityQueryDetail[];
|
|
31
|
+
challenge?: string;
|
|
32
|
+
}): IVPRDetails;
|
|
33
|
+
//# sourceMappingURL=capabilityRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilityRequest.d.ts","sourceRoot":"","sources":["../../src/request/capabilityRequest.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EACV,sBAAsB,EACtB,WAAW,EAGZ,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,iBAAiB,EACjB,SAAS,EACV,EAAE;IACD,iBAAiB,EAAE,sBAAsB,EAAE,CAAA;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,WAAW,CAsBd"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REQUESTER: builds the zcap-only VPR details for a set of capability
|
|
3
|
+
* requests. Each detail must name its `controller` (the grantee DID) and its
|
|
4
|
+
* `invocationTarget` (a URL under the user's Space, or a wallet-defined
|
|
5
|
+
* descriptor object); an empty set, or a detail missing either, throws --
|
|
6
|
+
* there would be nothing for the wallet to ask consent for.
|
|
7
|
+
*
|
|
8
|
+
* @param options {object}
|
|
9
|
+
* @param options.capabilityQueries {ICapabilityQueryDetail[]}
|
|
10
|
+
* @param [options.challenge] {string} a requester-chosen nonce the wallet
|
|
11
|
+
* echoes in its response presentation
|
|
12
|
+
* @returns {IVPRDetails}
|
|
13
|
+
*/
|
|
14
|
+
export function composeCapabilityRequest({ capabilityQueries, challenge }) {
|
|
15
|
+
if (capabilityQueries.length === 0) {
|
|
16
|
+
throw new Error('A capability request must ask for at least one zcap.');
|
|
17
|
+
}
|
|
18
|
+
for (const detail of capabilityQueries) {
|
|
19
|
+
if (typeof detail.controller !== 'string' || detail.controller === '') {
|
|
20
|
+
throw new Error('A capability query must name its "controller".');
|
|
21
|
+
}
|
|
22
|
+
const target = detail.invocationTarget;
|
|
23
|
+
if ((typeof target !== 'string' || target === '') &&
|
|
24
|
+
(typeof target !== 'object' || target === null)) {
|
|
25
|
+
throw new Error('A capability query must name its "invocationTarget".');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const query = {
|
|
29
|
+
type: 'AuthorizationCapabilityQuery',
|
|
30
|
+
capabilityQuery: capabilityQueries,
|
|
31
|
+
...(challenge !== undefined && { challenge })
|
|
32
|
+
};
|
|
33
|
+
return { query: [query] };
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=capabilityRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilityRequest.js","sourceRoot":"","sources":["../../src/request/capabilityRequest.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,wBAAwB,CAAC,EACvC,iBAAiB,EACjB,SAAS,EAIV;IACC,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;IACD,KAAK,MAAM,MAAM,IAAI,iBAAiB,EAAE,CAAC;QACvC,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,IAAI,MAAM,CAAC,UAAU,KAAK,EAAE,EAAE,CAAC;YACtE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAA;QACnE,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,CAAC,gBAAgB,CAAA;QACtC,IACE,CAAC,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,EAAE,CAAC;YAC7C,CAAC,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,CAAC,EAC/C,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;QACzE,CAAC;IACH,CAAC;IACD,MAAM,KAAK,GAAe;QACxB,IAAI,EAAE,8BAA8B;QACpC,eAAe,EAAE,iBAAiB;QAClC,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,CAAC;KAC9C,CAAA;IACD,OAAO,EAAE,KAAK,EAAE,CAAC,KAAkB,CAAC,EAAE,CAAA;AACxC,CAAC"}
|