@unicitylabs/sphere-sdk 0.14.0-dev.6 → 0.14.0-dev.7
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/dist/connect/index.cjs +1 -1
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +1 -1
- package/dist/connect/index.js.map +1 -1
- package/dist/core/index.cjs +416 -223
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +111 -108
- package/dist/core/index.d.ts +111 -108
- package/dist/core/index.js +416 -223
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/connect/index.cjs +1 -1
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.js +1 -1
- package/dist/impl/browser/connect/index.js.map +1 -1
- package/dist/impl/wallet-api-v2/index.cjs +38 -5
- package/dist/impl/wallet-api-v2/index.cjs.map +1 -1
- package/dist/impl/wallet-api-v2/index.d.cts +23 -2
- package/dist/impl/wallet-api-v2/index.d.ts +23 -2
- package/dist/impl/wallet-api-v2/index.js +38 -5
- package/dist/impl/wallet-api-v2/index.js.map +1 -1
- package/dist/index.cjs +416 -223
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -109
- package/dist/index.d.ts +112 -109
- package/dist/index.js +416 -223
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +340 -199
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.d.cts +68 -19
- package/dist/modules/payments-v2/index.d.ts +68 -19
- package/dist/modules/payments-v2/index.js +339 -199
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -742,7 +742,10 @@ var STORE_KEYS = {
|
|
|
742
742
|
shortfalls: "shortfalls",
|
|
743
743
|
settlingLinks: "settling",
|
|
744
744
|
streamCursor: (s) => `cursor:${s}`,
|
|
745
|
-
epochLatch: "epoch-latch"
|
|
745
|
+
epochLatch: "epoch-latch",
|
|
746
|
+
// §5.2 InventoryView durable overlays (#625/#679).
|
|
747
|
+
suspectedSpent: "suspected-spent",
|
|
748
|
+
knownSpends: "known-spends"
|
|
746
749
|
};
|
|
747
750
|
|
|
748
751
|
// node_modules/@noble/curves/utils.js
|
|
@@ -2766,6 +2769,7 @@ var WalletApiSession = class {
|
|
|
2766
2769
|
epochLatch = null;
|
|
2767
2770
|
reseedChain = Promise.resolve();
|
|
2768
2771
|
reseedsPending = 0;
|
|
2772
|
+
epochHandlers = /* @__PURE__ */ new Set();
|
|
2769
2773
|
handlers = /* @__PURE__ */ new Map();
|
|
2770
2774
|
statusHandlers = /* @__PURE__ */ new Set();
|
|
2771
2775
|
socket = null;
|
|
@@ -2868,6 +2872,18 @@ var WalletApiSession = class {
|
|
|
2868
2872
|
await this.deps.kv.set(this.refreshKey, tokens.refreshToken);
|
|
2869
2873
|
}
|
|
2870
2874
|
// ── epoch latch (F12) ─────────────────────────────────────────────────────
|
|
2875
|
+
/** §5.1: the latched server syncEpoch ('' before first server contact). */
|
|
2876
|
+
currentEpoch() {
|
|
2877
|
+
return this.epochLatch ?? "";
|
|
2878
|
+
}
|
|
2879
|
+
/**
|
|
2880
|
+
* §5.1 restore hook (FacadeSession contract): handlers are AWAITED inside
|
|
2881
|
+
* the reseed chain, BEFORE any stream nudge resumes.
|
|
2882
|
+
*/
|
|
2883
|
+
subscribeEpochChange(handler) {
|
|
2884
|
+
this.epochHandlers.add(handler);
|
|
2885
|
+
return () => this.epochHandlers.delete(handler);
|
|
2886
|
+
}
|
|
2871
2887
|
noteEpoch(epoch) {
|
|
2872
2888
|
if (this.epochLatch === epoch) return;
|
|
2873
2889
|
const previous = this.epochLatch;
|
|
@@ -2881,7 +2897,7 @@ var WalletApiSession = class {
|
|
|
2881
2897
|
}
|
|
2882
2898
|
async runReseed(epoch, previous) {
|
|
2883
2899
|
try {
|
|
2884
|
-
|
|
2900
|
+
for (const handler of [...this.epochHandlers]) await handler(epoch);
|
|
2885
2901
|
await this.deps.kv.set(STORE_KEYS.epochLatch, epoch);
|
|
2886
2902
|
} catch {
|
|
2887
2903
|
if (this.epochLatch === epoch) this.epochLatch = previous;
|
|
@@ -4089,6 +4105,7 @@ var WalletApiDeliveryPort = class {
|
|
|
4089
4105
|
wake;
|
|
4090
4106
|
deriveFn;
|
|
4091
4107
|
seenChain = new SerialChain();
|
|
4108
|
+
lastIncomingEpoch = null;
|
|
4092
4109
|
constructor(config) {
|
|
4093
4110
|
this.client = config.client;
|
|
4094
4111
|
this.kv = config.kv;
|
|
@@ -4183,6 +4200,7 @@ var WalletApiDeliveryPort = class {
|
|
|
4183
4200
|
const seen = await this.readSeen();
|
|
4184
4201
|
let page = await this.client.listMailbox(sinceCursor === void 0 ? 0 : Number(sinceCursor));
|
|
4185
4202
|
for (; ; ) {
|
|
4203
|
+
this.lastIncomingEpoch = String(page.syncEpoch);
|
|
4186
4204
|
for (const entry of page.entries) {
|
|
4187
4205
|
if (entry.status !== "unclaimed") continue;
|
|
4188
4206
|
if (seen.has(entry.entryId)) continue;
|
|
@@ -4192,6 +4210,10 @@ var WalletApiDeliveryPort = class {
|
|
|
4192
4210
|
page = await this.client.listMailbox(page.cursor);
|
|
4193
4211
|
}
|
|
4194
4212
|
}
|
|
4213
|
+
/** §5.7: the page-honest epoch — the restore-detection source Receive keys on. */
|
|
4214
|
+
incomingEpoch() {
|
|
4215
|
+
return this.lastIncomingEpoch;
|
|
4216
|
+
}
|
|
4195
4217
|
toIncoming(entry) {
|
|
4196
4218
|
const bundle = this.openEnvelope(entry);
|
|
4197
4219
|
return {
|
|
@@ -4347,7 +4369,7 @@ var WalletApiSplitCheckpointStore = class {
|
|
|
4347
4369
|
return utf8(`${transferId}:${String(opIndex)}`);
|
|
4348
4370
|
}
|
|
4349
4371
|
async put(transferId, opIndex, bytes) {
|
|
4350
|
-
const {
|
|
4372
|
+
const { kv, fieldKey } = this.config;
|
|
4351
4373
|
const aad = this.aad(transferId, opIndex);
|
|
4352
4374
|
const cacheKey = this.cacheKey(transferId, opIndex);
|
|
4353
4375
|
let envelope = await kv.get(cacheKey);
|
|
@@ -4355,10 +4377,21 @@ var WalletApiSplitCheckpointStore = class {
|
|
|
4355
4377
|
envelope = encryptFieldBytes(fieldKey, bytes, aad);
|
|
4356
4378
|
await kv.set(cacheKey, envelope);
|
|
4357
4379
|
}
|
|
4358
|
-
const
|
|
4359
|
-
const record = await client.postProgress(transferId, opIndex, envelope, signature);
|
|
4380
|
+
const record = await this.post(transferId, opIndex, envelope);
|
|
4360
4381
|
return this.open(record.payload, aad);
|
|
4361
4382
|
}
|
|
4383
|
+
/** §5.1 restore (CheckpointReseeder): re-POST the cached ciphertext byte-identical; false = none cached. */
|
|
4384
|
+
async reseedCheckpoint(transferId, opIndex) {
|
|
4385
|
+
const envelope = await this.config.kv.get(this.cacheKey(transferId, opIndex));
|
|
4386
|
+
if (envelope === null) return false;
|
|
4387
|
+
await this.post(transferId, opIndex, envelope);
|
|
4388
|
+
return true;
|
|
4389
|
+
}
|
|
4390
|
+
/** The ONE signed progress-append path put() and reseedCheckpoint() share. */
|
|
4391
|
+
async post(transferId, opIndex, envelope) {
|
|
4392
|
+
const signature = await this.config.signProgress(progressSignMessage(transferId, opIndex, envelope));
|
|
4393
|
+
return this.config.client.postProgress(transferId, opIndex, envelope, signature);
|
|
4394
|
+
}
|
|
4362
4395
|
async get(transferId, opIndex) {
|
|
4363
4396
|
const records = await this.config.client.getProgress(transferId);
|
|
4364
4397
|
const record = records.find((r) => r.opIndex === opIndex);
|