@dynamic-labs/waas 5.0.0-rc.3 → 5.0.0
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/CHANGELOG.md +80 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -12
- package/src/DynamicWaasMixin.cjs +11 -13
- package/src/DynamicWaasMixin.d.ts +3 -2
- package/src/DynamicWaasMixin.js +11 -13
- package/utils/createWaasClientSecureStorage.cjs +58 -11
- package/utils/createWaasClientSecureStorage.d.ts +1 -1
- package/utils/createWaasClientSecureStorage.js +38 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,84 @@
|
|
|
1
1
|
|
|
2
|
+
## [5.0.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.0.0-rc.4...v5.0.0) (2026-07-29)
|
|
3
|
+
|
|
4
|
+
## 🚀 Dynamic SDK v5 is live
|
|
5
|
+
|
|
6
|
+
This release has been a long time coming. We've cleaned up the architecture, cut support for v1 and v2 embedded wallets from core, shipped a migration path for legacy wallets, and made the SDK story a lot cleaner for both web and mobile devs.
|
|
7
|
+
|
|
8
|
+
### 🔥 Embedded Wallet clean up
|
|
9
|
+
|
|
10
|
+
V1/V2 embedded wallets support has been removed from `@dynamic-labs/sdk-react-core`. Dynamic WaaS (V3) is now the one and only embedded wallet type, all new embedded wallets are V3.
|
|
11
|
+
|
|
12
|
+
### 📦 New: `@dynamic-labs/legacy-embedded-wallet-migration`
|
|
13
|
+
|
|
14
|
+
For users still on V1/V2 embedded wallets, we've got you covered with a dedicated migration package. It owns all the logic for upgrading to V3. This includes recovery flow, session keys, private key export, and the migration UI.
|
|
15
|
+
|
|
16
|
+
Two paths available:
|
|
17
|
+
|
|
18
|
+
- **UI-based** (recommended): Mount `LegacyWalletMigrationProvider` and the upgrade modal opens automatically when a legacy wallet is detected at login. It handles the full flow end-to-end.
|
|
19
|
+
- **Headless**: Call `upgradeToDynamicWaas()` directly if you want a custom migration UX.
|
|
20
|
+
|
|
21
|
+
### 📱 JS SDK for web and React Native are the new default
|
|
22
|
+
|
|
23
|
+
Going forward, we're encouraging all developers building for web and React Native to use the JS SDK. It's the direction we're investing in. Ideally v5 is our final version of the old React SDK. To be clear: **no new features will be added to the old SDKs, including v5. All new feature development is happening in the JS SDK.**
|
|
24
|
+
|
|
25
|
+
### ✏️ Legacy package renames
|
|
26
|
+
|
|
27
|
+
The old packages have been renamed to make their status explicit. Update your `package.json` accordingly:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
@dynamic-labs/client → @dynamic-labs/legacy-client
|
|
31
|
+
@dynamic-labs/react-hooks → @dynamic-labs/legacy-react-hooks
|
|
32
|
+
@dynamic-labs/react-native-extension → @dynamic-labs/legacy-react-native-extension
|
|
33
|
+
@dynamic-labs/web-extension → @dynamic-labs/legacy-web-extension
|
|
34
|
+
@dynamic-labs/solana-extension → @dynamic-labs/legacy-solana-extension
|
|
35
|
+
@dynamic-labs/sui-extension → @dynamic-labs/legacy-sui-extension
|
|
36
|
+
@dynamic-labs/viem-extension → @dynamic-labs/legacy-viem-extension
|
|
37
|
+
@dynamic-labs/zerodev-extension → @dynamic-labs/legacy-zerodev-extension
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### :book: Full migration guide
|
|
41
|
+
|
|
42
|
+
Everything you need to upgrade from v4 → v5: [Upgrade SDK from V4 to V5 - Dynamic](https://www.dynamic.xyz/docs/react/reference/upgrade/v5)
|
|
43
|
+
|
|
44
|
+
Huge props to everyone who contributed to this. :tada:
|
|
45
|
+
|
|
46
|
+
------------------------------------------
|
|
47
|
+
|
|
48
|
+
### ⚠ BREAKING CHANGES
|
|
49
|
+
|
|
50
|
+
* **waas:** move the client key-share store onto the core storage API (#12096)
|
|
51
|
+
* **react-native-extension:** store sensitive information with react-native-keychain (#12092)
|
|
52
|
+
|
|
53
|
+
### Features
|
|
54
|
+
|
|
55
|
+
* **bitcoin:** add sendBitcoinWithConfirmation to show confirm modal on BTC sends ([#12025](https://github.com/dynamic-labs/dynamic-auth/issues/12025)) ([5f992f5](https://github.com/dynamic-labs/dynamic-auth/commit/5f992f5fdaf805f07870ab9248ea2fe06a2fd3bf))
|
|
56
|
+
* **waas:** delegate key shares with initial signer rules [DYNT-1675] ([#12028](https://github.com/dynamic-labs/dynamic-auth/issues/12028)) ([6b1ffc5](https://github.com/dynamic-labs/dynamic-auth/commit/6b1ffc5ee7070d639916a65b6a0aa6ada0167cb8)), closes [dynamic-labs/dynamic-waas-sdk#1500](https://github.com/dynamic-labs/dynamic-waas-sdk/issues/1500) [#10754](https://github.com/dynamic-labs/dynamic-auth/issues/10754) [#10772](https://github.com/dynamic-labs/dynamic-auth/issues/10772) [#646](https://github.com/dynamic-labs/dynamic-auth/issues/646) [#649](https://github.com/dynamic-labs/dynamic-auth/issues/649) [#1500](https://github.com/dynamic-labs/dynamic-auth/issues/1500) [dynamic-labs/dynamic-waas-sdk#1500](https://github.com/dynamic-labs/dynamic-waas-sdk/issues/1500)
|
|
57
|
+
* **waas:** expose rawSign sha256/blake2b in SignMessageContext ([#12075](https://github.com/dynamic-labs/dynamic-auth/issues/12075)) ([20e3d2f](https://github.com/dynamic-labs/dynamic-auth/commit/20e3d2f40d18aa0bdb77e9b00fa4a5dc5dd6e9de))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### Bug Fixes
|
|
61
|
+
|
|
62
|
+
* **bitcoin:** resolve the public key of the active wallet, not the first ([#12091](https://github.com/dynamic-labs/dynamic-auth/issues/12091)) ([ebad70c](https://github.com/dynamic-labs/dynamic-auth/commit/ebad70c37ab9a771ad7051ca8f3c68d52c1d32fa)), closes [#11970](https://github.com/dynamic-labs/dynamic-auth/issues/11970) [#11970](https://github.com/dynamic-labs/dynamic-auth/issues/11970) [#11970](https://github.com/dynamic-labs/dynamic-auth/issues/11970)
|
|
63
|
+
* fallback to local wallet balance when token balances API returns no tokens ([#12059](https://github.com/dynamic-labs/dynamic-auth/issues/12059)) ([26c9022](https://github.com/dynamic-labs/dynamic-auth/commit/26c9022da3371b0da0498ec641157aa9fed356aa))
|
|
64
|
+
* security updates ([#12114](https://github.com/dynamic-labs/dynamic-auth/issues/12114)) ([a4f9bc1](https://github.com/dynamic-labs/dynamic-auth/commit/a4f9bc19870156903b76996c55ecd46a3417f004)) ([#12050](https://github.com/dynamic-labs/dynamic-auth/issues/12050)) ([8eeec92](https://github.com/dynamic-labs/dynamic-auth/commit/8eeec923d0f2f688ade60440e1f92bb1fd646201)) ([#12088](https://github.com/dynamic-labs/dynamic-auth/issues/12088)) ([f11f1f3](https://github.com/dynamic-labs/dynamic-auth/commit/f11f1f384201fa31f58753c0854eaf17f420fb09))
|
|
65
|
+
* replace deprecated polygon-rpc.com RPC with polygon.drpc.org ([#12032](https://github.com/dynamic-labs/dynamic-auth/issues/12032)) ([e1ece53](https://github.com/dynamic-labs/dynamic-auth/commit/e1ece538aedf6127048ca64daf9f9f3cf3a7026e))
|
|
66
|
+
* **sui:** stop using Sui Foundation fullnode URLs in WaaS and extension connectors ([#12108](https://github.com/dynamic-labs/dynamic-auth/issues/12108)) ([b23c85b](https://github.com/dynamic-labs/dynamic-auth/commit/b23c85b7c06f3147705a026ba23f5e8ae1f03b68))
|
|
67
|
+
* **wallet-book:** use Backpack universal link for iOS in-app browser ([#12053](https://github.com/dynamic-labs/dynamic-auth/issues/12053)) ([afba6b1](https://github.com/dynamic-labs/dynamic-auth/commit/afba6b192e4be50aaeca9f5fad88b44808a034a0))
|
|
68
|
+
* **wallet-connect:** recover WalletConnect IndexedDB store when object store is missing ([#12048](https://github.com/dynamic-labs/dynamic-auth/issues/12048)) ([96ff80e](https://github.com/dynamic-labs/dynamic-auth/commit/96ff80e40b28740de15b1702b85f954100fd5f25))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
* **react-native-extension:** store sensitive information with react-native-keychain ([#12092](https://github.com/dynamic-labs/dynamic-auth/issues/12092)) ([10c0f2f](https://github.com/dynamic-labs/dynamic-auth/commit/10c0f2f6c281e300e4a0455aaaa0d452808dcb87))
|
|
72
|
+
* **waas:** move the client key-share store onto the core storage API ([#12096](https://github.com/dynamic-labs/dynamic-auth/issues/12096)) ([778f993](https://github.com/dynamic-labs/dynamic-auth/commit/778f993c5528ec03a7f1446dcb81a041a22db89b)), closes [#12094](https://github.com/dynamic-labs/dynamic-auth/issues/12094) [#12094](https://github.com/dynamic-labs/dynamic-auth/issues/12094) [#12092](https://github.com/dynamic-labs/dynamic-auth/issues/12092) [#12094](https://github.com/dynamic-labs/dynamic-auth/issues/12094)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
## [5.0.0-rc.4](https://github.com/dynamic-labs/dynamic-auth/compare/v5.0.0-rc.3...v5.0.0-rc.4) (2026-07-20)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
### Features
|
|
79
|
+
|
|
80
|
+
* **business-accounts:** redesign demo + fix getBusinessAccount arg shape ([#11975](https://github.com/dynamic-labs/dynamic-auth/issues/11975)) ([7c2feaf](https://github.com/dynamic-labs/dynamic-auth/commit/7c2feaf6d0e00b210d67302353b40e90fdc7c8d1))
|
|
81
|
+
|
|
2
82
|
## [5.0.0-rc.3](https://github.com/dynamic-labs/dynamic-auth/compare/v5.0.0-rc.2...v5.0.0-rc.3) (2026-07-17)
|
|
3
83
|
|
|
4
84
|
## [5.0.0-rc.2](https://github.com/dynamic-labs/dynamic-auth/compare/v5.0.0-rc.1...v5.0.0-rc.2) (2026-07-17)
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/waas",
|
|
3
|
-
"version": "5.0.0
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,18 +16,19 @@
|
|
|
16
16
|
"./package.json": "./package.json"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@dynamic-labs-sdk/client": "1.
|
|
20
|
-
"@dynamic-labs/assert-package-version": "5.0.0
|
|
21
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
22
|
-
"@dynamic-labs-wallet/browser-wallet-client": "1.0.
|
|
19
|
+
"@dynamic-labs-sdk/client": "1.20.0",
|
|
20
|
+
"@dynamic-labs/assert-package-version": "5.0.0",
|
|
21
|
+
"@dynamic-labs/sdk-api-core": "0.0.1093",
|
|
22
|
+
"@dynamic-labs-wallet/browser-wallet-client": "1.0.79",
|
|
23
23
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.1",
|
|
24
|
-
"
|
|
25
|
-
"@dynamic-labs/
|
|
26
|
-
"@dynamic-labs/
|
|
27
|
-
"@dynamic-labs/
|
|
28
|
-
"@dynamic-labs/
|
|
29
|
-
"@dynamic-labs/
|
|
30
|
-
"@dynamic-labs/wallet-
|
|
24
|
+
"zod": "4.0.5",
|
|
25
|
+
"@dynamic-labs/ethereum-core": "5.0.0",
|
|
26
|
+
"@dynamic-labs/logger": "5.0.0",
|
|
27
|
+
"@dynamic-labs/solana-core": "5.0.0",
|
|
28
|
+
"@dynamic-labs/sui-core": "5.0.0",
|
|
29
|
+
"@dynamic-labs/utils": "5.0.0",
|
|
30
|
+
"@dynamic-labs/wallet-book": "5.0.0",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "5.0.0"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {}
|
|
33
34
|
}
|
package/src/DynamicWaasMixin.cjs
CHANGED
|
@@ -131,7 +131,7 @@ const withDynamicWaas = (BaseClass) => {
|
|
|
131
131
|
this.getSessionPublicKey = getSessionPublicKey;
|
|
132
132
|
}
|
|
133
133
|
delegateKeyShares(_a) {
|
|
134
|
-
return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, password, }) {
|
|
134
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ accountAddress, password, initialSignerRules, }) {
|
|
135
135
|
var _b, _c, _d;
|
|
136
136
|
if (!accountAddress) {
|
|
137
137
|
throw new Error('Account address is required');
|
|
@@ -146,13 +146,8 @@ const withDynamicWaas = (BaseClass) => {
|
|
|
146
146
|
if (!authToken) {
|
|
147
147
|
throw new Error('Auth token is required');
|
|
148
148
|
}
|
|
149
|
-
return walletClient.delegateKeyShares({
|
|
150
|
-
|
|
151
|
-
authToken,
|
|
152
|
-
password: resolvedPassword,
|
|
153
|
-
sessionPublicKey: (yield ((_d = this.getSessionPublicKey) === null || _d === void 0 ? void 0 : _d.call(this))),
|
|
154
|
-
signedSessionId,
|
|
155
|
-
});
|
|
149
|
+
return walletClient.delegateKeyShares(Object.assign({ accountAddress,
|
|
150
|
+
authToken, password: resolvedPassword, sessionPublicKey: (yield ((_d = this.getSessionPublicKey) === null || _d === void 0 ? void 0 : _d.call(this))), signedSessionId }, (initialSignerRules && { initialSignerRules })));
|
|
156
151
|
});
|
|
157
152
|
}
|
|
158
153
|
constructor(...args) {
|
|
@@ -310,9 +305,14 @@ const withDynamicWaas = (BaseClass) => {
|
|
|
310
305
|
if (!signedSessionId) {
|
|
311
306
|
throw new utils.DynamicError('Signed session ID is required', 'signed_session_id_is_required');
|
|
312
307
|
}
|
|
313
|
-
const createdWallet = yield walletClient.createWalletAccount(
|
|
308
|
+
const createdWallet = yield walletClient.createWalletAccount({
|
|
309
|
+
authToken: (_b = this.getAuthToken) === null || _b === void 0 ? void 0 : _b.call(this),
|
|
310
|
+
bitcoinConfig,
|
|
311
|
+
businessAccountId,
|
|
314
312
|
password,
|
|
315
|
-
signedSessionId,
|
|
313
|
+
signedSessionId,
|
|
314
|
+
thresholdSignatureScheme: thresholdSignatureScheme,
|
|
315
|
+
});
|
|
316
316
|
return createdWallet;
|
|
317
317
|
});
|
|
318
318
|
}
|
|
@@ -333,17 +333,15 @@ const withDynamicWaas = (BaseClass) => {
|
|
|
333
333
|
signerType,
|
|
334
334
|
walletId,
|
|
335
335
|
});
|
|
336
|
-
// browser-wallet-client@1.0.48 types use workspaceAccountId; cast to
|
|
337
|
-
// bridge the rename while runtime behaviour is correct.
|
|
338
336
|
return walletClient.reshareToNewSignerShareSet({
|
|
339
337
|
accountAddress,
|
|
340
338
|
authToken: (_d = this.getAuthToken) === null || _d === void 0 ? void 0 : _d.call(this),
|
|
339
|
+
businessAccountId,
|
|
341
340
|
password,
|
|
342
341
|
signedSessionId,
|
|
343
342
|
signerType: signerType,
|
|
344
343
|
targetSignerIdentity: targetSignerIdentity,
|
|
345
344
|
walletId,
|
|
346
|
-
workspaceAccountId: businessAccountId,
|
|
347
345
|
});
|
|
348
346
|
});
|
|
349
347
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BitcoinConfig, DynamicWalletClient } from '@dynamic-labs-wallet/browser-wallet-client';
|
|
2
2
|
import type { LogoutReason } from '@dynamic-labs-sdk/client';
|
|
3
3
|
import { InstrumentOptions, Logger } from '@dynamic-labs/logger';
|
|
4
|
-
import { MFAAction, SignMessageContext, TokenScope } from '@dynamic-labs/sdk-api-core';
|
|
4
|
+
import { MFAAction, SignMessageContext, TokenScope, WaasPolicyRule } from '@dynamic-labs/sdk-api-core';
|
|
5
5
|
import { GetWalletPasswordFn } from '@dynamic-labs/wallet-connector-core';
|
|
6
6
|
import { InstrumentContext, InstrumentationTimer, TraceContext } from '../utils/instrumentation';
|
|
7
7
|
export declare class WaasExportHandler {
|
|
@@ -74,9 +74,10 @@ export declare const withDynamicWaas: <T extends abstract new (...args: any[]) =
|
|
|
74
74
|
setRelayUrl(relayUrl: string): void;
|
|
75
75
|
setGetSignedSessionIdFunction(getSignedSessionId: () => Promise<string>): void;
|
|
76
76
|
setGetSessionPublicKeyFunction(getSessionPublicKey: () => Promise<string | undefined>): void;
|
|
77
|
-
delegateKeyShares({ accountAddress, password, }: {
|
|
77
|
+
delegateKeyShares({ accountAddress, password, initialSignerRules, }: {
|
|
78
78
|
accountAddress: string;
|
|
79
79
|
password?: string;
|
|
80
|
+
initialSignerRules?: WaasPolicyRule[];
|
|
80
81
|
}): Promise<void>;
|
|
81
82
|
createRevocableSignedSessionCallback(): {
|
|
82
83
|
getSignedSessionId: () => Promise<string>;
|
package/src/DynamicWaasMixin.js
CHANGED
|
@@ -127,7 +127,7 @@ const withDynamicWaas = (BaseClass) => {
|
|
|
127
127
|
this.getSessionPublicKey = getSessionPublicKey;
|
|
128
128
|
}
|
|
129
129
|
delegateKeyShares(_a) {
|
|
130
|
-
return __awaiter(this, arguments, void 0, function* ({ accountAddress, password, }) {
|
|
130
|
+
return __awaiter(this, arguments, void 0, function* ({ accountAddress, password, initialSignerRules, }) {
|
|
131
131
|
var _b, _c, _d;
|
|
132
132
|
if (!accountAddress) {
|
|
133
133
|
throw new Error('Account address is required');
|
|
@@ -142,13 +142,8 @@ const withDynamicWaas = (BaseClass) => {
|
|
|
142
142
|
if (!authToken) {
|
|
143
143
|
throw new Error('Auth token is required');
|
|
144
144
|
}
|
|
145
|
-
return walletClient.delegateKeyShares({
|
|
146
|
-
|
|
147
|
-
authToken,
|
|
148
|
-
password: resolvedPassword,
|
|
149
|
-
sessionPublicKey: (yield ((_d = this.getSessionPublicKey) === null || _d === void 0 ? void 0 : _d.call(this))),
|
|
150
|
-
signedSessionId,
|
|
151
|
-
});
|
|
145
|
+
return walletClient.delegateKeyShares(Object.assign({ accountAddress,
|
|
146
|
+
authToken, password: resolvedPassword, sessionPublicKey: (yield ((_d = this.getSessionPublicKey) === null || _d === void 0 ? void 0 : _d.call(this))), signedSessionId }, (initialSignerRules && { initialSignerRules })));
|
|
152
147
|
});
|
|
153
148
|
}
|
|
154
149
|
constructor(...args) {
|
|
@@ -306,9 +301,14 @@ const withDynamicWaas = (BaseClass) => {
|
|
|
306
301
|
if (!signedSessionId) {
|
|
307
302
|
throw new DynamicError('Signed session ID is required', 'signed_session_id_is_required');
|
|
308
303
|
}
|
|
309
|
-
const createdWallet = yield walletClient.createWalletAccount(
|
|
304
|
+
const createdWallet = yield walletClient.createWalletAccount({
|
|
305
|
+
authToken: (_b = this.getAuthToken) === null || _b === void 0 ? void 0 : _b.call(this),
|
|
306
|
+
bitcoinConfig,
|
|
307
|
+
businessAccountId,
|
|
310
308
|
password,
|
|
311
|
-
signedSessionId,
|
|
309
|
+
signedSessionId,
|
|
310
|
+
thresholdSignatureScheme: thresholdSignatureScheme,
|
|
311
|
+
});
|
|
312
312
|
return createdWallet;
|
|
313
313
|
});
|
|
314
314
|
}
|
|
@@ -329,17 +329,15 @@ const withDynamicWaas = (BaseClass) => {
|
|
|
329
329
|
signerType,
|
|
330
330
|
walletId,
|
|
331
331
|
});
|
|
332
|
-
// browser-wallet-client@1.0.48 types use workspaceAccountId; cast to
|
|
333
|
-
// bridge the rename while runtime behaviour is correct.
|
|
334
332
|
return walletClient.reshareToNewSignerShareSet({
|
|
335
333
|
accountAddress,
|
|
336
334
|
authToken: (_d = this.getAuthToken) === null || _d === void 0 ? void 0 : _d.call(this),
|
|
335
|
+
businessAccountId,
|
|
337
336
|
password,
|
|
338
337
|
signedSessionId,
|
|
339
338
|
signerType: signerType,
|
|
340
339
|
targetSignerIdentity: targetSignerIdentity,
|
|
341
340
|
walletId,
|
|
342
|
-
workspaceAccountId: businessAccountId,
|
|
343
341
|
});
|
|
344
342
|
});
|
|
345
343
|
}
|
|
@@ -4,24 +4,71 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../_virtual/_tslib.cjs');
|
|
7
|
-
var
|
|
7
|
+
var client = require('@dynamic-labs-sdk/client');
|
|
8
|
+
var core = require('@dynamic-labs-sdk/client/core');
|
|
9
|
+
var z = require('zod/mini');
|
|
8
10
|
|
|
11
|
+
function _interopNamespace(e) {
|
|
12
|
+
if (e && e.__esModule) return e;
|
|
13
|
+
var n = Object.create(null);
|
|
14
|
+
if (e) {
|
|
15
|
+
Object.keys(e).forEach(function (k) {
|
|
16
|
+
if (k !== 'default') {
|
|
17
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return e[k]; }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
n["default"] = e;
|
|
26
|
+
return Object.freeze(n);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var z__namespace = /*#__PURE__*/_interopNamespace(z);
|
|
30
|
+
|
|
31
|
+
const createWaasClientKeyShareSchema = (accountAddress) => core.createStorageKeySchema({
|
|
32
|
+
config: { storageTier: 'secure' },
|
|
33
|
+
key: `waas_client_key_share_${accountAddress}`,
|
|
34
|
+
schema: z__namespace.object({
|
|
35
|
+
value: z__namespace.array(z__namespace.unknown()),
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
9
38
|
const createWaasClientSecureStorage = () => ({
|
|
10
39
|
getClientKeyShare: (accountAddress) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
40
|
+
const core$1 = core.getCore(client.getDefaultClient());
|
|
41
|
+
try {
|
|
42
|
+
const schema = createWaasClientKeyShareSchema(accountAddress);
|
|
43
|
+
const shares = yield core$1.storage.getItem(schema);
|
|
44
|
+
return shares ? shares.value : [];
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
core$1.logger.error('Error retrieving client key share:', error);
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
15
50
|
}),
|
|
16
51
|
removeClientKeyShare: (accountAddress) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
52
|
+
const core$1 = core.getCore(client.getDefaultClient());
|
|
53
|
+
try {
|
|
54
|
+
const schema = createWaasClientKeyShareSchema(accountAddress);
|
|
55
|
+
yield core$1.storage.removeItem(schema);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
core$1.logger.error('Error removing client key share:', error);
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
20
61
|
}),
|
|
21
62
|
setClientKeyShare: (accountAddress, shares) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
63
|
+
const core$1 = core.getCore(client.getDefaultClient());
|
|
64
|
+
try {
|
|
65
|
+
const schema = createWaasClientKeyShareSchema(accountAddress);
|
|
66
|
+
yield core$1.storage.setItem(schema, { value: shares });
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
core$1.logger.error('Error setting client key share:', error);
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
25
72
|
}),
|
|
26
73
|
});
|
|
27
74
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const createWaasClientSecureStorage: () => {
|
|
2
|
-
getClientKeyShare: (accountAddress: string) => Promise<
|
|
2
|
+
getClientKeyShare: (accountAddress: string) => Promise<unknown[]>;
|
|
3
3
|
removeClientKeyShare: (accountAddress: string) => Promise<void>;
|
|
4
4
|
setClientKeyShare: (accountAddress: string, shares: unknown[]) => Promise<void>;
|
|
5
5
|
};
|
|
@@ -1,23 +1,50 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../_virtual/_tslib.js';
|
|
3
|
-
import {
|
|
3
|
+
import { getDefaultClient } from '@dynamic-labs-sdk/client';
|
|
4
|
+
import { getCore, createStorageKeySchema } from '@dynamic-labs-sdk/client/core';
|
|
5
|
+
import * as z from 'zod/mini';
|
|
4
6
|
|
|
7
|
+
const createWaasClientKeyShareSchema = (accountAddress) => createStorageKeySchema({
|
|
8
|
+
config: { storageTier: 'secure' },
|
|
9
|
+
key: `waas_client_key_share_${accountAddress}`,
|
|
10
|
+
schema: z.object({
|
|
11
|
+
value: z.array(z.unknown()),
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
5
14
|
const createWaasClientSecureStorage = () => ({
|
|
6
15
|
getClientKeyShare: (accountAddress) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
16
|
+
const core = getCore(getDefaultClient());
|
|
17
|
+
try {
|
|
18
|
+
const schema = createWaasClientKeyShareSchema(accountAddress);
|
|
19
|
+
const shares = yield core.storage.getItem(schema);
|
|
20
|
+
return shares ? shares.value : [];
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
core.logger.error('Error retrieving client key share:', error);
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
11
26
|
}),
|
|
12
27
|
removeClientKeyShare: (accountAddress) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
const core = getCore(getDefaultClient());
|
|
29
|
+
try {
|
|
30
|
+
const schema = createWaasClientKeyShareSchema(accountAddress);
|
|
31
|
+
yield core.storage.removeItem(schema);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
core.logger.error('Error removing client key share:', error);
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
16
37
|
}),
|
|
17
38
|
setClientKeyShare: (accountAddress, shares) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
39
|
+
const core = getCore(getDefaultClient());
|
|
40
|
+
try {
|
|
41
|
+
const schema = createWaasClientKeyShareSchema(accountAddress);
|
|
42
|
+
yield core.storage.setItem(schema, { value: shares });
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
core.logger.error('Error setting client key share:', error);
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
21
48
|
}),
|
|
22
49
|
});
|
|
23
50
|
|