@dynamic-labs-wallet/browser 0.0.0-beta.317 → 0.0.0-beta.318
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/index.cjs.js +205 -122
- package/index.esm.js +206 -123
- package/package.json +4 -4
- package/src/client.d.ts +27 -5
- package/src/client.d.ts.map +1 -1
- package/src/services/encryption.d.ts +6 -6
- package/src/services/encryption.d.ts.map +1 -1
package/index.cjs.js
CHANGED
|
@@ -652,6 +652,84 @@ const createBackupData = ({ encryptedKeyShares, accountAddress, thresholdSignatu
|
|
|
652
652
|
}
|
|
653
653
|
};
|
|
654
654
|
|
|
655
|
+
const ALG_LABEL_RSA = 'HYBRID-RSA-AES-256';
|
|
656
|
+
/**
|
|
657
|
+
* Convert base64 to base64url encoding
|
|
658
|
+
*/ const toBase64Url = (buffer)=>{
|
|
659
|
+
const base64 = Buffer.from(buffer).toString('base64');
|
|
660
|
+
return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
|
661
|
+
};
|
|
662
|
+
/**
|
|
663
|
+
* Convert ArrayBuffer to base64url
|
|
664
|
+
*/ const arrayBufferToBase64Url = (buffer)=>{
|
|
665
|
+
return toBase64Url(buffer);
|
|
666
|
+
};
|
|
667
|
+
/**
|
|
668
|
+
* Import RSA public key from PEM format
|
|
669
|
+
*/ const importRSAPublicKey = async (publicKeyPem)=>{
|
|
670
|
+
// Remove PEM headers and decode base64
|
|
671
|
+
const pemHeader = '-----BEGIN PUBLIC KEY-----';
|
|
672
|
+
const pemFooter = '-----END PUBLIC KEY-----';
|
|
673
|
+
const pemContents = publicKeyPem.replace(pemHeader, '').replace(pemFooter, '').replace(/\s/g, '');
|
|
674
|
+
const binaryDer = Buffer.from(pemContents, 'base64').toString('binary');
|
|
675
|
+
const keyData = new Uint8Array(binaryDer.length);
|
|
676
|
+
for(let i = 0; i < binaryDer.length; i++){
|
|
677
|
+
keyData[i] = binaryDer.charCodeAt(i);
|
|
678
|
+
}
|
|
679
|
+
return await crypto.subtle.importKey('spki', keyData, {
|
|
680
|
+
name: 'RSA-OAEP',
|
|
681
|
+
hash: 'SHA-256'
|
|
682
|
+
}, false, [
|
|
683
|
+
'encrypt'
|
|
684
|
+
]);
|
|
685
|
+
};
|
|
686
|
+
// encodedEnvelopeBytes intentionally omitted; alg/ct/ek/iv/tag/kid is sufficient
|
|
687
|
+
/**
|
|
688
|
+
* Encrypts data using HYBRID-RSA-AES-256 encryption scheme with Web Crypto API.
|
|
689
|
+
* 1. Generate random AES-256 key
|
|
690
|
+
* 2. Encrypt AES key with RSA public key
|
|
691
|
+
* 3. Encrypt data with AES-256-GCM
|
|
692
|
+
*/ const encryptDelegatedKeyShare = async (data, publicKeyPem, keyId)=>{
|
|
693
|
+
try {
|
|
694
|
+
// Step 1: Generate a random AES-256 key and 16-byte IV
|
|
695
|
+
const aesKey = await crypto.subtle.generateKey({
|
|
696
|
+
name: 'AES-GCM',
|
|
697
|
+
length: 256
|
|
698
|
+
}, true, [
|
|
699
|
+
'encrypt'
|
|
700
|
+
]);
|
|
701
|
+
const iv = crypto.getRandomValues(new Uint8Array(16)); // 128-bit IV for GCM
|
|
702
|
+
// Step 2: Encrypt the data with AES-256-GCM
|
|
703
|
+
const plaintext = new TextEncoder().encode(data);
|
|
704
|
+
const encryptedData = await crypto.subtle.encrypt({
|
|
705
|
+
name: 'AES-GCM',
|
|
706
|
+
iv: iv
|
|
707
|
+
}, aesKey, plaintext);
|
|
708
|
+
// Extract the auth tag from the encrypted data (last 16 bytes)
|
|
709
|
+
const encryptedDataArray = new Uint8Array(encryptedData);
|
|
710
|
+
const authTag = encryptedDataArray.slice(-16);
|
|
711
|
+
const ciphertext = encryptedDataArray.slice(0, -16);
|
|
712
|
+
// Step 3: Encrypt the AES key with RSA public key
|
|
713
|
+
const rsaPublicKey = await importRSAPublicKey(publicKeyPem);
|
|
714
|
+
// Export the AES key to encrypt it
|
|
715
|
+
const aesKeyData = await crypto.subtle.exportKey('raw', aesKey);
|
|
716
|
+
const encryptedAesKey = await crypto.subtle.encrypt({
|
|
717
|
+
name: 'RSA-OAEP'
|
|
718
|
+
}, rsaPublicKey, aesKeyData);
|
|
719
|
+
return _extends({
|
|
720
|
+
alg: ALG_LABEL_RSA,
|
|
721
|
+
iv: arrayBufferToBase64Url(iv.buffer),
|
|
722
|
+
ct: arrayBufferToBase64Url(ciphertext.buffer),
|
|
723
|
+
tag: arrayBufferToBase64Url(authTag.buffer),
|
|
724
|
+
ek: arrayBufferToBase64Url(encryptedAesKey)
|
|
725
|
+
}, keyId ? {
|
|
726
|
+
kid: keyId
|
|
727
|
+
} : {});
|
|
728
|
+
} catch (error) {
|
|
729
|
+
throw new Error(`Encryption failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
|
|
655
733
|
const localStorageWriteTest = {
|
|
656
734
|
tested: false,
|
|
657
735
|
writable: false
|
|
@@ -721,95 +799,21 @@ const localStorageWriteTest = {
|
|
|
721
799
|
}
|
|
722
800
|
});
|
|
723
801
|
|
|
724
|
-
/** Algorithm label for the new hybrid encryption standard */ const ALG_LABEL_RSA = 'HYBRID-RSA-AES-256';
|
|
725
|
-
/**
|
|
726
|
-
* Convert base64 to base64url encoding
|
|
727
|
-
*/ const toBase64Url = (buffer)=>{
|
|
728
|
-
const base64 = Buffer.from(buffer).toString('base64');
|
|
729
|
-
return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
|
730
|
-
};
|
|
731
|
-
/**
|
|
732
|
-
* Convert ArrayBuffer to base64url
|
|
733
|
-
*/ const arrayBufferToBase64Url = (buffer)=>{
|
|
734
|
-
return toBase64Url(buffer);
|
|
735
|
-
};
|
|
736
|
-
/**
|
|
737
|
-
* Import RSA public key from PEM format
|
|
738
|
-
*/ const importRSAPublicKey = async (publicKeyPem)=>{
|
|
739
|
-
// Remove PEM headers and decode base64
|
|
740
|
-
const pemHeader = '-----BEGIN PUBLIC KEY-----';
|
|
741
|
-
const pemFooter = '-----END PUBLIC KEY-----';
|
|
742
|
-
const pemContents = publicKeyPem.replace(pemHeader, '').replace(pemFooter, '').replace(/\s/g, '');
|
|
743
|
-
const binaryDer = Buffer.from(pemContents, 'base64').toString('binary');
|
|
744
|
-
const keyData = new Uint8Array(binaryDer.length);
|
|
745
|
-
for(let i = 0; i < binaryDer.length; i++){
|
|
746
|
-
keyData[i] = binaryDer.charCodeAt(i);
|
|
747
|
-
}
|
|
748
|
-
return await crypto.subtle.importKey('spki', keyData, {
|
|
749
|
-
name: 'RSA-OAEP',
|
|
750
|
-
hash: 'SHA-256'
|
|
751
|
-
}, false, [
|
|
752
|
-
'encrypt'
|
|
753
|
-
]);
|
|
754
|
-
};
|
|
755
|
-
/**
|
|
756
|
-
* Creates the encoded envelope bytes from the encrypted data components
|
|
757
|
-
*/ const createEncodedEnvelopeBytes = (iv, ciphertext, authTag, encryptedAesKey)=>{
|
|
758
|
-
const envelopeData = {
|
|
759
|
-
algorithm: ALG_LABEL_RSA,
|
|
760
|
-
iv: arrayBufferToBase64Url(iv.buffer),
|
|
761
|
-
encryptedData: arrayBufferToBase64Url(ciphertext.buffer),
|
|
762
|
-
authTag: arrayBufferToBase64Url(authTag.buffer),
|
|
763
|
-
encryptedKey: arrayBufferToBase64Url(encryptedAesKey)
|
|
764
|
-
};
|
|
765
|
-
return Buffer.from(new TextEncoder().encode(JSON.stringify(envelopeData))).toString('base64');
|
|
766
|
-
};
|
|
767
|
-
/**
|
|
768
|
-
* Encrypts data using HYBRID-RSA-AES-256 encryption scheme with Web Crypto API.
|
|
769
|
-
* 1. Generate random AES-256 key
|
|
770
|
-
* 2. Encrypt AES key with RSA public key
|
|
771
|
-
* 3. Encrypt data with AES-256-GCM
|
|
772
|
-
*/ const encryptDelegatedKeyShare = async (data, publicKeyPem)=>{
|
|
773
|
-
try {
|
|
774
|
-
// Step 1: Generate a random AES-256 key and 16-byte IV
|
|
775
|
-
const aesKey = await crypto.subtle.generateKey({
|
|
776
|
-
name: 'AES-GCM',
|
|
777
|
-
length: 256
|
|
778
|
-
}, true, [
|
|
779
|
-
'encrypt'
|
|
780
|
-
]);
|
|
781
|
-
const iv = crypto.getRandomValues(new Uint8Array(16)); // 128-bit IV for GCM
|
|
782
|
-
// Step 2: Encrypt the data with AES-256-GCM
|
|
783
|
-
const plaintext = new TextEncoder().encode(data);
|
|
784
|
-
const encryptedData = await crypto.subtle.encrypt({
|
|
785
|
-
name: 'AES-GCM',
|
|
786
|
-
iv: iv
|
|
787
|
-
}, aesKey, plaintext);
|
|
788
|
-
// Extract the auth tag from the encrypted data (last 16 bytes)
|
|
789
|
-
const encryptedDataArray = new Uint8Array(encryptedData);
|
|
790
|
-
const authTag = encryptedDataArray.slice(-16);
|
|
791
|
-
const ciphertext = encryptedDataArray.slice(0, -16);
|
|
792
|
-
// Step 3: Encrypt the AES key with RSA public key
|
|
793
|
-
const rsaPublicKey = await importRSAPublicKey(publicKeyPem);
|
|
794
|
-
// Export the AES key to encrypt it
|
|
795
|
-
const aesKeyData = await crypto.subtle.exportKey('raw', aesKey);
|
|
796
|
-
const encryptedAesKey = await crypto.subtle.encrypt({
|
|
797
|
-
name: 'RSA-OAEP'
|
|
798
|
-
}, rsaPublicKey, aesKeyData);
|
|
799
|
-
return {
|
|
800
|
-
algorithm: ALG_LABEL_RSA,
|
|
801
|
-
iv: arrayBufferToBase64Url(iv.buffer),
|
|
802
|
-
encryptedData: arrayBufferToBase64Url(ciphertext.buffer),
|
|
803
|
-
authTag: arrayBufferToBase64Url(authTag.buffer),
|
|
804
|
-
encryptedKey: arrayBufferToBase64Url(encryptedAesKey),
|
|
805
|
-
encodedEnvelopeBytes: createEncodedEnvelopeBytes(iv, ciphertext, authTag, encryptedAesKey)
|
|
806
|
-
};
|
|
807
|
-
} catch (error) {
|
|
808
|
-
throw new Error(`Encryption failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
809
|
-
}
|
|
810
|
-
};
|
|
811
|
-
|
|
812
802
|
class DynamicWalletClient {
|
|
803
|
+
async initializeForwardMPCClient() {
|
|
804
|
+
try {
|
|
805
|
+
await this.apiClient.forwardMPCClient.connect();
|
|
806
|
+
logger.info('Connected to ForwardMPC enclave websocket. Instance: ' + this.instanceId);
|
|
807
|
+
try {
|
|
808
|
+
await this.apiClient.forwardMPCClient.handshake();
|
|
809
|
+
logger.info('Handshaked with ForwardMPC enclave websocket. Instance: ' + this.instanceId);
|
|
810
|
+
} catch (error) {
|
|
811
|
+
logger.error('Error handshaking with ForwardMPC enclave websocket. Instance: ' + this.instanceId, error);
|
|
812
|
+
}
|
|
813
|
+
} catch (error) {
|
|
814
|
+
logger.error('Error connecting to ForwardMPC enclave websocket. Instance: ' + this.instanceId, error);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
813
817
|
getAuthMode() {
|
|
814
818
|
return this.authMode;
|
|
815
819
|
}
|
|
@@ -1138,6 +1142,32 @@ class DynamicWalletClient {
|
|
|
1138
1142
|
});
|
|
1139
1143
|
return data;
|
|
1140
1144
|
}
|
|
1145
|
+
async forwardMPCClientSign({ chainName, message, roomId, keyShare, derivationPath, formattedMessage }) {
|
|
1146
|
+
if (!this.apiClient.forwardMPCClient.connected) {
|
|
1147
|
+
await this.initializeForwardMPCClient();
|
|
1148
|
+
}
|
|
1149
|
+
logger.info('Forward MPC enabled, signing message with forward MPC');
|
|
1150
|
+
const signature = await this.apiClient.forwardMPCClient.signMessage({
|
|
1151
|
+
keyshare: keyShare,
|
|
1152
|
+
message: chainName === 'EVM' || chainName === 'SUI' ? message : formattedMessage,
|
|
1153
|
+
relayDomain: this.baseMPCRelayApiUrl || '',
|
|
1154
|
+
signingAlgo: chainName === 'EVM' ? 'ECDSA' : 'ED25519',
|
|
1155
|
+
hashAlgo: chainName === 'EVM' ? 'keccak256' : undefined,
|
|
1156
|
+
derivationPath: derivationPath,
|
|
1157
|
+
roomUuid: roomId
|
|
1158
|
+
});
|
|
1159
|
+
const signatureBytes = signature.data.signature;
|
|
1160
|
+
if (!(signatureBytes instanceof Uint8Array)) {
|
|
1161
|
+
throw new TypeError(`Invalid signature format: expected Uint8Array, got ${typeof signatureBytes}`);
|
|
1162
|
+
}
|
|
1163
|
+
// Convert to EcdsaSignature
|
|
1164
|
+
if (chainName === 'EVM') {
|
|
1165
|
+
const ecdsaSignature = web.EcdsaSignature.fromBuffer(signatureBytes);
|
|
1166
|
+
return ecdsaSignature;
|
|
1167
|
+
} else {
|
|
1168
|
+
return signatureBytes;
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1141
1171
|
async clientSign({ chainName, message, roomId, keyShare, derivationPath, isFormatted, dynamicRequestId }) {
|
|
1142
1172
|
try {
|
|
1143
1173
|
const mpcSigner = getMPCSigner({
|
|
@@ -1152,6 +1182,16 @@ class DynamicWalletClient {
|
|
|
1152
1182
|
derivationPath,
|
|
1153
1183
|
isFormatted
|
|
1154
1184
|
});
|
|
1185
|
+
if (this.forwardMPCEnabled) {
|
|
1186
|
+
return this.forwardMPCClientSign({
|
|
1187
|
+
chainName,
|
|
1188
|
+
message,
|
|
1189
|
+
roomId,
|
|
1190
|
+
keyShare,
|
|
1191
|
+
derivationPath,
|
|
1192
|
+
formattedMessage
|
|
1193
|
+
});
|
|
1194
|
+
}
|
|
1155
1195
|
const signature = await mpcSigner.sign(roomId, keyShare, formattedMessage, derivationPath);
|
|
1156
1196
|
return signature;
|
|
1157
1197
|
} catch (error) {
|
|
@@ -1342,10 +1382,9 @@ class DynamicWalletClient {
|
|
|
1342
1382
|
existingClientKeyShares
|
|
1343
1383
|
};
|
|
1344
1384
|
}
|
|
1345
|
-
async reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, password = undefined, signedSessionId, backupToGoogleDrive = false, delegateToProjectEnvironment = false, mfaToken }) {
|
|
1385
|
+
async reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, password = undefined, signedSessionId, backupToGoogleDrive = false, delegateToProjectEnvironment = false, mfaToken, revokeDelegation = false }) {
|
|
1346
1386
|
const dynamicRequestId = uuid.v4();
|
|
1347
1387
|
try {
|
|
1348
|
-
var _publicKey_key, _publicKey_key1;
|
|
1349
1388
|
await this.verifyPassword({
|
|
1350
1389
|
accountAddress,
|
|
1351
1390
|
password,
|
|
@@ -1382,7 +1421,8 @@ class DynamicWalletClient {
|
|
|
1382
1421
|
newThresholdSignatureScheme,
|
|
1383
1422
|
dynamicRequestId,
|
|
1384
1423
|
delegateToProjectEnvironment,
|
|
1385
|
-
mfaToken
|
|
1424
|
+
mfaToken,
|
|
1425
|
+
revokeDelegation
|
|
1386
1426
|
});
|
|
1387
1427
|
const { roomId, serverKeygenIds, newServerKeygenIds = [] } = data;
|
|
1388
1428
|
// Get the MPC config for the threshold signature scheme
|
|
@@ -1404,7 +1444,7 @@ class DynamicWalletClient {
|
|
|
1404
1444
|
Promise.all(existingResharePromises),
|
|
1405
1445
|
Promise.all(newResharePromises)
|
|
1406
1446
|
]);
|
|
1407
|
-
const
|
|
1447
|
+
const clientKeysharesToLocalStorage = delegateToProjectEnvironment ? [
|
|
1408
1448
|
...existingReshareResults
|
|
1409
1449
|
] : [
|
|
1410
1450
|
...existingReshareResults,
|
|
@@ -1413,33 +1453,20 @@ class DynamicWalletClient {
|
|
|
1413
1453
|
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
|
|
1414
1454
|
thresholdSignatureScheme: newThresholdSignatureScheme
|
|
1415
1455
|
});
|
|
1456
|
+
// store client key shares to localStorage
|
|
1416
1457
|
await this.setClientKeySharesToLocalStorage({
|
|
1417
1458
|
accountAddress,
|
|
1418
|
-
clientKeyShares:
|
|
1459
|
+
clientKeyShares: clientKeysharesToLocalStorage,
|
|
1419
1460
|
overwriteOrMerge: 'overwrite'
|
|
1420
1461
|
});
|
|
1462
|
+
// if delegateToProjectEnvironment is true, we need to update location for the delegated share
|
|
1463
|
+
const delegatedKeyshare = delegateToProjectEnvironment ? newReshareResults[0] : undefined;
|
|
1421
1464
|
await this.storeEncryptedBackupByWallet({
|
|
1422
1465
|
accountAddress,
|
|
1423
1466
|
password,
|
|
1424
1467
|
signedSessionId,
|
|
1425
1468
|
backupToGoogleDrive,
|
|
1426
|
-
|
|
1427
|
-
location: core.BackupLocation.DELEGATED
|
|
1428
|
-
}))
|
|
1429
|
-
});
|
|
1430
|
-
const publicKey = await this.apiClient.getDelegatedEncryptionKey({
|
|
1431
|
-
environmentId: this.environmentId
|
|
1432
|
-
});
|
|
1433
|
-
if (!(publicKey == null ? void 0 : (_publicKey_key = publicKey.key) == null ? void 0 : _publicKey_key.publicKeyPemB64)) {
|
|
1434
|
-
throw new Error('Public key not found');
|
|
1435
|
-
}
|
|
1436
|
-
const encryptedDelegatedKeyShareEnvelope = await encryptDelegatedKeyShare(JSON.stringify(clientKeyshares[0]), publicKey == null ? void 0 : (_publicKey_key1 = publicKey.key) == null ? void 0 : _publicKey_key1.publicKeyPemB64);
|
|
1437
|
-
await this.apiClient.publishDelegatedKeyShare({
|
|
1438
|
-
walletId: this.walletMap[accountAddress].walletId,
|
|
1439
|
-
encryptedKeyShare: encryptedDelegatedKeyShareEnvelope,
|
|
1440
|
-
signedSessionId,
|
|
1441
|
-
requiresSignedSessionId: this.requiresSignedSessionId(),
|
|
1442
|
-
dynamicRequestId
|
|
1469
|
+
delegatedKeyshare
|
|
1443
1470
|
});
|
|
1444
1471
|
} catch (error) {
|
|
1445
1472
|
logError({
|
|
@@ -1466,7 +1493,7 @@ class DynamicWalletClient {
|
|
|
1466
1493
|
throw error;
|
|
1467
1494
|
}
|
|
1468
1495
|
}
|
|
1469
|
-
async
|
|
1496
|
+
async performDelegationOperation({ accountAddress, password, signedSessionId, mfaToken, newThresholdSignatureScheme, revokeDelegation = false, operationName }) {
|
|
1470
1497
|
try {
|
|
1471
1498
|
const delegateToProjectEnvironment = this.featureFlags && this.featureFlags[core.FEATURE_FLAGS.ENABLE_DELEGATED_KEY_SHARES_FLAG] === true;
|
|
1472
1499
|
if (!delegateToProjectEnvironment) {
|
|
@@ -1486,19 +1513,17 @@ class DynamicWalletClient {
|
|
|
1486
1513
|
chainName: this.walletMap[accountAddress].chainName,
|
|
1487
1514
|
accountAddress,
|
|
1488
1515
|
oldThresholdSignatureScheme: currentThresholdSignatureScheme,
|
|
1489
|
-
newThresholdSignatureScheme
|
|
1516
|
+
newThresholdSignatureScheme,
|
|
1490
1517
|
password,
|
|
1491
1518
|
signedSessionId,
|
|
1492
1519
|
backupToGoogleDrive: false,
|
|
1493
1520
|
delegateToProjectEnvironment: true,
|
|
1494
|
-
mfaToken
|
|
1521
|
+
mfaToken,
|
|
1522
|
+
revokeDelegation
|
|
1495
1523
|
});
|
|
1496
|
-
const backupInfo = this.walletMap[accountAddress].clientKeySharesBackupInfo;
|
|
1497
|
-
const delegatedKeyShares = backupInfo.backups[core.BackupLocation.DELEGATED] || [];
|
|
1498
|
-
return delegatedKeyShares;
|
|
1499
1524
|
} catch (error) {
|
|
1500
1525
|
logError({
|
|
1501
|
-
message:
|
|
1526
|
+
message: `Error in ${operationName}`,
|
|
1502
1527
|
error: error,
|
|
1503
1528
|
context: {
|
|
1504
1529
|
accountAddress
|
|
@@ -1507,6 +1532,30 @@ class DynamicWalletClient {
|
|
|
1507
1532
|
throw error;
|
|
1508
1533
|
}
|
|
1509
1534
|
}
|
|
1535
|
+
async delegateKeyShares({ accountAddress, password = undefined, signedSessionId, mfaToken }) {
|
|
1536
|
+
await this.performDelegationOperation({
|
|
1537
|
+
accountAddress,
|
|
1538
|
+
password,
|
|
1539
|
+
signedSessionId,
|
|
1540
|
+
mfaToken,
|
|
1541
|
+
newThresholdSignatureScheme: core.ThresholdSignatureScheme.TWO_OF_THREE,
|
|
1542
|
+
operationName: 'delegateKeyShares'
|
|
1543
|
+
});
|
|
1544
|
+
const backupInfo = this.walletMap[accountAddress].clientKeySharesBackupInfo;
|
|
1545
|
+
const delegatedKeyShares = backupInfo.backups[core.BackupLocation.DELEGATED] || [];
|
|
1546
|
+
return delegatedKeyShares;
|
|
1547
|
+
}
|
|
1548
|
+
async revokeDelegation({ accountAddress, password = undefined, signedSessionId, mfaToken }) {
|
|
1549
|
+
await this.performDelegationOperation({
|
|
1550
|
+
accountAddress,
|
|
1551
|
+
password,
|
|
1552
|
+
signedSessionId,
|
|
1553
|
+
mfaToken,
|
|
1554
|
+
newThresholdSignatureScheme: core.ThresholdSignatureScheme.TWO_OF_TWO,
|
|
1555
|
+
revokeDelegation: true,
|
|
1556
|
+
operationName: 'revokeDelegation'
|
|
1557
|
+
});
|
|
1558
|
+
}
|
|
1510
1559
|
async exportKey({ accountAddress, chainName, password = undefined, signedSessionId, mfaToken }) {
|
|
1511
1560
|
const dynamicRequestId = uuid.v4();
|
|
1512
1561
|
try {
|
|
@@ -1690,6 +1739,10 @@ class DynamicWalletClient {
|
|
|
1690
1739
|
* 4. Updates backup metadata and synchronizes wallet state
|
|
1691
1740
|
* 5. Persists the updated wallet map to local storage
|
|
1692
1741
|
*
|
|
1742
|
+
* **Delegated Key Shares:**
|
|
1743
|
+
* - When delegatedKeyshare is provided, the method will not store the delegated key share but it will mark the delegated share as backed up on Dynamic's backend
|
|
1744
|
+
* - and encrypt the delegated key share to publish it to the webhook
|
|
1745
|
+
*
|
|
1693
1746
|
* @param params - The backup operation parameters
|
|
1694
1747
|
* @param params.accountAddress - The account address of the wallet to backup
|
|
1695
1748
|
* @param params.clientKeyShares - Optional specific key shares to backup (uses localStorage if not provided)
|
|
@@ -1697,7 +1750,7 @@ class DynamicWalletClient {
|
|
|
1697
1750
|
* @param params.signedSessionId - Optional signed session ID for authentication
|
|
1698
1751
|
* @param params.backupToGoogleDrive - Whether to backup to Google Drive (defaults to false)
|
|
1699
1752
|
* @returns Promise with backup metadata including share locations and IDs
|
|
1700
|
-
*/ async storeEncryptedBackupByWallet({ accountAddress, clientKeyShares = undefined, password = undefined, signedSessionId, backupToGoogleDrive = false,
|
|
1753
|
+
*/ async storeEncryptedBackupByWallet({ accountAddress, clientKeyShares = undefined, password = undefined, signedSessionId, backupToGoogleDrive = false, delegatedKeyshare = undefined }) {
|
|
1701
1754
|
const dynamicRequestId = uuid.v4();
|
|
1702
1755
|
try {
|
|
1703
1756
|
var _this_walletMap_accountAddress, _this_walletMap_accountAddress_clientKeySharesBackupInfo_backups_BackupLocation_GOOGLE_DRIVE, _this_walletMap_accountAddress_clientKeySharesBackupInfo_backups, _this_walletMap_accountAddress_clientKeySharesBackupInfo, _this_walletMap_accountAddress1;
|
|
@@ -1765,8 +1818,31 @@ class DynamicWalletClient {
|
|
|
1765
1818
|
location: core.BackupLocation.GOOGLE_DRIVE
|
|
1766
1819
|
});
|
|
1767
1820
|
}
|
|
1768
|
-
if
|
|
1769
|
-
|
|
1821
|
+
// if delegatedKeyshare is provided, we encrypt the delegated key share and publish it to the webhook
|
|
1822
|
+
// after publish confirmed, we mark the delegated share as backed up on Dynamic's backend
|
|
1823
|
+
if (delegatedKeyshare) {
|
|
1824
|
+
var _publicKey_key, _publicKey_key1, _publicKey_key2;
|
|
1825
|
+
const publicKey = await this.apiClient.getDelegatedEncryptionKey({
|
|
1826
|
+
environmentId: this.environmentId
|
|
1827
|
+
});
|
|
1828
|
+
if (!(publicKey == null ? void 0 : (_publicKey_key = publicKey.key) == null ? void 0 : _publicKey_key.publicKeyPemB64)) {
|
|
1829
|
+
throw new Error('Public key not found');
|
|
1830
|
+
}
|
|
1831
|
+
var _publicKey_key_keyId;
|
|
1832
|
+
const encryptedDelegatedKeyShareEnvelope = await encryptDelegatedKeyShare(JSON.stringify(delegatedKeyshare), publicKey == null ? void 0 : (_publicKey_key1 = publicKey.key) == null ? void 0 : _publicKey_key1.publicKeyPemB64, (_publicKey_key_keyId = publicKey == null ? void 0 : (_publicKey_key2 = publicKey.key) == null ? void 0 : _publicKey_key2.keyId) != null ? _publicKey_key_keyId : publicKey == null ? void 0 : publicKey.keyId);
|
|
1833
|
+
const { status } = await this.apiClient.publishDelegatedKeyShare({
|
|
1834
|
+
walletId: this.walletMap[accountAddress].walletId,
|
|
1835
|
+
encryptedKeyShare: encryptedDelegatedKeyShareEnvelope,
|
|
1836
|
+
signedSessionId,
|
|
1837
|
+
requiresSignedSessionId: this.requiresSignedSessionId(),
|
|
1838
|
+
dynamicRequestId
|
|
1839
|
+
});
|
|
1840
|
+
if (status !== 200) {
|
|
1841
|
+
throw new Error('Failed to publish delegated key share');
|
|
1842
|
+
}
|
|
1843
|
+
locations.push({
|
|
1844
|
+
location: core.BackupLocation.DELEGATED
|
|
1845
|
+
});
|
|
1770
1846
|
}
|
|
1771
1847
|
const backupData = await this.apiClient.markKeySharesAsBackedUp({
|
|
1772
1848
|
walletId: this.walletMap[accountAddress].walletId,
|
|
@@ -2466,7 +2542,7 @@ class DynamicWalletClient {
|
|
|
2466
2542
|
this.apiClient.syncAuthToken(authToken);
|
|
2467
2543
|
}
|
|
2468
2544
|
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, storageKey, debug, featureFlags, authMode = core.AuthMode.HEADER, authToken = undefined, // Represents the version of the client SDK used by developer
|
|
2469
|
-
sdkVersion }){
|
|
2545
|
+
sdkVersion, forwardMPCClient }){
|
|
2470
2546
|
this.userId = undefined;
|
|
2471
2547
|
this.sessionId = undefined;
|
|
2472
2548
|
this.initializePromise = null;
|
|
@@ -2475,6 +2551,7 @@ class DynamicWalletClient {
|
|
|
2475
2551
|
;
|
|
2476
2552
|
this.memoryStorage = null;
|
|
2477
2553
|
this.iframe = null;
|
|
2554
|
+
this.forwardMPCEnabled = false;
|
|
2478
2555
|
this.featureFlags = {};
|
|
2479
2556
|
this.environmentId = environmentId;
|
|
2480
2557
|
this.storageKey = `${STORAGE_KEY}-${storageKey != null ? storageKey : environmentId}`;
|
|
@@ -2486,7 +2563,8 @@ class DynamicWalletClient {
|
|
|
2486
2563
|
authToken,
|
|
2487
2564
|
baseApiUrl,
|
|
2488
2565
|
authMode,
|
|
2489
|
-
sdkVersion
|
|
2566
|
+
sdkVersion,
|
|
2567
|
+
forwardMPCClient
|
|
2490
2568
|
});
|
|
2491
2569
|
this.debug = Boolean(debug);
|
|
2492
2570
|
this.logger.setLogLevel(this.debug ? logger$1.LogLevel.DEBUG : DEFAULT_LOG_LEVEL);
|
|
@@ -2506,6 +2584,11 @@ class DynamicWalletClient {
|
|
|
2506
2584
|
if (authMode === core.AuthMode.HEADER && authToken) {
|
|
2507
2585
|
this.initLoggerContext(authToken);
|
|
2508
2586
|
}
|
|
2587
|
+
this.forwardMPCEnabled = this.featureFlags && this.featureFlags[core.FEATURE_FLAGS.ENABLE_FORWARD_MPC_CLIENT_FLAG] === true;
|
|
2588
|
+
// if forwardMPCEnabled is true and forwardMPCClient is not provided, initialize the forwardMPCClient
|
|
2589
|
+
if (this.forwardMPCEnabled && !forwardMPCClient) {
|
|
2590
|
+
this.initializeForwardMPCClient();
|
|
2591
|
+
}
|
|
2509
2592
|
}
|
|
2510
2593
|
}
|
|
2511
2594
|
|
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SigningAlgorithm, MPC_RELAY_PROD_API_URL, getMPCChainConfig, AuthMode, BackupLocation, parseNamespacedVersion, getClientThreshold, MPC_CONFIG, getTSSConfig, WalletOperation, getReshareConfig, FEATURE_FLAGS, ThresholdSignatureScheme, verifiedCredentialNameToChainEnum, DynamicApiClient, getEnvironmentFromUrl, IFRAME_DOMAIN_MAP } from '@dynamic-labs-wallet/core';
|
|
2
2
|
export * from '@dynamic-labs-wallet/core';
|
|
3
|
-
import { BIP340, ExportableEd25519, Ecdsa, MessageHash, EcdsaKeygenResult, ExportableEd25519KeygenResult, BIP340KeygenResult } from '#internal/web';
|
|
3
|
+
import { BIP340, ExportableEd25519, Ecdsa, MessageHash, EcdsaSignature, EcdsaKeygenResult, ExportableEd25519KeygenResult, BIP340KeygenResult } from '#internal/web';
|
|
4
4
|
export { BIP340, BIP340InitKeygenResult, BIP340KeygenResult, Ecdsa, EcdsaInitKeygenResult, EcdsaKeygenResult, EcdsaPublicKey, EcdsaSignature, Ed25519, Ed25519InitKeygenResult, Ed25519KeygenResult, MessageHash } from '#internal/web';
|
|
5
5
|
import { gte } from 'semver';
|
|
6
6
|
import { v4 } from 'uuid';
|
|
@@ -653,6 +653,84 @@ const createBackupData = ({ encryptedKeyShares, accountAddress, thresholdSignatu
|
|
|
653
653
|
}
|
|
654
654
|
};
|
|
655
655
|
|
|
656
|
+
const ALG_LABEL_RSA = 'HYBRID-RSA-AES-256';
|
|
657
|
+
/**
|
|
658
|
+
* Convert base64 to base64url encoding
|
|
659
|
+
*/ const toBase64Url = (buffer)=>{
|
|
660
|
+
const base64 = Buffer.from(buffer).toString('base64');
|
|
661
|
+
return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
|
662
|
+
};
|
|
663
|
+
/**
|
|
664
|
+
* Convert ArrayBuffer to base64url
|
|
665
|
+
*/ const arrayBufferToBase64Url = (buffer)=>{
|
|
666
|
+
return toBase64Url(buffer);
|
|
667
|
+
};
|
|
668
|
+
/**
|
|
669
|
+
* Import RSA public key from PEM format
|
|
670
|
+
*/ const importRSAPublicKey = async (publicKeyPem)=>{
|
|
671
|
+
// Remove PEM headers and decode base64
|
|
672
|
+
const pemHeader = '-----BEGIN PUBLIC KEY-----';
|
|
673
|
+
const pemFooter = '-----END PUBLIC KEY-----';
|
|
674
|
+
const pemContents = publicKeyPem.replace(pemHeader, '').replace(pemFooter, '').replace(/\s/g, '');
|
|
675
|
+
const binaryDer = Buffer.from(pemContents, 'base64').toString('binary');
|
|
676
|
+
const keyData = new Uint8Array(binaryDer.length);
|
|
677
|
+
for(let i = 0; i < binaryDer.length; i++){
|
|
678
|
+
keyData[i] = binaryDer.charCodeAt(i);
|
|
679
|
+
}
|
|
680
|
+
return await crypto.subtle.importKey('spki', keyData, {
|
|
681
|
+
name: 'RSA-OAEP',
|
|
682
|
+
hash: 'SHA-256'
|
|
683
|
+
}, false, [
|
|
684
|
+
'encrypt'
|
|
685
|
+
]);
|
|
686
|
+
};
|
|
687
|
+
// encodedEnvelopeBytes intentionally omitted; alg/ct/ek/iv/tag/kid is sufficient
|
|
688
|
+
/**
|
|
689
|
+
* Encrypts data using HYBRID-RSA-AES-256 encryption scheme with Web Crypto API.
|
|
690
|
+
* 1. Generate random AES-256 key
|
|
691
|
+
* 2. Encrypt AES key with RSA public key
|
|
692
|
+
* 3. Encrypt data with AES-256-GCM
|
|
693
|
+
*/ const encryptDelegatedKeyShare = async (data, publicKeyPem, keyId)=>{
|
|
694
|
+
try {
|
|
695
|
+
// Step 1: Generate a random AES-256 key and 16-byte IV
|
|
696
|
+
const aesKey = await crypto.subtle.generateKey({
|
|
697
|
+
name: 'AES-GCM',
|
|
698
|
+
length: 256
|
|
699
|
+
}, true, [
|
|
700
|
+
'encrypt'
|
|
701
|
+
]);
|
|
702
|
+
const iv = crypto.getRandomValues(new Uint8Array(16)); // 128-bit IV for GCM
|
|
703
|
+
// Step 2: Encrypt the data with AES-256-GCM
|
|
704
|
+
const plaintext = new TextEncoder().encode(data);
|
|
705
|
+
const encryptedData = await crypto.subtle.encrypt({
|
|
706
|
+
name: 'AES-GCM',
|
|
707
|
+
iv: iv
|
|
708
|
+
}, aesKey, plaintext);
|
|
709
|
+
// Extract the auth tag from the encrypted data (last 16 bytes)
|
|
710
|
+
const encryptedDataArray = new Uint8Array(encryptedData);
|
|
711
|
+
const authTag = encryptedDataArray.slice(-16);
|
|
712
|
+
const ciphertext = encryptedDataArray.slice(0, -16);
|
|
713
|
+
// Step 3: Encrypt the AES key with RSA public key
|
|
714
|
+
const rsaPublicKey = await importRSAPublicKey(publicKeyPem);
|
|
715
|
+
// Export the AES key to encrypt it
|
|
716
|
+
const aesKeyData = await crypto.subtle.exportKey('raw', aesKey);
|
|
717
|
+
const encryptedAesKey = await crypto.subtle.encrypt({
|
|
718
|
+
name: 'RSA-OAEP'
|
|
719
|
+
}, rsaPublicKey, aesKeyData);
|
|
720
|
+
return _extends({
|
|
721
|
+
alg: ALG_LABEL_RSA,
|
|
722
|
+
iv: arrayBufferToBase64Url(iv.buffer),
|
|
723
|
+
ct: arrayBufferToBase64Url(ciphertext.buffer),
|
|
724
|
+
tag: arrayBufferToBase64Url(authTag.buffer),
|
|
725
|
+
ek: arrayBufferToBase64Url(encryptedAesKey)
|
|
726
|
+
}, keyId ? {
|
|
727
|
+
kid: keyId
|
|
728
|
+
} : {});
|
|
729
|
+
} catch (error) {
|
|
730
|
+
throw new Error(`Encryption failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
|
|
656
734
|
const localStorageWriteTest = {
|
|
657
735
|
tested: false,
|
|
658
736
|
writable: false
|
|
@@ -722,95 +800,21 @@ const localStorageWriteTest = {
|
|
|
722
800
|
}
|
|
723
801
|
});
|
|
724
802
|
|
|
725
|
-
/** Algorithm label for the new hybrid encryption standard */ const ALG_LABEL_RSA = 'HYBRID-RSA-AES-256';
|
|
726
|
-
/**
|
|
727
|
-
* Convert base64 to base64url encoding
|
|
728
|
-
*/ const toBase64Url = (buffer)=>{
|
|
729
|
-
const base64 = Buffer.from(buffer).toString('base64');
|
|
730
|
-
return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
|
731
|
-
};
|
|
732
|
-
/**
|
|
733
|
-
* Convert ArrayBuffer to base64url
|
|
734
|
-
*/ const arrayBufferToBase64Url = (buffer)=>{
|
|
735
|
-
return toBase64Url(buffer);
|
|
736
|
-
};
|
|
737
|
-
/**
|
|
738
|
-
* Import RSA public key from PEM format
|
|
739
|
-
*/ const importRSAPublicKey = async (publicKeyPem)=>{
|
|
740
|
-
// Remove PEM headers and decode base64
|
|
741
|
-
const pemHeader = '-----BEGIN PUBLIC KEY-----';
|
|
742
|
-
const pemFooter = '-----END PUBLIC KEY-----';
|
|
743
|
-
const pemContents = publicKeyPem.replace(pemHeader, '').replace(pemFooter, '').replace(/\s/g, '');
|
|
744
|
-
const binaryDer = Buffer.from(pemContents, 'base64').toString('binary');
|
|
745
|
-
const keyData = new Uint8Array(binaryDer.length);
|
|
746
|
-
for(let i = 0; i < binaryDer.length; i++){
|
|
747
|
-
keyData[i] = binaryDer.charCodeAt(i);
|
|
748
|
-
}
|
|
749
|
-
return await crypto.subtle.importKey('spki', keyData, {
|
|
750
|
-
name: 'RSA-OAEP',
|
|
751
|
-
hash: 'SHA-256'
|
|
752
|
-
}, false, [
|
|
753
|
-
'encrypt'
|
|
754
|
-
]);
|
|
755
|
-
};
|
|
756
|
-
/**
|
|
757
|
-
* Creates the encoded envelope bytes from the encrypted data components
|
|
758
|
-
*/ const createEncodedEnvelopeBytes = (iv, ciphertext, authTag, encryptedAesKey)=>{
|
|
759
|
-
const envelopeData = {
|
|
760
|
-
algorithm: ALG_LABEL_RSA,
|
|
761
|
-
iv: arrayBufferToBase64Url(iv.buffer),
|
|
762
|
-
encryptedData: arrayBufferToBase64Url(ciphertext.buffer),
|
|
763
|
-
authTag: arrayBufferToBase64Url(authTag.buffer),
|
|
764
|
-
encryptedKey: arrayBufferToBase64Url(encryptedAesKey)
|
|
765
|
-
};
|
|
766
|
-
return Buffer.from(new TextEncoder().encode(JSON.stringify(envelopeData))).toString('base64');
|
|
767
|
-
};
|
|
768
|
-
/**
|
|
769
|
-
* Encrypts data using HYBRID-RSA-AES-256 encryption scheme with Web Crypto API.
|
|
770
|
-
* 1. Generate random AES-256 key
|
|
771
|
-
* 2. Encrypt AES key with RSA public key
|
|
772
|
-
* 3. Encrypt data with AES-256-GCM
|
|
773
|
-
*/ const encryptDelegatedKeyShare = async (data, publicKeyPem)=>{
|
|
774
|
-
try {
|
|
775
|
-
// Step 1: Generate a random AES-256 key and 16-byte IV
|
|
776
|
-
const aesKey = await crypto.subtle.generateKey({
|
|
777
|
-
name: 'AES-GCM',
|
|
778
|
-
length: 256
|
|
779
|
-
}, true, [
|
|
780
|
-
'encrypt'
|
|
781
|
-
]);
|
|
782
|
-
const iv = crypto.getRandomValues(new Uint8Array(16)); // 128-bit IV for GCM
|
|
783
|
-
// Step 2: Encrypt the data with AES-256-GCM
|
|
784
|
-
const plaintext = new TextEncoder().encode(data);
|
|
785
|
-
const encryptedData = await crypto.subtle.encrypt({
|
|
786
|
-
name: 'AES-GCM',
|
|
787
|
-
iv: iv
|
|
788
|
-
}, aesKey, plaintext);
|
|
789
|
-
// Extract the auth tag from the encrypted data (last 16 bytes)
|
|
790
|
-
const encryptedDataArray = new Uint8Array(encryptedData);
|
|
791
|
-
const authTag = encryptedDataArray.slice(-16);
|
|
792
|
-
const ciphertext = encryptedDataArray.slice(0, -16);
|
|
793
|
-
// Step 3: Encrypt the AES key with RSA public key
|
|
794
|
-
const rsaPublicKey = await importRSAPublicKey(publicKeyPem);
|
|
795
|
-
// Export the AES key to encrypt it
|
|
796
|
-
const aesKeyData = await crypto.subtle.exportKey('raw', aesKey);
|
|
797
|
-
const encryptedAesKey = await crypto.subtle.encrypt({
|
|
798
|
-
name: 'RSA-OAEP'
|
|
799
|
-
}, rsaPublicKey, aesKeyData);
|
|
800
|
-
return {
|
|
801
|
-
algorithm: ALG_LABEL_RSA,
|
|
802
|
-
iv: arrayBufferToBase64Url(iv.buffer),
|
|
803
|
-
encryptedData: arrayBufferToBase64Url(ciphertext.buffer),
|
|
804
|
-
authTag: arrayBufferToBase64Url(authTag.buffer),
|
|
805
|
-
encryptedKey: arrayBufferToBase64Url(encryptedAesKey),
|
|
806
|
-
encodedEnvelopeBytes: createEncodedEnvelopeBytes(iv, ciphertext, authTag, encryptedAesKey)
|
|
807
|
-
};
|
|
808
|
-
} catch (error) {
|
|
809
|
-
throw new Error(`Encryption failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
810
|
-
}
|
|
811
|
-
};
|
|
812
|
-
|
|
813
803
|
class DynamicWalletClient {
|
|
804
|
+
async initializeForwardMPCClient() {
|
|
805
|
+
try {
|
|
806
|
+
await this.apiClient.forwardMPCClient.connect();
|
|
807
|
+
logger.info('Connected to ForwardMPC enclave websocket. Instance: ' + this.instanceId);
|
|
808
|
+
try {
|
|
809
|
+
await this.apiClient.forwardMPCClient.handshake();
|
|
810
|
+
logger.info('Handshaked with ForwardMPC enclave websocket. Instance: ' + this.instanceId);
|
|
811
|
+
} catch (error) {
|
|
812
|
+
logger.error('Error handshaking with ForwardMPC enclave websocket. Instance: ' + this.instanceId, error);
|
|
813
|
+
}
|
|
814
|
+
} catch (error) {
|
|
815
|
+
logger.error('Error connecting to ForwardMPC enclave websocket. Instance: ' + this.instanceId, error);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
814
818
|
getAuthMode() {
|
|
815
819
|
return this.authMode;
|
|
816
820
|
}
|
|
@@ -1139,6 +1143,32 @@ class DynamicWalletClient {
|
|
|
1139
1143
|
});
|
|
1140
1144
|
return data;
|
|
1141
1145
|
}
|
|
1146
|
+
async forwardMPCClientSign({ chainName, message, roomId, keyShare, derivationPath, formattedMessage }) {
|
|
1147
|
+
if (!this.apiClient.forwardMPCClient.connected) {
|
|
1148
|
+
await this.initializeForwardMPCClient();
|
|
1149
|
+
}
|
|
1150
|
+
logger.info('Forward MPC enabled, signing message with forward MPC');
|
|
1151
|
+
const signature = await this.apiClient.forwardMPCClient.signMessage({
|
|
1152
|
+
keyshare: keyShare,
|
|
1153
|
+
message: chainName === 'EVM' || chainName === 'SUI' ? message : formattedMessage,
|
|
1154
|
+
relayDomain: this.baseMPCRelayApiUrl || '',
|
|
1155
|
+
signingAlgo: chainName === 'EVM' ? 'ECDSA' : 'ED25519',
|
|
1156
|
+
hashAlgo: chainName === 'EVM' ? 'keccak256' : undefined,
|
|
1157
|
+
derivationPath: derivationPath,
|
|
1158
|
+
roomUuid: roomId
|
|
1159
|
+
});
|
|
1160
|
+
const signatureBytes = signature.data.signature;
|
|
1161
|
+
if (!(signatureBytes instanceof Uint8Array)) {
|
|
1162
|
+
throw new TypeError(`Invalid signature format: expected Uint8Array, got ${typeof signatureBytes}`);
|
|
1163
|
+
}
|
|
1164
|
+
// Convert to EcdsaSignature
|
|
1165
|
+
if (chainName === 'EVM') {
|
|
1166
|
+
const ecdsaSignature = EcdsaSignature.fromBuffer(signatureBytes);
|
|
1167
|
+
return ecdsaSignature;
|
|
1168
|
+
} else {
|
|
1169
|
+
return signatureBytes;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1142
1172
|
async clientSign({ chainName, message, roomId, keyShare, derivationPath, isFormatted, dynamicRequestId }) {
|
|
1143
1173
|
try {
|
|
1144
1174
|
const mpcSigner = getMPCSigner({
|
|
@@ -1153,6 +1183,16 @@ class DynamicWalletClient {
|
|
|
1153
1183
|
derivationPath,
|
|
1154
1184
|
isFormatted
|
|
1155
1185
|
});
|
|
1186
|
+
if (this.forwardMPCEnabled) {
|
|
1187
|
+
return this.forwardMPCClientSign({
|
|
1188
|
+
chainName,
|
|
1189
|
+
message,
|
|
1190
|
+
roomId,
|
|
1191
|
+
keyShare,
|
|
1192
|
+
derivationPath,
|
|
1193
|
+
formattedMessage
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1156
1196
|
const signature = await mpcSigner.sign(roomId, keyShare, formattedMessage, derivationPath);
|
|
1157
1197
|
return signature;
|
|
1158
1198
|
} catch (error) {
|
|
@@ -1343,10 +1383,9 @@ class DynamicWalletClient {
|
|
|
1343
1383
|
existingClientKeyShares
|
|
1344
1384
|
};
|
|
1345
1385
|
}
|
|
1346
|
-
async reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, password = undefined, signedSessionId, backupToGoogleDrive = false, delegateToProjectEnvironment = false, mfaToken }) {
|
|
1386
|
+
async reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, password = undefined, signedSessionId, backupToGoogleDrive = false, delegateToProjectEnvironment = false, mfaToken, revokeDelegation = false }) {
|
|
1347
1387
|
const dynamicRequestId = v4();
|
|
1348
1388
|
try {
|
|
1349
|
-
var _publicKey_key, _publicKey_key1;
|
|
1350
1389
|
await this.verifyPassword({
|
|
1351
1390
|
accountAddress,
|
|
1352
1391
|
password,
|
|
@@ -1383,7 +1422,8 @@ class DynamicWalletClient {
|
|
|
1383
1422
|
newThresholdSignatureScheme,
|
|
1384
1423
|
dynamicRequestId,
|
|
1385
1424
|
delegateToProjectEnvironment,
|
|
1386
|
-
mfaToken
|
|
1425
|
+
mfaToken,
|
|
1426
|
+
revokeDelegation
|
|
1387
1427
|
});
|
|
1388
1428
|
const { roomId, serverKeygenIds, newServerKeygenIds = [] } = data;
|
|
1389
1429
|
// Get the MPC config for the threshold signature scheme
|
|
@@ -1405,7 +1445,7 @@ class DynamicWalletClient {
|
|
|
1405
1445
|
Promise.all(existingResharePromises),
|
|
1406
1446
|
Promise.all(newResharePromises)
|
|
1407
1447
|
]);
|
|
1408
|
-
const
|
|
1448
|
+
const clientKeysharesToLocalStorage = delegateToProjectEnvironment ? [
|
|
1409
1449
|
...existingReshareResults
|
|
1410
1450
|
] : [
|
|
1411
1451
|
...existingReshareResults,
|
|
@@ -1414,33 +1454,20 @@ class DynamicWalletClient {
|
|
|
1414
1454
|
this.walletMap[accountAddress] = _extends({}, this.walletMap[accountAddress], {
|
|
1415
1455
|
thresholdSignatureScheme: newThresholdSignatureScheme
|
|
1416
1456
|
});
|
|
1457
|
+
// store client key shares to localStorage
|
|
1417
1458
|
await this.setClientKeySharesToLocalStorage({
|
|
1418
1459
|
accountAddress,
|
|
1419
|
-
clientKeyShares:
|
|
1460
|
+
clientKeyShares: clientKeysharesToLocalStorage,
|
|
1420
1461
|
overwriteOrMerge: 'overwrite'
|
|
1421
1462
|
});
|
|
1463
|
+
// if delegateToProjectEnvironment is true, we need to update location for the delegated share
|
|
1464
|
+
const delegatedKeyshare = delegateToProjectEnvironment ? newReshareResults[0] : undefined;
|
|
1422
1465
|
await this.storeEncryptedBackupByWallet({
|
|
1423
1466
|
accountAddress,
|
|
1424
1467
|
password,
|
|
1425
1468
|
signedSessionId,
|
|
1426
1469
|
backupToGoogleDrive,
|
|
1427
|
-
|
|
1428
|
-
location: BackupLocation.DELEGATED
|
|
1429
|
-
}))
|
|
1430
|
-
});
|
|
1431
|
-
const publicKey = await this.apiClient.getDelegatedEncryptionKey({
|
|
1432
|
-
environmentId: this.environmentId
|
|
1433
|
-
});
|
|
1434
|
-
if (!(publicKey == null ? void 0 : (_publicKey_key = publicKey.key) == null ? void 0 : _publicKey_key.publicKeyPemB64)) {
|
|
1435
|
-
throw new Error('Public key not found');
|
|
1436
|
-
}
|
|
1437
|
-
const encryptedDelegatedKeyShareEnvelope = await encryptDelegatedKeyShare(JSON.stringify(clientKeyshares[0]), publicKey == null ? void 0 : (_publicKey_key1 = publicKey.key) == null ? void 0 : _publicKey_key1.publicKeyPemB64);
|
|
1438
|
-
await this.apiClient.publishDelegatedKeyShare({
|
|
1439
|
-
walletId: this.walletMap[accountAddress].walletId,
|
|
1440
|
-
encryptedKeyShare: encryptedDelegatedKeyShareEnvelope,
|
|
1441
|
-
signedSessionId,
|
|
1442
|
-
requiresSignedSessionId: this.requiresSignedSessionId(),
|
|
1443
|
-
dynamicRequestId
|
|
1470
|
+
delegatedKeyshare
|
|
1444
1471
|
});
|
|
1445
1472
|
} catch (error) {
|
|
1446
1473
|
logError({
|
|
@@ -1467,7 +1494,7 @@ class DynamicWalletClient {
|
|
|
1467
1494
|
throw error;
|
|
1468
1495
|
}
|
|
1469
1496
|
}
|
|
1470
|
-
async
|
|
1497
|
+
async performDelegationOperation({ accountAddress, password, signedSessionId, mfaToken, newThresholdSignatureScheme, revokeDelegation = false, operationName }) {
|
|
1471
1498
|
try {
|
|
1472
1499
|
const delegateToProjectEnvironment = this.featureFlags && this.featureFlags[FEATURE_FLAGS.ENABLE_DELEGATED_KEY_SHARES_FLAG] === true;
|
|
1473
1500
|
if (!delegateToProjectEnvironment) {
|
|
@@ -1487,19 +1514,17 @@ class DynamicWalletClient {
|
|
|
1487
1514
|
chainName: this.walletMap[accountAddress].chainName,
|
|
1488
1515
|
accountAddress,
|
|
1489
1516
|
oldThresholdSignatureScheme: currentThresholdSignatureScheme,
|
|
1490
|
-
newThresholdSignatureScheme
|
|
1517
|
+
newThresholdSignatureScheme,
|
|
1491
1518
|
password,
|
|
1492
1519
|
signedSessionId,
|
|
1493
1520
|
backupToGoogleDrive: false,
|
|
1494
1521
|
delegateToProjectEnvironment: true,
|
|
1495
|
-
mfaToken
|
|
1522
|
+
mfaToken,
|
|
1523
|
+
revokeDelegation
|
|
1496
1524
|
});
|
|
1497
|
-
const backupInfo = this.walletMap[accountAddress].clientKeySharesBackupInfo;
|
|
1498
|
-
const delegatedKeyShares = backupInfo.backups[BackupLocation.DELEGATED] || [];
|
|
1499
|
-
return delegatedKeyShares;
|
|
1500
1525
|
} catch (error) {
|
|
1501
1526
|
logError({
|
|
1502
|
-
message:
|
|
1527
|
+
message: `Error in ${operationName}`,
|
|
1503
1528
|
error: error,
|
|
1504
1529
|
context: {
|
|
1505
1530
|
accountAddress
|
|
@@ -1508,6 +1533,30 @@ class DynamicWalletClient {
|
|
|
1508
1533
|
throw error;
|
|
1509
1534
|
}
|
|
1510
1535
|
}
|
|
1536
|
+
async delegateKeyShares({ accountAddress, password = undefined, signedSessionId, mfaToken }) {
|
|
1537
|
+
await this.performDelegationOperation({
|
|
1538
|
+
accountAddress,
|
|
1539
|
+
password,
|
|
1540
|
+
signedSessionId,
|
|
1541
|
+
mfaToken,
|
|
1542
|
+
newThresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_THREE,
|
|
1543
|
+
operationName: 'delegateKeyShares'
|
|
1544
|
+
});
|
|
1545
|
+
const backupInfo = this.walletMap[accountAddress].clientKeySharesBackupInfo;
|
|
1546
|
+
const delegatedKeyShares = backupInfo.backups[BackupLocation.DELEGATED] || [];
|
|
1547
|
+
return delegatedKeyShares;
|
|
1548
|
+
}
|
|
1549
|
+
async revokeDelegation({ accountAddress, password = undefined, signedSessionId, mfaToken }) {
|
|
1550
|
+
await this.performDelegationOperation({
|
|
1551
|
+
accountAddress,
|
|
1552
|
+
password,
|
|
1553
|
+
signedSessionId,
|
|
1554
|
+
mfaToken,
|
|
1555
|
+
newThresholdSignatureScheme: ThresholdSignatureScheme.TWO_OF_TWO,
|
|
1556
|
+
revokeDelegation: true,
|
|
1557
|
+
operationName: 'revokeDelegation'
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1511
1560
|
async exportKey({ accountAddress, chainName, password = undefined, signedSessionId, mfaToken }) {
|
|
1512
1561
|
const dynamicRequestId = v4();
|
|
1513
1562
|
try {
|
|
@@ -1691,6 +1740,10 @@ class DynamicWalletClient {
|
|
|
1691
1740
|
* 4. Updates backup metadata and synchronizes wallet state
|
|
1692
1741
|
* 5. Persists the updated wallet map to local storage
|
|
1693
1742
|
*
|
|
1743
|
+
* **Delegated Key Shares:**
|
|
1744
|
+
* - When delegatedKeyshare is provided, the method will not store the delegated key share but it will mark the delegated share as backed up on Dynamic's backend
|
|
1745
|
+
* - and encrypt the delegated key share to publish it to the webhook
|
|
1746
|
+
*
|
|
1694
1747
|
* @param params - The backup operation parameters
|
|
1695
1748
|
* @param params.accountAddress - The account address of the wallet to backup
|
|
1696
1749
|
* @param params.clientKeyShares - Optional specific key shares to backup (uses localStorage if not provided)
|
|
@@ -1698,7 +1751,7 @@ class DynamicWalletClient {
|
|
|
1698
1751
|
* @param params.signedSessionId - Optional signed session ID for authentication
|
|
1699
1752
|
* @param params.backupToGoogleDrive - Whether to backup to Google Drive (defaults to false)
|
|
1700
1753
|
* @returns Promise with backup metadata including share locations and IDs
|
|
1701
|
-
*/ async storeEncryptedBackupByWallet({ accountAddress, clientKeyShares = undefined, password = undefined, signedSessionId, backupToGoogleDrive = false,
|
|
1754
|
+
*/ async storeEncryptedBackupByWallet({ accountAddress, clientKeyShares = undefined, password = undefined, signedSessionId, backupToGoogleDrive = false, delegatedKeyshare = undefined }) {
|
|
1702
1755
|
const dynamicRequestId = v4();
|
|
1703
1756
|
try {
|
|
1704
1757
|
var _this_walletMap_accountAddress, _this_walletMap_accountAddress_clientKeySharesBackupInfo_backups_BackupLocation_GOOGLE_DRIVE, _this_walletMap_accountAddress_clientKeySharesBackupInfo_backups, _this_walletMap_accountAddress_clientKeySharesBackupInfo, _this_walletMap_accountAddress1;
|
|
@@ -1766,8 +1819,31 @@ class DynamicWalletClient {
|
|
|
1766
1819
|
location: BackupLocation.GOOGLE_DRIVE
|
|
1767
1820
|
});
|
|
1768
1821
|
}
|
|
1769
|
-
if
|
|
1770
|
-
|
|
1822
|
+
// if delegatedKeyshare is provided, we encrypt the delegated key share and publish it to the webhook
|
|
1823
|
+
// after publish confirmed, we mark the delegated share as backed up on Dynamic's backend
|
|
1824
|
+
if (delegatedKeyshare) {
|
|
1825
|
+
var _publicKey_key, _publicKey_key1, _publicKey_key2;
|
|
1826
|
+
const publicKey = await this.apiClient.getDelegatedEncryptionKey({
|
|
1827
|
+
environmentId: this.environmentId
|
|
1828
|
+
});
|
|
1829
|
+
if (!(publicKey == null ? void 0 : (_publicKey_key = publicKey.key) == null ? void 0 : _publicKey_key.publicKeyPemB64)) {
|
|
1830
|
+
throw new Error('Public key not found');
|
|
1831
|
+
}
|
|
1832
|
+
var _publicKey_key_keyId;
|
|
1833
|
+
const encryptedDelegatedKeyShareEnvelope = await encryptDelegatedKeyShare(JSON.stringify(delegatedKeyshare), publicKey == null ? void 0 : (_publicKey_key1 = publicKey.key) == null ? void 0 : _publicKey_key1.publicKeyPemB64, (_publicKey_key_keyId = publicKey == null ? void 0 : (_publicKey_key2 = publicKey.key) == null ? void 0 : _publicKey_key2.keyId) != null ? _publicKey_key_keyId : publicKey == null ? void 0 : publicKey.keyId);
|
|
1834
|
+
const { status } = await this.apiClient.publishDelegatedKeyShare({
|
|
1835
|
+
walletId: this.walletMap[accountAddress].walletId,
|
|
1836
|
+
encryptedKeyShare: encryptedDelegatedKeyShareEnvelope,
|
|
1837
|
+
signedSessionId,
|
|
1838
|
+
requiresSignedSessionId: this.requiresSignedSessionId(),
|
|
1839
|
+
dynamicRequestId
|
|
1840
|
+
});
|
|
1841
|
+
if (status !== 200) {
|
|
1842
|
+
throw new Error('Failed to publish delegated key share');
|
|
1843
|
+
}
|
|
1844
|
+
locations.push({
|
|
1845
|
+
location: BackupLocation.DELEGATED
|
|
1846
|
+
});
|
|
1771
1847
|
}
|
|
1772
1848
|
const backupData = await this.apiClient.markKeySharesAsBackedUp({
|
|
1773
1849
|
walletId: this.walletMap[accountAddress].walletId,
|
|
@@ -2467,7 +2543,7 @@ class DynamicWalletClient {
|
|
|
2467
2543
|
this.apiClient.syncAuthToken(authToken);
|
|
2468
2544
|
}
|
|
2469
2545
|
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, storageKey, debug, featureFlags, authMode = AuthMode.HEADER, authToken = undefined, // Represents the version of the client SDK used by developer
|
|
2470
|
-
sdkVersion }){
|
|
2546
|
+
sdkVersion, forwardMPCClient }){
|
|
2471
2547
|
this.userId = undefined;
|
|
2472
2548
|
this.sessionId = undefined;
|
|
2473
2549
|
this.initializePromise = null;
|
|
@@ -2476,6 +2552,7 @@ class DynamicWalletClient {
|
|
|
2476
2552
|
;
|
|
2477
2553
|
this.memoryStorage = null;
|
|
2478
2554
|
this.iframe = null;
|
|
2555
|
+
this.forwardMPCEnabled = false;
|
|
2479
2556
|
this.featureFlags = {};
|
|
2480
2557
|
this.environmentId = environmentId;
|
|
2481
2558
|
this.storageKey = `${STORAGE_KEY}-${storageKey != null ? storageKey : environmentId}`;
|
|
@@ -2487,7 +2564,8 @@ class DynamicWalletClient {
|
|
|
2487
2564
|
authToken,
|
|
2488
2565
|
baseApiUrl,
|
|
2489
2566
|
authMode,
|
|
2490
|
-
sdkVersion
|
|
2567
|
+
sdkVersion,
|
|
2568
|
+
forwardMPCClient
|
|
2491
2569
|
});
|
|
2492
2570
|
this.debug = Boolean(debug);
|
|
2493
2571
|
this.logger.setLogLevel(this.debug ? LogLevel.DEBUG : DEFAULT_LOG_LEVEL);
|
|
@@ -2507,6 +2585,11 @@ class DynamicWalletClient {
|
|
|
2507
2585
|
if (authMode === AuthMode.HEADER && authToken) {
|
|
2508
2586
|
this.initLoggerContext(authToken);
|
|
2509
2587
|
}
|
|
2588
|
+
this.forwardMPCEnabled = this.featureFlags && this.featureFlags[FEATURE_FLAGS.ENABLE_FORWARD_MPC_CLIENT_FLAG] === true;
|
|
2589
|
+
// if forwardMPCEnabled is true and forwardMPCClient is not provided, initialize the forwardMPCClient
|
|
2590
|
+
if (this.forwardMPCEnabled && !forwardMPCClient) {
|
|
2591
|
+
this.initializeForwardMPCClient();
|
|
2592
|
+
}
|
|
2510
2593
|
}
|
|
2511
2594
|
}
|
|
2512
2595
|
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/browser",
|
|
3
|
-
"version": "0.0.0-beta.
|
|
3
|
+
"version": "0.0.0-beta.318",
|
|
4
4
|
"license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/core": "0.0.0-beta.
|
|
7
|
+
"@dynamic-labs-wallet/core": "0.0.0-beta.318",
|
|
8
8
|
"@dynamic-labs/logger": "^4.25.3",
|
|
9
|
-
"@dynamic-labs/sdk-api-core": "^0.0.
|
|
9
|
+
"@dynamic-labs/sdk-api-core": "^0.0.801",
|
|
10
10
|
"argon2id": "1.0.1",
|
|
11
|
-
"axios": "1.
|
|
11
|
+
"axios": "1.12.2",
|
|
12
12
|
"http-errors": "2.0.0",
|
|
13
13
|
"semver": "^7.6.3",
|
|
14
14
|
"uuid": "11.1.0",
|
package/src/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { BIP340KeygenResult, EcdsaKeygenResult, type EcdsaPublicKey, EcdsaSignature, ExportableEd25519KeygenResult, MessageHash } from '#internal/web';
|
|
1
2
|
import { AuthMode, BackupLocation, type BackupLocationWithExternalKeyShareId, DynamicApiClient, type DynamicWalletClientProps, type FeatureFlags, type InitializeResult, type KeyShareBackupInfo, ThresholdSignatureScheme, WalletOperation } from '@dynamic-labs-wallet/core';
|
|
2
|
-
import { BIP340KeygenResult, EcdsaKeygenResult, type EcdsaPublicKey, type EcdsaSignature, ExportableEd25519KeygenResult } from '#internal/web';
|
|
3
3
|
import type { SignMessageContext } from '@dynamic-labs/sdk-api-core';
|
|
4
4
|
import type { ClientInitKeygenResult, ClientKeyShare } from './mpc/types.js';
|
|
5
5
|
import { type SupportedStorage } from './services/localStorage.js';
|
|
@@ -20,12 +20,14 @@ export declare class DynamicWalletClient {
|
|
|
20
20
|
} | null;
|
|
21
21
|
protected baseMPCRelayApiUrl?: string;
|
|
22
22
|
protected iframe: HTMLIFrameElement | null;
|
|
23
|
+
protected forwardMPCEnabled: boolean;
|
|
23
24
|
readonly instanceId: string;
|
|
24
25
|
readonly iframeDomain: string;
|
|
25
26
|
readonly featureFlags: FeatureFlags;
|
|
26
27
|
protected authMode: AuthMode;
|
|
27
28
|
protected sdkVersion?: string;
|
|
28
|
-
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, storageKey, debug, featureFlags, authMode, authToken, sdkVersion, }: DynamicWalletClientProps);
|
|
29
|
+
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, storageKey, debug, featureFlags, authMode, authToken, sdkVersion, forwardMPCClient, }: DynamicWalletClientProps);
|
|
30
|
+
private initializeForwardMPCClient;
|
|
29
31
|
getAuthMode(): AuthMode;
|
|
30
32
|
/**
|
|
31
33
|
* Check if the SDK version meets the requirement for signed session ID
|
|
@@ -94,6 +96,14 @@ export declare class DynamicWalletClient {
|
|
|
94
96
|
context?: SignMessageContext;
|
|
95
97
|
onError?: (error: Error) => void;
|
|
96
98
|
}): Promise<import("@dynamic-labs-wallet/core").OpenRoomResponse>;
|
|
99
|
+
forwardMPCClientSign({ chainName, message, roomId, keyShare, derivationPath, formattedMessage, }: {
|
|
100
|
+
chainName: string;
|
|
101
|
+
message: string | Uint8Array;
|
|
102
|
+
roomId: string;
|
|
103
|
+
keyShare: ClientKeyShare;
|
|
104
|
+
derivationPath: Uint32Array | undefined;
|
|
105
|
+
formattedMessage: string | Uint8Array | MessageHash;
|
|
106
|
+
}): Promise<Uint8Array | EcdsaSignature>;
|
|
97
107
|
clientSign({ chainName, message, roomId, keyShare, derivationPath, isFormatted, dynamicRequestId, }: {
|
|
98
108
|
chainName: string;
|
|
99
109
|
message: string | Uint8Array;
|
|
@@ -151,7 +161,7 @@ export declare class DynamicWalletClient {
|
|
|
151
161
|
existingClientKeygenIds: string[];
|
|
152
162
|
existingClientKeyShares: ClientKeyShare[];
|
|
153
163
|
}>;
|
|
154
|
-
reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, password, signedSessionId, backupToGoogleDrive, delegateToProjectEnvironment, mfaToken, }: {
|
|
164
|
+
reshare({ chainName, accountAddress, oldThresholdSignatureScheme, newThresholdSignatureScheme, password, signedSessionId, backupToGoogleDrive, delegateToProjectEnvironment, mfaToken, revokeDelegation, }: {
|
|
155
165
|
chainName: string;
|
|
156
166
|
accountAddress: string;
|
|
157
167
|
oldThresholdSignatureScheme: ThresholdSignatureScheme;
|
|
@@ -161,13 +171,21 @@ export declare class DynamicWalletClient {
|
|
|
161
171
|
backupToGoogleDrive?: boolean;
|
|
162
172
|
delegateToProjectEnvironment?: boolean;
|
|
163
173
|
mfaToken?: string;
|
|
174
|
+
revokeDelegation?: boolean;
|
|
164
175
|
}): Promise<void>;
|
|
176
|
+
private performDelegationOperation;
|
|
165
177
|
delegateKeyShares({ accountAddress, password, signedSessionId, mfaToken, }: {
|
|
166
178
|
accountAddress: string;
|
|
167
179
|
password?: string;
|
|
168
180
|
signedSessionId: string;
|
|
169
181
|
mfaToken?: string;
|
|
170
182
|
}): Promise<BackupLocationWithExternalKeyShareId[]>;
|
|
183
|
+
revokeDelegation({ accountAddress, password, signedSessionId, mfaToken, }: {
|
|
184
|
+
accountAddress: string;
|
|
185
|
+
password?: string;
|
|
186
|
+
signedSessionId: string;
|
|
187
|
+
mfaToken?: string;
|
|
188
|
+
}): Promise<void>;
|
|
171
189
|
exportKey({ accountAddress, chainName, password, signedSessionId, mfaToken, }: {
|
|
172
190
|
accountAddress: string;
|
|
173
191
|
chainName: string;
|
|
@@ -222,6 +240,10 @@ export declare class DynamicWalletClient {
|
|
|
222
240
|
* 4. Updates backup metadata and synchronizes wallet state
|
|
223
241
|
* 5. Persists the updated wallet map to local storage
|
|
224
242
|
*
|
|
243
|
+
* **Delegated Key Shares:**
|
|
244
|
+
* - When delegatedKeyshare is provided, the method will not store the delegated key share but it will mark the delegated share as backed up on Dynamic's backend
|
|
245
|
+
* - and encrypt the delegated key share to publish it to the webhook
|
|
246
|
+
*
|
|
225
247
|
* @param params - The backup operation parameters
|
|
226
248
|
* @param params.accountAddress - The account address of the wallet to backup
|
|
227
249
|
* @param params.clientKeyShares - Optional specific key shares to backup (uses localStorage if not provided)
|
|
@@ -230,13 +252,13 @@ export declare class DynamicWalletClient {
|
|
|
230
252
|
* @param params.backupToGoogleDrive - Whether to backup to Google Drive (defaults to false)
|
|
231
253
|
* @returns Promise with backup metadata including share locations and IDs
|
|
232
254
|
*/
|
|
233
|
-
storeEncryptedBackupByWallet({ accountAddress, clientKeyShares, password, signedSessionId, backupToGoogleDrive,
|
|
255
|
+
storeEncryptedBackupByWallet({ accountAddress, clientKeyShares, password, signedSessionId, backupToGoogleDrive, delegatedKeyshare, }: {
|
|
234
256
|
accountAddress: string;
|
|
235
257
|
clientKeyShares?: ClientKeyShare[];
|
|
236
258
|
password?: string;
|
|
237
259
|
signedSessionId: string;
|
|
238
260
|
backupToGoogleDrive?: boolean;
|
|
239
|
-
|
|
261
|
+
delegatedKeyshare?: any;
|
|
240
262
|
}): Promise<any>;
|
|
241
263
|
storeEncryptedBackupByWalletWithRetry({ accountAddress, clientKeyShares, password, signedSessionId, }: {
|
|
242
264
|
accountAddress: string;
|
package/src/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client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AC;QAClB,eAAe,CAAC,EAAE,eAAe,CAAC;QAClC,eAAe,EAAE,MAAM,CAAC;KACzB;IAsDK,mBAAmB,CAAC,EACxB,cAAc,GACf,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,OAAO,CAAC;IAMpB;;OAEG;IACG,4BAA4B,CAAC,EACjC,cAAc,EACd,eAAiD,GAClD,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,eAAe,CAAC;KACnC,GAAG,OAAO,CAAC,OAAO,CAAC;IAYpB;;OAEG;IACG,uCAAuC,CAAC,EAC5C,cAAc,EACd,eAAiD,GAClD,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,eAAe,CAAC;KACnC,GAAG,OAAO,CAAC,OAAO,CAAC;IAgCd,iCAAiC,CAAC,EACtC,cAAc,GACf,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAiCzB,SAAS,CAAC,EACd,cAAc,EACd,eAA8C,EAC9C,UAAsB,EACtB,QAAoB,EACpB,eAAe,GAChB,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,eAAe,CAAC;QAClC,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC;KACzB;IAmGK,UAAU;IAgDhB;;;OAGG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM;CAOhC"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
export declare const ALG_LABEL_RSA = "HYBRID-RSA-AES-256";
|
|
3
3
|
/** Envelope returned for encrypted delegated key share */
|
|
4
4
|
export type EncryptedDelegatedKeyShareEnvelope = {
|
|
5
|
-
|
|
5
|
+
alg: typeof ALG_LABEL_RSA;
|
|
6
6
|
iv: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
ct: string;
|
|
8
|
+
tag: string;
|
|
9
|
+
ek: string;
|
|
10
|
+
kid?: string;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* Encrypts data using HYBRID-RSA-AES-256 encryption scheme with Web Crypto API.
|
|
@@ -15,5 +15,5 @@ export type EncryptedDelegatedKeyShareEnvelope = {
|
|
|
15
15
|
* 2. Encrypt AES key with RSA public key
|
|
16
16
|
* 3. Encrypt data with AES-256-GCM
|
|
17
17
|
*/
|
|
18
|
-
export declare const encryptDelegatedKeyShare: (data: string, publicKeyPem: string) => Promise<EncryptedDelegatedKeyShareEnvelope>;
|
|
18
|
+
export declare const encryptDelegatedKeyShare: (data: string, publicKeyPem: string, keyId?: string) => Promise<EncryptedDelegatedKeyShareEnvelope>;
|
|
19
19
|
//# sourceMappingURL=encryption.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/services/encryption.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,eAAO,MAAM,aAAa,uBAAuB,CAAC;AAElD,0DAA0D;AAC1D,MAAM,MAAM,kCAAkC,GAAG;IAC/C,
|
|
1
|
+
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/services/encryption.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,eAAO,MAAM,aAAa,uBAAuB,CAAC;AAElD,0DAA0D;AAC1D,MAAM,MAAM,kCAAkC,GAAG;IAC/C,GAAG,EAAE,OAAO,aAAa,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAiDF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,SAC7B,MAAM,gBACE,MAAM,UACZ,MAAM,KACb,OAAO,CAAC,kCAAkC,CA0D5C,CAAC"}
|