hd-wallet-wasm 2.0.28 → 2.0.30
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.
|
@@ -119,8 +119,8 @@ function epmJcsCanonicalize(value) {
|
|
|
119
119
|
* wallet signature over this content verifies isomorphically in the browser and
|
|
120
120
|
* on wasmedge. Mirrors the field set/rules exactly: trim + omit-empty strings,
|
|
121
121
|
* enum-label ENTITY_TYPE (always) / KEY_TYPE (Signing|Encryption only), nested
|
|
122
|
-
* ADDRESS,
|
|
123
|
-
* and SIGNATURE excluded.
|
|
122
|
+
* ADDRESS, all public CryptoKey fields in KEYS, CHAIN_PROOFS arrays,
|
|
123
|
+
* SIGNATURE_TIMESTAMP (integer, when nonzero), and SIGNATURE excluded.
|
|
124
124
|
*
|
|
125
125
|
* @param {Object} epm - EPM fields as a plain object (schema UPPER_SNAKE keys;
|
|
126
126
|
* ENTITY_TYPE/KEY_TYPE may be enum index or label)
|
|
@@ -170,6 +170,9 @@ export function buildEPMSigningContent(epm) {
|
|
|
170
170
|
epmAddStr(e, 'KEY_ADDRESS', kg('KEY_ADDRESS'));
|
|
171
171
|
const kt = epmEnumName(kg('KEY_TYPE'), EPM_KEY_TYPE_NAMES);
|
|
172
172
|
if (kt === 'Signing' || kt === 'Encryption') e.KEY_TYPE = kt;
|
|
173
|
+
epmAddStr(e, 'KEY_PATH', kg('KEY_PATH'));
|
|
174
|
+
epmAddStr(e, 'ALGORITHM', kg('ALGORITHM'));
|
|
175
|
+
epmAddStr(e, 'ENCODING', kg('ENCODING'));
|
|
173
176
|
if (Object.keys(e).length) arr.push(e);
|
|
174
177
|
}
|
|
175
178
|
if (arr.length) content.KEYS = arr;
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -179,6 +179,7 @@ export interface SdnWasmPublicIdentity {
|
|
|
179
179
|
|
|
180
180
|
export type SdnRegistryRowId =
|
|
181
181
|
| 'sdn-node-console-v2'
|
|
182
|
+
| 'spaceaware-publish-request-v1'
|
|
182
183
|
| 'asset-review-authority-activation-v1'
|
|
183
184
|
| 'asset-review-decision-v1';
|
|
184
185
|
|
|
@@ -213,6 +214,34 @@ export interface SdnLoginV2WireRequest {
|
|
|
213
214
|
protocolVersion: 2;
|
|
214
215
|
}
|
|
215
216
|
|
|
217
|
+
/** Internal wallet-origin request; the wallet obtains the provider challenge. */
|
|
218
|
+
export interface SdnPublishRequest {
|
|
219
|
+
protocolVersion: 1;
|
|
220
|
+
providerOrigin: string;
|
|
221
|
+
method: 'POST';
|
|
222
|
+
requestUri: string;
|
|
223
|
+
bodySha256: string;
|
|
224
|
+
bodyBytes: number;
|
|
225
|
+
challengeId: string;
|
|
226
|
+
challengeBase64url: string;
|
|
227
|
+
schema: 'CZM' | 'ETM';
|
|
228
|
+
entityId: string;
|
|
229
|
+
entityName: string;
|
|
230
|
+
documentCount: number;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface SdnPublishSignature {
|
|
234
|
+
schemaVersion: 1;
|
|
235
|
+
keyId: `sha256:${string}`;
|
|
236
|
+
identityScheme: 'sdn-bip32-slip10-purpose-v1';
|
|
237
|
+
algorithm: 'ed25519';
|
|
238
|
+
encoding: 'raw';
|
|
239
|
+
signatureProfile: 'ed25519-sdn-signed-request-v2';
|
|
240
|
+
publicKeyHex: string;
|
|
241
|
+
signatureHex: string;
|
|
242
|
+
requestDigestSha256: string;
|
|
243
|
+
}
|
|
244
|
+
|
|
216
245
|
export interface ReviewedTransform {
|
|
217
246
|
translation: readonly [number, number, number];
|
|
218
247
|
rotation: readonly [number, number, number, number];
|
|
@@ -307,6 +336,26 @@ export interface SdnIdentityCapabilities {
|
|
|
307
336
|
request: SdnLoginV2WireRequest,
|
|
308
337
|
registryRow: 'sdn-node-console-v2',
|
|
309
338
|
): CanonicalWalletSignature;
|
|
339
|
+
signSdnPublishRequest(
|
|
340
|
+
handle: SdnIdentityHandle,
|
|
341
|
+
request: SdnPublishRequest,
|
|
342
|
+
registryRow: 'spaceaware-publish-request-v1',
|
|
343
|
+
): SdnPublishSignature;
|
|
344
|
+
/** The account key's EPM ChainProof that a session key may fetch paid modules. */
|
|
345
|
+
signModuleDeliveryKey(
|
|
346
|
+
handle: SdnIdentityHandle,
|
|
347
|
+
request: { protocolVersion: 1; origin: string; sessionPublicKeyHex: string; expiresAt: number },
|
|
348
|
+
registryRow: 'spaceaware-module-delivery-key-v1',
|
|
349
|
+
): {
|
|
350
|
+
schemaVersion: 1;
|
|
351
|
+
keyPath: string;
|
|
352
|
+
accountXpub: string;
|
|
353
|
+
publicKeyHex: string;
|
|
354
|
+
signedPayloadHex: string;
|
|
355
|
+
signatureHex: string;
|
|
356
|
+
algorithm: 'secp256k1';
|
|
357
|
+
encoding: 'der';
|
|
358
|
+
};
|
|
310
359
|
signAssetReviewAuthorityActivation(
|
|
311
360
|
handle: SdnIdentityHandle,
|
|
312
361
|
request: AssetReviewAuthorityActivationRequest,
|
package/dist/runtime/index.mjs
CHANGED
|
@@ -33,6 +33,8 @@ const RAW_ENTRYPOINTS = Object.freeze([
|
|
|
33
33
|
'_hd_sdn_import_remembered_identity',
|
|
34
34
|
'_hd_sdn_sign_login_v1',
|
|
35
35
|
'_hd_sdn_sign_login_v2',
|
|
36
|
+
'_hd_sdn_sign_publish_request',
|
|
37
|
+
'_hd_sdn_sign_module_delivery_key',
|
|
36
38
|
'_hd_sdn_sign_asset_review_authority_activation',
|
|
37
39
|
'_hd_sdn_sign_asset_review_decision',
|
|
38
40
|
'_hd_sdn_seal_remembered_identity',
|
|
@@ -347,6 +349,28 @@ function parseIdentity(bytes) {
|
|
|
347
349
|
}
|
|
348
350
|
|
|
349
351
|
function copySignature(value, canonical) {
|
|
352
|
+
if (canonical === 'module-delivery-key') {
|
|
353
|
+
if (!exactKeys(value, ['schemaVersion', 'keyPath', 'accountXpub', 'publicKeyHex',
|
|
354
|
+
'signedPayloadHex', 'signatureHex', 'algorithm', 'encoding']) ||
|
|
355
|
+
value.schemaVersion !== 1 || !/^m\/44'\/0'\/\d+'$/u.test(value.keyPath) ||
|
|
356
|
+
typeof value.accountXpub !== 'string' || !value.accountXpub.startsWith('xpub') ||
|
|
357
|
+
!validLowerHex(value.publicKeyHex, 66) ||
|
|
358
|
+
typeof value.signedPayloadHex !== 'string' || !/^(?:[0-9a-f]{2})+$/u.test(value.signedPayloadHex) ||
|
|
359
|
+
typeof value.signatureHex !== 'string' || !/^30(?:[0-9a-f]{2}){7,72}$/u.test(value.signatureHex) ||
|
|
360
|
+
value.algorithm !== 'secp256k1' || value.encoding !== 'der') fail('CRYPTO_FAILURE');
|
|
361
|
+
return Object.freeze({ ...value });
|
|
362
|
+
}
|
|
363
|
+
if (canonical === 'publish') {
|
|
364
|
+
if (!exactKeys(value, ['schemaVersion', 'keyId', 'identityScheme', 'algorithm',
|
|
365
|
+
'encoding', 'signatureProfile', 'publicKeyHex', 'signatureHex', 'requestDigestSha256']) ||
|
|
366
|
+
value.schemaVersion !== 1 || !validKeyId(value.keyId) ||
|
|
367
|
+
value.identityScheme !== 'sdn-bip32-slip10-purpose-v1' ||
|
|
368
|
+
value.algorithm !== 'ed25519' || value.encoding !== 'raw' ||
|
|
369
|
+
value.signatureProfile !== 'ed25519-sdn-signed-request-v2' ||
|
|
370
|
+
!validLowerHex(value.publicKeyHex, 64) || !validLowerHex(value.signatureHex, 128) ||
|
|
371
|
+
!validLowerHex(value.requestDigestSha256, 64)) fail('CRYPTO_FAILURE');
|
|
372
|
+
return Object.freeze({ ...value });
|
|
373
|
+
}
|
|
350
374
|
const common = [
|
|
351
375
|
'schemaVersion', 'keyId', 'identityScheme', 'algorithm', 'encoding',
|
|
352
376
|
'signatureProfile', 'signatureHex',
|
|
@@ -795,6 +819,36 @@ export function createSdnTypedCapabilities(wasm) {
|
|
|
795
819
|
);
|
|
796
820
|
},
|
|
797
821
|
|
|
822
|
+
signSdnPublishRequest(handle, request, registryRow) {
|
|
823
|
+
const record = recordFor(handle);
|
|
824
|
+
if (registryRow !== 'spaceaware-publish-request-v1') fail('INVALID_REQUEST');
|
|
825
|
+
const requestBytes = encodeRequest(request);
|
|
826
|
+
return invokeSign(
|
|
827
|
+
'_hd_sdn_sign_publish_request', record, requestBytes,
|
|
828
|
+
(native, input, length, output, required) => [
|
|
829
|
+
native, input, length, 4, output, MAX_OUTPUT_BYTES, required,
|
|
830
|
+
],
|
|
831
|
+
'publish',
|
|
832
|
+
);
|
|
833
|
+
},
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Account key's proof that `request.sessionPublicKeyHex` may fetch paid
|
|
837
|
+
* modules for this account: an EPM ChainProof's fields.
|
|
838
|
+
*/
|
|
839
|
+
signModuleDeliveryKey(handle, request, registryRow) {
|
|
840
|
+
const record = recordFor(handle);
|
|
841
|
+
if (registryRow !== 'spaceaware-module-delivery-key-v1') fail('INVALID_REQUEST');
|
|
842
|
+
const requestBytes = encodeRequest(request);
|
|
843
|
+
return invokeSign(
|
|
844
|
+
'_hd_sdn_sign_module_delivery_key', record, requestBytes,
|
|
845
|
+
(native, input, length, output, required) => [
|
|
846
|
+
native, input, length, 5, output, MAX_OUTPUT_BYTES, required,
|
|
847
|
+
],
|
|
848
|
+
'module-delivery-key',
|
|
849
|
+
);
|
|
850
|
+
},
|
|
851
|
+
|
|
798
852
|
signAssetReviewAuthorityActivation(handle, request, registryRow) {
|
|
799
853
|
const record = recordFor(handle);
|
|
800
854
|
if (registryRow !== 'asset-review-authority-activation-v1') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hd-wallet-wasm",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.30",
|
|
4
4
|
"description": "Comprehensive HD Wallet implementation in WebAssembly - BIP-32/39/44, multi-curve, multi-chain support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/runtime/index.mjs",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@types/node": "^20.0.0"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "d59643a6d9797dc505ff626d6e80339fbff6b548"
|
|
96
96
|
}
|