@getpara/core-sdk 2.0.0-alpha.12 → 2.0.0-alpha.14
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 +16 -6
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/types/coreApi.js +2 -1
- package/dist/esm/ParaCore.js +16 -6
- package/dist/esm/constants.js +1 -1
- package/dist/esm/types/coreApi.js +2 -1
- package/dist/types/ParaCore.d.ts +2 -0
- package/dist/types/types/coreApi.d.ts +6 -2
- package/dist/types/types/methods.d.ts +8 -2
- package/package.json +3 -3
package/dist/cjs/ParaCore.js
CHANGED
|
@@ -439,8 +439,8 @@ const _ParaCore = class _ParaCore {
|
|
|
439
439
|
return (0, import_user_management_client.isTelegram)((_a = this.authInfo) == null ? void 0 : _a.auth);
|
|
440
440
|
}
|
|
441
441
|
get isExternalWalletAuth() {
|
|
442
|
-
var _a;
|
|
443
|
-
return (0, import_user_management_client.isExternalWallet)((_a = __privateGet(this, _authInfo)) == null ? void 0 : _a.auth);
|
|
442
|
+
var _a, _b, _c;
|
|
443
|
+
return (0, import_user_management_client.isExternalWallet)((_a = __privateGet(this, _authInfo)) == null ? void 0 : _a.auth) && !!((_c = (_b = __privateGet(this, _authInfo)) == null ? void 0 : _b.externalWallet) == null ? void 0 : _c.withFullParaAuth);
|
|
444
444
|
}
|
|
445
445
|
get partnerId() {
|
|
446
446
|
var _a;
|
|
@@ -2595,6 +2595,12 @@ const _ParaCore = class _ParaCore {
|
|
|
2595
2595
|
return sessionLookupId;
|
|
2596
2596
|
});
|
|
2597
2597
|
}
|
|
2598
|
+
issueJwt() {
|
|
2599
|
+
return __async(this, arguments, function* ({ keyIndex = 0 } = {}) {
|
|
2600
|
+
const res = yield this.ctx.client.issueJwt({ keyIndex });
|
|
2601
|
+
return res;
|
|
2602
|
+
});
|
|
2603
|
+
}
|
|
2598
2604
|
/**
|
|
2599
2605
|
* Logs the user out.
|
|
2600
2606
|
* @param {Object} opts the options object.
|
|
@@ -2967,7 +2973,10 @@ prepareLoginState_fn = function(_0, _1) {
|
|
|
2967
2973
|
sessionLookupId
|
|
2968
2974
|
}) {
|
|
2969
2975
|
const _a = loginState, { loginAuthMethods } = _a, authState = __objRest(_a, ["loginAuthMethods"]);
|
|
2970
|
-
|
|
2976
|
+
const isPasskeySupported = yield this.isPasskeySupported(), isPasskeyPossible = loginAuthMethods.includes(import_user_management_client.AuthMethod.PASSKEY) && !this.isNativePasskey, isPasswordPossible = loginAuthMethods.includes(import_user_management_client.AuthMethod.PASSWORD);
|
|
2977
|
+
return __spreadValues(__spreadValues(__spreadProps(__spreadValues({}, authState), {
|
|
2978
|
+
isPasskeySupported
|
|
2979
|
+
}), isPasskeyPossible ? {
|
|
2971
2980
|
passkeyUrl: yield this.getLoginUrl({ sessionId: sessionLookupId, shorten, portalTheme }),
|
|
2972
2981
|
passkeyKnownDeviceUrl: yield this.constructPortalUrl("loginAuth", {
|
|
2973
2982
|
sessionId: sessionLookupId,
|
|
@@ -2978,7 +2987,7 @@ prepareLoginState_fn = function(_0, _1) {
|
|
|
2978
2987
|
shorten,
|
|
2979
2988
|
portalTheme
|
|
2980
2989
|
})
|
|
2981
|
-
} : {}),
|
|
2990
|
+
} : {}), isPasswordPossible ? {
|
|
2982
2991
|
passwordUrl: yield this.constructPortalUrl("loginPassword", {
|
|
2983
2992
|
sessionId: sessionLookupId,
|
|
2984
2993
|
shorten,
|
|
@@ -2990,16 +2999,17 @@ prepareLoginState_fn = function(_0, _1) {
|
|
|
2990
2999
|
prepareSignUpState_fn = function(_0, _1) {
|
|
2991
3000
|
return __async(this, arguments, function* (serverSignupState, { useShortUrls: shorten = false, portalTheme }) {
|
|
2992
3001
|
const _a = serverSignupState, { signupAuthMethods } = _a, authState = __objRest(_a, ["signupAuthMethods"]);
|
|
3002
|
+
const isPasskeySupported = yield this.isPasskeySupported();
|
|
2993
3003
|
const [isPasskey, isPassword] = [
|
|
2994
3004
|
signupAuthMethods.includes(import_user_management_client.AuthMethod.PASSKEY),
|
|
2995
|
-
signupAuthMethods.includes(import_user_management_client.AuthMethod.PASSWORD)
|
|
3005
|
+
signupAuthMethods.includes(import_user_management_client.AuthMethod.PASSWORD) || !isPasskeySupported
|
|
2996
3006
|
];
|
|
2997
3007
|
if (!isPasskey && !isPassword) {
|
|
2998
3008
|
throw new Error(
|
|
2999
3009
|
"No supported authentication methods found. Please ensure you have enabled either WebAuth passkeys or passwords in your Developer Portal settings."
|
|
3000
3010
|
);
|
|
3001
3011
|
}
|
|
3002
|
-
const signupState = authState;
|
|
3012
|
+
const signupState = __spreadProps(__spreadValues({}, authState), { isPasskeySupported });
|
|
3003
3013
|
if (isPasskey) {
|
|
3004
3014
|
const { url: passkeyUrl, credentialId: passkeyId } = yield this.getNewCredentialAndUrl({
|
|
3005
3015
|
authMethod: "PASSKEY",
|
package/dist/cjs/constants.js
CHANGED
|
@@ -39,7 +39,7 @@ __export(constants_exports, {
|
|
|
39
39
|
SHORT_POLLING_INTERVAL_MS: () => SHORT_POLLING_INTERVAL_MS
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(constants_exports);
|
|
42
|
-
const PARA_CORE_VERSION = "2.0.0-alpha.
|
|
42
|
+
const PARA_CORE_VERSION = "2.0.0-alpha.13";
|
|
43
43
|
const PREFIX = "@CAPSULE/";
|
|
44
44
|
const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
|
|
45
45
|
const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
|
package/dist/esm/ParaCore.js
CHANGED
|
@@ -402,8 +402,8 @@ const _ParaCore = class _ParaCore {
|
|
|
402
402
|
return isTelegram((_a = this.authInfo) == null ? void 0 : _a.auth);
|
|
403
403
|
}
|
|
404
404
|
get isExternalWalletAuth() {
|
|
405
|
-
var _a;
|
|
406
|
-
return isExternalWallet((_a = __privateGet(this, _authInfo)) == null ? void 0 : _a.auth);
|
|
405
|
+
var _a, _b, _c;
|
|
406
|
+
return isExternalWallet((_a = __privateGet(this, _authInfo)) == null ? void 0 : _a.auth) && !!((_c = (_b = __privateGet(this, _authInfo)) == null ? void 0 : _b.externalWallet) == null ? void 0 : _c.withFullParaAuth);
|
|
407
407
|
}
|
|
408
408
|
get partnerId() {
|
|
409
409
|
var _a;
|
|
@@ -2558,6 +2558,12 @@ const _ParaCore = class _ParaCore {
|
|
|
2558
2558
|
return sessionLookupId;
|
|
2559
2559
|
});
|
|
2560
2560
|
}
|
|
2561
|
+
issueJwt() {
|
|
2562
|
+
return __async(this, arguments, function* ({ keyIndex = 0 } = {}) {
|
|
2563
|
+
const res = yield this.ctx.client.issueJwt({ keyIndex });
|
|
2564
|
+
return res;
|
|
2565
|
+
});
|
|
2566
|
+
}
|
|
2561
2567
|
/**
|
|
2562
2568
|
* Logs the user out.
|
|
2563
2569
|
* @param {Object} opts the options object.
|
|
@@ -2930,7 +2936,10 @@ prepareLoginState_fn = function(_0, _1) {
|
|
|
2930
2936
|
sessionLookupId
|
|
2931
2937
|
}) {
|
|
2932
2938
|
const _a = loginState, { loginAuthMethods } = _a, authState = __objRest(_a, ["loginAuthMethods"]);
|
|
2933
|
-
|
|
2939
|
+
const isPasskeySupported = yield this.isPasskeySupported(), isPasskeyPossible = loginAuthMethods.includes(AuthMethod.PASSKEY) && !this.isNativePasskey, isPasswordPossible = loginAuthMethods.includes(AuthMethod.PASSWORD);
|
|
2940
|
+
return __spreadValues(__spreadValues(__spreadProps(__spreadValues({}, authState), {
|
|
2941
|
+
isPasskeySupported
|
|
2942
|
+
}), isPasskeyPossible ? {
|
|
2934
2943
|
passkeyUrl: yield this.getLoginUrl({ sessionId: sessionLookupId, shorten, portalTheme }),
|
|
2935
2944
|
passkeyKnownDeviceUrl: yield this.constructPortalUrl("loginAuth", {
|
|
2936
2945
|
sessionId: sessionLookupId,
|
|
@@ -2941,7 +2950,7 @@ prepareLoginState_fn = function(_0, _1) {
|
|
|
2941
2950
|
shorten,
|
|
2942
2951
|
portalTheme
|
|
2943
2952
|
})
|
|
2944
|
-
} : {}),
|
|
2953
|
+
} : {}), isPasswordPossible ? {
|
|
2945
2954
|
passwordUrl: yield this.constructPortalUrl("loginPassword", {
|
|
2946
2955
|
sessionId: sessionLookupId,
|
|
2947
2956
|
shorten,
|
|
@@ -2953,16 +2962,17 @@ prepareLoginState_fn = function(_0, _1) {
|
|
|
2953
2962
|
prepareSignUpState_fn = function(_0, _1) {
|
|
2954
2963
|
return __async(this, arguments, function* (serverSignupState, { useShortUrls: shorten = false, portalTheme }) {
|
|
2955
2964
|
const _a = serverSignupState, { signupAuthMethods } = _a, authState = __objRest(_a, ["signupAuthMethods"]);
|
|
2965
|
+
const isPasskeySupported = yield this.isPasskeySupported();
|
|
2956
2966
|
const [isPasskey, isPassword] = [
|
|
2957
2967
|
signupAuthMethods.includes(AuthMethod.PASSKEY),
|
|
2958
|
-
signupAuthMethods.includes(AuthMethod.PASSWORD)
|
|
2968
|
+
signupAuthMethods.includes(AuthMethod.PASSWORD) || !isPasskeySupported
|
|
2959
2969
|
];
|
|
2960
2970
|
if (!isPasskey && !isPassword) {
|
|
2961
2971
|
throw new Error(
|
|
2962
2972
|
"No supported authentication methods found. Please ensure you have enabled either WebAuth passkeys or passwords in your Developer Portal settings."
|
|
2963
2973
|
);
|
|
2964
2974
|
}
|
|
2965
|
-
const signupState = authState;
|
|
2975
|
+
const signupState = __spreadProps(__spreadValues({}, authState), { isPasskeySupported });
|
|
2966
2976
|
if (isPasskey) {
|
|
2967
2977
|
const { url: passkeyUrl, credentialId: passkeyId } = yield this.getNewCredentialAndUrl({
|
|
2968
2978
|
authMethod: "PASSKEY",
|
package/dist/esm/constants.js
CHANGED
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -171,6 +171,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
171
171
|
getWallets(): Record<string, Wallet>;
|
|
172
172
|
getAddress(walletId?: string): string | undefined;
|
|
173
173
|
protected abstract getPlatformUtils(): PlatformUtils;
|
|
174
|
+
abstract isPasskeySupported(): Promise<boolean>;
|
|
174
175
|
protected constructPortalUrl(type: PortalUrlType, opts?: PortalUrlOptions): Promise<string>;
|
|
175
176
|
/**
|
|
176
177
|
* Constructs a new `ParaCore` instance.
|
|
@@ -640,6 +641,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
640
641
|
* @returns {Promise<string>} the ID
|
|
641
642
|
**/
|
|
642
643
|
getVerificationToken(): CoreMethodResponse<'getVerificationToken'>;
|
|
644
|
+
issueJwt({ keyIndex }?: CoreMethodParams<'issueJwt'>): CoreMethodResponse<'issueJwt'>;
|
|
643
645
|
/**
|
|
644
646
|
* Logs the user out.
|
|
645
647
|
* @param {Object} opts the options object.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BackupKitEmailProps, CurrentWalletIds, ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, PregenAuth, Setup2faResponse, TelegramAuthResponse, VerifiedAuth, VerifyExternalWalletParams, WalletEntity, WalletParams, TWalletType } from '@getpara/user-management-client';
|
|
1
|
+
import { BackupKitEmailProps, CurrentWalletIds, ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, PregenAuth, Setup2faResponse, TelegramAuthResponse, VerifiedAuth, VerifyExternalWalletParams, WalletEntity, WalletParams, TWalletType, IssueJwtParams, IssueJwtResponse } from '@getpara/user-management-client';
|
|
2
2
|
import { AuthStateLogin, AuthStateVerify, OAuthResponse, AuthStateBaseParams, WithCustomTheme, WithUseShortUrls, Verify2faResponse, AuthStateSignup, AuthStateVerifyOrLogin, OAuthUrlParams, StorageType, PollParams, CoreAuthInfo, GetWalletBalanceParams, GetWalletBalanceResponse } from './methods.js';
|
|
3
3
|
import { ParaCore } from '../ParaCore.js';
|
|
4
4
|
import { FullSignatureRes, Wallet } from './wallet.js';
|
|
5
|
-
export declare const PARA_CORE_METHODS: readonly ["getAuthInfo", "signUpOrLogIn", "verifyNewAccount", "waitForLogin", "waitForSignup", "waitForWalletCreation", "getOAuthUrl", "verifyOAuth", "getFarcasterConnectUri", "verifyFarcaster", "verifyTelegram", "resendVerificationCode", "loginExternalWallet", "verifyExternalWallet", "setup2fa", "enable2fa", "verify2fa", "logout", "clearStorage", "isSessionActive", "isFullyLoggedIn", "refreshSession", "keepSessionAlive", "exportSession", "importSession", "getVerificationToken", "getWallets", "getWalletsByType", "fetchWallets", "createWallet", "createWalletPerType", "getPregenWallets", "hasPregenWallet", "updatePregenWalletIdentifier", "createPregenWallet", "createPregenWalletPerType", "claimPregenWallets", "createGuestWallets", "distributeNewWalletShare", "getUserShare", "setUserShare", "refreshShare", "signMessage", "signTransaction", "initiateOnRampTransaction", "getWalletBalance"];
|
|
5
|
+
export declare const PARA_CORE_METHODS: readonly ["getAuthInfo", "signUpOrLogIn", "verifyNewAccount", "waitForLogin", "waitForSignup", "waitForWalletCreation", "getOAuthUrl", "verifyOAuth", "getFarcasterConnectUri", "verifyFarcaster", "verifyTelegram", "resendVerificationCode", "loginExternalWallet", "verifyExternalWallet", "setup2fa", "enable2fa", "verify2fa", "logout", "clearStorage", "isSessionActive", "isFullyLoggedIn", "refreshSession", "keepSessionAlive", "exportSession", "importSession", "getVerificationToken", "getWallets", "getWalletsByType", "fetchWallets", "createWallet", "createWalletPerType", "getPregenWallets", "hasPregenWallet", "updatePregenWalletIdentifier", "createPregenWallet", "createPregenWalletPerType", "claimPregenWallets", "createGuestWallets", "distributeNewWalletShare", "getUserShare", "setUserShare", "refreshShare", "signMessage", "signTransaction", "initiateOnRampTransaction", "getWalletBalance", "issueJwt"];
|
|
6
6
|
export type CoreMethodName = (typeof PARA_CORE_METHODS)[number];
|
|
7
7
|
export type CoreMethodParams<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
|
|
8
8
|
params: infer P;
|
|
@@ -469,6 +469,10 @@ export type CoreMethods = Record<CoreMethodName, {
|
|
|
469
469
|
params: GetWalletBalanceParams;
|
|
470
470
|
response: GetWalletBalanceResponse;
|
|
471
471
|
};
|
|
472
|
+
issueJwt: {
|
|
473
|
+
params: IssueJwtParams;
|
|
474
|
+
response: IssueJwtResponse;
|
|
475
|
+
};
|
|
472
476
|
};
|
|
473
477
|
export type CoreInterface = {
|
|
474
478
|
[key in keyof CoreMethods]: CoreMethod<key>;
|
|
@@ -49,6 +49,12 @@ export type WithShorten = {
|
|
|
49
49
|
*/
|
|
50
50
|
shorten?: boolean;
|
|
51
51
|
};
|
|
52
|
+
export type WithIsPasskeySupported = {
|
|
53
|
+
/**
|
|
54
|
+
* Whether the current device supports WebAuth passkeys.
|
|
55
|
+
*/
|
|
56
|
+
isPasskeySupported: boolean;
|
|
57
|
+
};
|
|
52
58
|
export type PollParams = {
|
|
53
59
|
/**
|
|
54
60
|
* A callback function that will be invoked on each method poll.
|
|
@@ -80,7 +86,7 @@ export type OAuthUrlParams = {
|
|
|
80
86
|
};
|
|
81
87
|
export type AuthStateBaseParams = WithCustomTheme & WithUseShortUrls;
|
|
82
88
|
export type AuthStateVerify = ServerAuthStateVerify;
|
|
83
|
-
export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & {
|
|
89
|
+
export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & WithIsPasskeySupported & {
|
|
84
90
|
/**
|
|
85
91
|
* A Para Portal URL for logging in via a WebAuth passkey. For best compatibility, you should open this URL in a new window or tab.
|
|
86
92
|
*/
|
|
@@ -94,7 +100,7 @@ export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & {
|
|
|
94
100
|
*/
|
|
95
101
|
passwordUrl?: string;
|
|
96
102
|
};
|
|
97
|
-
export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> & {
|
|
103
|
+
export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> & WithIsPasskeySupported & {
|
|
98
104
|
/**
|
|
99
105
|
* A Para Portal URL for creating a new WebAuth passkey.
|
|
100
106
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.14",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@celo/utils": "^8.0.2",
|
|
11
11
|
"@cosmjs/encoding": "^0.32.4",
|
|
12
12
|
"@ethereumjs/util": "^9.1.0",
|
|
13
|
-
"@getpara/user-management-client": "2.0.0-alpha.
|
|
13
|
+
"@getpara/user-management-client": "2.0.0-alpha.14",
|
|
14
14
|
"@noble/hashes": "^1.5.0",
|
|
15
15
|
"base64url": "^3.0.1",
|
|
16
16
|
"libphonenumber-js": "1.11.2",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"require": "./dist/cjs/index.js"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "03898846281bf37536a6ed12dede119e6171ad45"
|
|
45
45
|
}
|