decane-connect-kit 2.7.6 → 2.8.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/index.cjs +312 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -6
- package/dist/index.d.ts +38 -6
- package/dist/index.js +312 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -92,7 +92,7 @@ interface DecaneConnectConfig {
|
|
|
92
92
|
appId: string;
|
|
93
93
|
apiKey: string;
|
|
94
94
|
chains: Chain[];
|
|
95
|
-
authMethods: Array<'google' | 'email' | 'kingschat'>;
|
|
95
|
+
authMethods: Array<'google' | 'email' | 'phone' | 'kingschat'>;
|
|
96
96
|
/**
|
|
97
97
|
* Scopes requested from KingsChat at sign-in. Defaults to
|
|
98
98
|
* `['send_chat_message']`, which is what KingsChat's own SDK asks for and is
|
|
@@ -315,6 +315,23 @@ interface DecaneConnect {
|
|
|
315
315
|
providerId?: string;
|
|
316
316
|
}): Promise<ConnectResult>;
|
|
317
317
|
verifyEmailCode(email: string, code: string): Promise<ConnectResult>;
|
|
318
|
+
/**
|
|
319
|
+
* Send a 6-digit sign-in code by SMS (delivered via Termii).
|
|
320
|
+
*
|
|
321
|
+
* `phone` must be **E.164** — `+2348012345678`. Local formats like
|
|
322
|
+
* `08012345678` are rejected rather than guessed at: the wallet is derived
|
|
323
|
+
* from the number, so guessing a country would either merge two people onto
|
|
324
|
+
* one wallet or split one person across two. Collect the country in your UI.
|
|
325
|
+
*
|
|
326
|
+
* Always resolves, whether or not the number has an account — the backend
|
|
327
|
+
* answers identically either way so this cannot be used to discover who is
|
|
328
|
+
* registered. Follow with {@link verifyPhoneCode}.
|
|
329
|
+
*/
|
|
330
|
+
connectWithPhone(phone: string): Promise<{
|
|
331
|
+
codeRequired: true;
|
|
332
|
+
}>;
|
|
333
|
+
/** Verify the SMS code and open the wallet. Pass the same E.164 number. */
|
|
334
|
+
verifyPhoneCode(phone: string, code: string): Promise<ConnectResult>;
|
|
318
335
|
unlock(): Promise<void>;
|
|
319
336
|
isUnlocked(): boolean;
|
|
320
337
|
/**
|
|
@@ -503,6 +520,8 @@ declare class ApiClient {
|
|
|
503
520
|
authKingsChat(accessToken: string): Promise<AuthResult>;
|
|
504
521
|
authEmailStart(email: string): Promise<void>;
|
|
505
522
|
authEmailVerify(email: string, code: string): Promise<AuthResult>;
|
|
523
|
+
authPhoneStart(phone: string): Promise<void>;
|
|
524
|
+
authPhoneVerify(phone: string, code: string): Promise<AuthResult>;
|
|
506
525
|
getAddresses(jwt: string): Promise<{
|
|
507
526
|
evm: string | null;
|
|
508
527
|
solana: string | null;
|
|
@@ -668,7 +687,7 @@ interface DecaneProvider {
|
|
|
668
687
|
type ConnectMode = "all" | "social" | "wallets" | "evm" | "solana" | "tron" | "evm+social" | "solana+social" | "tron+social" | "evm+tron" | "evm+tron+social";
|
|
669
688
|
interface SocialConfig {
|
|
670
689
|
apiKey: string;
|
|
671
|
-
authMethods?: ("google" | "email" | "kingschat")[];
|
|
690
|
+
authMethods?: ("google" | "email" | "phone" | "kingschat")[];
|
|
672
691
|
/**
|
|
673
692
|
* Scopes requested from KingsChat. Defaults to `['send_chat_message']`, which
|
|
674
693
|
* is what KingsChat's own SDK asks for and is enough to establish identity.
|
|
@@ -1052,13 +1071,17 @@ interface WalletSelectorProps {
|
|
|
1052
1071
|
theme?: "light" | "dark" | "auto";
|
|
1053
1072
|
networks?: "evm" | "solana" | "tron" | "bitcoin" | "all";
|
|
1054
1073
|
mode?: ConnectMode;
|
|
1055
|
-
socialAuthMethods?: ("google" | "email" | "kingschat")[];
|
|
1074
|
+
socialAuthMethods?: ("google" | "email" | "phone" | "kingschat")[];
|
|
1056
1075
|
onGoogleSignIn?: () => Promise<void>;
|
|
1057
1076
|
onKingsChatSignIn?: () => Promise<void>;
|
|
1058
1077
|
onEmailStart?: (email: string) => Promise<{
|
|
1059
1078
|
codeRequired: true;
|
|
1060
1079
|
}>;
|
|
1061
1080
|
onEmailVerify?: (email: string, code: string) => Promise<void>;
|
|
1081
|
+
onPhoneStart?: (phone: string) => Promise<{
|
|
1082
|
+
codeRequired: true;
|
|
1083
|
+
}>;
|
|
1084
|
+
onPhoneVerify?: (phone: string, code: string) => Promise<void>;
|
|
1062
1085
|
/** Button text for the developer's own auth system, e.g. "Continue with Acme Inc". Omitted entirely when not configured. */
|
|
1063
1086
|
customAuthLabel?: string;
|
|
1064
1087
|
onCustomAuthSignIn?: () => Promise<void>;
|
|
@@ -1068,7 +1091,7 @@ interface WalletSelectorProps {
|
|
|
1068
1091
|
passkeyAddress?: string | null;
|
|
1069
1092
|
onPasskeySignIn?: () => Promise<unknown>;
|
|
1070
1093
|
}
|
|
1071
|
-
declare function WalletSelector({ provider, open, onClose, onConnect, theme, networks, mode, socialAuthMethods, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, }: WalletSelectorProps): React.ReactPortal | null;
|
|
1094
|
+
declare function WalletSelector({ provider, open, onClose, onConnect, theme, networks, mode, socialAuthMethods, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, onPhoneStart, onPhoneVerify, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, }: WalletSelectorProps): React.ReactPortal | null;
|
|
1072
1095
|
|
|
1073
1096
|
type Theme = "light" | "dark" | "auto";
|
|
1074
1097
|
interface SocialAuthState {
|
|
@@ -1131,7 +1154,11 @@ interface SocialWalletModalProps {
|
|
|
1131
1154
|
codeRequired: true;
|
|
1132
1155
|
}>;
|
|
1133
1156
|
onEmailVerify: (email: string, code: string) => Promise<void>;
|
|
1134
|
-
|
|
1157
|
+
onPhoneStart?: (phone: string) => Promise<{
|
|
1158
|
+
codeRequired: true;
|
|
1159
|
+
}>;
|
|
1160
|
+
onPhoneVerify?: (phone: string, code: string) => Promise<void>;
|
|
1161
|
+
authMethods?: Array<"google" | "email" | "phone" | "kingschat">;
|
|
1135
1162
|
customAuthLabel?: string;
|
|
1136
1163
|
onCustomAuthSignIn?: () => Promise<void>;
|
|
1137
1164
|
canUsePasskey?: boolean;
|
|
@@ -1148,7 +1175,7 @@ interface SocialWalletModalProps {
|
|
|
1148
1175
|
rpcUrls?: Record<string, string>;
|
|
1149
1176
|
chains?: string[];
|
|
1150
1177
|
}
|
|
1151
|
-
declare function SocialWalletModal({ open, onClose, theme, socialAuth, onUnlock, onDisconnect, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, authMethods, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, onRotateShares, onExportPortableBackup, rpcUrls, chains, }: SocialWalletModalProps): React.ReactPortal | null;
|
|
1178
|
+
declare function SocialWalletModal({ open, onClose, theme, socialAuth, onUnlock, onDisconnect, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, onPhoneStart, onPhoneVerify, authMethods, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, onRotateShares, onExportPortableBackup, rpcUrls, chains, }: SocialWalletModalProps): React.ReactPortal | null;
|
|
1152
1179
|
|
|
1153
1180
|
declare function DecaneMark({ size, muted }: {
|
|
1154
1181
|
size?: number;
|
|
@@ -1179,6 +1206,7 @@ declare function useSocialAuth(): {
|
|
|
1179
1206
|
needsReconnect: boolean;
|
|
1180
1207
|
googleLoading: boolean;
|
|
1181
1208
|
emailLoading: boolean;
|
|
1209
|
+
phoneLoading: boolean;
|
|
1182
1210
|
tokenLoading: boolean;
|
|
1183
1211
|
customLoading: boolean;
|
|
1184
1212
|
customAuthLabel: string | undefined;
|
|
@@ -1189,6 +1217,10 @@ declare function useSocialAuth(): {
|
|
|
1189
1217
|
codeRequired: true;
|
|
1190
1218
|
}>;
|
|
1191
1219
|
confirmEmailCode: (email: string, code: string) => Promise<void>;
|
|
1220
|
+
sendPhoneCode: (phone: string) => Promise<{
|
|
1221
|
+
codeRequired: true;
|
|
1222
|
+
}>;
|
|
1223
|
+
confirmPhoneCode: (phone: string, code: string) => Promise<void>;
|
|
1192
1224
|
signInWithToken: (token: string, opts?: {
|
|
1193
1225
|
providerId?: string;
|
|
1194
1226
|
}) => Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -92,7 +92,7 @@ interface DecaneConnectConfig {
|
|
|
92
92
|
appId: string;
|
|
93
93
|
apiKey: string;
|
|
94
94
|
chains: Chain[];
|
|
95
|
-
authMethods: Array<'google' | 'email' | 'kingschat'>;
|
|
95
|
+
authMethods: Array<'google' | 'email' | 'phone' | 'kingschat'>;
|
|
96
96
|
/**
|
|
97
97
|
* Scopes requested from KingsChat at sign-in. Defaults to
|
|
98
98
|
* `['send_chat_message']`, which is what KingsChat's own SDK asks for and is
|
|
@@ -315,6 +315,23 @@ interface DecaneConnect {
|
|
|
315
315
|
providerId?: string;
|
|
316
316
|
}): Promise<ConnectResult>;
|
|
317
317
|
verifyEmailCode(email: string, code: string): Promise<ConnectResult>;
|
|
318
|
+
/**
|
|
319
|
+
* Send a 6-digit sign-in code by SMS (delivered via Termii).
|
|
320
|
+
*
|
|
321
|
+
* `phone` must be **E.164** — `+2348012345678`. Local formats like
|
|
322
|
+
* `08012345678` are rejected rather than guessed at: the wallet is derived
|
|
323
|
+
* from the number, so guessing a country would either merge two people onto
|
|
324
|
+
* one wallet or split one person across two. Collect the country in your UI.
|
|
325
|
+
*
|
|
326
|
+
* Always resolves, whether or not the number has an account — the backend
|
|
327
|
+
* answers identically either way so this cannot be used to discover who is
|
|
328
|
+
* registered. Follow with {@link verifyPhoneCode}.
|
|
329
|
+
*/
|
|
330
|
+
connectWithPhone(phone: string): Promise<{
|
|
331
|
+
codeRequired: true;
|
|
332
|
+
}>;
|
|
333
|
+
/** Verify the SMS code and open the wallet. Pass the same E.164 number. */
|
|
334
|
+
verifyPhoneCode(phone: string, code: string): Promise<ConnectResult>;
|
|
318
335
|
unlock(): Promise<void>;
|
|
319
336
|
isUnlocked(): boolean;
|
|
320
337
|
/**
|
|
@@ -503,6 +520,8 @@ declare class ApiClient {
|
|
|
503
520
|
authKingsChat(accessToken: string): Promise<AuthResult>;
|
|
504
521
|
authEmailStart(email: string): Promise<void>;
|
|
505
522
|
authEmailVerify(email: string, code: string): Promise<AuthResult>;
|
|
523
|
+
authPhoneStart(phone: string): Promise<void>;
|
|
524
|
+
authPhoneVerify(phone: string, code: string): Promise<AuthResult>;
|
|
506
525
|
getAddresses(jwt: string): Promise<{
|
|
507
526
|
evm: string | null;
|
|
508
527
|
solana: string | null;
|
|
@@ -668,7 +687,7 @@ interface DecaneProvider {
|
|
|
668
687
|
type ConnectMode = "all" | "social" | "wallets" | "evm" | "solana" | "tron" | "evm+social" | "solana+social" | "tron+social" | "evm+tron" | "evm+tron+social";
|
|
669
688
|
interface SocialConfig {
|
|
670
689
|
apiKey: string;
|
|
671
|
-
authMethods?: ("google" | "email" | "kingschat")[];
|
|
690
|
+
authMethods?: ("google" | "email" | "phone" | "kingschat")[];
|
|
672
691
|
/**
|
|
673
692
|
* Scopes requested from KingsChat. Defaults to `['send_chat_message']`, which
|
|
674
693
|
* is what KingsChat's own SDK asks for and is enough to establish identity.
|
|
@@ -1052,13 +1071,17 @@ interface WalletSelectorProps {
|
|
|
1052
1071
|
theme?: "light" | "dark" | "auto";
|
|
1053
1072
|
networks?: "evm" | "solana" | "tron" | "bitcoin" | "all";
|
|
1054
1073
|
mode?: ConnectMode;
|
|
1055
|
-
socialAuthMethods?: ("google" | "email" | "kingschat")[];
|
|
1074
|
+
socialAuthMethods?: ("google" | "email" | "phone" | "kingschat")[];
|
|
1056
1075
|
onGoogleSignIn?: () => Promise<void>;
|
|
1057
1076
|
onKingsChatSignIn?: () => Promise<void>;
|
|
1058
1077
|
onEmailStart?: (email: string) => Promise<{
|
|
1059
1078
|
codeRequired: true;
|
|
1060
1079
|
}>;
|
|
1061
1080
|
onEmailVerify?: (email: string, code: string) => Promise<void>;
|
|
1081
|
+
onPhoneStart?: (phone: string) => Promise<{
|
|
1082
|
+
codeRequired: true;
|
|
1083
|
+
}>;
|
|
1084
|
+
onPhoneVerify?: (phone: string, code: string) => Promise<void>;
|
|
1062
1085
|
/** Button text for the developer's own auth system, e.g. "Continue with Acme Inc". Omitted entirely when not configured. */
|
|
1063
1086
|
customAuthLabel?: string;
|
|
1064
1087
|
onCustomAuthSignIn?: () => Promise<void>;
|
|
@@ -1068,7 +1091,7 @@ interface WalletSelectorProps {
|
|
|
1068
1091
|
passkeyAddress?: string | null;
|
|
1069
1092
|
onPasskeySignIn?: () => Promise<unknown>;
|
|
1070
1093
|
}
|
|
1071
|
-
declare function WalletSelector({ provider, open, onClose, onConnect, theme, networks, mode, socialAuthMethods, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, }: WalletSelectorProps): React.ReactPortal | null;
|
|
1094
|
+
declare function WalletSelector({ provider, open, onClose, onConnect, theme, networks, mode, socialAuthMethods, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, onPhoneStart, onPhoneVerify, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, }: WalletSelectorProps): React.ReactPortal | null;
|
|
1072
1095
|
|
|
1073
1096
|
type Theme = "light" | "dark" | "auto";
|
|
1074
1097
|
interface SocialAuthState {
|
|
@@ -1131,7 +1154,11 @@ interface SocialWalletModalProps {
|
|
|
1131
1154
|
codeRequired: true;
|
|
1132
1155
|
}>;
|
|
1133
1156
|
onEmailVerify: (email: string, code: string) => Promise<void>;
|
|
1134
|
-
|
|
1157
|
+
onPhoneStart?: (phone: string) => Promise<{
|
|
1158
|
+
codeRequired: true;
|
|
1159
|
+
}>;
|
|
1160
|
+
onPhoneVerify?: (phone: string, code: string) => Promise<void>;
|
|
1161
|
+
authMethods?: Array<"google" | "email" | "phone" | "kingschat">;
|
|
1135
1162
|
customAuthLabel?: string;
|
|
1136
1163
|
onCustomAuthSignIn?: () => Promise<void>;
|
|
1137
1164
|
canUsePasskey?: boolean;
|
|
@@ -1148,7 +1175,7 @@ interface SocialWalletModalProps {
|
|
|
1148
1175
|
rpcUrls?: Record<string, string>;
|
|
1149
1176
|
chains?: string[];
|
|
1150
1177
|
}
|
|
1151
|
-
declare function SocialWalletModal({ open, onClose, theme, socialAuth, onUnlock, onDisconnect, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, authMethods, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, onRotateShares, onExportPortableBackup, rpcUrls, chains, }: SocialWalletModalProps): React.ReactPortal | null;
|
|
1178
|
+
declare function SocialWalletModal({ open, onClose, theme, socialAuth, onUnlock, onDisconnect, onGoogleSignIn, onKingsChatSignIn, onEmailStart, onEmailVerify, onPhoneStart, onPhoneVerify, authMethods, customAuthLabel, onCustomAuthSignIn, canUsePasskey, passkeyAddress, onPasskeySignIn, onRotateShares, onExportPortableBackup, rpcUrls, chains, }: SocialWalletModalProps): React.ReactPortal | null;
|
|
1152
1179
|
|
|
1153
1180
|
declare function DecaneMark({ size, muted }: {
|
|
1154
1181
|
size?: number;
|
|
@@ -1179,6 +1206,7 @@ declare function useSocialAuth(): {
|
|
|
1179
1206
|
needsReconnect: boolean;
|
|
1180
1207
|
googleLoading: boolean;
|
|
1181
1208
|
emailLoading: boolean;
|
|
1209
|
+
phoneLoading: boolean;
|
|
1182
1210
|
tokenLoading: boolean;
|
|
1183
1211
|
customLoading: boolean;
|
|
1184
1212
|
customAuthLabel: string | undefined;
|
|
@@ -1189,6 +1217,10 @@ declare function useSocialAuth(): {
|
|
|
1189
1217
|
codeRequired: true;
|
|
1190
1218
|
}>;
|
|
1191
1219
|
confirmEmailCode: (email: string, code: string) => Promise<void>;
|
|
1220
|
+
sendPhoneCode: (phone: string) => Promise<{
|
|
1221
|
+
codeRequired: true;
|
|
1222
|
+
}>;
|
|
1223
|
+
confirmPhoneCode: (phone: string, code: string) => Promise<void>;
|
|
1192
1224
|
signInWithToken: (token: string, opts?: {
|
|
1193
1225
|
providerId?: string;
|
|
1194
1226
|
}) => Promise<void>;
|