@unicitylabs/sphere-sdk 0.14.8 → 0.14.9-dev.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/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 +34 -4
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +34 -4
- 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 +5 -1
- package/dist/impl/wallet-api-v2/index.cjs.map +1 -1
- package/dist/impl/wallet-api-v2/index.d.cts +0 -1
- package/dist/impl/wallet-api-v2/index.d.ts +0 -1
- package/dist/impl/wallet-api-v2/index.js +5 -1
- package/dist/impl/wallet-api-v2/index.js.map +1 -1
- package/dist/index.cjs +34 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +22 -2
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.js +22 -2
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core/index.cjs
CHANGED
|
@@ -11416,6 +11416,15 @@ var ListStore = class {
|
|
|
11416
11416
|
return await this.kv.get(this.storeKey) ?? [];
|
|
11417
11417
|
}
|
|
11418
11418
|
};
|
|
11419
|
+
function senderNametagOption(ownNametag) {
|
|
11420
|
+
let nametag;
|
|
11421
|
+
try {
|
|
11422
|
+
nametag = ownNametag?.();
|
|
11423
|
+
} catch {
|
|
11424
|
+
return {};
|
|
11425
|
+
}
|
|
11426
|
+
return nametag === void 0 || nametag === "" ? {} : { senderNametag: nametag };
|
|
11427
|
+
}
|
|
11419
11428
|
var DeliveryJournal = class extends ListStore {
|
|
11420
11429
|
constructor(kv) {
|
|
11421
11430
|
super(kv, STORE_KEYS.deliveryJournal, (e) => `${e.transferId}:${String(e.opIndex)}`);
|
|
@@ -11466,7 +11475,8 @@ var DeliveryJournal = class extends ListStore {
|
|
|
11466
11475
|
try {
|
|
11467
11476
|
await deps.delivery.deliver(entry.recipientPubkey, hexToBytes4(entry.blobHex), {
|
|
11468
11477
|
transferId: entry.transferId,
|
|
11469
|
-
...entry.memo !== void 0 ? { memo: entry.memo } : {}
|
|
11478
|
+
...entry.memo !== void 0 ? { memo: entry.memo } : {},
|
|
11479
|
+
...senderNametagOption(deps.ownNametag)
|
|
11470
11480
|
});
|
|
11471
11481
|
await this.remove(entry.transferId, entry.opIndex);
|
|
11472
11482
|
stats.delivered += 1;
|
|
@@ -11734,7 +11744,11 @@ var TransferMachine = class {
|
|
|
11734
11744
|
const journaled = committed.filter((o) => o.error === void 0 && o.recipientBlob !== void 0);
|
|
11735
11745
|
let pending = journaled.length < committed.length;
|
|
11736
11746
|
if (journaled.length === 0) return pending;
|
|
11737
|
-
const options = {
|
|
11747
|
+
const options = {
|
|
11748
|
+
transferId,
|
|
11749
|
+
...memo !== void 0 ? { memo } : {},
|
|
11750
|
+
...senderNametagOption(this.deps.ownNametag)
|
|
11751
|
+
};
|
|
11738
11752
|
if (await this.tryBatchDeposit(recipientPubkey, journaled, options)) return pending;
|
|
11739
11753
|
for (const outcome of journaled) {
|
|
11740
11754
|
const stillPending = await this.deliverOne(recipientPubkey, outcome, options);
|
|
@@ -12168,6 +12182,9 @@ var Converger = class {
|
|
|
12168
12182
|
return {
|
|
12169
12183
|
delivery: this.deps.delivery,
|
|
12170
12184
|
now: () => this.deps.now(),
|
|
12185
|
+
// sphere#487: a replayed leg carries the sender's name too — the machine
|
|
12186
|
+
// deps hold the one live getter, so replay can never drift from a send.
|
|
12187
|
+
...this.deps.machineDeps.ownNametag !== void 0 ? { ownNametag: this.deps.machineDeps.ownNametag } : {},
|
|
12171
12188
|
attention: (transferId, code, detail) => {
|
|
12172
12189
|
this.deps.emit(
|
|
12173
12190
|
"transfer:attention",
|
|
@@ -13811,6 +13828,9 @@ function buildMachineDeps(deps, hooks, historyStore) {
|
|
|
13811
13828
|
decryptPayload: async (envelope) => JSON.parse(decryptField(deps.fieldKey, envelope)),
|
|
13812
13829
|
signComplete: deps.signComplete,
|
|
13813
13830
|
ownPubkey: hexToBytes4(deps.ownPubkey),
|
|
13831
|
+
// sphere#487: the same live getter Requests uses — the delivery envelope is
|
|
13832
|
+
// the recipient's ONLY source for the sender's Unicity ID.
|
|
13833
|
+
...deps.ownNametag !== void 0 ? { ownNametag: deps.ownNametag } : {},
|
|
13814
13834
|
emit: deps.emit,
|
|
13815
13835
|
now: deps.now ?? Date.now,
|
|
13816
13836
|
recordHistory: async ({ transferId, payload, committedAmount }) => {
|
|
@@ -15287,10 +15307,14 @@ var WalletApiDeliveryPort = class {
|
|
|
15287
15307
|
sha: bytesToHex3(sha256(bytes))
|
|
15288
15308
|
};
|
|
15289
15309
|
}
|
|
15310
|
+
// sphere#487: the nametag is a per-call option and NOT port config — a
|
|
15311
|
+
// construction-time copy would silently go stale on registration, and only a
|
|
15312
|
+
// caller-supplied value is enforceable by the port contract suite (which any
|
|
15313
|
+
// swapped DeliveryPort must pass).
|
|
15290
15314
|
buildEnvelope(recipientPubkey, options) {
|
|
15291
15315
|
const key = deriveDeliveryEncryptionKey(this.identity.privateKey, recipientPubkey);
|
|
15292
15316
|
return encryptDeliveryBundle(key, {
|
|
15293
|
-
senderNametag: options.senderNametag
|
|
15317
|
+
senderNametag: options.senderNametag,
|
|
15294
15318
|
memo: options.memo
|
|
15295
15319
|
});
|
|
15296
15320
|
}
|
|
@@ -18342,6 +18366,7 @@ var Sphere = class _Sphere {
|
|
|
18342
18366
|
"INVALID_CONFIG"
|
|
18343
18367
|
);
|
|
18344
18368
|
}
|
|
18369
|
+
const facadeAddressId = identity.directAddress === void 0 ? void 0 : getAddressId(identity.directAddress);
|
|
18345
18370
|
const facade = composePaymentsV2({
|
|
18346
18371
|
identity,
|
|
18347
18372
|
composition: this._paymentsV2Composition,
|
|
@@ -18355,7 +18380,12 @@ var Sphere = class _Sphere {
|
|
|
18355
18380
|
price: this._priceProvider,
|
|
18356
18381
|
emit: (event, payload) => this.emitEvent(event, payload),
|
|
18357
18382
|
resolvePeer: (identifier) => this._transport.resolve?.(identifier) ?? Promise.resolve(null),
|
|
18358
|
-
|
|
18383
|
+
// Scoped to THIS facade's address, never "whichever is active":
|
|
18384
|
+
// switchToAddress moves _currentAddressIndex BEFORE stopping this
|
|
18385
|
+
// vertical, so the argument-less getter would hand an in-flight
|
|
18386
|
+
// deliver the NEXT address's Unicity ID — a name the sending key does
|
|
18387
|
+
// not own (sphere#487 review).
|
|
18388
|
+
nametag: () => this.getNametagForAddress(facadeAddressId)
|
|
18359
18389
|
}
|
|
18360
18390
|
});
|
|
18361
18391
|
this._paymentsV2Active = { index, facade };
|