@interop/wallet-core 0.62.0 → 0.65.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 +41 -16
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +46 -26
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
- package/dist/clientAnnex/credentialAnchoredGenesis.js +91 -39
- package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -1
- package/dist/clientAnnex/establish.d.ts +55 -34
- package/dist/clientAnnex/establish.d.ts.map +1 -1
- package/dist/clientAnnex/establish.js +102 -56
- package/dist/clientAnnex/establish.js.map +1 -1
- package/dist/clientAnnex/forget.d.ts +16 -2
- package/dist/clientAnnex/forget.d.ts.map +1 -1
- package/dist/clientAnnex/forget.js +11 -9
- package/dist/clientAnnex/forget.js.map +1 -1
- package/dist/clientAnnex/forgetLast.d.ts +62 -18
- package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
- package/dist/clientAnnex/forgetLast.js +92 -26
- package/dist/clientAnnex/forgetLast.js.map +1 -1
- package/dist/clientAnnex/gc.d.ts +3 -2
- package/dist/clientAnnex/gc.d.ts.map +1 -1
- package/dist/clientAnnex/gc.js +7 -7
- package/dist/clientAnnex/gc.js.map +1 -1
- package/dist/clientAnnex/heal.d.ts +38 -5
- package/dist/clientAnnex/heal.d.ts.map +1 -1
- package/dist/clientAnnex/heal.js +346 -236
- package/dist/clientAnnex/heal.js.map +1 -1
- package/dist/clientAnnex/index.d.ts +21 -5
- package/dist/clientAnnex/index.d.ts.map +1 -1
- package/dist/clientAnnex/index.js +24 -5
- package/dist/clientAnnex/index.js.map +1 -1
- package/dist/clientAnnex/ladder.d.ts +58 -0
- package/dist/clientAnnex/ladder.d.ts.map +1 -1
- package/dist/clientAnnex/ladder.js +222 -33
- package/dist/clientAnnex/ladder.js.map +1 -1
- package/dist/clientAnnex/ladderAnchored.d.ts +148 -22
- package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/ladderAnchored.js +391 -346
- package/dist/clientAnnex/ladderAnchored.js.map +1 -1
- package/dist/clientAnnex/log.d.ts +162 -43
- package/dist/clientAnnex/log.d.ts.map +1 -1
- package/dist/clientAnnex/log.js +423 -192
- package/dist/clientAnnex/log.js.map +1 -1
- package/dist/clientAnnex/mend.d.ts +12 -6
- package/dist/clientAnnex/mend.d.ts.map +1 -1
- package/dist/clientAnnex/mend.js +26 -12
- package/dist/clientAnnex/mend.js.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts +6 -4
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.js +56 -35
- package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
- package/dist/clientAnnex/spaceCapability.d.ts +123 -0
- package/dist/clientAnnex/spaceCapability.d.ts.map +1 -0
- package/dist/clientAnnex/spaceCapability.js +152 -0
- package/dist/clientAnnex/spaceCapability.js.map +1 -0
- package/dist/clientAnnex/stages.d.ts +63 -0
- package/dist/clientAnnex/stages.d.ts.map +1 -0
- package/dist/clientAnnex/stages.js +64 -0
- package/dist/clientAnnex/stages.js.map +1 -0
- package/dist/clientAnnex/zcap.d.ts +1 -1
- package/dist/clientAnnex/zcap.d.ts.map +1 -1
- package/dist/clientAnnex/zcap.js +42 -35
- package/dist/clientAnnex/zcap.js.map +1 -1
- package/dist/clients/policy.d.ts +15 -1
- package/dist/clients/policy.d.ts.map +1 -1
- package/dist/clients/policy.js +12 -6
- package/dist/clients/policy.js.map +1 -1
- package/dist/clients/revocation.d.ts +18 -10
- package/dist/clients/revocation.d.ts.map +1 -1
- package/dist/clients/revocation.js +13 -5
- package/dist/clients/revocation.js.map +1 -1
- package/dist/clients/rosterPolicy.d.ts +10 -2
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +41 -24
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/descriptors/acquire.d.ts.map +1 -1
- package/dist/descriptors/acquire.js +6 -23
- package/dist/descriptors/acquire.js.map +1 -1
- package/dist/descriptors/cipher.d.ts.map +1 -1
- package/dist/descriptors/cipher.js +5 -0
- package/dist/descriptors/cipher.js.map +1 -1
- package/dist/descriptors/errors.d.ts +43 -0
- package/dist/descriptors/errors.d.ts.map +1 -0
- package/dist/descriptors/errors.js +45 -0
- package/dist/descriptors/errors.js.map +1 -0
- package/dist/descriptors/index.d.ts +5 -0
- package/dist/descriptors/index.d.ts.map +1 -1
- package/dist/descriptors/index.js +5 -0
- package/dist/descriptors/index.js.map +1 -1
- package/dist/enrollment/enrollment.d.ts +37 -10
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +52 -15
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/genesis/accountGenesis.d.ts +42 -11
- package/dist/genesis/accountGenesis.d.ts.map +1 -1
- package/dist/genesis/accountGenesis.js +80 -22
- package/dist/genesis/accountGenesis.js.map +1 -1
- package/dist/genesis/index.d.ts +3 -1
- package/dist/genesis/index.d.ts.map +1 -1
- package/dist/genesis/index.js +3 -1
- package/dist/genesis/index.js.map +1 -1
- package/dist/identity/agents.d.ts +17 -1
- package/dist/identity/agents.d.ts.map +1 -1
- package/dist/identity/agents.js +23 -7
- package/dist/identity/agents.js.map +1 -1
- package/dist/identity/index.d.ts +3 -1
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +3 -1
- package/dist/identity/index.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/keyring/index.d.ts +2 -1
- package/dist/keyring/index.d.ts.map +1 -1
- package/dist/keyring/index.js +2 -1
- package/dist/keyring/index.js.map +1 -1
- package/dist/keyring/record.d.ts.map +1 -1
- package/dist/keyring/record.js +3 -6
- package/dist/keyring/record.js.map +1 -1
- package/dist/keyring/unlockSpace.d.ts +14 -5
- package/dist/keyring/unlockSpace.d.ts.map +1 -1
- package/dist/keyring/unlockSpace.js +31 -36
- package/dist/keyring/unlockSpace.js.map +1 -1
- package/dist/keys/index.d.ts +10 -6
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +9 -5
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts +12 -11
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +15 -13
- package/dist/keys/rosterLogStore.js.map +1 -1
- package/dist/keys/rosterStore.d.ts +3 -6
- package/dist/keys/rosterStore.d.ts.map +1 -1
- package/dist/keys/rosterStore.js +10 -9
- package/dist/keys/rosterStore.js.map +1 -1
- package/dist/keys/spaceEpochs.d.ts.map +1 -1
- package/dist/keys/spaceEpochs.js +2 -3
- package/dist/keys/spaceEpochs.js.map +1 -1
- package/dist/keys/userKeyRoster.d.ts +57 -7
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +222 -17
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/keys/userKeyRosterCascade.d.ts +7 -6
- package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
- package/dist/keys/userKeyRosterCascade.js +7 -6
- package/dist/keys/userKeyRosterCascade.js.map +1 -1
- package/dist/keys/wasLabelsStore.d.ts +9 -2
- package/dist/keys/wasLabelsStore.d.ts.map +1 -1
- package/dist/keys/wasLabelsStore.js +14 -6
- package/dist/keys/wasLabelsStore.js.map +1 -1
- package/dist/log.d.ts +7 -2
- package/dist/log.d.ts.map +1 -1
- package/dist/log.js +6 -1
- package/dist/log.js.map +1 -1
- package/dist/recovery/index.d.ts +12 -8
- package/dist/recovery/index.d.ts.map +1 -1
- package/dist/recovery/index.js +11 -7
- package/dist/recovery/index.js.map +1 -1
- package/dist/recovery/recoveryCode.d.ts +27 -7
- package/dist/recovery/recoveryCode.d.ts.map +1 -1
- package/dist/recovery/recoveryCode.js +18 -6
- package/dist/recovery/recoveryCode.js.map +1 -1
- package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
- package/dist/recovery/recoveryDelegation.js +21 -34
- package/dist/recovery/recoveryDelegation.js.map +1 -1
- package/dist/recovery/recoveryWebvh.d.ts +75 -63
- package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
- package/dist/recovery/recoveryWebvh.js +127 -116
- package/dist/recovery/recoveryWebvh.js.map +1 -1
- package/dist/request/classify.d.ts +32 -8
- package/dist/request/classify.d.ts.map +1 -1
- package/dist/request/classify.js +39 -14
- package/dist/request/classify.js.map +1 -1
- package/dist/request/ephemeralExchange.d.ts +1 -6
- package/dist/request/ephemeralExchange.d.ts.map +1 -1
- package/dist/request/ephemeralExchange.js.map +1 -1
- package/dist/request/onboarding.d.ts.map +1 -1
- package/dist/request/onboarding.js +2 -2
- package/dist/request/onboarding.js.map +1 -1
- package/dist/request/parse.d.ts.map +1 -1
- package/dist/request/parse.js +2 -3
- package/dist/request/parse.js.map +1 -1
- package/dist/resourceLog/controller.d.ts +34 -12
- package/dist/resourceLog/controller.d.ts.map +1 -1
- package/dist/resourceLog/controller.js +79 -86
- package/dist/resourceLog/controller.js.map +1 -1
- package/dist/resourceLog/document.d.ts +182 -0
- package/dist/resourceLog/document.d.ts.map +1 -0
- package/dist/resourceLog/document.js +159 -0
- package/dist/resourceLog/document.js.map +1 -0
- package/dist/resourceLog/errors.d.ts +47 -8
- package/dist/resourceLog/errors.d.ts.map +1 -1
- package/dist/resourceLog/errors.js +54 -8
- package/dist/resourceLog/errors.js.map +1 -1
- package/dist/resourceLog/index.d.ts +7 -3
- package/dist/resourceLog/index.d.ts.map +1 -1
- package/dist/resourceLog/index.js +7 -3
- package/dist/resourceLog/index.js.map +1 -1
- package/dist/resourceLog/ladderRungs.d.ts +35 -0
- package/dist/resourceLog/ladderRungs.d.ts.map +1 -0
- package/dist/resourceLog/ladderRungs.js +352 -0
- package/dist/resourceLog/ladderRungs.js.map +1 -0
- package/dist/resourceLog/license.d.ts +42 -17
- package/dist/resourceLog/license.d.ts.map +1 -1
- package/dist/resourceLog/license.js +38 -24
- package/dist/resourceLog/license.js.map +1 -1
- package/dist/space/activity.d.ts +15 -15
- package/dist/space/activity.d.ts.map +1 -1
- package/dist/space/activity.js +15 -15
- package/dist/space/activity.js.map +1 -1
- package/dist/space/collections.d.ts +11 -0
- package/dist/space/collections.d.ts.map +1 -1
- package/dist/space/collections.js +13 -0
- package/dist/space/collections.js.map +1 -1
- package/dist/space/deleteSpace.d.ts +28 -0
- package/dist/space/deleteSpace.d.ts.map +1 -0
- package/dist/space/deleteSpace.js +44 -0
- package/dist/space/deleteSpace.js.map +1 -0
- package/dist/space/errors.d.ts.map +1 -1
- package/dist/space/errors.js +0 -1
- package/dist/space/errors.js.map +1 -1
- package/dist/space/index.d.ts +6 -0
- package/dist/space/index.d.ts.map +1 -1
- package/dist/space/index.js +6 -0
- package/dist/space/index.js.map +1 -1
- package/dist/space/plaintextCollection.d.ts +43 -0
- package/dist/space/plaintextCollection.d.ts.map +1 -0
- package/dist/space/plaintextCollection.js +17 -0
- package/dist/space/plaintextCollection.js.map +1 -0
- package/dist/stages.d.ts +23 -0
- package/dist/stages.d.ts.map +1 -0
- package/dist/stages.js +23 -0
- package/dist/stages.js.map +1 -0
- package/dist/sync/index.d.ts +7 -0
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +7 -0
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/push.js +4 -4
- package/dist/sync/push.js.map +1 -1
- package/dist/sync/remint.js +2 -2
- package/dist/sync/remint.js.map +1 -1
- package/dist/sync/types.d.ts +41 -1
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/types.js +47 -1
- package/dist/sync/types.js.map +1 -1
- package/dist/unlock/index.d.ts +5 -1
- package/dist/unlock/index.d.ts.map +1 -1
- package/dist/unlock/index.js +5 -1
- package/dist/unlock/index.js.map +1 -1
- package/dist/unlock/retire.d.ts +35 -7
- package/dist/unlock/retire.d.ts.map +1 -1
- package/dist/unlock/retire.js +52 -14
- package/dist/unlock/retire.js.map +1 -1
- package/dist/unlock/standingClient.d.ts.map +1 -1
- package/dist/unlock/standingClient.js +5 -1
- package/dist/unlock/standingClient.js.map +1 -1
- package/dist/unlock/standingWebvh.d.ts +217 -35
- package/dist/unlock/standingWebvh.d.ts.map +1 -1
- package/dist/unlock/standingWebvh.js +469 -210
- package/dist/unlock/standingWebvh.js.map +1 -1
- package/dist/webvh/accountEntry.d.ts +146 -0
- package/dist/webvh/accountEntry.d.ts.map +1 -0
- package/dist/webvh/accountEntry.js +239 -0
- package/dist/webvh/accountEntry.js.map +1 -0
- package/dist/webvh/didWeb.d.ts +12 -7
- package/dist/webvh/didWeb.d.ts.map +1 -1
- package/dist/webvh/didWeb.js +2 -2
- package/dist/webvh/didWeb.js.map +1 -1
- package/dist/webvh/didWebProjection.d.ts +164 -0
- package/dist/webvh/didWebProjection.d.ts.map +1 -0
- package/dist/webvh/didWebProjection.js +230 -0
- package/dist/webvh/didWebProjection.js.map +1 -0
- package/dist/webvh/didWebvh.d.ts +275 -136
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +307 -340
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/enrollClient.d.ts +65 -0
- package/dist/webvh/enrollClient.d.ts.map +1 -0
- package/dist/webvh/enrollClient.js +172 -0
- package/dist/webvh/enrollClient.js.map +1 -0
- package/dist/webvh/index.d.ts +37 -12
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +33 -10
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/listClients.d.ts +1 -35
- package/dist/webvh/listClients.d.ts.map +1 -1
- package/dist/webvh/listClients.js +2 -30
- package/dist/webvh/listClients.js.map +1 -1
- package/dist/webvh/revokeClient.d.ts +41 -11
- package/dist/webvh/revokeClient.d.ts.map +1 -1
- package/dist/webvh/revokeClient.js +99 -48
- package/dist/webvh/revokeClient.js.map +1 -1
- package/dist/webvh/standingZcap.d.ts +61 -14
- package/dist/webvh/standingZcap.d.ts.map +1 -1
- package/dist/webvh/standingZcap.js +91 -0
- package/dist/webvh/standingZcap.js.map +1 -1
- package/dist/webvh/verifyLog.d.ts +59 -5
- package/dist/webvh/verifyLog.d.ts.map +1 -1
- package/dist/webvh/verifyLog.js +76 -11
- package/dist/webvh/verifyLog.js.map +1 -1
- package/dist/webvh/wasIdStore.d.ts +8 -8
- package/dist/webvh/wasIdStore.d.ts.map +1 -1
- package/dist/webvh/wasIdStore.js +39 -14
- package/dist/webvh/wasIdStore.js.map +1 -1
- package/dist/webvh/zcap.d.ts +14 -1
- package/dist/webvh/zcap.d.ts.map +1 -1
- package/dist/webvh/zcap.js +3 -27
- package/dist/webvh/zcap.js.map +1 -1
- package/package.json +2 -2
- package/dist/webvh/keyAgreement.d.ts +0 -97
- package/dist/webvh/keyAgreement.d.ts.map +0 -1
- package/dist/webvh/keyAgreement.js +0 -71
- package/dist/webvh/keyAgreement.js.map +0 -1
package/dist/clients/policy.js
CHANGED
|
@@ -6,14 +6,20 @@
|
|
|
6
6
|
* @param options.client {AccountClientView} the row in question
|
|
7
7
|
* @param options.clients {AccountClientView[]} the whole listing (the
|
|
8
8
|
* last-client rule is a property of the account, not of the row)
|
|
9
|
+
* @param [options.signerKind] {string} who would sign the removal entry:
|
|
10
|
+
* `'client'` (the default, an enrolled client's update keys) or `'ladder'`
|
|
11
|
+
* (a standing credential's rung), which lifts the self and last-client
|
|
12
|
+
* refusals -- see the module doc
|
|
9
13
|
* @returns {{ allowed: boolean, refusal?: DisconnectRefusal }}
|
|
10
14
|
*/
|
|
11
|
-
export function disconnectEligibility({ client, clients }) {
|
|
12
|
-
if (client
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
export function disconnectEligibility({ client, clients, signerKind = 'client' }) {
|
|
16
|
+
if (signerKind === 'client') {
|
|
17
|
+
if (client.isCurrent) {
|
|
18
|
+
return { allowed: false, refusal: 'self' };
|
|
19
|
+
}
|
|
20
|
+
if (clients.length <= 1) {
|
|
21
|
+
return { allowed: false, refusal: 'last-client' };
|
|
22
|
+
}
|
|
17
23
|
}
|
|
18
24
|
if (!client.updateKeyMultibase) {
|
|
19
25
|
return { allowed: false, refusal: 'unattributed-update-key' };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/clients/policy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/clients/policy.ts"],"names":[],"mappings":"AAkDA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACpC,MAAM,EACN,OAAO,EACP,UAAU,GAAG,QAAQ,EAKtB;IACC,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC5B,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,CAAA;QAC5C,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,CAAA;QACnD,CAAC;IACH,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAC/B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAA;IAC/D,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;AAC1B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,EACnC,MAAM,EAGP;IACC,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,oEAAoE;YAClE,8CAA8C,CACjD,CAAA;IACH,CAAC;IACD,OAAO;QACL,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;QAC/C,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;KAC9C,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,WAAW,EACX,UAAU,EAIX;IACC,OAAO,WAAW,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,EAAE,OAAO,KAAK,QAAQ;QACtE,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,UAAU,CAAA;AAChB,CAAC"}
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
* from the document the edit itself just resolved to (no re-fetch of the
|
|
21
21
|
* log this call just extended). On a log-governed roster store the
|
|
22
22
|
* orchestrator itself guarantees post-edit anchoring: the controller view
|
|
23
|
-
* built from the edit's own post-edit log is set as the store's
|
|
24
|
-
*
|
|
25
|
-
* rotation and the seal backstop anchor at or
|
|
26
|
-
* app's injected controller resolution still
|
|
27
|
-
* view. The roster delivers, never sources, so the
|
|
23
|
+
* built from the edit's own post-edit log is set as the store's minimum
|
|
24
|
+
* controller version (`setMinimumControllerVersion`) before anything
|
|
25
|
+
* roster-side runs, so the rotation and the seal backstop anchor at or
|
|
26
|
+
* past the edit even where the app's injected controller resolution still
|
|
27
|
+
* serves a cached pre-edit view. The roster delivers, never sources, so the
|
|
28
28
|
* stage names no client at all: it converges the roster onto that document
|
|
29
29
|
* (the login sweep's own path), retiring every current-epoch recipient the
|
|
30
30
|
* document no longer keys in one rotation. Nothing here has to pair a
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
import type { IKeyAgreementKey } from '@interop/data-integrity-core';
|
|
73
73
|
import type { CollectionEncryption } from '@interop/was-client';
|
|
74
74
|
import type { EncryptionDescriptorStore } from '@interop/was-client/edv';
|
|
75
|
-
import { type
|
|
75
|
+
import { type AccountLogSigner, type PublishedKeyDocument, type RevokedClientKeys, type WebvhIdStore } from '../webvh/index.js';
|
|
76
76
|
import { type CascadeCollections, type RosterSealReport, type UserKey, type UserKeyCascadeResult } from '../keys/index.js';
|
|
77
77
|
export type { CascadeCollections, RosterSealReport };
|
|
78
78
|
/**
|
|
@@ -125,11 +125,18 @@ export interface ClientRevocationResult {
|
|
|
125
125
|
*
|
|
126
126
|
* @param options {object}
|
|
127
127
|
* @param options.idStore {WebvhIdStore} the account's `id` collection store
|
|
128
|
-
* @param options.
|
|
129
|
-
* update-key seeds,
|
|
128
|
+
* @param options.signer {AccountLogSigner} who signs the document edit:
|
|
129
|
+
* THIS client's did:webvh update-key seeds, or the acting credential's
|
|
130
|
+
* ladder seed
|
|
130
131
|
* @param options.revokedClient {RevokedClientKeys} the revoked client's
|
|
131
132
|
* public halves (its two verification-method multibases and its active
|
|
132
133
|
* update key)
|
|
134
|
+
* @param [options.projectionStore] {object} an `id`-collection store the
|
|
135
|
+
* caller may write through, passed straight to the document edit: the
|
|
136
|
+
* post-removal `did:web` projection is PUT through it immediately before
|
|
137
|
+
* that entry publishes, so a ladder-signed disconnect does not leave
|
|
138
|
+
* `did.json` naming the revoked client. Best-effort, and omitted the
|
|
139
|
+
* behavior is unchanged (see `revokeWebvhClient`)
|
|
133
140
|
* @param [options.knownLatentHashes] {string[]} the standing recovery codes'
|
|
134
141
|
* update-key hashes, so the document edit can tell the revoked client's
|
|
135
142
|
* staged commitment apart from a latent recovery commitment (the one
|
|
@@ -164,9 +171,10 @@ export interface ClientRevocationResult {
|
|
|
164
171
|
* keeps operating without a re-login
|
|
165
172
|
* @returns {Promise<ClientRevocationResult>}
|
|
166
173
|
*/
|
|
167
|
-
export declare function revokeAccountClient({ idStore,
|
|
174
|
+
export declare function revokeAccountClient({ idStore, signer, projectionStore, revokedClient, knownLatentHashes, expectedDid, ownSigningKeyMultibase, rosterStore, userKey, clientKeyAgreementKey, pinnedEpochId, onUserKeyAdopted, collections, remintRecoveryDelegations, remintGenerationDelegation, onRotationAdopted }: {
|
|
168
175
|
idStore: WebvhIdStore;
|
|
169
|
-
|
|
176
|
+
signer: AccountLogSigner;
|
|
177
|
+
projectionStore?: Pick<WebvhIdStore, 'getIdResourceRaw' | 'putIdResource'>;
|
|
170
178
|
revokedClient: RevokedClientKeys;
|
|
171
179
|
knownLatentHashes?: string[];
|
|
172
180
|
expectedDid?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revocation.d.ts","sourceRoot":"","sources":["../../src/clients/revocation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAEL,KAAK,
|
|
1
|
+
{"version":3,"file":"revocation.d.ts","sourceRoot":"","sources":["../../src/clients/revocation.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,oBAAoB,EAC1B,MAAM,kBAAkB,CAAA;AAEzB,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAA;AAEpD;;;;;;;;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EAAE,gBAAgB,CAAA;IACvC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE;QAC3B,OAAO,EAAE,OAAO,CAAA;QAChB,aAAa,EAAE,MAAM,CAAA;QACrB,UAAU,EAAE,oBAAoB,CAAA;KACjC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACnB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,yBAAyB,CAAC,EAAE,CAAC,OAAO,EAAE;QACpC,QAAQ,EAAE,oBAAoB,CAAA;KAC/B,KAAK,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACpD,0BAA0B,CAAC,EAAE,CAAC,OAAO,EAAE;QACrC,QAAQ,EAAE,oBAAoB,CAAA;KAC/B,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAA;IACzC,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACtE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CA+ElC"}
|
|
@@ -17,11 +17,18 @@ import { rotateRosterToDocumentAndCascade } from '../keys/index.js';
|
|
|
17
17
|
*
|
|
18
18
|
* @param options {object}
|
|
19
19
|
* @param options.idStore {WebvhIdStore} the account's `id` collection store
|
|
20
|
-
* @param options.
|
|
21
|
-
* update-key seeds,
|
|
20
|
+
* @param options.signer {AccountLogSigner} who signs the document edit:
|
|
21
|
+
* THIS client's did:webvh update-key seeds, or the acting credential's
|
|
22
|
+
* ladder seed
|
|
22
23
|
* @param options.revokedClient {RevokedClientKeys} the revoked client's
|
|
23
24
|
* public halves (its two verification-method multibases and its active
|
|
24
25
|
* update key)
|
|
26
|
+
* @param [options.projectionStore] {object} an `id`-collection store the
|
|
27
|
+
* caller may write through, passed straight to the document edit: the
|
|
28
|
+
* post-removal `did:web` projection is PUT through it immediately before
|
|
29
|
+
* that entry publishes, so a ladder-signed disconnect does not leave
|
|
30
|
+
* `did.json` naming the revoked client. Best-effort, and omitted the
|
|
31
|
+
* behavior is unchanged (see `revokeWebvhClient`)
|
|
25
32
|
* @param [options.knownLatentHashes] {string[]} the standing recovery codes'
|
|
26
33
|
* update-key hashes, so the document edit can tell the revoked client's
|
|
27
34
|
* staged commitment apart from a latent recovery commitment (the one
|
|
@@ -56,7 +63,7 @@ import { rotateRosterToDocumentAndCascade } from '../keys/index.js';
|
|
|
56
63
|
* keeps operating without a re-login
|
|
57
64
|
* @returns {Promise<ClientRevocationResult>}
|
|
58
65
|
*/
|
|
59
|
-
export async function revokeAccountClient({ idStore,
|
|
66
|
+
export async function revokeAccountClient({ idStore, signer, projectionStore, revokedClient, knownLatentHashes, expectedDid, ownSigningKeyMultibase, rosterStore, userKey, clientKeyAgreementKey, pinnedEpochId, onUserKeyAdopted, collections, remintRecoveryDelegations, remintGenerationDelegation, onRotationAdopted }) {
|
|
60
67
|
if (ownSigningKeyMultibase &&
|
|
61
68
|
ownSigningKeyMultibase === revokedClient.signingKeyMultibase) {
|
|
62
69
|
throw new Error('This wallet cannot disconnect itself; use another enrolled wallet ' +
|
|
@@ -71,13 +78,14 @@ export async function revokeAccountClient({ idStore, updateKeys, revokedClient,
|
|
|
71
78
|
// recipients from.
|
|
72
79
|
const { did, doc, log } = await revokeWebvhClient({
|
|
73
80
|
idStore,
|
|
74
|
-
|
|
81
|
+
signer,
|
|
82
|
+
...(projectionStore ? { projectionStore } : {}),
|
|
75
83
|
revokedClient,
|
|
76
84
|
...(knownLatentHashes ? { knownLatentHashes } : {}),
|
|
77
85
|
...(expectedDid !== undefined ? { expectedDid } : {})
|
|
78
86
|
});
|
|
79
87
|
// 2-3. The shared roster-and-cascade tail: the roster rotation onto the
|
|
80
|
-
// post-edit document (with its post-edit controller
|
|
88
|
+
// post-edit document (with its post-edit minimum controller version and its seal
|
|
81
89
|
// backstop), then the collection fan-out onto the fresh key.
|
|
82
90
|
const tail = await rotateRosterToDocumentAndCascade({
|
|
83
91
|
rosterStore,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revocation.js","sourceRoot":"","sources":["../../src/clients/revocation.ts"],"names":[],"mappings":"AA0EA,OAAO,EACL,iBAAiB,EAKlB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,gCAAgC,EAKjC,MAAM,kBAAkB,CAAA;AAoCzB
|
|
1
|
+
{"version":3,"file":"revocation.js","sourceRoot":"","sources":["../../src/clients/revocation.ts"],"names":[],"mappings":"AA0EA,OAAO,EACL,iBAAiB,EAKlB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,gCAAgC,EAKjC,MAAM,kBAAkB,CAAA;AAoCzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,EACxC,OAAO,EACP,MAAM,EACN,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,sBAAsB,EACtB,WAAW,EACX,OAAO,EACP,qBAAqB,EACrB,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,yBAAyB,EACzB,0BAA0B,EAC1B,iBAAiB,EA0BlB;IACC,IACE,sBAAsB;QACtB,sBAAsB,KAAK,aAAa,CAAC,mBAAmB,EAC5D,CAAC;QACD,MAAM,IAAI,KAAK,CACb,oEAAoE;YAClE,sCAAsC,CACzC,CAAA;IACH,CAAC;IACD,IAAI,CAAC,aAAa,CAAC,kBAAkB,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CACb,oEAAoE;YAClE,8CAA8C,CACjD,CAAA;IACH,CAAC;IAED,2EAA2E;IAC3E,0EAA0E;IAC1E,mBAAmB;IACnB,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,MAAM,iBAAiB,CAAC;QACh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AAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAA;IAErE,mEAAmE;IACnE,YAAY;IACZ,MAAM,UAAU,GAAG,MAAM,0BAA0B,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAA;IAExE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,iBAAiB,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;IACtD,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,QAAQ,EAAE,GAAG;QACb,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;QACvC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtC,CAAA;AACH,CAAC"}
|
|
@@ -112,7 +112,13 @@ export declare function checkUserKeyRosterAtLogin({ store, userKey, clientKeyAgr
|
|
|
112
112
|
/**
|
|
113
113
|
* Converges the roster onto the account's locally verified did:webvh document,
|
|
114
114
|
* adopting a rotation the ordinary way (a roster re-read) and handing back the
|
|
115
|
-
* key and descriptor the collection fan-out should run against.
|
|
115
|
+
* key and descriptor the collection fan-out should run against. Both
|
|
116
|
+
* directions run: a current-epoch recipient the document no longer keys is
|
|
117
|
+
* rotated away, and an enrolled client the document DOES key that holds no
|
|
118
|
+
* wrap is escrowed into every epoch. The escrow direction is what the login
|
|
119
|
+
* sweep contributes to a ceremony torn between the entry that published a
|
|
120
|
+
* client and the append that was to wrap the user key to it; it appends
|
|
121
|
+
* without rotating, so it leaves `rotated` false.
|
|
116
122
|
*
|
|
117
123
|
* Best-effort UP TO the rotation: a log that cannot be fetched or verified, or
|
|
118
124
|
* a roster that turns out to need nothing, resolves to the unchanged input,
|
|
@@ -143,7 +149,8 @@ export declare function checkUserKeyRosterAtLogin({ store, userKey, clientKeyAgr
|
|
|
143
149
|
* {@link AdoptedUserKey} of a rotation, before the fan-out runs
|
|
144
150
|
* @returns {Promise<object>} whether the roster rotated on this call,
|
|
145
151
|
* whether the seal backstop had to append (`sealed`), the stale recipient
|
|
146
|
-
* kids found,
|
|
152
|
+
* kids found, the kids escrowed by the mirror direction, and the key +
|
|
153
|
+
* descriptor to fan out with
|
|
147
154
|
*/
|
|
148
155
|
export declare function convergeUserKeyRosterToAccount({ pointer, store, userKey, descriptor, clientKeyAgreementKey, pinnedEpochId, accountLogPinStore, onUserKeyAdopted }: {
|
|
149
156
|
pointer: AccountLogPointer;
|
|
@@ -158,6 +165,7 @@ export declare function convergeUserKeyRosterToAccount({ pointer, store, userKey
|
|
|
158
165
|
rotated: boolean;
|
|
159
166
|
sealed: boolean;
|
|
160
167
|
staleRecipientIds: string[];
|
|
168
|
+
escrowedRecipientIds: string[];
|
|
161
169
|
userKey: UserKey;
|
|
162
170
|
descriptor: CollectionEncryption;
|
|
163
171
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rosterPolicy.d.ts","sourceRoot":"","sources":["../../src/clients/rosterPolicy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CA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,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAqC1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAsB,8BAA8B,CAAC,EACnD,OAAO,EACP,KAAK,EACL,OAAO,EACP,UAAU,EACV,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EACjB,EAAE;IACD,OAAO,EAAE,iBAAiB,CAAA;IAC1B,KAAK,EAAE,yBAAyB,CAAA;IAChC,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,oBAAoB,CAAA;IAChC,qBAAqB,EAAE,gBAAgB,CAAA;IACvC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,kBAAkB,CAAC,EAAE,mBAAmB,CAAA;IACxC,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC9D,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAC3B,oBAAoB,EAAE,MAAM,EAAE,CAAA;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,oBAAoB,CAAA;CACjC,CAAC,CA0HD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { convergeUserKeyRosterToDocument, isSealableDescriptorStore, readUserKeyRoster } from '../keys/index.js';
|
|
2
2
|
import { log } from '../log.js';
|
|
3
|
+
import { isResourceLogRefusal } from '../resourceLog/errors.js';
|
|
3
4
|
import { verifyAccountLog } from '../webvh/index.js';
|
|
4
5
|
/**
|
|
5
6
|
* Whether a thrown error is one of the roster refusals -- a fabricated or
|
|
@@ -9,33 +10,29 @@ import { verifyAccountLog } from '../webvh/index.js';
|
|
|
9
10
|
* rather than degrading it, so both entry points rethrow them instead of
|
|
10
11
|
* warning and carrying on.
|
|
11
12
|
*
|
|
12
|
-
* The
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `UserKeyRosterContinuityError` stays a refusal: with no chain to compare it
|
|
20
|
-
* cannot tell a rollback from a fork, and it is the guard that remains when
|
|
21
|
-
* the chain-head pin was lost with a reinstall.
|
|
13
|
+
* The log half is {@link isResourceLogRefusal}, which carries the chain-head
|
|
14
|
+
* pin's `rollback` carve-out for every reader of a governed log; what this
|
|
15
|
+
* adds is the three names the generic taxonomy does not have. Among them the
|
|
16
|
+
* epoch pin's own `UserKeyRosterContinuityError` stays a refusal with no
|
|
17
|
+
* carve-out of its own: with no chain to compare it cannot tell a rollback
|
|
18
|
+
* from a fork, and it is the guard that remains when the chain-head pin was
|
|
19
|
+
* lost with a reinstall.
|
|
22
20
|
*
|
|
23
|
-
* Matched on `err.name` rather than `instanceof
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* branch.
|
|
21
|
+
* Matched on `err.name` rather than `instanceof`, for the reason the shared
|
|
22
|
+
* predicate is: the errors are raised inside the app-injected descriptor
|
|
23
|
+
* store, which can resolve to a different copy of this package (linked, or
|
|
24
|
+
* duplicated through a dependency tree), and a refusal from that copy must
|
|
25
|
+
* not fall into the warn-and-proceed transport branch.
|
|
28
26
|
*
|
|
29
27
|
* @param err {unknown}
|
|
30
28
|
* @returns {boolean}
|
|
31
29
|
*/
|
|
32
30
|
function isRosterRefusal(err) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return err.reason !== 'rollback';
|
|
31
|
+
if (isResourceLogRefusal(err)) {
|
|
32
|
+
return true;
|
|
36
33
|
}
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
const name = err?.name;
|
|
35
|
+
return (name === 'UserKeyRosterContinuityError' ||
|
|
39
36
|
name === 'UserKeyRosterIntegrityError' ||
|
|
40
37
|
name === 'UserKeyRosterUnwrapError');
|
|
41
38
|
}
|
|
@@ -110,7 +107,13 @@ export async function checkUserKeyRosterAtLogin({ store, userKey, clientKeyAgree
|
|
|
110
107
|
/**
|
|
111
108
|
* Converges the roster onto the account's locally verified did:webvh document,
|
|
112
109
|
* adopting a rotation the ordinary way (a roster re-read) and handing back the
|
|
113
|
-
* key and descriptor the collection fan-out should run against.
|
|
110
|
+
* key and descriptor the collection fan-out should run against. Both
|
|
111
|
+
* directions run: a current-epoch recipient the document no longer keys is
|
|
112
|
+
* rotated away, and an enrolled client the document DOES key that holds no
|
|
113
|
+
* wrap is escrowed into every epoch. The escrow direction is what the login
|
|
114
|
+
* sweep contributes to a ceremony torn between the entry that published a
|
|
115
|
+
* client and the append that was to wrap the user key to it; it appends
|
|
116
|
+
* without rotating, so it leaves `rotated` false.
|
|
114
117
|
*
|
|
115
118
|
* Best-effort UP TO the rotation: a log that cannot be fetched or verified, or
|
|
116
119
|
* a roster that turns out to need nothing, resolves to the unchanged input,
|
|
@@ -141,18 +144,21 @@ export async function checkUserKeyRosterAtLogin({ store, userKey, clientKeyAgree
|
|
|
141
144
|
* {@link AdoptedUserKey} of a rotation, before the fan-out runs
|
|
142
145
|
* @returns {Promise<object>} whether the roster rotated on this call,
|
|
143
146
|
* whether the seal backstop had to append (`sealed`), the stale recipient
|
|
144
|
-
* kids found,
|
|
147
|
+
* kids found, the kids escrowed by the mirror direction, and the key +
|
|
148
|
+
* descriptor to fan out with
|
|
145
149
|
*/
|
|
146
150
|
export async function convergeUserKeyRosterToAccount({ pointer, store, userKey, descriptor, clientKeyAgreementKey, pinnedEpochId, accountLogPinStore, onUserKeyAdopted }) {
|
|
147
151
|
const unchanged = {
|
|
148
152
|
rotated: false,
|
|
149
153
|
sealed: false,
|
|
150
154
|
staleRecipientIds: [],
|
|
155
|
+
escrowedRecipientIds: [],
|
|
151
156
|
userKey,
|
|
152
157
|
descriptor
|
|
153
158
|
};
|
|
154
159
|
let rotated;
|
|
155
160
|
let staleRecipientIds;
|
|
161
|
+
let escrowedRecipientIds;
|
|
156
162
|
try {
|
|
157
163
|
const { doc } = await verifyAccountLog({
|
|
158
164
|
...pointer,
|
|
@@ -161,10 +167,16 @@ export async function convergeUserKeyRosterToAccount({ pointer, store, userKey,
|
|
|
161
167
|
const converged = await convergeUserKeyRosterToDocument({
|
|
162
168
|
store,
|
|
163
169
|
document: doc,
|
|
164
|
-
descriptor
|
|
170
|
+
descriptor,
|
|
171
|
+
// The escrow direction needs a key that unwraps every epoch, and the
|
|
172
|
+
// login sweep is the standing mender for a ceremony torn between the
|
|
173
|
+
// entry that published a client and the append that was to wrap the
|
|
174
|
+
// user key to it. Without it only the retire direction would run here.
|
|
175
|
+
ownerKeyAgreementKey: clientKeyAgreementKey
|
|
165
176
|
});
|
|
166
177
|
rotated = converged.rotated;
|
|
167
178
|
staleRecipientIds = converged.staleRecipientIds;
|
|
179
|
+
escrowedRecipientIds = converged.escrowedRecipientIds;
|
|
168
180
|
}
|
|
169
181
|
catch (err) {
|
|
170
182
|
if (isRosterRefusal(err)) {
|
|
@@ -196,8 +208,12 @@ export async function convergeUserKeyRosterToAccount({ pointer, store, userKey,
|
|
|
196
208
|
log.warn('Could not seal the wrap-set roster log', { err });
|
|
197
209
|
}
|
|
198
210
|
}
|
|
211
|
+
if (escrowedRecipientIds.length > 0) {
|
|
212
|
+
log.warn('The wrap-set roster held no wrap for client(s) the account document ' +
|
|
213
|
+
'keys; the escrow has been completed', { escrowedRecipientCount: escrowedRecipientIds.length });
|
|
214
|
+
}
|
|
199
215
|
if (!rotated) {
|
|
200
|
-
return { ...unchanged, sealed };
|
|
216
|
+
return { ...unchanged, sealed, escrowedRecipientIds };
|
|
201
217
|
}
|
|
202
218
|
log.warn('The wrap-set roster still wrapped the current key to recipient(s) ' +
|
|
203
219
|
'the account document no longer keys; the rotation has been completed', { staleRecipientCount: staleRecipientIds.length });
|
|
@@ -235,6 +251,7 @@ export async function convergeUserKeyRosterToAccount({ pointer, store, userKey,
|
|
|
235
251
|
rotated: true,
|
|
236
252
|
sealed,
|
|
237
253
|
staleRecipientIds,
|
|
254
|
+
escrowedRecipientIds,
|
|
238
255
|
userKey: read.userKey,
|
|
239
256
|
descriptor: read.descriptor
|
|
240
257
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rosterPolicy.js","sourceRoot":"","sources":["../../src/clients/rosterPolicy.ts"],"names":[],"mappings":"AA4DA,OAAO,EACL,+BAA+B,EAC/B,yBAAyB,EACzB,iBAAiB,EAGlB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAapD
|
|
1
|
+
{"version":3,"file":"rosterPolicy.js","sourceRoot":"","sources":["../../src/clients/rosterPolicy.ts"],"names":[],"mappings":"AA4DA,OAAO,EACL,+BAA+B,EAC/B,yBAAyB,EACzB,iBAAiB,EAGlB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAapD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAS,eAAe,CAAC,GAAY;IACnC,IAAI,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAA;IACb,CAAC;IACD,MAAM,IAAI,GAAI,GAAiC,EAAE,IAAI,CAAA;IACrD,OAAO,CACL,IAAI,KAAK,8BAA8B;QACvC,IAAI,KAAK,6BAA6B;QACtC,IAAI,KAAK,0BAA0B,CACpC,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,EAC9C,KAAK,EACL,OAAO,EACP,qBAAqB,EACrB,aAAa,EACb,YAAY,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5B,CAAC,CAAA;IACF,OAAO;QACL,OAAO,EAAE,IAAI;QACb,MAAM;QACN,iBAAiB;QACjB,oBAAoB;QACpB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acquire.d.ts","sourceRoot":"","sources":["../../src/descriptors/acquire.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"acquire.d.ts","sourceRoot":"","sources":["../../src/descriptors/acquire.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAG1E;;;;;;;GAOG;AACH,MAAM,WAAW,0BAA0B;IACzC,oBAAoB,CAAC,OAAO,EAAE;QAC5B,YAAY,EAAE,MAAM,CAAA;KACrB,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAA;CAC9C;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,cAAc,CAAC,OAAO,EAAE;QACtB,YAAY,EAAE,MAAM,CAAA;KACrB,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAA;IAC7C,eAAe,CAAC,OAAO,EAAE;QACvB,YAAY,EAAE,MAAM,CAAA;QACpB,UAAU,EAAE,oBAAoB,CAAA;KACjC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAClB;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,GAAG,EACH,OAAO,EACR,EAAE;IACD,GAAG,EAAE,SAAS,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB,GAAG,0BAA0B,CAU7B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,MAAM,EACN,KAAK,EACL,YAAY,EACZ,YAAY,EACb,EAAE;IACD,MAAM,CAAC,EAAE,0BAA0B,CAAA;IACnC,KAAK,EAAE,yBAAyB,CAAA;IAChC,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACtE,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAwB5C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,MAAM,EACN,KAAK,EACL,aAAa,EACb,YAAY,EACb,EAAE;IACD,MAAM,CAAC,EAAE,0BAA0B,CAAA;IACnC,KAAK,EAAE,yBAAyB,CAAA;IAChC,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACtE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAiBhD"}
|
|
@@ -1,25 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Whether a thrown fetch failure is a resource-log refusal the cache must NOT
|
|
3
|
-
* paper over: a fabricated log (`ResourceLogIntegrityError`), or a log that
|
|
4
|
-
* is not the continuation of the pinned history
|
|
5
|
-
* (`ResourceLogContinuityError`) -- EXCEPT continuity reason `rollback`,
|
|
6
|
-
* which is reconcilable divergence (possibly replication lag): the pin is
|
|
7
|
-
* never regressed and nothing rolled-back is adopted, so serving the cached
|
|
8
|
-
* copy in the meantime is exactly the offline case. Matched on `err.name`
|
|
9
|
-
* rather than `instanceof`, which keeps this file dependency-light and
|
|
10
|
-
* survives a linked or duplicated copy of the package.
|
|
11
|
-
*
|
|
12
|
-
* @param err {unknown}
|
|
13
|
-
* @returns {boolean}
|
|
14
|
-
*/
|
|
15
|
-
function isLogRefusal(err) {
|
|
16
|
-
const name = err?.name;
|
|
17
|
-
if (name === 'ResourceLogIntegrityError') {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
return (name === 'ResourceLogContinuityError' &&
|
|
21
|
-
err.reason !== 'rollback');
|
|
22
|
-
}
|
|
1
|
+
import { isResourceLogRefusal } from '../resourceLog/errors.js';
|
|
23
2
|
/**
|
|
24
3
|
* The {@link EncryptionDescriptorSource} over a was-client handle: reads the
|
|
25
4
|
* collection's Description in the given Space and returns its `encryption`
|
|
@@ -78,7 +57,11 @@ export async function acquireDescriptor({ source, cache, collectionId, onFetchEr
|
|
|
78
57
|
return cache.readDescriptor({ collectionId });
|
|
79
58
|
}
|
|
80
59
|
catch (err) {
|
|
81
|
-
|
|
60
|
+
// A resource-log refusal the cache must not paper over -- a fabricated
|
|
61
|
+
// log, or one that is not the continuation of the pinned history. A
|
|
62
|
+
// rollback is not one of them and falls through to the cache, as any
|
|
63
|
+
// transport failure does.
|
|
64
|
+
if (isResourceLogRefusal(err)) {
|
|
82
65
|
throw err;
|
|
83
66
|
}
|
|
84
67
|
onFetchError?.(err, { collectionId });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acquire.js","sourceRoot":"","sources":["../../src/descriptors/acquire.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"acquire.js","sourceRoot":"","sources":["../../src/descriptors/acquire.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AA+B/D;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,GAAG,EACH,OAAO,EAIR;IACC,OAAO;QACL,KAAK,CAAC,oBAAoB,CAAC,EAAE,YAAY,EAAE;YACzC,MAAM,WAA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,CAAA;IAChC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACtE,GAAG,OAAO,CAAC,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"cipher.d.ts","sourceRoot":"","sources":["../../src/descriptors/cipher.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAEL,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAChC,MAAM,cAAc,CAAA;AAErB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,4BAA4B,CAAC,EACjD,eAAe,EACf,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,KAAK,EACL,YAAY,EACb,EAAE;IACD,eAAe,EAAE,gBAAgB,CAAA;IACjC,WAAW,EAAE,YAAY,CAAA;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;IACnC,MAAM,CAAC,EAAE,0BAA0B,CAAA;IACnC,KAAK,EAAE,yBAAyB,CAAA;IAChC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACtE,GAAG,OAAO,CAAC,SAAS,CAAC,CAyFrB"}
|
|
@@ -61,6 +61,11 @@ export async function createRefreshingEdvDocCipher({ keyAgreementKey, keyResolve
|
|
|
61
61
|
return await inner.decrypt({ envelope });
|
|
62
62
|
}
|
|
63
63
|
catch (err) {
|
|
64
|
+
// `instanceof` is safe here and only here: `inner` is built in this
|
|
65
|
+
// file by `createEdvDocCipher`, from the same `@interop/was-client`
|
|
66
|
+
// import this class comes from, so no injected seam is crossed. A
|
|
67
|
+
// caller classifying what THIS cipher throws is crossing one, and uses
|
|
68
|
+
// `isUnknownEpochError` / `isKeyUnwrapError` instead.
|
|
64
69
|
if (!(err instanceof UnknownEpochError) || !source) {
|
|
65
70
|
throw err;
|
|
66
71
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cipher.js","sourceRoot":"","sources":["../../src/descriptors/cipher.ts"],"names":[],"mappings":"AAsCA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,iBAAiB,EAGlB,MAAM,cAAc,CAAA;AAErB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,EACjD,eAAe,EACf,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,KAAK,EACL,YAAY,EASb;IACC,MAAM,KAAK,GAAG,KAAK,IAAwB,EAAE;QAC3C,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC;YACzC,MAAM;YACN,KAAK;YACL,YAAY;YACZ,YAAY;SACb,CAAC,CAAA;QACF,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,eAAe,YAAY,2CAA2C;gBACpE,kEAAkE;gBAClE,oEAAoE,CACvE,CAAA;QACH,CAAC;QACD,OAAO,kBAAkB,CAAC;YACxB,eAAe;YACf,WAAW;YACX,YAAY;YACZ,YAAY;YACZ,UAAU;SACX,CAAC,CAAA;IACJ,CAAC,CAAA;IAED,IAAI,KAAK,GAAG,MAAM,KAAK,EAAE,CAAA;IACzB,0EAA0E;IAC1E,yEAAyE;IACzE,+CAA+C;IAC/C,IAAI,SAAS,GAAyB,IAAI,CAAA;IAE1C,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,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CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;YACpC,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The read-side classification of what an injected `DocCipher` throws when it
|
|
6
|
+
* cannot open an envelope.
|
|
7
|
+
*
|
|
8
|
+
* A decrypt has two distinguishable no-key outcomes, and a host that scans
|
|
9
|
+
* rows must tell them apart: an epoch the descriptor this reader holds does
|
|
10
|
+
* not list at all (`UnknownEpochError` -- possibly fresh data behind a stale
|
|
11
|
+
* descriptor, so a re-read may fix it), and an epoch the descriptor does list
|
|
12
|
+
* but this reader holds no key for (`KeyUnwrapError` -- real data, and
|
|
13
|
+
* permanently unreadable here, since re-reading the same descriptor cannot
|
|
14
|
+
* produce a key the reader was not given). Neither is corruption, so neither
|
|
15
|
+
* row may be treated as garbage.
|
|
16
|
+
*
|
|
17
|
+
* Both are matched on `err.name`, never `instanceof`: the cipher is an
|
|
18
|
+
* injected seam, and in a wallet whose `@interop/was-client` resolves to a
|
|
19
|
+
* second copy (a `link:` dev setup, a dedupe miss through a dependency tree)
|
|
20
|
+
* the class the cipher throws is not the class the caller imported. The cost
|
|
21
|
+
* of the miss lands on real data -- a scan that misses `KeyUnwrapError` drops
|
|
22
|
+
* the row into its undecryptable bucket, which a host is entitled to purge.
|
|
23
|
+
* Both classes assign their `name` explicitly, which is what makes the string
|
|
24
|
+
* a contract.
|
|
25
|
+
*
|
|
26
|
+
* The unknown-epoch half of the pair ships from `@interop/wallet-core/sync`
|
|
27
|
+
* as `isUnknownEpochError`: the create-loss re-mint dispatches on it, and
|
|
28
|
+
* `sync` deliberately imports nothing else in this library. This file is the
|
|
29
|
+
* home of the other half, beside the cipher that raises it, and stays
|
|
30
|
+
* import-free for the same reason `resourceLog/errors.ts` does.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Whether an error is the cipher's not-a-recipient signal (`KeyUnwrapError`):
|
|
34
|
+
* the envelope's epoch IS on the descriptor this reader holds, but the reader
|
|
35
|
+
* has no key for it -- never a recipient of that epoch, or removed and the
|
|
36
|
+
* epoch rotated since. Real data, unreadable by this wallet, and never
|
|
37
|
+
* garbage: a caller skips such a row and leaves it in place.
|
|
38
|
+
*
|
|
39
|
+
* @param err {unknown}
|
|
40
|
+
* @returns {boolean}
|
|
41
|
+
*/
|
|
42
|
+
export declare function isKeyUnwrapError(err: unknown): boolean;
|
|
43
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/descriptors/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEtD"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2026 Interop Alliance. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The read-side classification of what an injected `DocCipher` throws when it
|
|
6
|
+
* cannot open an envelope.
|
|
7
|
+
*
|
|
8
|
+
* A decrypt has two distinguishable no-key outcomes, and a host that scans
|
|
9
|
+
* rows must tell them apart: an epoch the descriptor this reader holds does
|
|
10
|
+
* not list at all (`UnknownEpochError` -- possibly fresh data behind a stale
|
|
11
|
+
* descriptor, so a re-read may fix it), and an epoch the descriptor does list
|
|
12
|
+
* but this reader holds no key for (`KeyUnwrapError` -- real data, and
|
|
13
|
+
* permanently unreadable here, since re-reading the same descriptor cannot
|
|
14
|
+
* produce a key the reader was not given). Neither is corruption, so neither
|
|
15
|
+
* row may be treated as garbage.
|
|
16
|
+
*
|
|
17
|
+
* Both are matched on `err.name`, never `instanceof`: the cipher is an
|
|
18
|
+
* injected seam, and in a wallet whose `@interop/was-client` resolves to a
|
|
19
|
+
* second copy (a `link:` dev setup, a dedupe miss through a dependency tree)
|
|
20
|
+
* the class the cipher throws is not the class the caller imported. The cost
|
|
21
|
+
* of the miss lands on real data -- a scan that misses `KeyUnwrapError` drops
|
|
22
|
+
* the row into its undecryptable bucket, which a host is entitled to purge.
|
|
23
|
+
* Both classes assign their `name` explicitly, which is what makes the string
|
|
24
|
+
* a contract.
|
|
25
|
+
*
|
|
26
|
+
* The unknown-epoch half of the pair ships from `@interop/wallet-core/sync`
|
|
27
|
+
* as `isUnknownEpochError`: the create-loss re-mint dispatches on it, and
|
|
28
|
+
* `sync` deliberately imports nothing else in this library. This file is the
|
|
29
|
+
* home of the other half, beside the cipher that raises it, and stays
|
|
30
|
+
* import-free for the same reason `resourceLog/errors.ts` does.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Whether an error is the cipher's not-a-recipient signal (`KeyUnwrapError`):
|
|
34
|
+
* the envelope's epoch IS on the descriptor this reader holds, but the reader
|
|
35
|
+
* has no key for it -- never a recipient of that epoch, or removed and the
|
|
36
|
+
* epoch rotated since. Real data, unreadable by this wallet, and never
|
|
37
|
+
* garbage: a caller skips such a row and leaves it in place.
|
|
38
|
+
*
|
|
39
|
+
* @param err {unknown}
|
|
40
|
+
* @returns {boolean}
|
|
41
|
+
*/
|
|
42
|
+
export function isKeyUnwrapError(err) {
|
|
43
|
+
return err?.name === 'KeyUnwrapError';
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/descriptors/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC3C,OAAQ,GAAiC,EAAE,IAAI,KAAK,gBAAgB,CAAA;AACtE,CAAC"}
|
|
@@ -35,10 +35,15 @@
|
|
|
35
35
|
* cipher that acquires its own descriptor and, on an unknown-epoch decrypt,
|
|
36
36
|
* re-reads the description, swaps itself, and retries exactly once per
|
|
37
37
|
* instance.
|
|
38
|
+
* - `isKeyUnwrapError` -- how a host scanning rows tells "not a recipient of
|
|
39
|
+
* this epoch" from corruption, matched by `err.name` because the cipher is
|
|
40
|
+
* an injected seam. Its sibling `isUnknownEpochError` ships from
|
|
41
|
+
* `@interop/wallet-core/sync`.
|
|
38
42
|
*/
|
|
39
43
|
export { acquireDescriptor, acquireDescriptors, wasDescriptorSource } from './acquire.js';
|
|
40
44
|
export type { EncryptionDescriptorCache, EncryptionDescriptorSource } from './acquire.js';
|
|
41
45
|
export { EPOCH_CONFIGURATION_STATE_TYPE, logGovernedDescriptorSource, readGovernedEpochConfiguration } from './logSource.js';
|
|
42
46
|
export { DescriptorRefreshPolicy } from './refresh.js';
|
|
43
47
|
export { createRefreshingEdvDocCipher } from './cipher.js';
|
|
48
|
+
export { isKeyUnwrapError } from './errors.js';
|
|
44
49
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/descriptors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/descriptors/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,8BAA8B,EAC/B,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -35,9 +35,14 @@
|
|
|
35
35
|
* cipher that acquires its own descriptor and, on an unknown-epoch decrypt,
|
|
36
36
|
* re-reads the description, swaps itself, and retries exactly once per
|
|
37
37
|
* instance.
|
|
38
|
+
* - `isKeyUnwrapError` -- how a host scanning rows tells "not a recipient of
|
|
39
|
+
* this epoch" from corruption, matched by `err.name` because the cipher is
|
|
40
|
+
* an injected seam. Its sibling `isUnknownEpochError` ships from
|
|
41
|
+
* `@interop/wallet-core/sync`.
|
|
38
42
|
*/
|
|
39
43
|
export { acquireDescriptor, acquireDescriptors, wasDescriptorSource } from './acquire.js';
|
|
40
44
|
export { EPOCH_CONFIGURATION_STATE_TYPE, logGovernedDescriptorSource, readGovernedEpochConfiguration } from './logSource.js';
|
|
41
45
|
export { DescriptorRefreshPolicy } from './refresh.js';
|
|
42
46
|
export { createRefreshingEdvDocCipher } from './cipher.js';
|
|
47
|
+
export { isKeyUnwrapError } from './errors.js';
|
|
43
48
|
//# sourceMappingURL=index.js.map
|