@getpara/core-sdk 2.0.0-alpha.5 → 2.0.0-alpha.51
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 +764 -204
- package/dist/cjs/constants.js +7 -1
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/types/auth.js +33 -0
- package/dist/cjs/types/coreApi.js +20 -3
- package/dist/cjs/types/index.js +2 -0
- package/dist/cjs/utils/formatting.js +4 -0
- package/dist/cjs/utils/phone.js +14 -2
- package/dist/esm/ParaCore.js +771 -208
- package/dist/esm/constants.js +5 -1
- package/dist/esm/index.js +22 -3
- package/dist/esm/types/auth.js +11 -0
- package/dist/esm/types/coreApi.js +18 -2
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/utils/formatting.js +2 -0
- package/dist/esm/utils/phone.js +12 -1
- package/dist/types/ParaCore.d.ts +87 -49
- package/dist/types/PlatformUtils.d.ts +2 -3
- package/dist/types/constants.d.ts +16 -14
- package/dist/types/index.d.ts +3 -3
- package/dist/types/shares/KeyContainer.d.ts +0 -2
- package/dist/types/types/auth.d.ts +16 -0
- package/dist/types/types/config.d.ts +9 -1
- package/dist/types/types/coreApi.d.ts +100 -36
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/methods.d.ts +63 -7
- package/dist/types/types/wallet.d.ts +4 -1
- package/dist/types/utils/formatting.d.ts +2 -0
- package/dist/types/utils/phone.d.ts +4 -0
- package/package.json +23 -23
|
@@ -1,24 +1,48 @@
|
|
|
1
|
-
import { BackupKitEmailProps, CurrentWalletIds, ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, PregenAuth, Setup2faResponse,
|
|
2
|
-
import { AuthStateLogin, AuthStateVerify, OAuthResponse, AuthStateBaseParams, WithCustomTheme, WithUseShortUrls, Verify2faResponse, AuthStateSignup, AuthStateVerifyOrLogin, OAuthUrlParams, StorageType, PollParams, CoreAuthInfo, GetWalletBalanceParams, GetWalletBalanceResponse } from './methods.js';
|
|
1
|
+
import { BackupKitEmailProps, CurrentWalletIds, ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, PregenAuth, Setup2faResponse, VerifiedAuth, VerifyExternalWalletParams, WalletEntity, WalletParams, TWalletType, IssueJwtParams, IssueJwtResponse, TLinkedAccountType, LinkedAccounts } from '@getpara/user-management-client';
|
|
2
|
+
import { AuthStateLogin, AuthStateVerify, OAuthResponse, AuthStateBaseParams, WithCustomTheme, WithUseShortUrls, Verify2faResponse, AuthStateSignup, AuthStateVerifyOrLogin, OAuthUrlParams, StorageType, PollParams, CoreAuthInfo, GetWalletBalanceParams, GetWalletBalanceResponse, FarcasterParams, TelegramParams, OAuthParams } from './methods.js';
|
|
3
3
|
import { ParaCore } from '../ParaCore.js';
|
|
4
4
|
import { FullSignatureRes, Wallet } from './wallet.js';
|
|
5
|
-
|
|
5
|
+
import { AccountLinkInProgress } from './auth.js';
|
|
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", "prepareLogin", "sendLoginCode"];
|
|
6
8
|
export type CoreMethodName = (typeof PARA_CORE_METHODS)[number];
|
|
7
9
|
export type CoreMethodParams<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
|
|
8
10
|
params: infer P;
|
|
9
11
|
} ? P : never;
|
|
12
|
+
export type CoreMethodIsGetter<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
|
|
13
|
+
isGetter: true;
|
|
14
|
+
} ? true : false;
|
|
10
15
|
export type CoreMethodResponse<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
|
|
11
16
|
response: infer R;
|
|
12
17
|
} ? CoreMethods[method] extends {
|
|
13
18
|
sync: true;
|
|
14
19
|
} ? R : Promise<R> : void;
|
|
15
|
-
export type CoreMethod<method extends CoreMethodName & keyof CoreMethods> = CoreMethodParams<method> extends void | never ? () => CoreMethodResponse<method> : (_?: CoreMethodParams<method>) => CoreMethodResponse<method>;
|
|
20
|
+
export type CoreMethod<method extends CoreMethodName & keyof CoreMethods> = CoreMethodIsGetter<method> extends true ? Awaited<CoreMethodResponse<method>> : CoreMethodParams<method> extends void | never ? () => CoreMethodResponse<method> : (_?: CoreMethodParams<method>) => CoreMethodResponse<method>;
|
|
16
21
|
export type CoreAction<method extends CoreMethodName & keyof CoreMethods> = CoreMethodParams<method> extends void | never ? (_?: ParaCore) => CoreMethodResponse<method> : (_?: ParaCore, __?: CoreMethodParams<method>) => CoreMethodResponse<method>;
|
|
22
|
+
export type InternalMethodName = (typeof PARA_INTERNAL_METHODS)[number];
|
|
23
|
+
export type InternalMethodParams<method extends InternalMethodName & keyof InternalMethods> = InternalMethods[method] extends {
|
|
24
|
+
params: infer P;
|
|
25
|
+
} ? P : never;
|
|
26
|
+
export type InternalMethodIsGetter<method extends InternalMethodName & keyof InternalMethods> = InternalMethods[method] extends {
|
|
27
|
+
isGetter: true;
|
|
28
|
+
} ? true : false;
|
|
29
|
+
export type InternalMethodResponse<method extends InternalMethodName & keyof InternalMethods> = InternalMethods[method] extends {
|
|
30
|
+
response: infer R;
|
|
31
|
+
} ? InternalMethods[method] extends {
|
|
32
|
+
sync: true;
|
|
33
|
+
} ? R : Promise<R> : void;
|
|
34
|
+
export type InternalMethod<method extends InternalMethodName & keyof InternalMethods> = InternalMethodIsGetter<method> extends true ? Awaited<InternalMethodResponse<method>> : InternalMethodParams<method> extends void | never ? () => InternalMethodResponse<method> : (_?: InternalMethodParams<method>) => InternalMethodResponse<method>;
|
|
35
|
+
export type InternalAction<method extends InternalMethodName & keyof InternalMethods> = InternalMethodParams<method> extends void | never ? (_?: ParaCore) => InternalMethodResponse<method> : (_?: ParaCore, __?: InternalMethodParams<method>) => InternalMethodResponse<method>;
|
|
17
36
|
export type CoreMethods = Record<CoreMethodName, {
|
|
18
37
|
params?: unknown;
|
|
19
38
|
response?: unknown;
|
|
20
39
|
sync?: true;
|
|
21
40
|
}> & {
|
|
41
|
+
accountLinkInProgress: {
|
|
42
|
+
params: never;
|
|
43
|
+
response: AccountLinkInProgress;
|
|
44
|
+
isGetter: true;
|
|
45
|
+
};
|
|
22
46
|
getAuthInfo: {
|
|
23
47
|
params: void;
|
|
24
48
|
response: CoreAuthInfo | undefined;
|
|
@@ -98,17 +122,7 @@ export type CoreMethods = Record<CoreMethodName, {
|
|
|
98
122
|
response: string;
|
|
99
123
|
};
|
|
100
124
|
verifyOAuth: {
|
|
101
|
-
params: AuthStateBaseParams &
|
|
102
|
-
/**
|
|
103
|
-
* A function returning a boolean, indicating whether the OAuth process should be cancelled.
|
|
104
|
-
*/
|
|
105
|
-
isCanceled?: () => boolean;
|
|
106
|
-
/**
|
|
107
|
-
* A callback function that will be invoked with the OAuth URL when it is available.
|
|
108
|
-
* For example, you can use this to open the URL in a new window or tab.
|
|
109
|
-
*/
|
|
110
|
-
onOAuthUrl?: (url: string) => void;
|
|
111
|
-
};
|
|
125
|
+
params: AuthStateBaseParams & OAuthParams;
|
|
112
126
|
response: OAuthResponse;
|
|
113
127
|
};
|
|
114
128
|
getFarcasterConnectUri: {
|
|
@@ -116,26 +130,11 @@ export type CoreMethods = Record<CoreMethodName, {
|
|
|
116
130
|
response: string;
|
|
117
131
|
};
|
|
118
132
|
verifyFarcaster: {
|
|
119
|
-
params: AuthStateBaseParams &
|
|
120
|
-
/**
|
|
121
|
-
* A function returning a boolean, indicating whether the Farcaster login process should be cancelled.
|
|
122
|
-
*/
|
|
123
|
-
isCanceled?: () => boolean;
|
|
124
|
-
/**
|
|
125
|
-
* A callback function that will be invoked with the Farcaster Connect URI when it is available.
|
|
126
|
-
* You will need to display the URI as a QR code.
|
|
127
|
-
*/
|
|
128
|
-
onConnectUri?: (uri: string) => void;
|
|
129
|
-
};
|
|
133
|
+
params: AuthStateBaseParams & FarcasterParams;
|
|
130
134
|
response: OAuthResponse;
|
|
131
135
|
};
|
|
132
136
|
verifyTelegram: {
|
|
133
|
-
params: AuthStateBaseParams &
|
|
134
|
-
/**
|
|
135
|
-
* The response received from the Telegram login bot.
|
|
136
|
-
*/
|
|
137
|
-
telegramAuthResponse: TelegramAuthResponse;
|
|
138
|
-
};
|
|
137
|
+
params: AuthStateBaseParams & TelegramParams;
|
|
139
138
|
response: OAuthResponse;
|
|
140
139
|
};
|
|
141
140
|
loginExternalWallet: {
|
|
@@ -143,16 +142,18 @@ export type CoreMethods = Record<CoreMethodName, {
|
|
|
143
142
|
/**
|
|
144
143
|
* The external wallet information to use for login.
|
|
145
144
|
*/
|
|
146
|
-
externalWallet: ExternalWalletInfo;
|
|
145
|
+
externalWallet: ExternalWalletInfo | ExternalWalletInfo[];
|
|
147
146
|
};
|
|
148
147
|
response: AuthStateVerifyOrLogin;
|
|
149
148
|
};
|
|
150
149
|
verifyExternalWallet: {
|
|
151
150
|
params: AuthStateBaseParams & VerifyExternalWalletParams;
|
|
152
|
-
response: AuthStateSignup;
|
|
151
|
+
response: AuthStateSignup | AuthStateLogin;
|
|
153
152
|
};
|
|
154
153
|
resendVerificationCode: {
|
|
155
|
-
params:
|
|
154
|
+
params: {
|
|
155
|
+
type?: 'SIGNUP' | 'LINK_ACCOUNT' | 'LOGIN';
|
|
156
|
+
} | undefined;
|
|
156
157
|
response: void;
|
|
157
158
|
};
|
|
158
159
|
logout: {
|
|
@@ -469,7 +470,70 @@ export type CoreMethods = Record<CoreMethodName, {
|
|
|
469
470
|
params: GetWalletBalanceParams;
|
|
470
471
|
response: GetWalletBalanceResponse;
|
|
471
472
|
};
|
|
473
|
+
issueJwt: {
|
|
474
|
+
params: IssueJwtParams;
|
|
475
|
+
response: IssueJwtResponse;
|
|
476
|
+
};
|
|
477
|
+
getLinkedAccounts: {
|
|
478
|
+
params: {
|
|
479
|
+
withMetadata?: boolean;
|
|
480
|
+
};
|
|
481
|
+
response: LinkedAccounts & {
|
|
482
|
+
userId: string;
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
export type InternalMethods = {
|
|
487
|
+
linkAccount: {
|
|
488
|
+
params: {
|
|
489
|
+
auth: VerifiedAuth;
|
|
490
|
+
} | {
|
|
491
|
+
externalWallet: ExternalWalletInfo;
|
|
492
|
+
} | {
|
|
493
|
+
type: TLinkedAccountType | 'X';
|
|
494
|
+
};
|
|
495
|
+
response: AccountLinkInProgress;
|
|
496
|
+
};
|
|
497
|
+
unlinkAccount: {
|
|
498
|
+
params: {
|
|
499
|
+
linkedAccountId: string;
|
|
500
|
+
};
|
|
501
|
+
response: LinkedAccounts;
|
|
502
|
+
};
|
|
503
|
+
verifyEmailOrPhoneLink: {
|
|
504
|
+
params: {
|
|
505
|
+
verificationCode?: string;
|
|
506
|
+
};
|
|
507
|
+
response: LinkedAccounts;
|
|
508
|
+
};
|
|
509
|
+
verifyOAuthLink: {
|
|
510
|
+
params: OAuthParams;
|
|
511
|
+
response: LinkedAccounts;
|
|
512
|
+
};
|
|
513
|
+
verifyFarcasterLink: {
|
|
514
|
+
params: FarcasterParams;
|
|
515
|
+
response: LinkedAccounts;
|
|
516
|
+
};
|
|
517
|
+
verifyTelegramLink: {
|
|
518
|
+
params: TelegramParams;
|
|
519
|
+
response: LinkedAccounts;
|
|
520
|
+
};
|
|
521
|
+
verifyExternalWalletLink: {
|
|
522
|
+
params: Omit<VerifyExternalWalletParams, 'externalWallet'>;
|
|
523
|
+
response: LinkedAccounts;
|
|
524
|
+
};
|
|
525
|
+
prepareLogin: {
|
|
526
|
+
params: void;
|
|
527
|
+
response: string;
|
|
528
|
+
};
|
|
529
|
+
sendLoginCode: {
|
|
530
|
+
params: void;
|
|
531
|
+
response: void;
|
|
532
|
+
};
|
|
472
533
|
};
|
|
473
534
|
export type CoreInterface = {
|
|
474
|
-
[key in keyof CoreMethods]: CoreMethod<key
|
|
535
|
+
[key in keyof CoreMethods]: Partial<CoreMethod<key>>;
|
|
536
|
+
};
|
|
537
|
+
export type InternalInterface = {
|
|
538
|
+
[key in keyof InternalMethods]: Partial<InternalMethod<key>>;
|
|
475
539
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateSignup, AuthMethod, ServerAuthStateVerify, VerifiedAuth, AuthExtras, TOAuthMethod, TWalletType } from '@getpara/user-management-client';
|
|
1
|
+
import { PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateSignup, AuthMethod, ServerAuthStateVerify, VerifiedAuth, AuthExtras, TOAuthMethod, TWalletType, TelegramAuthResponse } 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';
|
|
17
|
+
export type PortalUrlType = 'createAuth' | 'createPassword' | 'loginAuth' | 'loginPassword' | 'txReview' | 'onRamp' | 'telegramLogin' | 'createPIN' | 'loginPIN';
|
|
18
18
|
export type PortalUrlOptions = {
|
|
19
19
|
params?: Record<string, string | undefined | null>;
|
|
20
20
|
isForNewDevice?: boolean;
|
|
@@ -24,10 +24,11 @@ export type PortalUrlOptions = {
|
|
|
24
24
|
portalTheme?: Theme;
|
|
25
25
|
pathId?: string;
|
|
26
26
|
shorten?: boolean;
|
|
27
|
+
isEmbedded?: boolean;
|
|
27
28
|
};
|
|
28
29
|
export type WithAuthMethod = {
|
|
29
30
|
/**
|
|
30
|
-
* Which authorization method to use for the URL, either `'passkey'` or `'
|
|
31
|
+
* Which authorization method to use for the URL, either `'passkey'` or `'password'`.
|
|
31
32
|
*/
|
|
32
33
|
authMethod?: Uppercase<AuthMethod>;
|
|
33
34
|
};
|
|
@@ -49,6 +50,12 @@ export type WithShorten = {
|
|
|
49
50
|
*/
|
|
50
51
|
shorten?: boolean;
|
|
51
52
|
};
|
|
53
|
+
export type WithIsPasskeySupported = {
|
|
54
|
+
/**
|
|
55
|
+
* Whether the current device supports WebAuth passkeys.
|
|
56
|
+
*/
|
|
57
|
+
isPasskeySupported: boolean;
|
|
58
|
+
};
|
|
52
59
|
export type PollParams = {
|
|
53
60
|
/**
|
|
54
61
|
* A callback function that will be invoked on each method poll.
|
|
@@ -59,6 +66,23 @@ export type PollParams = {
|
|
|
59
66
|
*/
|
|
60
67
|
onCancel?: () => void;
|
|
61
68
|
};
|
|
69
|
+
export type FarcasterParams = PollParams & {
|
|
70
|
+
/**
|
|
71
|
+
* A function returning a boolean, indicating whether the Farcaster login process should be cancelled.
|
|
72
|
+
*/
|
|
73
|
+
isCanceled?: () => boolean;
|
|
74
|
+
/**
|
|
75
|
+
* A callback function that will be invoked with the Farcaster Connect URI when it is available.
|
|
76
|
+
* You will need to display the URI as a QR code.
|
|
77
|
+
*/
|
|
78
|
+
onConnectUri?: (uri: string) => void;
|
|
79
|
+
};
|
|
80
|
+
export type TelegramParams = {
|
|
81
|
+
/**
|
|
82
|
+
* The response received from the Telegram login bot.
|
|
83
|
+
*/
|
|
84
|
+
telegramAuthResponse: TelegramAuthResponse;
|
|
85
|
+
};
|
|
62
86
|
export type LoginUrlParams = WithAuthMethod & WithCustomTheme & WithShorten & {
|
|
63
87
|
sessionId?: string;
|
|
64
88
|
};
|
|
@@ -74,13 +98,33 @@ export type OAuthUrlParams = {
|
|
|
74
98
|
*/
|
|
75
99
|
method: Exclude<TOAuthMethod, 'TELEGRAM' | 'FARCASTER'>;
|
|
76
100
|
/**
|
|
77
|
-
* The
|
|
101
|
+
* The app scheme to redirect to after OAuth is complete.
|
|
102
|
+
*/
|
|
103
|
+
appScheme?: string;
|
|
104
|
+
};
|
|
105
|
+
export type OAuthParams = OAuthUrlParams & PollParams & {
|
|
106
|
+
/**
|
|
107
|
+
* A function returning a boolean, indicating whether the OAuth process should be cancelled.
|
|
108
|
+
*/
|
|
109
|
+
isCanceled?: () => boolean;
|
|
110
|
+
/**
|
|
111
|
+
* A callback function that will be invoked with the OAuth URL when it is available.
|
|
112
|
+
* For example, you can use this to open the URL in a new window or tab.
|
|
113
|
+
*
|
|
114
|
+
* You should pass one of `onOAuthUrl` or `onOAuthPopup`, not both.
|
|
115
|
+
*/
|
|
116
|
+
onOAuthUrl?: (url: string) => void;
|
|
117
|
+
/**
|
|
118
|
+
* A callback function that will be invoked with the OAuth popup window when it is available.
|
|
119
|
+
* If supplied, a window will automatically be opened for you if running on an applicable platform.
|
|
120
|
+
*
|
|
121
|
+
* You should pass one of `onOAuthUrl` or `onOAuthPopup`, not both.
|
|
78
122
|
*/
|
|
79
|
-
|
|
123
|
+
onOAuthPopup?: (popup: Window) => void;
|
|
80
124
|
};
|
|
81
125
|
export type AuthStateBaseParams = WithCustomTheme & WithUseShortUrls;
|
|
82
126
|
export type AuthStateVerify = ServerAuthStateVerify;
|
|
83
|
-
export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & {
|
|
127
|
+
export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & WithIsPasskeySupported & {
|
|
84
128
|
/**
|
|
85
129
|
* 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
130
|
*/
|
|
@@ -93,8 +137,12 @@ export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & {
|
|
|
93
137
|
* A Para Portal URL for logging in via a password.
|
|
94
138
|
*/
|
|
95
139
|
passwordUrl?: string;
|
|
140
|
+
/**
|
|
141
|
+
* A Para Portal URL for logging in via a PIN.
|
|
142
|
+
*/
|
|
143
|
+
pinUrl?: string;
|
|
96
144
|
};
|
|
97
|
-
export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> & {
|
|
145
|
+
export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> & WithIsPasskeySupported & {
|
|
98
146
|
/**
|
|
99
147
|
* A Para Portal URL for creating a new WebAuth passkey.
|
|
100
148
|
*/
|
|
@@ -103,6 +151,10 @@ export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> &
|
|
|
103
151
|
* A Para Portal URL for creating a new user password.
|
|
104
152
|
*/
|
|
105
153
|
passwordUrl?: string;
|
|
154
|
+
/**
|
|
155
|
+
* A Para Portal URL for creating a new user PIN.
|
|
156
|
+
*/
|
|
157
|
+
pinUrl?: string;
|
|
106
158
|
/**
|
|
107
159
|
* The Para system ID for the newly generated passkey.
|
|
108
160
|
*/
|
|
@@ -111,6 +163,10 @@ export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> &
|
|
|
111
163
|
* The Para system ID for the newly generated password.
|
|
112
164
|
*/
|
|
113
165
|
passwordId?: string;
|
|
166
|
+
/**
|
|
167
|
+
* The Para system ID for the newly generated PIN.
|
|
168
|
+
*/
|
|
169
|
+
pinId?: string;
|
|
114
170
|
};
|
|
115
171
|
export type AuthStateVerifyOrLogin = AuthStateVerify | AuthStateLogin;
|
|
116
172
|
export type AuthStateSignupOrLogin = AuthStateSignup | AuthStateLogin;
|
|
@@ -20,6 +20,9 @@ export interface Wallet {
|
|
|
20
20
|
lastUsedPartnerId?: string;
|
|
21
21
|
isExternal?: boolean;
|
|
22
22
|
isExternalWithParaAuth?: boolean;
|
|
23
|
+
externalProviderId?: string;
|
|
24
|
+
isExternalWithVerification?: boolean;
|
|
25
|
+
isExternalConnectionOnly?: boolean;
|
|
23
26
|
ensName?: string | null;
|
|
24
27
|
ensAvatar?: string | null;
|
|
25
28
|
}
|
|
@@ -39,4 +42,4 @@ export interface DeniedSignatureResWithUrl extends DeniedSignatureRes {
|
|
|
39
42
|
}
|
|
40
43
|
export type SignatureRes = SuccessfulSignatureRes | DeniedSignatureRes;
|
|
41
44
|
export type FullSignatureRes = SuccessfulSignatureRes | DeniedSignatureResWithUrl;
|
|
42
|
-
export type ExternalWalletConnectionType = 'NONE' | 'CONNECTION_ONLY' | 'AUTHENTICATED';
|
|
45
|
+
export type ExternalWalletConnectionType = 'NONE' | 'CONNECTION_ONLY' | 'AUTHENTICATED' | 'VERIFICATION';
|
|
@@ -10,6 +10,8 @@ export declare function hexToSignature(hexSig: string): Signature;
|
|
|
10
10
|
export declare function hexToUint8Array(hex: string): Uint8Array;
|
|
11
11
|
export declare function hexToDecimal(hex: string): string;
|
|
12
12
|
export declare function decimalToHex(decimal: string): Hex;
|
|
13
|
+
export declare function compressPubkey(pubkey: Uint8Array): Uint8Array;
|
|
14
|
+
export declare function rawSecp256k1PubkeyToRawAddress(pubkeyData: Uint8Array): Uint8Array;
|
|
13
15
|
export declare function getCosmosAddress(publicKey: string, prefix: string): string;
|
|
14
16
|
export declare function truncateAddress(str: string, addressType: TWalletType, { prefix, targetLength, }?: {
|
|
15
17
|
prefix?: string;
|
|
@@ -5,3 +5,7 @@ export declare function formatPhoneNumber(phone: string, countryCode: string | u
|
|
|
5
5
|
forDisplay: true;
|
|
6
6
|
}): string | null;
|
|
7
7
|
export declare function displayPhoneNumber(phone: string, countryCode?: string): string;
|
|
8
|
+
export declare function splitPhoneNumber(phone: `+${number}`): {
|
|
9
|
+
phone: string;
|
|
10
|
+
countryCode: string;
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,39 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
4
|
-
"main": "dist/cjs/index.js",
|
|
5
|
-
"module": "dist/esm/index.js",
|
|
6
|
-
"types": "dist/types/index.d.ts",
|
|
7
|
-
"typings": "dist/types/index.d.ts",
|
|
8
|
-
"sideEffects": false,
|
|
3
|
+
"version": "2.0.0-alpha.51",
|
|
9
4
|
"dependencies": {
|
|
10
5
|
"@celo/utils": "^8.0.2",
|
|
11
6
|
"@cosmjs/encoding": "^0.32.4",
|
|
12
7
|
"@ethereumjs/util": "^9.1.0",
|
|
13
|
-
"@getpara/user-management-client": "2.0.0-alpha.
|
|
8
|
+
"@getpara/user-management-client": "2.0.0-alpha.51",
|
|
14
9
|
"@noble/hashes": "^1.5.0",
|
|
15
10
|
"base64url": "^3.0.1",
|
|
16
|
-
"libphonenumber-js": "1.11.
|
|
11
|
+
"libphonenumber-js": "^1.11.7",
|
|
17
12
|
"node-forge": "^1.3.1",
|
|
18
13
|
"uuid": "^11.1.0"
|
|
19
14
|
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types",
|
|
22
|
-
"old-build": "yarn build:cjs && yarn build:esm && yarn build:types; yarn post-build",
|
|
23
|
-
"post-build": "./scripts/set-version.sh",
|
|
24
|
-
"build:cjs": "rm -rf dist/cjs && tsc --module commonjs --outDir dist/cjs && printf '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
25
|
-
"build:esm": "rm -rf dist/esm && tsc --module es6 --outDir dist/esm && printf '{\"type\":\"module\",\"sideEffects\":false}' > dist/esm/package.json",
|
|
26
|
-
"build:types": "rm -rf dist/types && tsc --module es6 --declarationDir dist/types --emitDeclarationOnly --declaration",
|
|
27
|
-
"test": "vitest run --coverage"
|
|
28
|
-
},
|
|
29
15
|
"devDependencies": {
|
|
30
16
|
"@faker-js/faker": "^9.5.1",
|
|
31
|
-
"typescript": "5.
|
|
17
|
+
"typescript": "^5.8.3"
|
|
32
18
|
},
|
|
33
|
-
"files": [
|
|
34
|
-
"dist",
|
|
35
|
-
"package.json"
|
|
36
|
-
],
|
|
37
19
|
"exports": {
|
|
38
20
|
".": {
|
|
39
21
|
"types": "./dist/types/index.d.ts",
|
|
@@ -41,5 +23,23 @@
|
|
|
41
23
|
"require": "./dist/cjs/index.js"
|
|
42
24
|
}
|
|
43
25
|
},
|
|
44
|
-
"
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"package.json"
|
|
29
|
+
],
|
|
30
|
+
"gitHead": "f5b6354bac51de2e6988af340d7490dbdb62bc88",
|
|
31
|
+
"main": "dist/cjs/index.js",
|
|
32
|
+
"module": "dist/esm/index.js",
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types",
|
|
35
|
+
"build:cjs": "rm -rf dist/cjs && tsc --module commonjs --outDir dist/cjs && printf '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
36
|
+
"build:esm": "rm -rf dist/esm && tsc --module es6 --outDir dist/esm && printf '{\"type\":\"module\",\"sideEffects\":false}' > dist/esm/package.json",
|
|
37
|
+
"build:types": "rm -rf dist/types && tsc --module es6 --declarationDir dist/types --emitDeclarationOnly --declaration",
|
|
38
|
+
"old-build": "yarn build:cjs && yarn build:esm && yarn build:types; yarn post-build",
|
|
39
|
+
"post-build": "./scripts/set-version.sh",
|
|
40
|
+
"test": "vitest run --coverage"
|
|
41
|
+
},
|
|
42
|
+
"sideEffects": false,
|
|
43
|
+
"types": "dist/types/index.d.ts",
|
|
44
|
+
"typings": "dist/types/index.d.ts"
|
|
45
45
|
}
|