@getpara/core-sdk 2.0.0-dev.3 → 2.0.0-dev.7
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 +493 -146
- package/dist/cjs/constants.js +10 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/shares/enclave.js +274 -0
- package/dist/cjs/shares/shareDistribution.js +16 -1
- package/dist/cjs/types/coreApi.js +3 -1
- package/dist/esm/ParaCore.js +493 -147
- package/dist/esm/constants.js +7 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/shares/enclave.js +234 -0
- package/dist/esm/shares/shareDistribution.js +16 -1
- package/dist/esm/types/coreApi.js +3 -1
- package/dist/types/ParaCore.d.ts +41 -8
- package/dist/types/PlatformUtils.d.ts +2 -1
- package/dist/types/constants.d.ts +3 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/shares/enclave.d.ts +81 -0
- package/dist/types/shares/shareDistribution.d.ts +4 -2
- package/dist/types/types/config.d.ts +2 -0
- package/dist/types/types/coreApi.d.ts +12 -3
- package/dist/types/types/methods.d.ts +37 -8
- package/dist/types/types/wallet.d.ts +2 -2
- package/package.json +3 -3
|
@@ -4,7 +4,7 @@ import { ParaCore } from '../ParaCore.js';
|
|
|
4
4
|
import { FullSignatureRes, Wallet } from './wallet.js';
|
|
5
5
|
import { AccountLinkInProgress } from './auth.js';
|
|
6
6
|
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", "getLinkedAccounts", "accountLinkInProgress"];
|
|
7
|
-
export declare const PARA_INTERNAL_METHODS: readonly ["linkAccount", "unlinkAccount", "verifyEmailOrPhoneLink", "verifyOAuthLink", "verifyFarcasterLink", "verifyTelegramLink", "verifyExternalWalletLink", "accountLinkInProgress"];
|
|
7
|
+
export declare const PARA_INTERNAL_METHODS: readonly ["linkAccount", "unlinkAccount", "verifyEmailOrPhoneLink", "verifyOAuthLink", "verifyFarcasterLink", "verifyTelegramLink", "verifyExternalWalletLink", "accountLinkInProgress", "prepareLogin", "sendLoginCode"];
|
|
8
8
|
export type CoreMethodName = (typeof PARA_CORE_METHODS)[number];
|
|
9
9
|
export type CoreMethodParams<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
|
|
10
10
|
params: infer P;
|
|
@@ -118,6 +118,7 @@ export type CoreMethods = Record<CoreMethodName, {
|
|
|
118
118
|
getOAuthUrl: {
|
|
119
119
|
params: OAuthUrlParams & {
|
|
120
120
|
sessionLookupId?: string;
|
|
121
|
+
encryptionKey?: string;
|
|
121
122
|
};
|
|
122
123
|
response: string;
|
|
123
124
|
};
|
|
@@ -148,11 +149,11 @@ export type CoreMethods = Record<CoreMethodName, {
|
|
|
148
149
|
};
|
|
149
150
|
verifyExternalWallet: {
|
|
150
151
|
params: AuthStateBaseParams & VerifyExternalWalletParams;
|
|
151
|
-
response: AuthStateSignup;
|
|
152
|
+
response: AuthStateSignup | AuthStateLogin;
|
|
152
153
|
};
|
|
153
154
|
resendVerificationCode: {
|
|
154
155
|
params: {
|
|
155
|
-
type?: 'SIGNUP' | 'LINK_ACCOUNT';
|
|
156
|
+
type?: 'SIGNUP' | 'LINK_ACCOUNT' | 'LOGIN';
|
|
156
157
|
} | undefined;
|
|
157
158
|
response: void;
|
|
158
159
|
};
|
|
@@ -522,6 +523,14 @@ export type InternalMethods = {
|
|
|
522
523
|
params: Omit<VerifyExternalWalletParams, 'externalWallet'>;
|
|
523
524
|
response: LinkedAccounts;
|
|
524
525
|
};
|
|
526
|
+
prepareLogin: {
|
|
527
|
+
params: void;
|
|
528
|
+
response: string;
|
|
529
|
+
};
|
|
530
|
+
sendLoginCode: {
|
|
531
|
+
params: void;
|
|
532
|
+
response: void;
|
|
533
|
+
};
|
|
525
534
|
};
|
|
526
535
|
export type CoreInterface = {
|
|
527
536
|
[key in keyof CoreMethods]: Partial<CoreMethod<key>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateSignup, AuthMethod, ServerAuthStateVerify, VerifiedAuth, AuthExtras, TOAuthMethod, TWalletType, TelegramAuthResponse } from '@getpara/user-management-client';
|
|
1
|
+
import { PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateSignup, AuthMethod, ServerAuthStateVerify, VerifiedAuth, AuthExtras, TOAuthMethod, TWalletType, TelegramAuthResponse, VerifyThirdPartyAuth, ServerAuthStateDone } from '@getpara/user-management-client';
|
|
2
2
|
import { Theme } from './theme.js';
|
|
3
3
|
import { RecoveryStatus } from './recovery.js';
|
|
4
4
|
import { Wallet } from './wallet.js';
|
|
@@ -14,7 +14,7 @@ export type VerifyExternalWalletV1 = {
|
|
|
14
14
|
cosmosPublicKeyHex?: string;
|
|
15
15
|
cosmosSigner?: string;
|
|
16
16
|
};
|
|
17
|
-
export type PortalUrlType = 'createAuth' | 'createPassword' | 'loginAuth' | 'loginPassword' | 'txReview' | 'onRamp' | 'telegramLogin';
|
|
17
|
+
export type PortalUrlType = 'createAuth' | 'createPassword' | 'loginAuth' | 'loginPassword' | 'txReview' | 'onRamp' | 'telegramLogin' | 'createPIN' | 'loginPIN' | 'oAuth' | 'oAuthCallback' | 'loginOTP' | 'telegramLoginVerify' | 'loginFarcaster';
|
|
18
18
|
export type PortalUrlOptions = {
|
|
19
19
|
params?: Record<string, string | undefined | null>;
|
|
20
20
|
isForNewDevice?: boolean;
|
|
@@ -25,10 +25,13 @@ export type PortalUrlOptions = {
|
|
|
25
25
|
pathId?: string;
|
|
26
26
|
shorten?: boolean;
|
|
27
27
|
isEmbedded?: boolean;
|
|
28
|
+
oAuthMethod?: OAuthUrlParams['method'];
|
|
29
|
+
appScheme?: string;
|
|
30
|
+
encryptionKey?: string;
|
|
28
31
|
};
|
|
29
32
|
export type WithAuthMethod = {
|
|
30
33
|
/**
|
|
31
|
-
* Which authorization method to use for the URL, either `'passkey'` or `'
|
|
34
|
+
* Which authorization method to use for the URL, either `'passkey'` or `'password'`.
|
|
32
35
|
*/
|
|
33
36
|
authMethod?: Uppercase<AuthMethod>;
|
|
34
37
|
};
|
|
@@ -76,12 +79,14 @@ export type FarcasterParams = PollParams & {
|
|
|
76
79
|
* You will need to display the URI as a QR code.
|
|
77
80
|
*/
|
|
78
81
|
onConnectUri?: (uri: string) => void;
|
|
82
|
+
serverAuthState?: VerifyThirdPartyAuth;
|
|
79
83
|
};
|
|
80
84
|
export type TelegramParams = {
|
|
81
85
|
/**
|
|
82
86
|
* The response received from the Telegram login bot.
|
|
83
87
|
*/
|
|
84
|
-
telegramAuthResponse
|
|
88
|
+
telegramAuthResponse?: TelegramAuthResponse;
|
|
89
|
+
serverAuthState?: VerifyThirdPartyAuth;
|
|
85
90
|
};
|
|
86
91
|
export type LoginUrlParams = WithAuthMethod & WithCustomTheme & WithShorten & {
|
|
87
92
|
sessionId?: string;
|
|
@@ -110,11 +115,22 @@ export type OAuthParams = OAuthUrlParams & PollParams & {
|
|
|
110
115
|
/**
|
|
111
116
|
* A callback function that will be invoked with the OAuth URL when it is available.
|
|
112
117
|
* For example, you can use this to open the URL in a new window or tab.
|
|
118
|
+
*
|
|
119
|
+
* You should pass one of `onOAuthUrl` or `onOAuthPopup`, not both.
|
|
113
120
|
*/
|
|
114
121
|
onOAuthUrl?: (url: string) => void;
|
|
122
|
+
/**
|
|
123
|
+
* A callback function that will be invoked with the OAuth popup window when it is available.
|
|
124
|
+
* If supplied, a window will automatically be opened for you if running on an applicable platform.
|
|
125
|
+
*
|
|
126
|
+
* You should pass one of `onOAuthUrl` or `onOAuthPopup`, not both.
|
|
127
|
+
*/
|
|
128
|
+
onOAuthPopup?: (popup: Window) => void;
|
|
115
129
|
};
|
|
116
130
|
export type AuthStateBaseParams = WithCustomTheme & WithUseShortUrls;
|
|
117
|
-
export type AuthStateVerify = ServerAuthStateVerify
|
|
131
|
+
export type AuthStateVerify = ServerAuthStateVerify & {
|
|
132
|
+
loginUrl?: string;
|
|
133
|
+
};
|
|
118
134
|
export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & WithIsPasskeySupported & {
|
|
119
135
|
/**
|
|
120
136
|
* 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.
|
|
@@ -128,6 +144,10 @@ export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & Wi
|
|
|
128
144
|
* A Para Portal URL for logging in via a password.
|
|
129
145
|
*/
|
|
130
146
|
passwordUrl?: string;
|
|
147
|
+
/**
|
|
148
|
+
* A Para Portal URL for logging in via a PIN.
|
|
149
|
+
*/
|
|
150
|
+
pinUrl?: string;
|
|
131
151
|
};
|
|
132
152
|
export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> & WithIsPasskeySupported & {
|
|
133
153
|
/**
|
|
@@ -138,6 +158,10 @@ export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> &
|
|
|
138
158
|
* A Para Portal URL for creating a new user password.
|
|
139
159
|
*/
|
|
140
160
|
passwordUrl?: string;
|
|
161
|
+
/**
|
|
162
|
+
* A Para Portal URL for creating a new user PIN.
|
|
163
|
+
*/
|
|
164
|
+
pinUrl?: string;
|
|
141
165
|
/**
|
|
142
166
|
* The Para system ID for the newly generated passkey.
|
|
143
167
|
*/
|
|
@@ -146,11 +170,16 @@ export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> &
|
|
|
146
170
|
* The Para system ID for the newly generated password.
|
|
147
171
|
*/
|
|
148
172
|
passwordId?: string;
|
|
173
|
+
/**
|
|
174
|
+
* The Para system ID for the newly generated PIN.
|
|
175
|
+
*/
|
|
176
|
+
pinId?: string;
|
|
149
177
|
};
|
|
178
|
+
export type AuthStateDone = ServerAuthStateDone;
|
|
150
179
|
export type AuthStateVerifyOrLogin = AuthStateVerify | AuthStateLogin;
|
|
151
|
-
export type
|
|
152
|
-
export type OAuthResponse =
|
|
153
|
-
export type AuthState = AuthStateVerify | AuthStateLogin | AuthStateSignup;
|
|
180
|
+
export type AuthStateSignupOrLoginOrDone = AuthStateSignup | AuthStateLogin | AuthStateDone;
|
|
181
|
+
export type OAuthResponse = AuthStateSignupOrLoginOrDone;
|
|
182
|
+
export type AuthState = AuthStateVerify | AuthStateLogin | AuthStateSignup | AuthStateDone;
|
|
154
183
|
export type Verify2faParams = {
|
|
155
184
|
auth: VerifiedAuth;
|
|
156
185
|
verificationCode: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmbeddedWalletType, ExternalWalletType, PartnerEntity,
|
|
1
|
+
import { EmbeddedWalletType, ExternalWalletType, PartnerEntity, TPregenIdentifierType, TWalletScheme } from '@getpara/user-management-client';
|
|
2
2
|
export interface Wallet {
|
|
3
3
|
createdAt?: string;
|
|
4
4
|
id: string;
|
|
@@ -20,7 +20,7 @@ export interface Wallet {
|
|
|
20
20
|
lastUsedPartnerId?: string;
|
|
21
21
|
isExternal?: boolean;
|
|
22
22
|
isExternalWithParaAuth?: boolean;
|
|
23
|
-
externalProviderId?:
|
|
23
|
+
externalProviderId?: string;
|
|
24
24
|
isExternalWithVerification?: boolean;
|
|
25
25
|
isExternalConnectionOnly?: boolean;
|
|
26
26
|
ensName?: string | null;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.7",
|
|
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.0.0-dev.
|
|
8
|
+
"@getpara/user-management-client": "2.0.0-dev.7",
|
|
9
9
|
"@noble/hashes": "^1.5.0",
|
|
10
10
|
"base64url": "^3.0.1",
|
|
11
11
|
"libphonenumber-js": "^1.11.7",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dist",
|
|
28
28
|
"package.json"
|
|
29
29
|
],
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "225cd3693edaab4dac81df7285956d2616e5717f",
|
|
31
31
|
"main": "dist/cjs/index.js",
|
|
32
32
|
"module": "dist/esm/index.js",
|
|
33
33
|
"scripts": {
|