@totemsdk/wots-lease 1.0.0 → 1.0.2

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.
Files changed (67) hide show
  1. package/LICENSE +202 -21
  2. package/NOTICE +60 -0
  3. package/dist/axia.d.ts +1 -1
  4. package/dist/axia.js +41 -28
  5. package/dist/certificate.d.ts +37 -0
  6. package/dist/certificate.js +69 -0
  7. package/dist/cjs/axia.d.ts +33 -0
  8. package/dist/cjs/axia.js +145 -0
  9. package/dist/cjs/certificate.d.ts +37 -0
  10. package/dist/cjs/certificate.js +74 -0
  11. package/dist/cjs/device.d.ts +18 -0
  12. package/dist/cjs/device.js +34 -0
  13. package/dist/cjs/errors.d.ts +71 -0
  14. package/dist/cjs/errors.js +135 -0
  15. package/dist/cjs/hybrid.d.ts +37 -0
  16. package/dist/cjs/hybrid.js +145 -0
  17. package/dist/cjs/index.d.ts +17 -0
  18. package/dist/cjs/index.js +45 -0
  19. package/dist/cjs/journal.d.ts +30 -0
  20. package/dist/cjs/journal.js +369 -0
  21. package/dist/cjs/local.d.ts +83 -0
  22. package/dist/cjs/local.js +440 -0
  23. package/dist/cjs/onchain.d.ts +54 -0
  24. package/dist/cjs/onchain.js +314 -0
  25. package/dist/cjs/package.json +1 -0
  26. package/dist/cjs/quorum.d.ts +75 -0
  27. package/dist/cjs/quorum.js +307 -0
  28. package/dist/cjs/replicated-backup.d.ts +30 -0
  29. package/dist/cjs/replicated-backup.js +52 -0
  30. package/dist/cjs/seed.d.ts +41 -0
  31. package/dist/cjs/seed.js +84 -0
  32. package/dist/cjs/stubs.d.ts +50 -0
  33. package/dist/cjs/stubs.js +125 -0
  34. package/dist/cjs/types.d.ts +272 -0
  35. package/dist/cjs/types.js +5 -0
  36. package/dist/cjs/watermark.d.ts +51 -0
  37. package/dist/cjs/watermark.js +328 -0
  38. package/dist/device.js +2 -6
  39. package/dist/errors.d.ts +26 -0
  40. package/dist/errors.js +49 -25
  41. package/dist/hybrid.d.ts +4 -1
  42. package/dist/hybrid.js +72 -26
  43. package/dist/index.d.ts +6 -2
  44. package/dist/index.js +12 -38
  45. package/dist/journal.d.ts +14 -4
  46. package/dist/journal.js +327 -49
  47. package/dist/local.d.ts +31 -1
  48. package/dist/local.js +267 -68
  49. package/dist/onchain.d.ts +3 -1
  50. package/dist/onchain.js +63 -28
  51. package/dist/quorum.d.ts +15 -0
  52. package/dist/quorum.js +54 -15
  53. package/dist/replicated-backup.d.ts +30 -0
  54. package/dist/replicated-backup.js +48 -0
  55. package/dist/seed.d.ts +41 -0
  56. package/dist/seed.js +80 -0
  57. package/dist/stubs.d.ts +2 -0
  58. package/dist/stubs.js +20 -10
  59. package/dist/types.d.ts +74 -1
  60. package/dist/types.js +1 -2
  61. package/dist/watermark.d.ts +22 -1
  62. package/dist/watermark.js +133 -16
  63. package/package.json +25 -15
  64. package/rust/pkg/package.json +3 -3
  65. package/rust/pkg/wots_lease_wasm_bg.wasm +0 -0
  66. package/rust/pkg-node/package.json +3 -3
  67. package/rust/pkg-node/wots_lease_wasm_bg.wasm +0 -0
package/dist/types.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  * @totemsdk/wots-lease — canonical v3 watermark types and WotsLeaseProvider interface
3
3
  */
4
4
  import type { LocalLeaseProvider } from './local.js';
5
+ import type { StorageAdapter } from '@totemsdk/core';
5
6
  export type UnavailableReason = 'reserved' | 'committed' | 'burned' | 'reserved-expired';
6
7
  export interface SigningIndices {
7
8
  addressIndex: number;
@@ -28,6 +29,28 @@ export interface QuorumAttestation {
28
29
  indices: SigningIndices;
29
30
  expiresAt: number;
30
31
  signature?: string;
32
+ /**
33
+ * The reservation id the peer issued for these indices in its own journal.
34
+ * Commit/burn broadcasts must reference the peer's id, not the local one
35
+ * (AUD-044) — each peer only knows the reservation it issued.
36
+ */
37
+ peerReservationId?: string;
38
+ }
39
+ /**
40
+ * Identity used to authenticate lease certificates (Layer 4/5).
41
+ *
42
+ * A certificate's `signature` is a signature over the canonical certificate
43
+ * payload (see certificate.ts). Verifiers reject unsigned certificates.
44
+ */
45
+ export interface CertificateSigner {
46
+ /** Hex (0x-prefixed or bare) public key digest of the issuing identity. */
47
+ publicKeyDigest: string;
48
+ /** Identity label stored on issued certificates via `issuedBy`. */
49
+ name?: string;
50
+ /** Sign the canonical certificate message. */
51
+ sign(message: Uint8Array): Promise<Uint8Array>;
52
+ /** Verify a signature over the canonical certificate message. */
53
+ verify?(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
31
54
  }
32
55
  export interface LeaseCertificate {
33
56
  reservationId: string;
@@ -71,6 +94,28 @@ export interface LocalWatermark {
71
94
  capacity: number;
72
95
  lastSyncTimestamp?: number;
73
96
  }
97
+ /**
98
+ * A portable, self-describing watermark snapshot (RFC-013 §9). Used to seed a
99
+ * freshly-provisioned local watermark from an exported blob, an operator-supplied
100
+ * high-water mark, or the on-chain cursor, so a restored wallet never starts
101
+ * below the true high-water mark and reissues a spent leaf.
102
+ */
103
+ export interface WatermarkSeed {
104
+ readonly version: 1;
105
+ readonly treeId: string;
106
+ readonly addressCursor: number;
107
+ readonly l1Cursor: number;
108
+ readonly l2Cursor: number;
109
+ /** Flat indices already consumed (reserved/committed/burned). */
110
+ readonly unavailable?: readonly number[];
111
+ }
112
+ export interface SeedWatermarkOptions {
113
+ /**
114
+ * Permit a seed whose cursor is behind the current local cursor. Defaults to
115
+ * `false` — regression re-exposes used leaves, so seeding fails closed.
116
+ */
117
+ readonly allowRegression?: boolean;
118
+ }
74
119
  export interface ConflictRecord {
75
120
  treeId: string;
76
121
  localIndex: number;
@@ -115,6 +160,21 @@ export interface PersonalLeaseNodeConfig {
115
160
  nodeUrl: string;
116
161
  nodePubkey: string;
117
162
  authToken?: string;
163
+ /**
164
+ * Identity that authenticates certificates issued by this node. When it
165
+ * carries a `verify()` function, `verifyLeaseCertificate` uses it. Without
166
+ * any verifier the provider FAILS CLOSED (AUD-016) — an identity match on
167
+ * `issuedBy` alone is never enough.
168
+ */
169
+ certificateSigner?: CertificateSigner;
170
+ /**
171
+ * Verify-only cryptographic verifier for certificates issued by the node.
172
+ * The provider holds no signing key, so this is the recommended way to make
173
+ * `verifyLeaseCertificate` functional. When neither this nor a
174
+ * `certificateSigner.verify` is supplied, the provider rejects every
175
+ * certificate (fail closed).
176
+ */
177
+ verify?: (message: Uint8Array, signature: Uint8Array) => Promise<boolean>;
118
178
  }
119
179
  /**
120
180
  * Layer 4 — P2P quorum lease coordination.
@@ -146,6 +206,12 @@ export interface P2PQuorumLeaseProviderConfig {
146
206
  requestTimeoutMs?: number;
147
207
  /** Require quorum approval on commit as well as reserve. Default: false. */
148
208
  requireQuorumOnCommit?: boolean;
209
+ /**
210
+ * Identity that authenticates issued certificates. When set, reserved
211
+ * certificates carry a real signature; without it, certificates are
212
+ * issued unsigned and will FAIL verification.
213
+ */
214
+ certificateSigner?: CertificateSigner;
149
215
  }
150
216
  /**
151
217
  * Layer 5 — on-chain watermark anchoring.
@@ -187,13 +253,20 @@ export interface OnchainWatermarkProviderConfig {
187
253
  amount?: string;
188
254
  /** Local provider used for the authoritative local watermark + journal. */
189
255
  local: LocalLeaseProvider;
190
- /** Signer for the watermark coin's script (SIGNEDBY digest). */
256
+ /** Signer for the watermark coin's script (SIGNEDBY digest). Also authenticates issued certificates. */
191
257
  signer: {
192
258
  publicKeyDigest: string;
193
259
  sign(message: Uint8Array): Promise<Uint8Array>;
260
+ verify?(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
194
261
  };
195
262
  /** Port holding the flat watermark cursor in the coin state. Default: 0. */
196
263
  statePort?: number;
197
264
  /** Minimum blocks between on-chain publishes (rate limit). Default: 1. */
198
265
  minBlocksBetweenPublishes?: number;
266
+ /**
267
+ * Optional durable storage for the watermark coin's identity. When set, the
268
+ * provider persists the advanced watermark coin ID after each publish so the
269
+ * rollover survives restarts. Default: in-memory only.
270
+ */
271
+ storage?: StorageAdapter;
199
272
  }
package/dist/types.js CHANGED
@@ -1,5 +1,4 @@
1
- "use strict";
2
1
  /**
3
2
  * @totemsdk/wots-lease — canonical v3 watermark types and WotsLeaseProvider interface
4
3
  */
5
- Object.defineProperty(exports, "__esModule", { value: true });
4
+ export {};
@@ -7,9 +7,10 @@
7
7
  * - Storage key unchanged ('totem_wots_watermark') to avoid storage churn.
8
8
  */
9
9
  import type { StorageAdapter, LoggerAdapter } from '@totemsdk/core';
10
- import type { WotsWatermarkState, TreeWatermark, SigningIndices, UnavailableReason, LocalWatermark } from './types.js';
10
+ import type { WotsWatermarkState, TreeWatermark, SigningIndices, UnavailableReason, LocalWatermark, WatermarkSeed, SeedWatermarkOptions } from './types.js';
11
11
  export declare function flatIndex(idx: SigningIndices): number;
12
12
  export declare function fromFlatIndex(flat: number): SigningIndices;
13
+ export declare function assertValidSigningIndices(indices: SigningIndices): void;
13
14
  export declare class WotsWatermarkStore {
14
15
  private readonly storage;
15
16
  private state;
@@ -19,12 +20,32 @@ export declare class WotsWatermarkStore {
19
20
  initialize(): Promise<void>;
20
21
  private ensureInit;
21
22
  private persist;
23
+ /**
24
+ * Reload the persisted watermark and merge it monotonically into the local
25
+ * state. A provider that shares its storage with another provider (AUD-004)
26
+ * must call this inside its mutation critical section before allocating or
27
+ * marking, so it observes writes it did not make and never re-issues a slot
28
+ * another instance already took.
29
+ */
30
+ refresh(): Promise<void>;
22
31
  private getOrCreateTree;
23
32
  getNextIndices(treeId: string): SigningIndices;
24
33
  markUnavailable(treeId: string, indices: SigningIndices, reason: UnavailableReason): Promise<void>;
25
34
  isUnavailable(treeId: string, indices: SigningIndices): boolean;
26
35
  save(treeId: string, patch: Partial<TreeWatermark>): Promise<void>;
27
36
  getLocalWatermark(treeId: string): LocalWatermark;
37
+ /**
38
+ * Export a portable seed for a tree (RFC-013 §9). Includes the cursor and the
39
+ * flat indices already consumed, so it can rebuild the no-reuse state exactly.
40
+ */
41
+ exportSeed(treeId: string): WatermarkSeed;
42
+ /**
43
+ * Seed the watermark from an exported/operator/on-chain snapshot. Forward-only
44
+ * by default: a seed behind the current cursor raises
45
+ * {@link WatermarkSeedRegressionError} so a restore can never re-expose used
46
+ * leaves. The unavailable set is unioned, never shrunk.
47
+ */
48
+ seed(seed: WatermarkSeed, options?: SeedWatermarkOptions): Promise<void>;
28
49
  getRawState(): WotsWatermarkState;
29
50
  clear(): Promise<void>;
30
51
  }
package/dist/watermark.js CHANGED
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * WotsWatermarkStore — canonical v3 implementation
4
3
  *
@@ -7,26 +6,34 @@
7
6
  * - Enforces monotonicity: unavailable map can only grow, cursors can only advance.
8
7
  * - Storage key unchanged ('totem_wots_watermark') to avoid storage churn.
9
8
  */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.WotsWatermarkStore = void 0;
12
- exports.flatIndex = flatIndex;
13
- exports.fromFlatIndex = fromFlatIndex;
14
- const core_1 = require("@totemsdk/core");
15
- const errors_js_1 = require("./errors.js");
9
+ import { NoopLogger } from '@totemsdk/core';
10
+ import { WatermarkMonotonicityError, WatermarkExhaustedError, WatermarkSeedRegressionError, } from './errors.js';
16
11
  const STORAGE_KEY = 'totem_wots_watermark';
17
12
  const MAX_L = 64;
18
13
  const CAPACITY_PER_TREE = MAX_L * MAX_L * MAX_L;
19
14
  const DEFAULT_TREE = 'default';
20
- function flatIndex(idx) {
15
+ export function flatIndex(idx) {
16
+ assertValidSigningIndices(idx);
21
17
  return idx.addressIndex * MAX_L * MAX_L + idx.l1 * MAX_L + idx.l2;
22
18
  }
23
- function fromFlatIndex(flat) {
19
+ export function fromFlatIndex(flat) {
20
+ if (!Number.isSafeInteger(flat) || flat < 0 || flat >= CAPACITY_PER_TREE) {
21
+ throw new RangeError(`WOTS flat index must be an integer in [0, ${CAPACITY_PER_TREE - 1}]`);
22
+ }
24
23
  const addressIndex = Math.floor(flat / (MAX_L * MAX_L));
25
24
  const rem = flat % (MAX_L * MAX_L);
26
25
  const l1 = Math.floor(rem / MAX_L);
27
26
  const l2 = rem % MAX_L;
28
27
  return { addressIndex, l1, l2 };
29
28
  }
29
+ export function assertValidSigningIndices(indices) {
30
+ for (const name of ['addressIndex', 'l1', 'l2']) {
31
+ const value = indices[name];
32
+ if (!Number.isSafeInteger(value) || value < 0 || value >= MAX_L) {
33
+ throw new RangeError(`WOTS ${name} must be an integer in [0, ${MAX_L - 1}]`);
34
+ }
35
+ }
36
+ }
30
37
  function emptyTree(treeId) {
31
38
  return { treeId, addressCursor: 0, l1Cursor: 0, l2Cursor: 0, unavailable: {} };
32
39
  }
@@ -45,6 +52,37 @@ function nextIndices(cur) {
45
52
  return null;
46
53
  return { addressIndex, l1, l2 };
47
54
  }
55
+ /**
56
+ * Monotonic merge of two watermark states: the cursor is the further of the
57
+ * two and the unavailable maps are unioned, so merging never re-exposes a used
58
+ * index. Used to pick up writes made by another provider over the same storage
59
+ * (AUD-004).
60
+ */
61
+ function mergeWatermarkState(a, b) {
62
+ if (!a)
63
+ return b;
64
+ const trees = { ...a.trees };
65
+ for (const [treeId, bt] of Object.entries(b.trees)) {
66
+ const at = trees[treeId];
67
+ if (!at) {
68
+ trees[treeId] = bt;
69
+ continue;
70
+ }
71
+ const aFlat = flatIndex({ addressIndex: at.addressCursor, l1: at.l1Cursor, l2: at.l2Cursor });
72
+ const bFlat = flatIndex({ addressIndex: bt.addressCursor, l1: bt.l1Cursor, l2: bt.l2Cursor });
73
+ const cursor = bFlat > aFlat ? bt : at;
74
+ const lastSync = Math.max(at.lastSyncTimestamp ?? 0, bt.lastSyncTimestamp ?? 0);
75
+ trees[treeId] = {
76
+ treeId,
77
+ addressCursor: cursor.addressCursor,
78
+ l1Cursor: cursor.l1Cursor,
79
+ l2Cursor: cursor.l2Cursor,
80
+ unavailable: { ...bt.unavailable, ...at.unavailable },
81
+ ...(lastSync > 0 ? { lastSyncTimestamp: lastSync } : {}),
82
+ };
83
+ }
84
+ return { version: 3, trees };
85
+ }
48
86
  function migrateToV3(raw) {
49
87
  if (!raw) {
50
88
  return { version: 3, trees: {} };
@@ -87,8 +125,8 @@ function migrateToV3(raw) {
87
125
  tree.l2Cursor = v1.next_l2 ?? 0;
88
126
  return { version: 3, trees: { [DEFAULT_TREE]: tree } };
89
127
  }
90
- class WotsWatermarkStore {
91
- constructor(storage, logger = new core_1.NoopLogger()) {
128
+ export class WotsWatermarkStore {
129
+ constructor(storage, logger = new NoopLogger()) {
92
130
  this.storage = storage;
93
131
  this.state = null;
94
132
  this._initialized = false;
@@ -113,6 +151,19 @@ class WotsWatermarkStore {
113
151
  async persist() {
114
152
  await this.storage.set(STORAGE_KEY, this.state);
115
153
  }
154
+ /**
155
+ * Reload the persisted watermark and merge it monotonically into the local
156
+ * state. A provider that shares its storage with another provider (AUD-004)
157
+ * must call this inside its mutation critical section before allocating or
158
+ * marking, so it observes writes it did not make and never re-issues a slot
159
+ * another instance already took.
160
+ */
161
+ async refresh() {
162
+ if (!this._initialized || !this.state)
163
+ return;
164
+ const raw = await this.storage.get(STORAGE_KEY);
165
+ this.state = mergeWatermarkState(this.state, migrateToV3(raw));
166
+ }
116
167
  getOrCreateTree(treeId) {
117
168
  const s = this.ensureInit();
118
169
  if (!s.trees[treeId]) {
@@ -137,7 +188,7 @@ class WotsWatermarkStore {
137
188
  cur = nxt;
138
189
  attempts++;
139
190
  }
140
- throw new errors_js_1.WatermarkExhaustedError(treeId);
191
+ throw new WatermarkExhaustedError(treeId);
141
192
  }
142
193
  async markUnavailable(treeId, indices, reason) {
143
194
  const tree = this.getOrCreateTree(treeId);
@@ -160,7 +211,13 @@ class WotsWatermarkStore {
160
211
  const tree = s.trees[treeId];
161
212
  if (!tree)
162
213
  return false;
163
- return flatIndex(indices) in tree.unavailable;
214
+ const index = flatIndex(indices);
215
+ const cursor = flatIndex({
216
+ addressIndex: tree.addressCursor,
217
+ l1: tree.l1Cursor,
218
+ l2: tree.l2Cursor,
219
+ });
220
+ return index < cursor || index in tree.unavailable;
164
221
  }
165
222
  async save(treeId, patch) {
166
223
  const s = this.ensureInit();
@@ -169,12 +226,12 @@ class WotsWatermarkStore {
169
226
  const existingFlat = flatIndex({ addressIndex: existing.addressCursor, l1: existing.l1Cursor, l2: existing.l2Cursor });
170
227
  const newFlat = flatIndex({ addressIndex: merged.addressCursor, l1: merged.l1Cursor, l2: merged.l2Cursor });
171
228
  if (newFlat < existingFlat) {
172
- throw new errors_js_1.WatermarkMonotonicityError(`Cannot decrease watermark cursor for ${treeId}: ${existingFlat} → ${newFlat}`);
229
+ throw new WatermarkMonotonicityError(`Cannot decrease watermark cursor for ${treeId}: ${existingFlat} → ${newFlat}`);
173
230
  }
174
231
  const existingUnavailCount = Object.keys(existing.unavailable).length;
175
232
  const newUnavailCount = Object.keys(merged.unavailable).length;
176
233
  if (newUnavailCount < existingUnavailCount) {
177
- throw new errors_js_1.WatermarkMonotonicityError(`Cannot shrink unavailable map for ${treeId}: ${existingUnavailCount} → ${newUnavailCount}`);
234
+ throw new WatermarkMonotonicityError(`Cannot shrink unavailable map for ${treeId}: ${existingUnavailCount} → ${newUnavailCount}`);
178
235
  }
179
236
  s.trees[treeId] = merged;
180
237
  await this.persist();
@@ -192,6 +249,67 @@ class WotsWatermarkStore {
192
249
  lastSyncTimestamp: tree.lastSyncTimestamp,
193
250
  };
194
251
  }
252
+ /**
253
+ * Export a portable seed for a tree (RFC-013 §9). Includes the cursor and the
254
+ * flat indices already consumed, so it can rebuild the no-reuse state exactly.
255
+ */
256
+ exportSeed(treeId) {
257
+ const s = this.ensureInit();
258
+ const tree = s.trees[treeId] ?? emptyTree(treeId);
259
+ const unavailable = Object.keys(tree.unavailable)
260
+ .map((k) => Number(k))
261
+ .filter((f) => Number.isSafeInteger(f))
262
+ .sort((a, b) => a - b);
263
+ return {
264
+ version: 1,
265
+ treeId,
266
+ addressCursor: tree.addressCursor,
267
+ l1Cursor: tree.l1Cursor,
268
+ l2Cursor: tree.l2Cursor,
269
+ unavailable,
270
+ };
271
+ }
272
+ /**
273
+ * Seed the watermark from an exported/operator/on-chain snapshot. Forward-only
274
+ * by default: a seed behind the current cursor raises
275
+ * {@link WatermarkSeedRegressionError} so a restore can never re-expose used
276
+ * leaves. The unavailable set is unioned, never shrunk.
277
+ */
278
+ async seed(seed, options = {}) {
279
+ const s = this.ensureInit();
280
+ const existing = s.trees[seed.treeId] ?? emptyTree(seed.treeId);
281
+ const seedCursor = flatIndex({
282
+ addressIndex: seed.addressCursor,
283
+ l1: seed.l1Cursor,
284
+ l2: seed.l2Cursor,
285
+ });
286
+ const existingCursor = flatIndex({
287
+ addressIndex: existing.addressCursor,
288
+ l1: existing.l1Cursor,
289
+ l2: existing.l2Cursor,
290
+ });
291
+ if (!options.allowRegression && seedCursor < existingCursor) {
292
+ throw new WatermarkSeedRegressionError(seed.treeId, existingCursor, seedCursor);
293
+ }
294
+ const unavailable = { ...existing.unavailable };
295
+ for (const flat of seed.unavailable ?? []) {
296
+ if (!Number.isSafeInteger(flat) || flat < 0 || flat >= CAPACITY_PER_TREE) {
297
+ throw new RangeError(`Seed unavailable index must be an integer in [0, ${CAPACITY_PER_TREE - 1}]`);
298
+ }
299
+ if (!(flat in unavailable))
300
+ unavailable[flat] = 'committed';
301
+ }
302
+ s.trees[seed.treeId] = {
303
+ ...existing,
304
+ treeId: seed.treeId,
305
+ addressCursor: seed.addressCursor,
306
+ l1Cursor: seed.l1Cursor,
307
+ l2Cursor: seed.l2Cursor,
308
+ unavailable,
309
+ lastSyncTimestamp: Date.now(),
310
+ };
311
+ await this.persist();
312
+ }
195
313
  getRawState() {
196
314
  return this.ensureInit();
197
315
  }
@@ -201,4 +319,3 @@ class WotsWatermarkStore {
201
319
  await this.storage.remove(STORAGE_KEY);
202
320
  }
203
321
  }
204
- exports.WotsWatermarkStore = WotsWatermarkStore;
package/package.json CHANGED
@@ -1,14 +1,19 @@
1
1
  {
2
2
  "name": "@totemsdk/wots-lease",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "WOTS key-use coordination — canonical v3 watermark, provider-based lease safety layers",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "dist/cjs/index.js",
6
+ "types": "dist/cjs/index.d.ts",
7
7
  "exports": {
8
8
  ".": {
9
- "types": "./dist/index.d.ts",
10
- "require": "./dist/index.js",
11
- "import": "./dist/index.js"
9
+ "import": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "require": {
14
+ "types": "./dist/cjs/index.d.ts",
15
+ "default": "./dist/cjs/index.js"
16
+ }
12
17
  }
13
18
  },
14
19
  "files": [
@@ -16,12 +21,16 @@
16
21
  "rust/pkg/",
17
22
  "rust/pkg-node/",
18
23
  "README.md",
19
- "LICENSE"
24
+ "LICENSE",
25
+ "NOTICE"
20
26
  ],
21
27
  "dependencies": {
22
- "@totemsdk/lookup-protocol": "^0.1.6",
23
- "@totemsdk/core": "^1.2.9",
24
- "@totemsdk/txpow": "^0.1.7"
28
+ "@noble/hashes": "^1.8.0",
29
+ "@totemsdk/core": "^1.4.2",
30
+ "@totemsdk/txpow": "^1.1.1",
31
+ "@totemsdk/replication": "^0.2.0",
32
+ "@totemsdk/lookup-protocol": "^0.3.0",
33
+ "@totemsdk/storage": "^0.2.2"
25
34
  },
26
35
  "devDependencies": {
27
36
  "@types/jest": "^30.0.0",
@@ -36,15 +45,15 @@
36
45
  "publishConfig": {
37
46
  "access": "public"
38
47
  },
39
- "license": "MIT",
48
+ "license": "Apache-2.0",
40
49
  "author": "Totem SDK",
41
- "homepage": "https://totem.ing",
50
+ "homepage": "https://docs.totem.ing",
42
51
  "bugs": {
43
- "url": "https://github.com/totem-sdk/totem-sdk/issues"
52
+ "url": "https://github.com/Totem-Edge/totem-sdk/issues"
44
53
  },
45
54
  "repository": {
46
55
  "type": "git",
47
- "url": "git+https://github.com/totem-sdk/totem-sdk.git",
56
+ "url": "git+https://github.com/Totem-Edge/totem-sdk.git",
48
57
  "directory": "packages/wots-lease"
49
58
  },
50
59
  "keywords": [
@@ -56,8 +65,9 @@
56
65
  "wots",
57
66
  "utxo"
58
67
  ],
68
+ "type": "module",
59
69
  "scripts": {
60
- "build": "npm run build:wasm && tsc && node ../../scripts/clean-wasm-output-ignores.mjs",
70
+ "build": "tsc && tsc -p tsconfig.cjs.json && node -e \"require('fs').writeFileSync('dist/cjs/package.json', JSON.stringify({type:'commonjs'})+'\\n')\"",
61
71
  "build:wasm": "cd rust && wasm-pack build --target bundler --out-dir pkg && wasm-pack build --target nodejs --out-dir pkg-node",
62
72
  "clean": "rm -rf dist rust/pkg rust/pkg-node rust/target",
63
73
  "test": "jest"
@@ -6,10 +6,10 @@
6
6
  ],
7
7
  "description": "WOTS key-use coordination — canonical v3 watermark, flat index computation, monotonicity enforcement, device keyspace partitioning (Rust/WASM)",
8
8
  "version": "0.1.0",
9
- "license": "MIT",
9
+ "license": "Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/totem-sdk/totem-sdk"
12
+ "url": "https://github.com/Totem-Edge/totem-sdk"
13
13
  },
14
14
  "files": [
15
15
  "wots_lease_wasm_bg.wasm",
@@ -24,4 +24,4 @@
24
24
  "./wots_lease_wasm.js",
25
25
  "./snippets/*"
26
26
  ]
27
- }
27
+ }
Binary file
@@ -5,10 +5,10 @@
5
5
  ],
6
6
  "description": "WOTS key-use coordination — canonical v3 watermark, flat index computation, monotonicity enforcement, device keyspace partitioning (Rust/WASM)",
7
7
  "version": "0.1.0",
8
- "license": "MIT",
8
+ "license": "Apache-2.0",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "https://github.com/totem-sdk/totem-sdk"
11
+ "url": "https://github.com/Totem-Edge/totem-sdk"
12
12
  },
13
13
  "files": [
14
14
  "wots_lease_wasm_bg.wasm",
@@ -18,4 +18,4 @@
18
18
  "main": "wots_lease_wasm.js",
19
19
  "homepage": "https://totem.ing",
20
20
  "types": "wots_lease_wasm.d.ts"
21
- }
21
+ }