@getpara/web-sdk 1.16.0 → 1.18.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.
|
@@ -87,20 +87,34 @@ function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType) {
|
|
|
87
87
|
}
|
|
88
88
|
function ed25519Sign(ctx, share, userId, walletId, base64Bytes) {
|
|
89
89
|
return __async(this, null, function* () {
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
90
|
+
const protocolId = uuid.v4();
|
|
91
|
+
const preSignMessageRes = ctx.client.preSignMessage(
|
|
92
|
+
userId,
|
|
93
|
+
walletId,
|
|
94
|
+
base64Bytes,
|
|
95
|
+
WalletScheme.ED25519,
|
|
96
|
+
void 0,
|
|
97
|
+
protocolId
|
|
98
|
+
);
|
|
99
|
+
const signRes = function() {
|
|
100
|
+
return __async(this, null, function* () {
|
|
101
|
+
try {
|
|
102
|
+
const base64Sig = yield new Promise(
|
|
103
|
+
(resolve, reject) => globalThis.ed25519Sign(share, protocolId, base64Bytes, (err, result) => {
|
|
104
|
+
if (err) {
|
|
105
|
+
reject(err);
|
|
106
|
+
}
|
|
107
|
+
resolve(result);
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
return { signature: base64Sig };
|
|
111
|
+
} catch (e) {
|
|
112
|
+
throw new Error(`error signing for account of type SOLANA with userId ${userId} and walletId ${walletId}`);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}();
|
|
116
|
+
yield preSignMessageRes;
|
|
117
|
+
return yield signRes;
|
|
104
118
|
});
|
|
105
119
|
}
|
|
106
120
|
function keygen(ctx, userId, type, secretKey) {
|
package/dist/workers/worker.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface Message {
|
|
|
19
19
|
* Executes an operation with retry capabilities
|
|
20
20
|
* @param operation The function to execute
|
|
21
21
|
* @param maxRetries Maximum number of retries (default: 2)
|
|
22
|
-
* @param timeoutMs Timeout in milliseconds (default:
|
|
22
|
+
* @param timeoutMs Timeout in milliseconds (default: 10000)
|
|
23
23
|
* @returns The result of the operation
|
|
24
24
|
*/
|
|
25
25
|
export declare function withRetry<T>(operation: () => Promise<T>, maxRetries?: number, timeoutMs?: number): Promise<T>;
|
package/dist/workers/worker.js
CHANGED
|
@@ -101,7 +101,7 @@ function executeMessage(ctx, message) {
|
|
|
101
101
|
}
|
|
102
102
|
case "ED25519_SIGN": {
|
|
103
103
|
const { share, walletId, userId, base64Bytes } = params;
|
|
104
|
-
return walletUtils.ed25519Sign(ctx, share, userId, walletId, base64Bytes);
|
|
104
|
+
return withRetry(() => walletUtils.ed25519Sign(ctx, share, userId, walletId, base64Bytes));
|
|
105
105
|
}
|
|
106
106
|
case "ED25519_PREKEYGEN": {
|
|
107
107
|
const { email } = params;
|
|
@@ -118,7 +118,7 @@ function executeMessage(ctx, message) {
|
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
|
-
function withRetry(operation, maxRetries = 2, timeoutMs =
|
|
121
|
+
function withRetry(operation, maxRetries = 2, timeoutMs = 1e4) {
|
|
122
122
|
return __async(this, null, function* () {
|
|
123
123
|
let retries = 0;
|
|
124
124
|
while (true) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/web-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"wasm_exec.js"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@getpara/core-sdk": "1.
|
|
12
|
-
"@getpara/user-management-client": "1.
|
|
11
|
+
"@getpara/core-sdk": "1.18.0",
|
|
12
|
+
"@getpara/user-management-client": "1.18.0",
|
|
13
13
|
"base64url": "3.0.1",
|
|
14
14
|
"buffer": "6.0.3",
|
|
15
15
|
"cbor-web": "8.1.0",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"dist",
|
|
36
36
|
"package.json"
|
|
37
37
|
],
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "5928feb89e9fe821893477e4f892f6efa2ebffe2"
|
|
39
39
|
}
|