@getpara/core-sdk 2.29.0 → 2.31.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/dist/cjs/ParaCore.js +41 -11
- package/dist/cjs/constants.js +1 -1
- package/dist/esm/ParaCore.js +41 -11
- package/dist/esm/constants.js +1 -1
- package/dist/types/ParaCore.d.ts +10 -0
- package/package.json +3 -3
package/dist/cjs/ParaCore.js
CHANGED
|
@@ -1478,6 +1478,19 @@ const _ParaCore = class _ParaCore {
|
|
|
1478
1478
|
return yield __privateGet(this, _authService).signExternalWalletVerification(params);
|
|
1479
1479
|
});
|
|
1480
1480
|
}
|
|
1481
|
+
// Direct-to-wallet sign for an external-wallet user who's already authenticated.
|
|
1482
|
+
// The signExternalWalletVerification() path above dispatches a state-machine event
|
|
1483
|
+
// that's only handled from the `awaiting_wallet_signature` state — after login
|
|
1484
|
+
// the machine has moved past that, so the event is silently dropped and the
|
|
1485
|
+
// wallet never gets prompted. The re-auth flow (popup-driven SIWE for export-key
|
|
1486
|
+
// / transaction-review) needs the signature regardless of machine state, so it
|
|
1487
|
+
// routes here and reads the signature back synchronously.
|
|
1488
|
+
signExternalWalletMessageForReauth(params) {
|
|
1489
|
+
return __async(this, null, function* () {
|
|
1490
|
+
const _a = yield __privateGet(this, _externalWalletService).signMessage(params), { signature } = _a, rest = __objRest(_a, ["signature"]);
|
|
1491
|
+
return __spreadValues({ externalWallet: params.externalWallet, signedMessage: signature }, rest);
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1481
1494
|
verifyExternalWalletLink(opts) {
|
|
1482
1495
|
return __async(this, null, function* () {
|
|
1483
1496
|
const accountLinkInProgress = __privateMethod(this, _ParaCore_instances, assertIsLinkingAccount_fn).call(this, ["EXTERNAL_WALLET"]);
|
|
@@ -2144,6 +2157,9 @@ const _ParaCore = class _ParaCore {
|
|
|
2144
2157
|
}
|
|
2145
2158
|
getTransactionReviewUrl(transactionId, timeoutMs) {
|
|
2146
2159
|
return __async(this, null, function* () {
|
|
2160
|
+
if (this.isExternalWalletAuth) {
|
|
2161
|
+
yield this.ctx.client.sessionAddPortalVerification();
|
|
2162
|
+
}
|
|
2147
2163
|
const authMethods = yield this.supportedUserAuthMethods();
|
|
2148
2164
|
return this.constructPortalUrl("txReview", {
|
|
2149
2165
|
pathId: transactionId,
|
|
@@ -2833,6 +2849,7 @@ const _ParaCore = class _ParaCore {
|
|
|
2833
2849
|
}
|
|
2834
2850
|
exportPrivateKey() {
|
|
2835
2851
|
return __async(this, arguments, function* (args = {}) {
|
|
2852
|
+
var _a;
|
|
2836
2853
|
let walletId = args == null ? void 0 : args.walletId;
|
|
2837
2854
|
if (!(args == null ? void 0 : args.walletId)) {
|
|
2838
2855
|
walletId = this.findWalletId(void 0, { forbidPregen: true, scheme: ["DKLS", "ED25519"] });
|
|
@@ -2850,18 +2867,31 @@ const _ParaCore = class _ParaCore {
|
|
|
2850
2867
|
if (args.shouldOpenPopup) {
|
|
2851
2868
|
this.popupWindow = yield this.platformUtils.openPopup("about:blank", { type: import_types.PopupType.EXPORT_PRIVATE_KEY });
|
|
2852
2869
|
}
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2870
|
+
try {
|
|
2871
|
+
if (this.isExternalWalletAuth) {
|
|
2872
|
+
yield this.ctx.client.sessionAddPortalVerification();
|
|
2873
|
+
}
|
|
2874
|
+
const authMethods = yield this.supportedUserAuthMethods();
|
|
2875
|
+
const exportPrivateKeyUrl = yield this.constructPortalUrl("exportPrivateKey", {
|
|
2876
|
+
pathId: walletId,
|
|
2877
|
+
useLegacyUrl: authMethods.has(import_user_management_client.AuthMethod.PASSKEY)
|
|
2878
|
+
});
|
|
2879
|
+
if (args.shouldOpenPopup) {
|
|
2880
|
+
this.popupWindow.location.href = exportPrivateKeyUrl;
|
|
2881
|
+
}
|
|
2882
|
+
return {
|
|
2883
|
+
url: exportPrivateKeyUrl,
|
|
2884
|
+
popupWindow: this.popupWindow
|
|
2885
|
+
};
|
|
2886
|
+
} catch (err) {
|
|
2887
|
+
if (args.shouldOpenPopup) {
|
|
2888
|
+
try {
|
|
2889
|
+
(_a = this.popupWindow) == null ? void 0 : _a.close();
|
|
2890
|
+
} catch (e) {
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
throw err;
|
|
2860
2894
|
}
|
|
2861
|
-
return {
|
|
2862
|
-
url: exportPrivateKeyUrl,
|
|
2863
|
-
popupWindow: this.popupWindow
|
|
2864
|
-
};
|
|
2865
2895
|
});
|
|
2866
2896
|
}
|
|
2867
2897
|
};
|
package/dist/cjs/constants.js
CHANGED
|
@@ -46,7 +46,7 @@ __export(constants_exports, {
|
|
|
46
46
|
TRANSACTION_REVIEW_TIMEOUT_MS: () => TRANSACTION_REVIEW_TIMEOUT_MS
|
|
47
47
|
});
|
|
48
48
|
module.exports = __toCommonJS(constants_exports);
|
|
49
|
-
const PARA_CORE_VERSION = "2.
|
|
49
|
+
const PARA_CORE_VERSION = "2.31.0";
|
|
50
50
|
const PREFIX = "@CAPSULE/";
|
|
51
51
|
const PARA_PREFIX = "@PARA/";
|
|
52
52
|
const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
|
package/dist/esm/ParaCore.js
CHANGED
|
@@ -1420,6 +1420,19 @@ const _ParaCore = class _ParaCore {
|
|
|
1420
1420
|
return yield __privateGet(this, _authService).signExternalWalletVerification(params);
|
|
1421
1421
|
});
|
|
1422
1422
|
}
|
|
1423
|
+
// Direct-to-wallet sign for an external-wallet user who's already authenticated.
|
|
1424
|
+
// The signExternalWalletVerification() path above dispatches a state-machine event
|
|
1425
|
+
// that's only handled from the `awaiting_wallet_signature` state — after login
|
|
1426
|
+
// the machine has moved past that, so the event is silently dropped and the
|
|
1427
|
+
// wallet never gets prompted. The re-auth flow (popup-driven SIWE for export-key
|
|
1428
|
+
// / transaction-review) needs the signature regardless of machine state, so it
|
|
1429
|
+
// routes here and reads the signature back synchronously.
|
|
1430
|
+
signExternalWalletMessageForReauth(params) {
|
|
1431
|
+
return __async(this, null, function* () {
|
|
1432
|
+
const _a = yield __privateGet(this, _externalWalletService).signMessage(params), { signature } = _a, rest = __objRest(_a, ["signature"]);
|
|
1433
|
+
return __spreadValues({ externalWallet: params.externalWallet, signedMessage: signature }, rest);
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1423
1436
|
verifyExternalWalletLink(opts) {
|
|
1424
1437
|
return __async(this, null, function* () {
|
|
1425
1438
|
const accountLinkInProgress = __privateMethod(this, _ParaCore_instances, assertIsLinkingAccount_fn).call(this, ["EXTERNAL_WALLET"]);
|
|
@@ -2086,6 +2099,9 @@ const _ParaCore = class _ParaCore {
|
|
|
2086
2099
|
}
|
|
2087
2100
|
getTransactionReviewUrl(transactionId, timeoutMs) {
|
|
2088
2101
|
return __async(this, null, function* () {
|
|
2102
|
+
if (this.isExternalWalletAuth) {
|
|
2103
|
+
yield this.ctx.client.sessionAddPortalVerification();
|
|
2104
|
+
}
|
|
2089
2105
|
const authMethods = yield this.supportedUserAuthMethods();
|
|
2090
2106
|
return this.constructPortalUrl("txReview", {
|
|
2091
2107
|
pathId: transactionId,
|
|
@@ -2775,6 +2791,7 @@ const _ParaCore = class _ParaCore {
|
|
|
2775
2791
|
}
|
|
2776
2792
|
exportPrivateKey() {
|
|
2777
2793
|
return __async(this, arguments, function* (args = {}) {
|
|
2794
|
+
var _a;
|
|
2778
2795
|
let walletId = args == null ? void 0 : args.walletId;
|
|
2779
2796
|
if (!(args == null ? void 0 : args.walletId)) {
|
|
2780
2797
|
walletId = this.findWalletId(void 0, { forbidPregen: true, scheme: ["DKLS", "ED25519"] });
|
|
@@ -2792,18 +2809,31 @@ const _ParaCore = class _ParaCore {
|
|
|
2792
2809
|
if (args.shouldOpenPopup) {
|
|
2793
2810
|
this.popupWindow = yield this.platformUtils.openPopup("about:blank", { type: PopupType.EXPORT_PRIVATE_KEY });
|
|
2794
2811
|
}
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2812
|
+
try {
|
|
2813
|
+
if (this.isExternalWalletAuth) {
|
|
2814
|
+
yield this.ctx.client.sessionAddPortalVerification();
|
|
2815
|
+
}
|
|
2816
|
+
const authMethods = yield this.supportedUserAuthMethods();
|
|
2817
|
+
const exportPrivateKeyUrl = yield this.constructPortalUrl("exportPrivateKey", {
|
|
2818
|
+
pathId: walletId,
|
|
2819
|
+
useLegacyUrl: authMethods.has(AuthMethod.PASSKEY)
|
|
2820
|
+
});
|
|
2821
|
+
if (args.shouldOpenPopup) {
|
|
2822
|
+
this.popupWindow.location.href = exportPrivateKeyUrl;
|
|
2823
|
+
}
|
|
2824
|
+
return {
|
|
2825
|
+
url: exportPrivateKeyUrl,
|
|
2826
|
+
popupWindow: this.popupWindow
|
|
2827
|
+
};
|
|
2828
|
+
} catch (err) {
|
|
2829
|
+
if (args.shouldOpenPopup) {
|
|
2830
|
+
try {
|
|
2831
|
+
(_a = this.popupWindow) == null ? void 0 : _a.close();
|
|
2832
|
+
} catch (e) {
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
throw err;
|
|
2802
2836
|
}
|
|
2803
|
-
return {
|
|
2804
|
-
url: exportPrivateKeyUrl,
|
|
2805
|
-
popupWindow: this.popupWindow
|
|
2806
|
-
};
|
|
2807
2837
|
});
|
|
2808
2838
|
}
|
|
2809
2839
|
};
|
package/dist/esm/constants.js
CHANGED
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -458,6 +458,16 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
458
458
|
verifyExternalWallet(params: VerifyExternalWalletParams): Promise<import("./services/types").VerifyExternalWalletResponse>;
|
|
459
459
|
retryVerifyExternalWallet(): Promise<import("./services/types").VerifyExternalWalletResponse>;
|
|
460
460
|
signExternalWalletVerification(params: ExternalSignMessageParams): Promise<import("./services/types").BaseVerifyExternalWalletParams>;
|
|
461
|
+
signExternalWalletMessageForReauth(params: ExternalSignMessageParams & {
|
|
462
|
+
externalWallet: ExternalWalletInfo;
|
|
463
|
+
}): Promise<{
|
|
464
|
+
address: string;
|
|
465
|
+
cosmosPublicKeyHex?: string;
|
|
466
|
+
cosmosSigner?: string;
|
|
467
|
+
addressBech32?: string;
|
|
468
|
+
externalWallet: ExternalWalletInfo;
|
|
469
|
+
signedMessage: string;
|
|
470
|
+
}>;
|
|
461
471
|
protected verifyExternalWalletLink(opts: InternalMethodParams<'verifyExternalWalletLink'>): InternalMethodResponse<'verifyExternalWalletLink'>;
|
|
462
472
|
protected verifyTelegramProcess(opts: VerifyTelegramParams & {
|
|
463
473
|
isLinkAccount: false;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.31.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@celo/utils": "^8.0.2",
|
|
6
6
|
"@cosmjs/encoding": "^0.32.4",
|
|
7
7
|
"@ethereumjs/util": "^9.1.0",
|
|
8
|
-
"@getpara/user-management-client": "2.
|
|
8
|
+
"@getpara/user-management-client": "2.31.0",
|
|
9
9
|
"@noble/hashes": "^1.5.0",
|
|
10
10
|
"axios": "^1.8.4",
|
|
11
11
|
"base64url": "^3.0.1",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dist",
|
|
31
31
|
"package.json"
|
|
32
32
|
],
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "174819efc3091ef104a4b54c887066587b07e4b8",
|
|
34
34
|
"main": "dist/cjs/index.js",
|
|
35
35
|
"module": "dist/esm/index.js",
|
|
36
36
|
"scripts": {
|