@starknetfoundation/krusty-kms-wasm 0.12.0 → 0.12.1

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 CHANGED
@@ -25,6 +25,21 @@ console.log(getVersion());
25
25
  console.log(poseidonHash("0x1", "0x2"));
26
26
  ```
27
27
 
28
+ Run `init()` once and share its promise. Once `init()` has resolved, calling
29
+ it again returns the same instance, but two calls that overlap (the second
30
+ starting while the first is still loading) each instantiate the module. The
31
+ one that finishes last replaces the instance under every object created on
32
+ the other: their getters fail with `RuntimeError: Out of bounds memory
33
+ access`, and their frees can release objects the new instance has since
34
+ created.
35
+
36
+ ```ts
37
+ // krusty.ts: the one place that initializes the module
38
+ import init from "@starknetfoundation/krusty-kms-wasm";
39
+
40
+ export const krustyReady = init();
41
+ ```
42
+
28
43
  This package is generated with `wasm-pack --target web` and is intended for
29
44
  browser-oriented ESM toolchains that support loading WebAssembly modules.
30
45
 
@@ -265,8 +265,11 @@ export class WasmFundProofResult {
265
265
  *
266
266
  * This type intentionally exposes `private_key` as a plain hex string for
267
267
  * JS interop (signing, export, wallet recovery). That string lives in the
268
- * JS heap and **cannot** be reliably wiped. Prefer companion public-only
269
- * APIs (`derivePublicKey`, etc.) when private material is not required.
268
+ * JS heap and **cannot** be reliably wiped. The copy this object owns in
269
+ * WASM memory is zeroized when the object is freed (`free()` or garbage
270
+ * collection); each getter read makes a temporary copy that is freed
271
+ * without being wiped. Prefer companion public-only APIs
272
+ * (`derivePublicKey`, etc.) when private material is not required.
270
273
  * Never `console.log` this value; `Debug` redacts the private key.
271
274
  */
272
275
  export class WasmKeypair {
@@ -305,8 +308,10 @@ export class WasmKeypair {
305
308
  * # Security / threat model
306
309
  *
307
310
  * `private_key` is a plain hex string in the JS heap and cannot be reliably
308
- * wiped. Prefer [`WasmNostrPublicKey`] / `deriveNostrPublicKey` when private
309
- * material is not required. `Debug` redacts the private key.
311
+ * wiped. The copy this object owns in WASM memory is zeroized when the
312
+ * object is freed, as for [`WasmKeypair`]. Prefer [`WasmNostrPublicKey`] /
313
+ * `deriveNostrPublicKey` when private material is not required. `Debug`
314
+ * redacts the private key.
310
315
  */
311
316
  export class WasmNostrKeypair {
312
317
  free(): void;
@@ -558,8 +563,10 @@ export class WasmStarkSignature {
558
563
  * # Security / threat model
559
564
  *
560
565
  * `private_key` is a plain hex string in the JS heap and cannot be reliably
561
- * wiped. Prefer [`WasmStarkXOnlyPublicKey`] when private material is not
562
- * required. `Debug` redacts the private key; default `Serialize` omits it.
566
+ * wiped. The copy this object owns in WASM memory is zeroized when the
567
+ * object is freed, as for [`WasmKeypair`]. Prefer [`WasmStarkXOnlyPublicKey`]
568
+ * when private material is not required. `Debug` redacts the private key;
569
+ * default `Serialize` omits it.
563
570
  */
564
571
  export class WasmStarkXOnlyKeypair {
565
572
  free(): void;
@@ -1213,8 +1213,11 @@ if (Symbol.dispose) WasmFundProofResult.prototype[Symbol.dispose] = WasmFundProo
1213
1213
  *
1214
1214
  * This type intentionally exposes `private_key` as a plain hex string for
1215
1215
  * JS interop (signing, export, wallet recovery). That string lives in the
1216
- * JS heap and **cannot** be reliably wiped. Prefer companion public-only
1217
- * APIs (`derivePublicKey`, etc.) when private material is not required.
1216
+ * JS heap and **cannot** be reliably wiped. The copy this object owns in
1217
+ * WASM memory is zeroized when the object is freed (`free()` or garbage
1218
+ * collection); each getter read makes a temporary copy that is freed
1219
+ * without being wiped. Prefer companion public-only APIs
1220
+ * (`derivePublicKey`, etc.) when private material is not required.
1218
1221
  * Never `console.log` this value; `Debug` redacts the private key.
1219
1222
  */
1220
1223
  export class WasmKeypair {
@@ -1371,8 +1374,10 @@ if (Symbol.dispose) WasmKeypair.prototype[Symbol.dispose] = WasmKeypair.prototyp
1371
1374
  * # Security / threat model
1372
1375
  *
1373
1376
  * `private_key` is a plain hex string in the JS heap and cannot be reliably
1374
- * wiped. Prefer [`WasmNostrPublicKey`] / `deriveNostrPublicKey` when private
1375
- * material is not required. `Debug` redacts the private key.
1377
+ * wiped. The copy this object owns in WASM memory is zeroized when the
1378
+ * object is freed, as for [`WasmKeypair`]. Prefer [`WasmNostrPublicKey`] /
1379
+ * `deriveNostrPublicKey` when private material is not required. `Debug`
1380
+ * redacts the private key.
1376
1381
  */
1377
1382
  export class WasmNostrKeypair {
1378
1383
  static __wrap(ptr) {
@@ -2738,8 +2743,10 @@ if (Symbol.dispose) WasmStarkSignature.prototype[Symbol.dispose] = WasmStarkSign
2738
2743
  * # Security / threat model
2739
2744
  *
2740
2745
  * `private_key` is a plain hex string in the JS heap and cannot be reliably
2741
- * wiped. Prefer [`WasmStarkXOnlyPublicKey`] when private material is not
2742
- * required. `Debug` redacts the private key; default `Serialize` omits it.
2746
+ * wiped. The copy this object owns in WASM memory is zeroized when the
2747
+ * object is freed, as for [`WasmKeypair`]. Prefer [`WasmStarkXOnlyPublicKey`]
2748
+ * when private material is not required. `Debug` redacts the private key;
2749
+ * default `Serialize` omits it.
2743
2750
  */
2744
2751
  export class WasmStarkXOnlyKeypair {
2745
2752
  static __wrap(ptr) {
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Krusty KMS Contributors"
6
6
  ],
7
7
  "description": "WASM bindings for krusty-kms account and protocol utilities",
8
- "version": "0.12.0",
8
+ "version": "0.12.1",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",