@bsv/wallet-toolbox-mobile 2.1.26 → 2.1.28
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 +83 -0
- package/out/src/Wallet.d.ts +46 -2
- package/out/src/Wallet.d.ts.map +1 -1
- package/out/src/Wallet.js +65 -4
- package/out/src/Wallet.js.map +1 -1
- package/out/src/monitor/Monitor.d.ts.map +1 -1
- package/out/src/monitor/Monitor.js +12 -0
- package/out/src/monitor/Monitor.js.map +1 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.d.ts +59 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.d.ts.map +1 -1
- package/out/src/monitor/tasks/TaskCheckNoSends.js +93 -4
- package/out/src/monitor/tasks/TaskCheckNoSends.js.map +1 -1
- package/out/src/signer/methods/internalizeAction.d.ts +8 -1
- package/out/src/signer/methods/internalizeAction.d.ts.map +1 -1
- package/out/src/signer/methods/internalizeAction.js +8 -1
- package/out/src/signer/methods/internalizeAction.js.map +1 -1
- package/out/src/storage/StorageProvider.d.ts.map +1 -1
- package/out/src/storage/StorageProvider.js +79 -1
- package/out/src/storage/StorageProvider.js.map +1 -1
- package/out/src/storage/methods/ListActionsSpecOp.d.ts.map +1 -1
- package/out/src/storage/methods/ListActionsSpecOp.js +68 -5
- package/out/src/storage/methods/ListActionsSpecOp.js.map +1 -1
- package/out/src/storage/methods/createAction.js +27 -13
- package/out/src/storage/methods/createAction.js.map +1 -1
- package/out/src/storage/methods/internalizeAction.d.ts +11 -1
- package/out/src/storage/methods/internalizeAction.d.ts.map +1 -1
- package/out/src/storage/methods/internalizeAction.js +94 -26
- package/out/src/storage/methods/internalizeAction.js.map +1 -1
- package/out/src/storage/portable/index.d.ts.map +1 -1
- package/out/src/storage/portable/index.js +160 -114
- package/out/src/storage/portable/index.js.map +1 -1
- package/out/src/utility/identityUtils.d.ts +12 -6
- package/out/src/utility/identityUtils.d.ts.map +1 -1
- package/out/src/utility/identityUtils.js +78 -30
- package/out/src/utility/identityUtils.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseResults = exports.queryOverlay = exports.transformVerifiableCertificatesWithTrust = void 0;
|
|
4
|
+
exports.parseResults$ = parseResults$;
|
|
4
5
|
const sdk_1 = require("@bsv/sdk");
|
|
5
6
|
/**
|
|
6
7
|
* Transforms an array of VerifiableCertificate instances according to the trust settings.
|
|
@@ -67,50 +68,97 @@ const transformVerifiableCertificatesWithTrust = (trustSettings, certificates) =
|
|
|
67
68
|
};
|
|
68
69
|
exports.transformVerifiableCertificatesWithTrust = transformVerifiableCertificatesWithTrust;
|
|
69
70
|
/**
|
|
70
|
-
* Performs an identity overlay service lookup query and returns the parsed results
|
|
71
|
+
* Performs an identity overlay service lookup query and returns the parsed results.
|
|
71
72
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
73
|
+
* Identity paths benefit from a larger grace window (more hosts contribute outputs before the
|
|
74
|
+
* query resolves) — 300 ms is well under the "instant" perception threshold and catches the long
|
|
75
|
+
* tail of healthy-but-slightly-slow hosts.
|
|
74
76
|
*/
|
|
75
77
|
const queryOverlay = async (query, resolver) => {
|
|
76
78
|
const results = await resolver.query({
|
|
77
79
|
service: 'ls_identity',
|
|
78
80
|
query
|
|
79
|
-
});
|
|
81
|
+
}, undefined, { graceMs: 300 });
|
|
80
82
|
return await (0, exports.parseResults)(results);
|
|
81
83
|
};
|
|
82
84
|
exports.queryOverlay = queryOverlay;
|
|
83
85
|
/**
|
|
84
|
-
*
|
|
86
|
+
* Cooperative yield helper. On environments where the main thread also drives UI work
|
|
87
|
+
* (React Native, browsers), parsing many certificates synchronously freezes input handling.
|
|
88
|
+
* Interleaving a 0 ms timeout between iterations gives the runtime a chance to flush UI events.
|
|
85
89
|
*
|
|
86
|
-
*
|
|
87
|
-
|
|
90
|
+
* On Node we skip the yield to avoid the timer overhead (no UI to unblock).
|
|
91
|
+
*/
|
|
92
|
+
const isUiRuntime = () => {
|
|
93
|
+
var _a;
|
|
94
|
+
if (typeof globalThis === 'undefined')
|
|
95
|
+
return false;
|
|
96
|
+
const g = globalThis;
|
|
97
|
+
// React Native exposes __DEV__/navigator.product; browsers expose window/document.
|
|
98
|
+
if (typeof g.window !== 'undefined' && typeof g.document !== 'undefined')
|
|
99
|
+
return true;
|
|
100
|
+
if (typeof ((_a = g.navigator) === null || _a === void 0 ? void 0 : _a.product) === 'string' && g.navigator.product === 'ReactNative')
|
|
101
|
+
return true;
|
|
102
|
+
return false;
|
|
103
|
+
};
|
|
104
|
+
const yieldToUi = async () => {
|
|
105
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Parse a single overlay output into a verified, decrypted certificate. Returns `null` on any
|
|
109
|
+
* parse / decrypt / verify failure so a malformed entry can never block the others.
|
|
110
|
+
*/
|
|
111
|
+
const parseOne = async (output) => {
|
|
112
|
+
try {
|
|
113
|
+
const tx = sdk_1.Transaction.fromBEEF(output.beef);
|
|
114
|
+
const decodedOutput = sdk_1.PushDrop.decode(tx.outputs[output.outputIndex].lockingScript);
|
|
115
|
+
const certificate = JSON.parse(sdk_1.Utils.toUTF8(decodedOutput.fields[0]));
|
|
116
|
+
const verifiableCert = new sdk_1.VerifiableCertificate(certificate.type, certificate.serialNumber, certificate.subject, certificate.certifier, certificate.revocationOutpoint, certificate.fields, certificate.keyring, certificate.signature);
|
|
117
|
+
const decryptedFields = await verifiableCert.decryptFields(new sdk_1.ProtoWallet('anyone'));
|
|
118
|
+
await verifiableCert.verify();
|
|
119
|
+
verifiableCert.decryptedFields = decryptedFields;
|
|
120
|
+
return verifiableCert;
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
console.error(error);
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Parse the returned UTXOs, decrypting and verifying each certificate.
|
|
129
|
+
*
|
|
130
|
+
* On UI runtimes (browser / React Native), yields between iterations so the JS thread does not
|
|
131
|
+
* own the frame for the full duration. On Node, runs straight through.
|
|
88
132
|
*/
|
|
89
133
|
const parseResults = async (lookupResult) => {
|
|
90
|
-
if (lookupResult.type
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const decryptedFields = await verifiableCert.decryptFields(new sdk_1.ProtoWallet('anyone'));
|
|
101
|
-
// Verify the certificate signature is correct
|
|
102
|
-
await verifiableCert.verify();
|
|
103
|
-
verifiableCert.decryptedFields = decryptedFields;
|
|
104
|
-
parsedResults.push(verifiableCert);
|
|
105
|
-
}
|
|
106
|
-
catch (error) {
|
|
107
|
-
console.error(error);
|
|
108
|
-
// do nothing
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return parsedResults;
|
|
134
|
+
if (lookupResult.type !== 'output-list')
|
|
135
|
+
return [];
|
|
136
|
+
const parsedResults = [];
|
|
137
|
+
const shouldYield = isUiRuntime();
|
|
138
|
+
for (const output of lookupResult.outputs) {
|
|
139
|
+
if (shouldYield)
|
|
140
|
+
await yieldToUi();
|
|
141
|
+
const cert = await parseOne(output);
|
|
142
|
+
if (cert != null)
|
|
143
|
+
parsedResults.push(cert);
|
|
112
144
|
}
|
|
113
|
-
return
|
|
145
|
+
return parsedResults;
|
|
114
146
|
};
|
|
115
147
|
exports.parseResults = parseResults;
|
|
148
|
+
/**
|
|
149
|
+
* Iterable variant of {@link parseResults}: emits each successfully parsed certificate as soon as
|
|
150
|
+
* it's ready, so callers can render progressively instead of waiting for the full set.
|
|
151
|
+
*/
|
|
152
|
+
async function* parseResults$(lookupResult) {
|
|
153
|
+
if (lookupResult.type !== 'output-list')
|
|
154
|
+
return;
|
|
155
|
+
const shouldYield = isUiRuntime();
|
|
156
|
+
for (const output of lookupResult.outputs) {
|
|
157
|
+
if (shouldYield)
|
|
158
|
+
await yieldToUi();
|
|
159
|
+
const cert = await parseOne(output);
|
|
160
|
+
if (cert != null)
|
|
161
|
+
yield cert;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
116
164
|
//# sourceMappingURL=identityUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identityUtils.js","sourceRoot":"","sources":["../../../../src/utility/identityUtils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"identityUtils.js","sourceRoot":"","sources":["../../../../src/utility/identityUtils.ts"],"names":[],"mappings":";;;AA6LA,sCAQC;AArMD,kCAYiB;AAgBjB;;;;;;;;GAQG;AACI,MAAM,wCAAwC,GAAG,CACtD,aAA4B,EAC5B,YAAqC,EACT,EAAE;IAC9B,0DAA0D;IAC1D,MAAM,cAAc,GAAkC,EAAE,CAAA;IACxD,2BAA2B;IAC3B,MAAM,cAAc,GAA8B,EAAE,CAAA;IAEpD,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;;QAC1B,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAA;QACnC,IAAI,OAAO,KAAK,EAAE,IAAI,SAAS,KAAK,EAAE;YAAE,OAAM;QAE9C,yDAAyD;QACzD,IAAI,cAAc,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC;YACtC,MAAM,KAAK,GAAG,aAAa,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,SAAS,CAAC,CAAA;YACpF,IAAI,KAAK,IAAI,IAAI;gBAAE,OAAM,CAAC,yDAAyD;YACnF,cAAc,CAAC,SAAS,CAAC,GAAG,KAAK,CAAA;QACnC,CAAC;QAED,8DAA8D;QAC9D,MAAM,aAAa,GAAsB;YACvC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC,IAAI;YACpC,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AClC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAA;QACnC,IAAI,IAAI,IAAI,IAAI;YAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC5C,CAAC;IACD,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA;AAVY,QAAA,YAAY,gBAUxB;AAED;;;GAGG;AACI,KAAK,SAAU,CAAC,CAAC,aAAa,CAAE,YAA0B;IAC/D,IAAI,YAAY,CAAC,IAAI,KAAK,aAAa;QAAE,OAAM;IAC/C,MAAM,WAAW,GAAG,WAAW,EAAE,CAAA;IACjC,KAAK,MAAM,MAAM,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;QAC1C,IAAI,WAAW;YAAE,MAAM,SAAS,EAAE,CAAA;QAClC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAA;QACnC,IAAI,IAAI,IAAI,IAAI;YAAE,MAAM,IAAI,CAAA;IAC9B,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsv/wallet-toolbox-mobile",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.28",
|
|
4
4
|
"description": "Client only Wallet Storage",
|
|
5
5
|
"main": "./out/src/index.mobile.js",
|
|
6
6
|
"types": "./out/src/index.mobile.d.ts",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/bsv-blockchain/ts-stack/tree/main/packages/wallet/wallet-toolbox/mobile#readme",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@bsv/sdk": "^2.1.0",
|
|
25
24
|
"hash-wasm": "^4.12.0",
|
|
26
|
-
"idb": "^8.0.2"
|
|
25
|
+
"idb": "^8.0.2",
|
|
26
|
+
"@bsv/sdk": "2.1.2"
|
|
27
27
|
}
|
|
28
28
|
}
|