@smartledger/keys 1.5.6 → 1.5.8

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.
@@ -2,6 +2,7 @@
2
2
  * Browser entry point for @lumen/keys SDK
3
3
  * Includes WASM initialization and browser-compatible exports
4
4
  */
5
+ import { SignatureSuiteRegistry } from '@smartledger/crypto';
5
6
  import type { KeySDK } from './types.js';
6
7
  export * from './types.js';
7
8
  export { InMemoryKeyStorage } from '@smartledger/crypto';
@@ -11,8 +12,13 @@ export { InMemoryKeyStorage } from '@smartledger/crypto';
11
12
  *
12
13
  * All signature suites (ECDSA, ML-DSA-44, ML-DSA-65, ML-DSA-87) are
13
14
  * auto-registered in globalRegistry when @smartledger/crypto loads.
15
+ *
16
+ * @param suiteRegistry - Optional custom suite registry. If not provided,
17
+ * uses the globalRegistry from @smartledger/crypto.
18
+ * To ensure the same registry instance across your app,
19
+ * import globalRegistry from '@smartledger/crypto' and pass it here.
14
20
  */
15
- export declare function createKeySDK(): Promise<KeySDK>;
21
+ export declare function createKeySDK(suiteRegistry?: SignatureSuiteRegistry): Promise<KeySDK>;
16
22
  /**
17
23
  * Browser-ready default export
18
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;GAMG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAepD;AAED;;GAEG;;;;AACH,wBAEE"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAIL,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,aAAa,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgB1F;AAED;;GAEG;;;;AACH,wBAEE"}
@@ -32,15 +32,21 @@ Object.defineProperty(exports, "InMemoryKeyStorage", { enumerable: true, get: fu
32
32
  *
33
33
  * All signature suites (ECDSA, ML-DSA-44, ML-DSA-65, ML-DSA-87) are
34
34
  * auto-registered in globalRegistry when @smartledger/crypto loads.
35
+ *
36
+ * @param suiteRegistry - Optional custom suite registry. If not provided,
37
+ * uses the globalRegistry from @smartledger/crypto.
38
+ * To ensure the same registry instance across your app,
39
+ * import globalRegistry from '@smartledger/crypto' and pass it here.
35
40
  */
36
- async function createKeySDK() {
41
+ async function createKeySDK(suiteRegistry) {
37
42
  const storage = new crypto_1.InMemoryKeyStorage();
38
43
  const keyRegistry = new crypto_1.KeyRegistry(storage);
39
- // Use the global registry with auto-registered suites
40
- // (BsvEcdsaSuite, MlDsa44Suite, MlDsa65Suite, MlDsa87Suite)
44
+ // Use provided registry or fall back to our imported globalRegistry
45
+ // Note: Due to Node.js module caching, our globalRegistry may differ from
46
+ // the user's imported globalRegistry. Always pass it explicitly!
41
47
  const sdk = new sdk_js_1.DefaultKeySDK({
42
48
  keyRegistry,
43
- suiteRegistry: crypto_1.globalRegistry,
49
+ suiteRegistry: suiteRegistry || crypto_1.globalRegistry,
44
50
  });
45
51
  // Pre-initialize WASM for ML-DSA if needed
46
52
  // The dilithium-crystals library will lazy-load WASM on first use
@@ -1 +1 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;AAqBH,oCAeC;AAlCD,qCAAyC;AACzC,gDAI6B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ACH,kBAAe;IACb,YAAY;CACb,CAAC;AAEF,8BAA8B;AAC9B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IACjC,MAAc,CAAC,SAAS,GAAG;QAC1B,YAAY;KACb,CAAC;AACJ,CAAC"}
@@ -2,6 +2,7 @@
2
2
  * Browser entry point for @lumen/keys SDK
3
3
  * Includes WASM initialization and browser-compatible exports
4
4
  */
5
+ import { SignatureSuiteRegistry } from '@smartledger/crypto';
5
6
  import type { KeySDK } from './types.js';
6
7
  export * from './types.js';
7
8
  export { InMemoryKeyStorage } from '@smartledger/crypto';
@@ -11,8 +12,13 @@ export { InMemoryKeyStorage } from '@smartledger/crypto';
11
12
  *
12
13
  * All signature suites (ECDSA, ML-DSA-44, ML-DSA-65, ML-DSA-87) are
13
14
  * auto-registered in globalRegistry when @smartledger/crypto loads.
15
+ *
16
+ * @param suiteRegistry - Optional custom suite registry. If not provided,
17
+ * uses the globalRegistry from @smartledger/crypto.
18
+ * To ensure the same registry instance across your app,
19
+ * import globalRegistry from '@smartledger/crypto' and pass it here.
14
20
  */
15
- export declare function createKeySDK(): Promise<KeySDK>;
21
+ export declare function createKeySDK(suiteRegistry?: SignatureSuiteRegistry): Promise<KeySDK>;
16
22
  /**
17
23
  * Browser-ready default export
18
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;GAMG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAepD;AAED;;GAEG;;;;AACH,wBAEE"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAIL,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,aAAa,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgB1F;AAED;;GAEG;;;;AACH,wBAEE"}
@@ -13,15 +13,21 @@ export { InMemoryKeyStorage } from '@smartledger/crypto';
13
13
  *
14
14
  * All signature suites (ECDSA, ML-DSA-44, ML-DSA-65, ML-DSA-87) are
15
15
  * auto-registered in globalRegistry when @smartledger/crypto loads.
16
+ *
17
+ * @param suiteRegistry - Optional custom suite registry. If not provided,
18
+ * uses the globalRegistry from @smartledger/crypto.
19
+ * To ensure the same registry instance across your app,
20
+ * import globalRegistry from '@smartledger/crypto' and pass it here.
16
21
  */
17
- export async function createKeySDK() {
22
+ export async function createKeySDK(suiteRegistry) {
18
23
  const storage = new InMemoryKeyStorage();
19
24
  const keyRegistry = new KeyRegistry(storage);
20
- // Use the global registry with auto-registered suites
21
- // (BsvEcdsaSuite, MlDsa44Suite, MlDsa65Suite, MlDsa87Suite)
25
+ // Use provided registry or fall back to our imported globalRegistry
26
+ // Note: Due to Node.js module caching, our globalRegistry may differ from
27
+ // the user's imported globalRegistry. Always pass it explicitly!
22
28
  const sdk = new DefaultKeySDK({
23
29
  keyRegistry,
24
- suiteRegistry: globalRegistry,
30
+ suiteRegistry: suiteRegistry || globalRegistry,
25
31
  });
26
32
  // Pre-initialize WASM for ML-DSA if needed
27
33
  // The dilithium-crystals library will lazy-load WASM on first use
@@ -1 +1 @@
1
- {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAA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AAG,GAAG,IAAI,aAAa,CAAC;QAC5B,WAAW;QACX,aAAa,EAAE,aAAa,IAAI,cAAc;KAC/C,CAAC,CAAC;IAEH,2CAA2C;IAC3C,kEAAkE;IAElE,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;GAEG;AACH,eAAe;IACb,YAAY;CACb,CAAC;AAEF,8BAA8B;AAC9B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IACjC,MAAc,CAAC,SAAS,GAAG;QAC1B,YAAY;KACb,CAAC;AACJ,CAAC"}
@@ -10790,12 +10790,12 @@ Consider using one of these suites or remove the derivationContext option.` : `N
10790
10790
  init_esbuild_shims();
10791
10791
 
10792
10792
  // src/browser.ts
10793
- async function createKeySDK() {
10793
+ async function createKeySDK(suiteRegistry) {
10794
10794
  const storage = new InMemoryKeyStorage();
10795
10795
  const keyRegistry = new KeyRegistry(storage);
10796
10796
  const sdk = new DefaultKeySDK({
10797
10797
  keyRegistry,
10798
- suiteRegistry: globalRegistry
10798
+ suiteRegistry: suiteRegistry || globalRegistry
10799
10799
  });
10800
10800
  return sdk;
10801
10801
  }