@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/index.js
CHANGED
|
@@ -11346,6 +11346,15 @@ var ListStore = class {
|
|
|
11346
11346
|
return await this.kv.get(this.storeKey) ?? [];
|
|
11347
11347
|
}
|
|
11348
11348
|
};
|
|
11349
|
+
function senderNametagOption(ownNametag) {
|
|
11350
|
+
let nametag;
|
|
11351
|
+
try {
|
|
11352
|
+
nametag = ownNametag?.();
|
|
11353
|
+
} catch {
|
|
11354
|
+
return {};
|
|
11355
|
+
}
|
|
11356
|
+
return nametag === void 0 || nametag === "" ? {} : { senderNametag: nametag };
|
|
11357
|
+
}
|
|
11349
11358
|
var DeliveryJournal = class extends ListStore {
|
|
11350
11359
|
constructor(kv) {
|
|
11351
11360
|
super(kv, STORE_KEYS.deliveryJournal, (e) => `${e.transferId}:${String(e.opIndex)}`);
|
|
@@ -11396,7 +11405,8 @@ var DeliveryJournal = class extends ListStore {
|
|
|
11396
11405
|
try {
|
|
11397
11406
|
await deps.delivery.deliver(entry.recipientPubkey, hexToBytes4(entry.blobHex), {
|
|
11398
11407
|
transferId: entry.transferId,
|
|
11399
|
-
...entry.memo !== void 0 ? { memo: entry.memo } : {}
|
|
11408
|
+
...entry.memo !== void 0 ? { memo: entry.memo } : {},
|
|
11409
|
+
...senderNametagOption(deps.ownNametag)
|
|
11400
11410
|
});
|
|
11401
11411
|
await this.remove(entry.transferId, entry.opIndex);
|
|
11402
11412
|
stats.delivered += 1;
|
|
@@ -11664,7 +11674,11 @@ var TransferMachine = class {
|
|
|
11664
11674
|
const journaled = committed.filter((o) => o.error === void 0 && o.recipientBlob !== void 0);
|
|
11665
11675
|
let pending = journaled.length < committed.length;
|
|
11666
11676
|
if (journaled.length === 0) return pending;
|
|
11667
|
-
const options = {
|
|
11677
|
+
const options = {
|
|
11678
|
+
transferId,
|
|
11679
|
+
...memo !== void 0 ? { memo } : {},
|
|
11680
|
+
...senderNametagOption(this.deps.ownNametag)
|
|
11681
|
+
};
|
|
11668
11682
|
if (await this.tryBatchDeposit(recipientPubkey, journaled, options)) return pending;
|
|
11669
11683
|
for (const outcome of journaled) {
|
|
11670
11684
|
const stillPending = await this.deliverOne(recipientPubkey, outcome, options);
|
|
@@ -12098,6 +12112,9 @@ var Converger = class {
|
|
|
12098
12112
|
return {
|
|
12099
12113
|
delivery: this.deps.delivery,
|
|
12100
12114
|
now: () => this.deps.now(),
|
|
12115
|
+
// sphere#487: a replayed leg carries the sender's name too — the machine
|
|
12116
|
+
// deps hold the one live getter, so replay can never drift from a send.
|
|
12117
|
+
...this.deps.machineDeps.ownNametag !== void 0 ? { ownNametag: this.deps.machineDeps.ownNametag } : {},
|
|
12101
12118
|
attention: (transferId, code, detail) => {
|
|
12102
12119
|
this.deps.emit(
|
|
12103
12120
|
"transfer:attention",
|
|
@@ -13741,6 +13758,9 @@ function buildMachineDeps(deps, hooks, historyStore) {
|
|
|
13741
13758
|
decryptPayload: async (envelope) => JSON.parse(decryptField(deps.fieldKey, envelope)),
|
|
13742
13759
|
signComplete: deps.signComplete,
|
|
13743
13760
|
ownPubkey: hexToBytes4(deps.ownPubkey),
|
|
13761
|
+
// sphere#487: the same live getter Requests uses — the delivery envelope is
|
|
13762
|
+
// the recipient's ONLY source for the sender's Unicity ID.
|
|
13763
|
+
...deps.ownNametag !== void 0 ? { ownNametag: deps.ownNametag } : {},
|
|
13744
13764
|
emit: deps.emit,
|
|
13745
13765
|
now: deps.now ?? Date.now,
|
|
13746
13766
|
recordHistory: async ({ transferId, payload, committedAmount }) => {
|
|
@@ -15217,10 +15237,14 @@ var WalletApiDeliveryPort = class {
|
|
|
15217
15237
|
sha: bytesToHex3(sha256(bytes))
|
|
15218
15238
|
};
|
|
15219
15239
|
}
|
|
15240
|
+
// sphere#487: the nametag is a per-call option and NOT port config — a
|
|
15241
|
+
// construction-time copy would silently go stale on registration, and only a
|
|
15242
|
+
// caller-supplied value is enforceable by the port contract suite (which any
|
|
15243
|
+
// swapped DeliveryPort must pass).
|
|
15220
15244
|
buildEnvelope(recipientPubkey, options) {
|
|
15221
15245
|
const key = deriveDeliveryEncryptionKey(this.identity.privateKey, recipientPubkey);
|
|
15222
15246
|
return encryptDeliveryBundle(key, {
|
|
15223
|
-
senderNametag: options.senderNametag
|
|
15247
|
+
senderNametag: options.senderNametag,
|
|
15224
15248
|
memo: options.memo
|
|
15225
15249
|
});
|
|
15226
15250
|
}
|
|
@@ -18272,6 +18296,7 @@ var Sphere = class _Sphere {
|
|
|
18272
18296
|
"INVALID_CONFIG"
|
|
18273
18297
|
);
|
|
18274
18298
|
}
|
|
18299
|
+
const facadeAddressId = identity.directAddress === void 0 ? void 0 : getAddressId(identity.directAddress);
|
|
18275
18300
|
const facade = composePaymentsV2({
|
|
18276
18301
|
identity,
|
|
18277
18302
|
composition: this._paymentsV2Composition,
|
|
@@ -18285,7 +18310,12 @@ var Sphere = class _Sphere {
|
|
|
18285
18310
|
price: this._priceProvider,
|
|
18286
18311
|
emit: (event, payload) => this.emitEvent(event, payload),
|
|
18287
18312
|
resolvePeer: (identifier) => this._transport.resolve?.(identifier) ?? Promise.resolve(null),
|
|
18288
|
-
|
|
18313
|
+
// Scoped to THIS facade's address, never "whichever is active":
|
|
18314
|
+
// switchToAddress moves _currentAddressIndex BEFORE stopping this
|
|
18315
|
+
// vertical, so the argument-less getter would hand an in-flight
|
|
18316
|
+
// deliver the NEXT address's Unicity ID — a name the sending key does
|
|
18317
|
+
// not own (sphere#487 review).
|
|
18318
|
+
nametag: () => this.getNametagForAddress(facadeAddressId)
|
|
18289
18319
|
}
|
|
18290
18320
|
});
|
|
18291
18321
|
this._paymentsV2Active = { index, facade };
|