@unicitylabs/sphere-sdk 0.14.8 → 0.14.9
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.js
CHANGED
|
@@ -11330,6 +11330,15 @@ var ListStore = class {
|
|
|
11330
11330
|
return await this.kv.get(this.storeKey) ?? [];
|
|
11331
11331
|
}
|
|
11332
11332
|
};
|
|
11333
|
+
function senderNametagOption(ownNametag) {
|
|
11334
|
+
let nametag;
|
|
11335
|
+
try {
|
|
11336
|
+
nametag = ownNametag?.();
|
|
11337
|
+
} catch {
|
|
11338
|
+
return {};
|
|
11339
|
+
}
|
|
11340
|
+
return nametag === void 0 || nametag === "" ? {} : { senderNametag: nametag };
|
|
11341
|
+
}
|
|
11333
11342
|
var DeliveryJournal = class extends ListStore {
|
|
11334
11343
|
constructor(kv) {
|
|
11335
11344
|
super(kv, STORE_KEYS.deliveryJournal, (e) => `${e.transferId}:${String(e.opIndex)}`);
|
|
@@ -11380,7 +11389,8 @@ var DeliveryJournal = class extends ListStore {
|
|
|
11380
11389
|
try {
|
|
11381
11390
|
await deps.delivery.deliver(entry.recipientPubkey, hexToBytes4(entry.blobHex), {
|
|
11382
11391
|
transferId: entry.transferId,
|
|
11383
|
-
...entry.memo !== void 0 ? { memo: entry.memo } : {}
|
|
11392
|
+
...entry.memo !== void 0 ? { memo: entry.memo } : {},
|
|
11393
|
+
...senderNametagOption(deps.ownNametag)
|
|
11384
11394
|
});
|
|
11385
11395
|
await this.remove(entry.transferId, entry.opIndex);
|
|
11386
11396
|
stats.delivered += 1;
|
|
@@ -11648,7 +11658,11 @@ var TransferMachine = class {
|
|
|
11648
11658
|
const journaled = committed.filter((o) => o.error === void 0 && o.recipientBlob !== void 0);
|
|
11649
11659
|
let pending = journaled.length < committed.length;
|
|
11650
11660
|
if (journaled.length === 0) return pending;
|
|
11651
|
-
const options = {
|
|
11661
|
+
const options = {
|
|
11662
|
+
transferId,
|
|
11663
|
+
...memo !== void 0 ? { memo } : {},
|
|
11664
|
+
...senderNametagOption(this.deps.ownNametag)
|
|
11665
|
+
};
|
|
11652
11666
|
if (await this.tryBatchDeposit(recipientPubkey, journaled, options)) return pending;
|
|
11653
11667
|
for (const outcome of journaled) {
|
|
11654
11668
|
const stillPending = await this.deliverOne(recipientPubkey, outcome, options);
|
|
@@ -12082,6 +12096,9 @@ var Converger = class {
|
|
|
12082
12096
|
return {
|
|
12083
12097
|
delivery: this.deps.delivery,
|
|
12084
12098
|
now: () => this.deps.now(),
|
|
12099
|
+
// sphere#487: a replayed leg carries the sender's name too — the machine
|
|
12100
|
+
// deps hold the one live getter, so replay can never drift from a send.
|
|
12101
|
+
...this.deps.machineDeps.ownNametag !== void 0 ? { ownNametag: this.deps.machineDeps.ownNametag } : {},
|
|
12085
12102
|
attention: (transferId, code, detail) => {
|
|
12086
12103
|
this.deps.emit(
|
|
12087
12104
|
"transfer:attention",
|
|
@@ -13725,6 +13742,9 @@ function buildMachineDeps(deps, hooks, historyStore) {
|
|
|
13725
13742
|
decryptPayload: async (envelope) => JSON.parse(decryptField(deps.fieldKey, envelope)),
|
|
13726
13743
|
signComplete: deps.signComplete,
|
|
13727
13744
|
ownPubkey: hexToBytes4(deps.ownPubkey),
|
|
13745
|
+
// sphere#487: the same live getter Requests uses — the delivery envelope is
|
|
13746
|
+
// the recipient's ONLY source for the sender's Unicity ID.
|
|
13747
|
+
...deps.ownNametag !== void 0 ? { ownNametag: deps.ownNametag } : {},
|
|
13728
13748
|
emit: deps.emit,
|
|
13729
13749
|
now: deps.now ?? Date.now,
|
|
13730
13750
|
recordHistory: async ({ transferId, payload, committedAmount }) => {
|
|
@@ -15201,10 +15221,14 @@ var WalletApiDeliveryPort = class {
|
|
|
15201
15221
|
sha: bytesToHex3(sha256(bytes))
|
|
15202
15222
|
};
|
|
15203
15223
|
}
|
|
15224
|
+
// sphere#487: the nametag is a per-call option and NOT port config — a
|
|
15225
|
+
// construction-time copy would silently go stale on registration, and only a
|
|
15226
|
+
// caller-supplied value is enforceable by the port contract suite (which any
|
|
15227
|
+
// swapped DeliveryPort must pass).
|
|
15204
15228
|
buildEnvelope(recipientPubkey, options) {
|
|
15205
15229
|
const key = deriveDeliveryEncryptionKey(this.identity.privateKey, recipientPubkey);
|
|
15206
15230
|
return encryptDeliveryBundle(key, {
|
|
15207
|
-
senderNametag: options.senderNametag
|
|
15231
|
+
senderNametag: options.senderNametag,
|
|
15208
15232
|
memo: options.memo
|
|
15209
15233
|
});
|
|
15210
15234
|
}
|
|
@@ -18256,6 +18280,7 @@ var Sphere = class _Sphere {
|
|
|
18256
18280
|
"INVALID_CONFIG"
|
|
18257
18281
|
);
|
|
18258
18282
|
}
|
|
18283
|
+
const facadeAddressId = identity.directAddress === void 0 ? void 0 : getAddressId(identity.directAddress);
|
|
18259
18284
|
const facade = composePaymentsV2({
|
|
18260
18285
|
identity,
|
|
18261
18286
|
composition: this._paymentsV2Composition,
|
|
@@ -18269,7 +18294,12 @@ var Sphere = class _Sphere {
|
|
|
18269
18294
|
price: this._priceProvider,
|
|
18270
18295
|
emit: (event, payload) => this.emitEvent(event, payload),
|
|
18271
18296
|
resolvePeer: (identifier) => this._transport.resolve?.(identifier) ?? Promise.resolve(null),
|
|
18272
|
-
|
|
18297
|
+
// Scoped to THIS facade's address, never "whichever is active":
|
|
18298
|
+
// switchToAddress moves _currentAddressIndex BEFORE stopping this
|
|
18299
|
+
// vertical, so the argument-less getter would hand an in-flight
|
|
18300
|
+
// deliver the NEXT address's Unicity ID — a name the sending key does
|
|
18301
|
+
// not own (sphere#487 review).
|
|
18302
|
+
nametag: () => this.getNametagForAddress(facadeAddressId)
|
|
18273
18303
|
}
|
|
18274
18304
|
});
|
|
18275
18305
|
this._paymentsV2Active = { index, facade };
|