@interop/wallet-core 0.42.0 → 0.43.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.
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
* continuity reason `rollback` (see {@link isRosterRefusal}), which lands in
|
|
25
25
|
* the transport class instead. Anything in that class (an unreachable
|
|
26
26
|
* server, a transport hiccup, the rollback) is warned about and resolves
|
|
27
|
-
* `null`, so the start keeps working from the cached key.
|
|
27
|
+
* `null`, so the start keeps working from the cached key. A throw from the
|
|
28
|
+
* app's adoption callback is a third class of its own: the read succeeded
|
|
29
|
+
* but the adopted key and epoch pin did not persist, so it propagates
|
|
30
|
+
* verbatim rather than degrading to the cached key.
|
|
28
31
|
*
|
|
29
32
|
* - {@link convergeUserKeyRosterToAccount} -- the roster stage of the
|
|
30
33
|
* cascade-completion sweep, which the collection fan-out then runs behind. A
|
|
@@ -93,7 +96,9 @@ export interface AdoptedUserKey {
|
|
|
93
96
|
* @param [options.onRosterRead] {Function} called with the
|
|
94
97
|
* {@link AdoptedUserKey} of every successful read (whether or not it rotated),
|
|
95
98
|
* so the epoch pin advances to the epoch just authenticated; the key and the
|
|
96
|
-
* pin must persist atomically
|
|
99
|
+
* pin must persist atomically. A throw from this callback propagates to the
|
|
100
|
+
* caller verbatim -- it means the adopted key and pin did NOT persist, which
|
|
101
|
+
* is neither a transport hiccup nor a roster refusal
|
|
97
102
|
* @returns {Promise<UserKeyRosterReadResult | null>} the read, or `null` when
|
|
98
103
|
* the account has no roster yet or the server could not be reached
|
|
99
104
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rosterPolicy.d.ts","sourceRoot":"","sources":["../../src/clients/rosterPolicy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH
|
|
1
|
+
{"version":3,"file":"rosterPolicy.d.ts","sourceRoot":"","sources":["../../src/clients/rosterPolicy.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;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AA;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,OAAO,EAAE,OAAO,CAAA;IAChB,UAAU,EAAE,oBAAoB,CAAA;CACjC,CAAC,CAwGD"}
|
|
@@ -64,27 +64,21 @@ function isRosterRefusal(err) {
|
|
|
64
64
|
* @param [options.onRosterRead] {Function} called with the
|
|
65
65
|
* {@link AdoptedUserKey} of every successful read (whether or not it rotated),
|
|
66
66
|
* so the epoch pin advances to the epoch just authenticated; the key and the
|
|
67
|
-
* pin must persist atomically
|
|
67
|
+
* pin must persist atomically. A throw from this callback propagates to the
|
|
68
|
+
* caller verbatim -- it means the adopted key and pin did NOT persist, which
|
|
69
|
+
* is neither a transport hiccup nor a roster refusal
|
|
68
70
|
* @returns {Promise<UserKeyRosterReadResult | null>} the read, or `null` when
|
|
69
71
|
* the account has no roster yet or the server could not be reached
|
|
70
72
|
*/
|
|
71
73
|
export async function checkUserKeyRosterAtLogin({ store, userKey, clientKeyAgreementKey, pinnedEpochId, onRosterRead }) {
|
|
74
|
+
let read;
|
|
72
75
|
try {
|
|
73
|
-
|
|
76
|
+
read = await readUserKeyRoster({
|
|
74
77
|
store,
|
|
75
78
|
...(userKey ? { userKey } : {}),
|
|
76
79
|
clientKeyAgreementKey,
|
|
77
80
|
pinnedEpochId
|
|
78
81
|
});
|
|
79
|
-
if (!read) {
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
await onRosterRead?.({
|
|
83
|
-
userKey: read.userKey,
|
|
84
|
-
latestEpochId: read.latestEpochId,
|
|
85
|
-
descriptor: read.descriptor
|
|
86
|
-
});
|
|
87
|
-
return read;
|
|
88
82
|
}
|
|
89
83
|
catch (err) {
|
|
90
84
|
if (isRosterRefusal(err)) {
|
|
@@ -96,6 +90,20 @@ export async function checkUserKeyRosterAtLogin({ store, userKey, clientKeyAgree
|
|
|
96
90
|
'user key:', err);
|
|
97
91
|
return null;
|
|
98
92
|
}
|
|
93
|
+
if (!read) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
// The adoption callback runs OUTSIDE the transport catch: the roster read
|
|
97
|
+
// itself succeeded, so a throw here is the app failing to persist the
|
|
98
|
+
// adopted key and epoch pin, and swallowing it into the warn-and-null path
|
|
99
|
+
// would report a broken persist as an offline start (the session would
|
|
100
|
+
// proceed on the retired cached key with the pin never advanced).
|
|
101
|
+
await onRosterRead?.({
|
|
102
|
+
userKey: read.userKey,
|
|
103
|
+
latestEpochId: read.latestEpochId,
|
|
104
|
+
descriptor: read.descriptor
|
|
105
|
+
});
|
|
106
|
+
return read;
|
|
99
107
|
}
|
|
100
108
|
/**
|
|
101
109
|
* Converges the roster onto the account's locally verified did:webvh document,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rosterPolicy.js","sourceRoot":"","sources":["../../src/clients/rosterPolicy.ts"],"names":[],"mappings":"
|
|
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,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAapD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAS,eAAe,CAAC,GAAY;IACn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AI,CAAC,UAAU;KAC5B,CAAC,CAAA;IACF,OAAO;QACL,OAAO,EAAE,IAAI;QACb,MAAM;QACN,iBAAiB;QACjB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interop/wallet-core",
|
|
3
3
|
"description": "Shared wallet-domain logic (WAS sync engine core and wallet Space layout contracts) for Interop wallet apps.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.43.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "pnpm run clear && tsc",
|