@interop/wallet-core 0.66.0 → 0.68.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 +12 -8
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts +6 -10
- package/dist/clientAnnex/credentialAnchoredGenesis.d.ts.map +1 -1
- package/dist/clientAnnex/credentialAnchoredGenesis.js +34 -56
- package/dist/clientAnnex/credentialAnchoredGenesis.js.map +1 -1
- package/dist/clientAnnex/establish.d.ts +46 -29
- package/dist/clientAnnex/establish.d.ts.map +1 -1
- package/dist/clientAnnex/establish.js +111 -86
- package/dist/clientAnnex/establish.js.map +1 -1
- package/dist/clientAnnex/forget.d.ts +7 -16
- package/dist/clientAnnex/forget.d.ts.map +1 -1
- package/dist/clientAnnex/forget.js +13 -24
- package/dist/clientAnnex/forget.js.map +1 -1
- package/dist/clientAnnex/forgetLast.d.ts +33 -129
- package/dist/clientAnnex/forgetLast.d.ts.map +1 -1
- package/dist/clientAnnex/forgetLast.js +43 -182
- package/dist/clientAnnex/forgetLast.js.map +1 -1
- package/dist/clientAnnex/gc.d.ts +26 -12
- package/dist/clientAnnex/gc.d.ts.map +1 -1
- package/dist/clientAnnex/gc.js +60 -57
- package/dist/clientAnnex/gc.js.map +1 -1
- package/dist/clientAnnex/heal.d.ts +75 -18
- package/dist/clientAnnex/heal.d.ts.map +1 -1
- package/dist/clientAnnex/heal.js +79 -147
- package/dist/clientAnnex/heal.js.map +1 -1
- package/dist/clientAnnex/index.d.ts +8 -8
- package/dist/clientAnnex/index.d.ts.map +1 -1
- package/dist/clientAnnex/index.js +5 -5
- package/dist/clientAnnex/index.js.map +1 -1
- package/dist/clientAnnex/ladder.d.ts +51 -4
- package/dist/clientAnnex/ladder.d.ts.map +1 -1
- package/dist/clientAnnex/ladder.js +283 -47
- package/dist/clientAnnex/ladder.js.map +1 -1
- package/dist/clientAnnex/ladderAnchored.d.ts +62 -73
- package/dist/clientAnnex/ladderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/ladderAnchored.js +103 -117
- package/dist/clientAnnex/ladderAnchored.js.map +1 -1
- package/dist/clientAnnex/log.d.ts +123 -125
- package/dist/clientAnnex/log.d.ts.map +1 -1
- package/dist/clientAnnex/log.js +174 -233
- package/dist/clientAnnex/log.js.map +1 -1
- package/dist/clientAnnex/mend.d.ts +0 -4
- package/dist/clientAnnex/mend.d.ts.map +1 -1
- package/dist/clientAnnex/mend.js +50 -51
- package/dist/clientAnnex/mend.js.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts +25 -13
- package/dist/clientAnnex/recoveryLadderAnchored.d.ts.map +1 -1
- package/dist/clientAnnex/recoveryLadderAnchored.js +80 -303
- package/dist/clientAnnex/recoveryLadderAnchored.js.map +1 -1
- package/dist/clientAnnex/rosterDeliveredEpochs.d.ts +13 -5
- package/dist/clientAnnex/rosterDeliveredEpochs.d.ts.map +1 -1
- package/dist/clientAnnex/rosterDeliveredEpochs.js +18 -9
- package/dist/clientAnnex/rosterDeliveredEpochs.js.map +1 -1
- package/dist/clientAnnex/selfEnroll.d.ts +6 -10
- package/dist/clientAnnex/selfEnroll.d.ts.map +1 -1
- package/dist/clientAnnex/selfEnroll.js +13 -18
- package/dist/clientAnnex/selfEnroll.js.map +1 -1
- package/dist/clientAnnex/zcap.d.ts +19 -0
- package/dist/clientAnnex/zcap.d.ts.map +1 -1
- package/dist/clientAnnex/zcap.js +80 -12
- package/dist/clientAnnex/zcap.js.map +1 -1
- package/dist/clients/index.d.ts +3 -2
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js +3 -2
- package/dist/clients/index.js.map +1 -1
- package/dist/clients/listing.d.ts.map +1 -1
- package/dist/clients/listing.js +33 -15
- package/dist/clients/listing.js.map +1 -1
- package/dist/clients/policy.d.ts +18 -0
- package/dist/clients/policy.d.ts.map +1 -1
- package/dist/clients/policy.js +22 -8
- package/dist/clients/policy.js.map +1 -1
- package/dist/clients/revocation.d.ts +18 -30
- package/dist/clients/revocation.d.ts.map +1 -1
- package/dist/clients/revocation.js +12 -27
- package/dist/clients/revocation.js.map +1 -1
- package/dist/clients/rosterPolicy.d.ts +6 -1
- package/dist/clients/rosterPolicy.d.ts.map +1 -1
- package/dist/clients/rosterPolicy.js +27 -30
- package/dist/clients/rosterPolicy.js.map +1 -1
- package/dist/descriptors/errors.d.ts +6 -5
- package/dist/descriptors/errors.d.ts.map +1 -1
- package/dist/descriptors/errors.js +6 -5
- package/dist/descriptors/errors.js.map +1 -1
- package/dist/descriptors/index.d.ts +7 -3
- package/dist/descriptors/index.d.ts.map +1 -1
- package/dist/descriptors/index.js +7 -3
- package/dist/descriptors/index.js.map +1 -1
- package/dist/descriptors/logSource.d.ts +28 -6
- package/dist/descriptors/logSource.d.ts.map +1 -1
- package/dist/descriptors/logSource.js +33 -7
- package/dist/descriptors/logSource.js.map +1 -1
- package/dist/enrollment/enrollment.d.ts.map +1 -1
- package/dist/enrollment/enrollment.js +3 -7
- package/dist/enrollment/enrollment.js.map +1 -1
- package/dist/genesis/accountGenesis.d.ts +11 -16
- package/dist/genesis/accountGenesis.d.ts.map +1 -1
- package/dist/genesis/accountGenesis.js +43 -47
- package/dist/genesis/accountGenesis.js.map +1 -1
- package/dist/genesis/kmsAuthentication.d.ts +50 -0
- package/dist/genesis/kmsAuthentication.d.ts.map +1 -0
- package/dist/genesis/kmsAuthentication.js +49 -0
- package/dist/genesis/kmsAuthentication.js.map +1 -0
- package/dist/keyring/kdf.d.ts +16 -20
- package/dist/keyring/kdf.d.ts.map +1 -1
- package/dist/keyring/kdf.js +2 -2
- package/dist/keyring/kdf.js.map +1 -1
- package/dist/keyring/unlockSpace.d.ts +8 -30
- package/dist/keyring/unlockSpace.d.ts.map +1 -1
- package/dist/keyring/unlockSpace.js +8 -31
- package/dist/keyring/unlockSpace.js.map +1 -1
- package/dist/keys/clientKeyRecord.d.ts +2 -1
- package/dist/keys/clientKeyRecord.d.ts.map +1 -1
- package/dist/keys/clientKeyRecord.js +28 -11
- package/dist/keys/clientKeyRecord.js.map +1 -1
- package/dist/keys/index.d.ts +6 -2
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +5 -1
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/rosterLogStore.d.ts.map +1 -1
- package/dist/keys/rosterLogStore.js +14 -5
- package/dist/keys/rosterLogStore.js.map +1 -1
- package/dist/keys/spaceEpochs.d.ts +92 -3
- package/dist/keys/spaceEpochs.d.ts.map +1 -1
- package/dist/keys/spaceEpochs.js +110 -4
- package/dist/keys/spaceEpochs.js.map +1 -1
- package/dist/keys/userKeyRoster.d.ts +30 -3
- package/dist/keys/userKeyRoster.d.ts.map +1 -1
- package/dist/keys/userKeyRoster.js +90 -15
- package/dist/keys/userKeyRoster.js.map +1 -1
- package/dist/keys/userKeyRosterCascade.d.ts.map +1 -1
- package/dist/keys/userKeyRosterCascade.js +5 -1
- package/dist/keys/userKeyRosterCascade.js.map +1 -1
- package/dist/recovery/continuation.d.ts +250 -0
- package/dist/recovery/continuation.d.ts.map +1 -0
- package/dist/recovery/continuation.js +467 -0
- package/dist/recovery/continuation.js.map +1 -0
- 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/recoveryDelegation.d.ts +23 -126
- package/dist/recovery/recoveryDelegation.d.ts.map +1 -1
- package/dist/recovery/recoveryDelegation.js +1 -266
- package/dist/recovery/recoveryDelegation.js.map +1 -1
- package/dist/recovery/recoveryWebvh.d.ts +52 -107
- package/dist/recovery/recoveryWebvh.d.ts.map +1 -1
- package/dist/recovery/recoveryWebvh.js +54 -403
- package/dist/recovery/recoveryWebvh.js.map +1 -1
- package/dist/request/classify.d.ts +3 -14
- package/dist/request/classify.d.ts.map +1 -1
- package/dist/request/classify.js +19 -40
- package/dist/request/classify.js.map +1 -1
- package/dist/request/index.d.ts +1 -0
- package/dist/request/index.d.ts.map +1 -1
- package/dist/request/index.js +1 -0
- package/dist/request/index.js.map +1 -1
- package/dist/request/onboarding.d.ts.map +1 -1
- package/dist/request/onboarding.js +19 -27
- package/dist/request/onboarding.js.map +1 -1
- package/dist/request/parse.d.ts +5 -3
- package/dist/request/parse.d.ts.map +1 -1
- package/dist/request/parse.js +7 -6
- package/dist/request/parse.js.map +1 -1
- package/dist/request/processRequest.d.ts.map +1 -1
- package/dist/request/processRequest.js +2 -1
- package/dist/request/processRequest.js.map +1 -1
- package/dist/request/queryPredicates.d.ts +98 -0
- package/dist/request/queryPredicates.d.ts.map +1 -0
- package/dist/request/queryPredicates.js +107 -0
- package/dist/request/queryPredicates.js.map +1 -0
- package/dist/resourceLog/document.d.ts +39 -0
- package/dist/resourceLog/document.d.ts.map +1 -1
- package/dist/resourceLog/document.js +41 -0
- package/dist/resourceLog/document.js.map +1 -1
- package/dist/resourceLog/index.d.ts +2 -2
- package/dist/resourceLog/index.js +2 -2
- package/dist/resourceLog/ladderRungs.d.ts.map +1 -1
- package/dist/resourceLog/ladderRungs.js +3 -2
- package/dist/resourceLog/ladderRungs.js.map +1 -1
- package/dist/sync/contactsConflict.d.ts.map +1 -1
- package/dist/sync/contactsConflict.js +8 -2
- package/dist/sync/contactsConflict.js.map +1 -1
- package/dist/sync/engine.d.ts +38 -23
- package/dist/sync/engine.d.ts.map +1 -1
- package/dist/sync/engine.js +36 -5
- package/dist/sync/engine.js.map +1 -1
- package/dist/sync/index.d.ts +9 -12
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +8 -11
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/push.d.ts.map +1 -1
- package/dist/sync/push.js +1 -2
- package/dist/sync/push.js.map +1 -1
- package/dist/sync/remint.d.ts +0 -31
- package/dist/sync/remint.d.ts.map +1 -1
- package/dist/sync/remint.js +32 -1
- package/dist/sync/remint.js.map +1 -1
- package/dist/sync/types.d.ts +4 -41
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/types.js +4 -47
- package/dist/sync/types.js.map +1 -1
- package/dist/unlock/index.d.ts +1 -1
- package/dist/unlock/index.d.ts.map +1 -1
- package/dist/unlock/index.js +1 -1
- package/dist/unlock/index.js.map +1 -1
- package/dist/unlock/retire.d.ts +16 -64
- package/dist/unlock/retire.d.ts.map +1 -1
- package/dist/unlock/retire.js +7 -86
- package/dist/unlock/retire.js.map +1 -1
- package/dist/unlock/standingWebvh.d.ts +27 -61
- package/dist/unlock/standingWebvh.d.ts.map +1 -1
- package/dist/unlock/standingWebvh.js +40 -92
- package/dist/unlock/standingWebvh.js.map +1 -1
- package/dist/unlock/unlockRecord.d.ts.map +1 -1
- package/dist/unlock/unlockRecord.js +69 -44
- package/dist/unlock/unlockRecord.js.map +1 -1
- package/dist/webvh/accountEntry.d.ts +68 -19
- package/dist/webvh/accountEntry.d.ts.map +1 -1
- package/dist/webvh/accountEntry.js +117 -37
- package/dist/webvh/accountEntry.js.map +1 -1
- package/dist/webvh/delegatedLogStore.d.ts +24 -13
- package/dist/webvh/delegatedLogStore.d.ts.map +1 -1
- package/dist/webvh/delegatedLogStore.js +40 -11
- package/dist/webvh/delegatedLogStore.js.map +1 -1
- package/dist/webvh/didWebvh.d.ts +91 -86
- package/dist/webvh/didWebvh.d.ts.map +1 -1
- package/dist/webvh/didWebvh.js +117 -142
- package/dist/webvh/didWebvh.js.map +1 -1
- package/dist/webvh/enrollClient.d.ts +2 -8
- package/dist/webvh/enrollClient.d.ts.map +1 -1
- package/dist/webvh/enrollClient.js +22 -31
- package/dist/webvh/enrollClient.js.map +1 -1
- package/dist/webvh/index.d.ts +12 -8
- package/dist/webvh/index.d.ts.map +1 -1
- package/dist/webvh/index.js +10 -7
- package/dist/webvh/index.js.map +1 -1
- package/dist/webvh/listClients.d.ts.map +1 -1
- package/dist/webvh/listClients.js +102 -65
- package/dist/webvh/listClients.js.map +1 -1
- package/dist/webvh/mergeMethods.d.ts +84 -0
- package/dist/webvh/mergeMethods.d.ts.map +1 -0
- package/dist/webvh/mergeMethods.js +46 -0
- package/dist/webvh/mergeMethods.js.map +1 -0
- package/dist/webvh/revokeClient.d.ts +15 -11
- package/dist/webvh/revokeClient.d.ts.map +1 -1
- package/dist/webvh/revokeClient.js +130 -57
- package/dist/webvh/revokeClient.js.map +1 -1
- package/dist/webvh/verifyLog.d.ts +45 -4
- package/dist/webvh/verifyLog.d.ts.map +1 -1
- package/dist/webvh/verifyLog.js +62 -21
- package/dist/webvh/verifyLog.js.map +1 -1
- package/dist/webvh/wasIdStore.d.ts +16 -3
- package/dist/webvh/wasIdStore.d.ts.map +1 -1
- package/dist/webvh/wasIdStore.js +18 -3
- package/dist/webvh/wasIdStore.js.map +1 -1
- package/package.json +11 -11
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import type { DIDDoc, DIDLog, ServiceEndpoint, VerificationMethod } from '@interop/did-method-webvh';
|
|
2
|
+
import type { WebvhIdStore } from '../webvh/didWebvh.js';
|
|
3
|
+
import type { RelationMembership } from '../webvh/mergeMethods.js';
|
|
4
|
+
/**
|
|
5
|
+
* What the add-and-retire entry retired, read back OFF THE LOG -- the resumed
|
|
6
|
+
* spend's answer to the same question the live run answers from the document
|
|
7
|
+
* it is editing. A run torn after that entry but before the caller's registry
|
|
8
|
+
* and unlock-Space teardown resumes into the already-complete branch, and
|
|
9
|
+
* without this it would be told nothing was retired and leave every other
|
|
10
|
+
* credential's registry entry standing.
|
|
11
|
+
*
|
|
12
|
+
* The entry is located by its own signature on the log: it is the first entry
|
|
13
|
+
* whose effective `updateKeys` authorize the successor key (the fresh
|
|
14
|
+
* ladder's rung 0 on the transient continuation, the new client's update key
|
|
15
|
+
* on the remembered one), which only that entry writes. What it retired is
|
|
16
|
+
* then the credential-class `keyAgreement` ids its predecessor published and
|
|
17
|
+
* it does not, less the spent code's own id -- the same exclusion the live
|
|
18
|
+
* branch makes, since the caller retires that one by name.
|
|
19
|
+
*
|
|
20
|
+
* @param options {object}
|
|
21
|
+
* @param options.log {DIDLog} the verified account log
|
|
22
|
+
* @param options.did {string} the account DID the log resolves to
|
|
23
|
+
* @param options.successorKeyMultibase {string} the update key only the
|
|
24
|
+
* add-and-retire entry authorizes
|
|
25
|
+
* @param options.spentVmId {string} the spent code's key-agreement
|
|
26
|
+
* verification-method id, excluded from the result
|
|
27
|
+
* @returns {string[]} the retired credentials' key-agreement ids, empty
|
|
28
|
+
* when no entry authorizes the successor key or it is the genesis entry
|
|
29
|
+
*/
|
|
30
|
+
export declare function retiredCredentialVmIdsFromLog({ log, did, successorKeyMultibase, spentVmId }: {
|
|
31
|
+
log: DIDLog;
|
|
32
|
+
did: string;
|
|
33
|
+
successorKeyMultibase: string;
|
|
34
|
+
spentVmId: string;
|
|
35
|
+
}): string[];
|
|
36
|
+
/**
|
|
37
|
+
* What a recovery spend retired, the three members both continuations
|
|
38
|
+
* report: the credential-class `keyAgreement` ids the add-and-retire entry
|
|
39
|
+
* struck for pre-recovery credentials OTHER than the spent code (what a
|
|
40
|
+
* caller drops registry entries and deletes unlock Spaces for), the rung
|
|
41
|
+
* hashes the entry struck, and the retired credentials whose rungs the log
|
|
42
|
+
* could not attribute -- each of which keeps a committed rung it could still
|
|
43
|
+
* reveal, and is left for the caller to report rather than struck.
|
|
44
|
+
*/
|
|
45
|
+
export interface RecoverySpendRetirement {
|
|
46
|
+
retiredCredentialVmIds: string[];
|
|
47
|
+
struckRungHashes: string[];
|
|
48
|
+
unclaimedCredentialVmIds: string[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The retirement report of a spend whose add-and-retire entry already
|
|
52
|
+
* stands, read back off the log: the same three members the continuation
|
|
53
|
+
* returns, derived the way its completed branch derives them, so a resume
|
|
54
|
+
* that holds only the successor's public halves (a remembered spend's pending
|
|
55
|
+
* client-key record, say) reports exactly what the first run reported rather
|
|
56
|
+
* than a second definition of the same question.
|
|
57
|
+
*
|
|
58
|
+
* The entry is located by the successor key it authorized
|
|
59
|
+
* ({@link retiredCredentialVmIdsFromLog}), and the strike is recomputed over
|
|
60
|
+
* the log as it stood just before that entry with the same protected sets the
|
|
61
|
+
* first run used: the successor key and its staged partner, and the
|
|
62
|
+
* replacement code's rung 0. A log that does not authorize the successor key
|
|
63
|
+
* (the entry never landed) reports nothing retired, since there is no entry to
|
|
64
|
+
* read back.
|
|
65
|
+
*
|
|
66
|
+
* @param options {object}
|
|
67
|
+
* @param options.log {DIDLog} the verified account log
|
|
68
|
+
* @param options.did {string} the account DID the log resolves to
|
|
69
|
+
* @param options.successor {object} the public halves of the key the entry
|
|
70
|
+
* authorized (`updateKeyMultibase`) and the staged partner whose hash the
|
|
71
|
+
* reveal entry committed after it (`stagedKeyMultibase`)
|
|
72
|
+
* @param options.replacementUpdateKeyMultibase {string} the replacement
|
|
73
|
+
* code's rung-0 update key
|
|
74
|
+
* @param options.spentKeyAgreementKeyMultibase {string} the spent code's
|
|
75
|
+
* key-agreement key, excluded from the retired set
|
|
76
|
+
* @returns {Promise<RecoverySpendRetirement>}
|
|
77
|
+
*/
|
|
78
|
+
export declare function recoverySpendRetirementFromLog({ log, did, successor, replacementUpdateKeyMultibase, spentKeyAgreementKeyMultibase }: {
|
|
79
|
+
log: DIDLog;
|
|
80
|
+
did: string;
|
|
81
|
+
successor: {
|
|
82
|
+
updateKeyMultibase: string;
|
|
83
|
+
stagedKeyMultibase: string;
|
|
84
|
+
};
|
|
85
|
+
replacementUpdateKeyMultibase: string;
|
|
86
|
+
spentKeyAgreementKeyMultibase: string;
|
|
87
|
+
}): Promise<RecoverySpendRetirement>;
|
|
88
|
+
/**
|
|
89
|
+
* The verification-method id a code's key-agreement key publishes under --
|
|
90
|
+
* the ordinary `<did>#<multibase>` form, indistinguishable by id from any
|
|
91
|
+
* other keyAgreement entry. Consumers that must exclude recovery entries do
|
|
92
|
+
* it structurally (an enrolled client is a `capabilityInvocation` entry; a
|
|
93
|
+
* recovery key never has one) or by the registry's recorded multibase.
|
|
94
|
+
*
|
|
95
|
+
* @param options {object}
|
|
96
|
+
* @param options.did {string} the account's did:webvh
|
|
97
|
+
* @param options.keyAgreementKeyMultibase {string}
|
|
98
|
+
* @returns {string}
|
|
99
|
+
*/
|
|
100
|
+
export declare function recoveryVmId({ did, keyAgreementKeyMultibase }: {
|
|
101
|
+
did: string;
|
|
102
|
+
keyAgreementKeyMultibase: string;
|
|
103
|
+
}): string;
|
|
104
|
+
/**
|
|
105
|
+
* The public halves of a recovery code as the document and log carry them:
|
|
106
|
+
* the X25519 key-agreement key published as the recovery VM, and the update
|
|
107
|
+
* key whose hash stands in `nextKeyHashes`.
|
|
108
|
+
*/
|
|
109
|
+
export interface RecoveryPublicKeys {
|
|
110
|
+
keyAgreementKeyMultibase: string;
|
|
111
|
+
updateKeyMultibase: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The public halves a SPEND needs of the replacement code it publishes: the
|
|
115
|
+
* two above plus the code's ladder VM key, which the add-and-retire entry
|
|
116
|
+
* installs under `assertionMethod` and `capabilityDelegation`. A code is a
|
|
117
|
+
* standing unlock credential with a ladder (`decisions/0020`) and its bridge
|
|
118
|
+
* delegation is signed by that ladder's VM (`decisions/0019`), so a
|
|
119
|
+
* replacement published without the VM could neither sign its own bridge nor
|
|
120
|
+
* spend. `recoveryClientFromCode` produces all three.
|
|
121
|
+
*/
|
|
122
|
+
export interface ReplacementRecoveryPublicKeys extends RecoveryPublicKeys {
|
|
123
|
+
ladderVmKeyMultibase: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Thrown by the recovery continuation when the log carries neither the code's
|
|
127
|
+
* update key nor its committed hash -- the code was revoked (or never
|
|
128
|
+
* issued), so no continuation can verify.
|
|
129
|
+
*/
|
|
130
|
+
export declare class RecoveryKeyNotCommittedError extends Error {
|
|
131
|
+
constructor(message?: string);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Thrown by the recovery continuation, before its reveal entry, when a
|
|
135
|
+
* credential-class `keyAgreement` id the add-and-retire entry would introduce
|
|
136
|
+
* already stands in the document -- the user re-typed a passphrase the
|
|
137
|
+
* account already stands on. The recovery exists to retire that credential,
|
|
138
|
+
* and an entry that re-binds it would strike its old ladder VM while leaving
|
|
139
|
+
* its old rung commitments standing, one member backed by two ladders. The
|
|
140
|
+
* app maps the refusal to "choose a passphrase you have not used". Nothing
|
|
141
|
+
* is published.
|
|
142
|
+
*/
|
|
143
|
+
export declare class RecoveryCredentialStandingError extends Error {
|
|
144
|
+
readonly credentialVmIds: string[];
|
|
145
|
+
constructor({ credentialVmIds }: {
|
|
146
|
+
credentialVmIds: string[];
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* The narrow store seam the recovery continuation writes through: a public
|
|
151
|
+
* read of the log and the delegated `did.jsonl` PUT. A subset of
|
|
152
|
+
* {@link WebvhIdStore}, so an app's remote-store class satisfies it too.
|
|
153
|
+
*/
|
|
154
|
+
export type RecoveryLogStore = Pick<WebvhIdStore, 'getIdResourceRaw' | 'putIdResource' | 'pin'>;
|
|
155
|
+
/**
|
|
156
|
+
* What a variant adds to the add-and-retire entry beyond the replacement
|
|
157
|
+
* code's own inventory, which the core appends after it: the verification
|
|
158
|
+
* methods, and the ids each relation gains. Order is load-bearing on the wire
|
|
159
|
+
* -- the methods land in `verificationMethod` and each relation in the order
|
|
160
|
+
* given, with the replacement code's after them.
|
|
161
|
+
*/
|
|
162
|
+
export interface RecoveryAddedInventory extends RelationMembership {
|
|
163
|
+
methods: VerificationMethod[];
|
|
164
|
+
services?: ServiceEndpoint[];
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* What one attempt of a recovery continuation returns: the superset both
|
|
168
|
+
* variants pick their public outcome from.
|
|
169
|
+
*/
|
|
170
|
+
export interface RecoveryContinuationOutcome extends RecoverySpendRetirement {
|
|
171
|
+
did: string;
|
|
172
|
+
doc: DIDDoc;
|
|
173
|
+
log: DIDLog;
|
|
174
|
+
webDoc?: object;
|
|
175
|
+
committed: boolean;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* One attempt of a recovery continuation, the shared control flow of
|
|
179
|
+
* `recoverWebvhClient` and `recoverWebvhLadderAnchored`; each wraps it in the
|
|
180
|
+
* conflict retry under its own preconditions. Both entries go through the
|
|
181
|
+
* account-entry seam ({@link signAccountEntry}) on its committed-key arm: the
|
|
182
|
+
* spent code's rung 0 signs the reveal-and-commit entry, and the successor
|
|
183
|
+
* key that entry committed signs the add-and-retire entry, so the pinned
|
|
184
|
+
* read, the carry-over precondition, the self-reveal union, the conditional
|
|
185
|
+
* publish, and the pin advance are the seam's. The body detects a completed
|
|
186
|
+
* run by the successor key standing authorized (reporting what the entry
|
|
187
|
+
* retired off the log), publishes the reveal-and-commit entry unless a torn
|
|
188
|
+
* earlier run left it standing, enters the `onCommitted` seam, and builds the
|
|
189
|
+
* add-and-retire entry from what the variant's `added` callback hands in.
|
|
190
|
+
*
|
|
191
|
+
* The reveal-and-commit entry commits, in this order, the successor key's
|
|
192
|
+
* hash, its staged partner's hash, and the replacement code's rung-0 hash --
|
|
193
|
+
* the ratified append order of `decisions/0007` (the replacement's comes
|
|
194
|
+
* LAST) and the anchor rule of `decisions/0014` both read that order. The
|
|
195
|
+
* add-and-retire entry is built on the head the reveal entry's own publish
|
|
196
|
+
* leaves standing, with no read in between; against a store whose PUT serves
|
|
197
|
+
* no ETag it is re-read under the same pin instead, so its compare-and-swap
|
|
198
|
+
* never degrades to an unconditional write.
|
|
199
|
+
*
|
|
200
|
+
* @param options {object}
|
|
201
|
+
* @param options.store {RecoveryLogStore}
|
|
202
|
+
* @param options.recovery {object} the spent code's update seed and public
|
|
203
|
+
* halves
|
|
204
|
+
* @param options.successor {object} the key the add-and-retire entry
|
|
205
|
+
* authorizes and signs with (`updateKeyMultibase`, from `updateSeed`) and
|
|
206
|
+
* the staged partner whose hash the reveal entry commits right after it
|
|
207
|
+
* (`stagedKeyMultibase`: the new client's staged key, or the fresh ladder's
|
|
208
|
+
* rung 1)
|
|
209
|
+
* @param options.replacement {ReplacementRecoveryPublicKeys}
|
|
210
|
+
* @param options.onCommitted {function} the persist-before-publish seam,
|
|
211
|
+
* entered once per attempt after the reveal entry stands and before the
|
|
212
|
+
* pivot is built; what it resolves to is handed to `added`
|
|
213
|
+
* @param options.added {function} builds the variant's additions to the
|
|
214
|
+
* add-and-retire entry from the account DID, the document the entry edits,
|
|
215
|
+
* and what the seam persisted
|
|
216
|
+
* @param [options.credentialVmIds] {function} `(did) => string[]` -- the
|
|
217
|
+
* credential-class `keyAgreement` ids `added` will introduce, checked
|
|
218
|
+
* against the read document before the reveal entry: one already standing
|
|
219
|
+
* is refused with {@link RecoveryCredentialStandingError}. The transient
|
|
220
|
+
* variant supplies its fresh credential's; the remembered variant's new
|
|
221
|
+
* client publishes a marked pair, which is never credential-class
|
|
222
|
+
* @param [options.expectedDid] {string}
|
|
223
|
+
* @returns {Promise<RecoveryContinuationOutcome>}
|
|
224
|
+
*/
|
|
225
|
+
export declare function recoveryContinuationOnce<Persisted>({ store, recovery, successor, replacement, onCommitted, added, credentialVmIds, expectedDid }: {
|
|
226
|
+
store: RecoveryLogStore;
|
|
227
|
+
recovery: RecoveryPublicKeys & {
|
|
228
|
+
updateSeed: Uint8Array;
|
|
229
|
+
};
|
|
230
|
+
successor: {
|
|
231
|
+
updateKeyMultibase: string;
|
|
232
|
+
updateSeed: Uint8Array;
|
|
233
|
+
stagedKeyMultibase: string;
|
|
234
|
+
};
|
|
235
|
+
replacement: ReplacementRecoveryPublicKeys;
|
|
236
|
+
onCommitted: (committed: {
|
|
237
|
+
builtOnHead: {
|
|
238
|
+
scid: string;
|
|
239
|
+
versionId: string;
|
|
240
|
+
};
|
|
241
|
+
}) => Promise<Persisted>;
|
|
242
|
+
added: (context: {
|
|
243
|
+
did: string;
|
|
244
|
+
doc: DIDDoc;
|
|
245
|
+
persisted: Persisted;
|
|
246
|
+
}) => RecoveryAddedInventory;
|
|
247
|
+
credentialVmIds?: (did: string) => string[];
|
|
248
|
+
expectedDid?: string;
|
|
249
|
+
}): Promise<RecoveryContinuationOutcome>;
|
|
250
|
+
//# sourceMappingURL=continuation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continuation.d.ts","sourceRoot":"","sources":["../../src/recovery/continuation.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EACV,MAAM,EACN,MAAM,EACN,eAAe,EACf,kBAAkB,EACnB,MAAM,2BAA2B,CAAA;AAQlC,OAAO,KAAK,EAAqB,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAG3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAelE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,GAAG,EACH,GAAG,EACH,qBAAqB,EACrB,SAAS,EACV,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,qBAAqB,EAAE,MAAM,CAAA;IAC7B,SAAS,EAAE,MAAM,CAAA;CAClB,GAAG,MAAM,EAAE,CAeX;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,uBAAuB;IACtC,sBAAsB,EAAE,MAAM,EAAE,CAAA;IAChC,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,wBAAwB,EAAE,MAAM,EAAE,CAAA;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,8BAA8B,CAAC,EACnD,GAAG,EACH,GAAG,EACH,SAAS,EACT,6BAA6B,EAC7B,6BAA6B,EAC9B,EAAE;IACD,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE;QAAE,kBAAkB,EAAE,MAAM,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAA;IACrE,6BAA6B,EAAE,MAAM,CAAA;IACrC,6BAA6B,EAAE,MAAM,CAAA;CACtC,GAAG,OA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