@bsv/wallet-toolbox 1.2.44 → 1.2.46
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/out/src/CWIStyleWalletManager.d.ts.map +1 -1
- package/out/src/CWIStyleWalletManager.js +15 -20
- package/out/src/CWIStyleWalletManager.js.map +1 -1
- package/out/src/WalletPermissionsManager.d.ts.map +1 -1
- package/out/src/WalletPermissionsManager.js +12 -3
- package/out/src/WalletPermissionsManager.js.map +1 -1
- package/out/tsconfig.all.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/CWIStyleWalletManager.ts +17 -24
- package/src/WalletPermissionsManager.ts +12 -3
package/package.json
CHANGED
|
@@ -360,7 +360,11 @@ export class OverlayUMPTokenInteractor implements UMPTokenInteractor {
|
|
|
360
360
|
description: oldTokenToConsume ? 'Renew UMP token (consume old, create new)' : 'Create new UMP token',
|
|
361
361
|
inputs,
|
|
362
362
|
outputs,
|
|
363
|
-
inputBEEF: inputToken?.beef
|
|
363
|
+
inputBEEF: inputToken?.beef,
|
|
364
|
+
options: {
|
|
365
|
+
randomizeOutputs: false,
|
|
366
|
+
acceptDelayedBroadcast: false
|
|
367
|
+
}
|
|
364
368
|
},
|
|
365
369
|
adminOriginator
|
|
366
370
|
)
|
|
@@ -1040,7 +1044,7 @@ export class CWIStyleWalletManager implements WalletInterface {
|
|
|
1040
1044
|
await this.getFactor('presentationKey'),
|
|
1041
1045
|
await this.getFactor('recoveryKey'),
|
|
1042
1046
|
this.rootPrimaryKey,
|
|
1043
|
-
await this.getFactor('privilegedKey'
|
|
1047
|
+
await this.getFactor('privilegedKey'), // Get ROOT privileged key
|
|
1044
1048
|
this.profiles // Pass the updated profile list
|
|
1045
1049
|
)
|
|
1046
1050
|
|
|
@@ -1082,7 +1086,7 @@ export class CWIStyleWalletManager implements WalletInterface {
|
|
|
1082
1086
|
await this.getFactor('presentationKey'),
|
|
1083
1087
|
await this.getFactor('recoveryKey'),
|
|
1084
1088
|
this.rootPrimaryKey,
|
|
1085
|
-
await this.getFactor('privilegedKey'
|
|
1089
|
+
await this.getFactor('privilegedKey'), // Get ROOT privileged key
|
|
1086
1090
|
this.profiles // Pass updated list
|
|
1087
1091
|
)
|
|
1088
1092
|
}
|
|
@@ -1161,7 +1165,7 @@ export class CWIStyleWalletManager implements WalletInterface {
|
|
|
1161
1165
|
// Decrypt existing factors needed for re-encryption, using the *root* privileged key manager
|
|
1162
1166
|
const recoveryKey = await this.getFactor('recoveryKey')
|
|
1163
1167
|
const presentationKey = await this.getFactor('presentationKey')
|
|
1164
|
-
const rootPrivilegedKey = await this.getFactor('privilegedKey'
|
|
1168
|
+
const rootPrivilegedKey = await this.getFactor('privilegedKey') // Get ROOT privileged key
|
|
1165
1169
|
|
|
1166
1170
|
await this.updateAuthFactors(
|
|
1167
1171
|
passwordSalt,
|
|
@@ -1195,7 +1199,7 @@ export class CWIStyleWalletManager implements WalletInterface {
|
|
|
1195
1199
|
// Decrypt existing factors needed
|
|
1196
1200
|
const passwordKey = await this.getFactor('passwordKey')
|
|
1197
1201
|
const presentationKey = await this.getFactor('presentationKey')
|
|
1198
|
-
const rootPrivilegedKey = await this.getFactor('privilegedKey'
|
|
1202
|
+
const rootPrivilegedKey = await this.getFactor('privilegedKey') // Get ROOT privileged key
|
|
1199
1203
|
|
|
1200
1204
|
// Generate and save new recovery key
|
|
1201
1205
|
const newRecoveryKey = Random(32)
|
|
@@ -1226,7 +1230,7 @@ export class CWIStyleWalletManager implements WalletInterface {
|
|
|
1226
1230
|
// Decrypt existing factors
|
|
1227
1231
|
const recoveryKey = await this.getFactor('recoveryKey')
|
|
1228
1232
|
const passwordKey = await this.getFactor('passwordKey')
|
|
1229
|
-
const rootPrivilegedKey = await this.getFactor('privilegedKey'
|
|
1233
|
+
const rootPrivilegedKey = await this.getFactor('privilegedKey') // Get ROOT privileged key
|
|
1230
1234
|
|
|
1231
1235
|
await this.updateAuthFactors(
|
|
1232
1236
|
this.currentUMPToken.passwordSalt,
|
|
@@ -1268,8 +1272,7 @@ export class CWIStyleWalletManager implements WalletInterface {
|
|
|
1268
1272
|
* @returns The decrypted key bytes.
|
|
1269
1273
|
*/
|
|
1270
1274
|
private async getFactor(
|
|
1271
|
-
factorName: 'passwordKey' | 'presentationKey' | 'recoveryKey' | 'privilegedKey'
|
|
1272
|
-
getRoot: boolean = false
|
|
1275
|
+
factorName: 'passwordKey' | 'presentationKey' | 'recoveryKey' | 'privilegedKey'
|
|
1273
1276
|
): Promise<number[]> {
|
|
1274
1277
|
if (!this.authenticated || !this.currentUMPToken || !this.rootPrivilegedKeyManager) {
|
|
1275
1278
|
throw new Error(`Cannot get factor "${factorName}": Wallet not ready.`)
|
|
@@ -1356,13 +1359,7 @@ export class CWIStyleWalletManager implements WalletInterface {
|
|
|
1356
1359
|
if (profiles && profiles.length > 0) {
|
|
1357
1360
|
const profilesJson = JSON.stringify(profiles)
|
|
1358
1361
|
const profilesBytes = Utils.toArray(profilesJson, 'utf8')
|
|
1359
|
-
profilesEncrypted = (
|
|
1360
|
-
await tempRootPrivilegedKeyManager.encrypt({
|
|
1361
|
-
plaintext: profilesBytes,
|
|
1362
|
-
protocolID: [2, 'admin profile wrapping'], // Separate protocol for profiles
|
|
1363
|
-
keyID: '1'
|
|
1364
|
-
})
|
|
1365
|
-
).ciphertext
|
|
1362
|
+
profilesEncrypted = new SymmetricKey(rootPrimaryKey).encrypt(profilesBytes) as number[]
|
|
1366
1363
|
}
|
|
1367
1364
|
|
|
1368
1365
|
// Construct the new UMP token data
|
|
@@ -1405,7 +1402,7 @@ export class CWIStyleWalletManager implements WalletInterface {
|
|
|
1405
1402
|
const currentActiveId = this.activeProfileId
|
|
1406
1403
|
let walletToUse: WalletInterface | undefined = this.underlying
|
|
1407
1404
|
|
|
1408
|
-
if (currentActiveId.every(x => x === 0)) {
|
|
1405
|
+
if (!currentActiveId.every(x => x === 0)) {
|
|
1409
1406
|
console.log('Temporarily switching to default profile to update UMP token...')
|
|
1410
1407
|
await this.switchProfile(DEFAULT_PROFILE_ID) // This rebuilds this.underlying
|
|
1411
1408
|
walletToUse = this.underlying
|
|
@@ -1418,7 +1415,7 @@ export class CWIStyleWalletManager implements WalletInterface {
|
|
|
1418
1415
|
// Publish the new token on-chain, consuming the old one
|
|
1419
1416
|
try {
|
|
1420
1417
|
newTokenData.currentOutpoint = await this.UMPTokenInteractor.buildAndSend(
|
|
1421
|
-
walletToUse,
|
|
1418
|
+
walletToUse,
|
|
1422
1419
|
this.adminOriginator,
|
|
1423
1420
|
newTokenData,
|
|
1424
1421
|
oldTokenToConsume // Consume the previous token
|
|
@@ -1614,13 +1611,9 @@ export class CWIStyleWalletManager implements WalletInterface {
|
|
|
1614
1611
|
this.profiles = [] // Clear existing profiles before loading
|
|
1615
1612
|
if (this.currentUMPToken.profilesEncrypted && this.currentUMPToken.profilesEncrypted.length > 0) {
|
|
1616
1613
|
try {
|
|
1617
|
-
const decryptedProfileBytes = (
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
protocolID: [2, 'admin profile wrapping'], // Use profile protocol ID
|
|
1621
|
-
keyID: '1'
|
|
1622
|
-
})
|
|
1623
|
-
).plaintext
|
|
1614
|
+
const decryptedProfileBytes = new SymmetricKey(rootPrimaryKey).decrypt(
|
|
1615
|
+
this.currentUMPToken.profilesEncrypted
|
|
1616
|
+
) as number[]
|
|
1624
1617
|
const profilesJson = Utils.toUTF8(decryptedProfileBytes)
|
|
1625
1618
|
this.profiles = JSON.parse(profilesJson) as Profile[]
|
|
1626
1619
|
} catch (error) {
|
|
@@ -1289,7 +1289,10 @@ export class WalletPermissionsManager implements WalletInterface {
|
|
|
1289
1289
|
basket: basketName,
|
|
1290
1290
|
tags
|
|
1291
1291
|
}
|
|
1292
|
-
]
|
|
1292
|
+
],
|
|
1293
|
+
options: {
|
|
1294
|
+
acceptDelayedBroadcast: false
|
|
1295
|
+
}
|
|
1293
1296
|
},
|
|
1294
1297
|
this.adminOriginator
|
|
1295
1298
|
)
|
|
@@ -1347,7 +1350,10 @@ export class WalletPermissionsManager implements WalletInterface {
|
|
|
1347
1350
|
basket: BASKET_MAP[r.type],
|
|
1348
1351
|
tags
|
|
1349
1352
|
}
|
|
1350
|
-
]
|
|
1353
|
+
],
|
|
1354
|
+
options: {
|
|
1355
|
+
acceptDelayedBroadcast: false
|
|
1356
|
+
}
|
|
1351
1357
|
},
|
|
1352
1358
|
this.adminOriginator
|
|
1353
1359
|
)
|
|
@@ -1743,7 +1749,10 @@ export class WalletPermissionsManager implements WalletInterface {
|
|
|
1743
1749
|
unlockingScriptLength: 73, // length of signature
|
|
1744
1750
|
inputDescription: `Consume old permission token`
|
|
1745
1751
|
}
|
|
1746
|
-
]
|
|
1752
|
+
],
|
|
1753
|
+
options: {
|
|
1754
|
+
acceptDelayedBroadcast: false
|
|
1755
|
+
}
|
|
1747
1756
|
},
|
|
1748
1757
|
this.adminOriginator
|
|
1749
1758
|
)
|