@talken/talkenkit 2.3.8 → 2.3.9

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.
Files changed (34) hide show
  1. package/dist/chunk-M2CMB5B2.js +93 -0
  2. package/dist/components/AbcLoginModal/AbcAuthModal.d.ts +11 -1
  3. package/dist/components/ConnectOptions/CompactMobileOptions.css.d.ts +26 -0
  4. package/dist/components/ConnectOptions/CompactMobileOptions.d.ts +19 -0
  5. package/dist/components/ConnectOptions/DesktopOptions.d.ts +9 -2
  6. package/dist/components/RainbowKitProvider/RainbowKitConfigProvider.d.ts +20 -0
  7. package/dist/components/RainbowKitProvider/RainbowKitProvider.d.ts +16 -1
  8. package/dist/encryption-3YHRI3PA.js +14 -0
  9. package/dist/hooks/useDeviceType.d.ts +9 -0
  10. package/dist/index.d.ts +4 -0
  11. package/dist/index.js +896 -687
  12. package/dist/wallets/walletConnectors/abcWallet/api/index.js +6 -6
  13. package/dist/wallets/walletConnectors/abcWallet/index.js +3 -3
  14. package/dist/wallets/walletConnectors/chunk-3WVSOTC4.js +63 -0
  15. package/dist/wallets/walletConnectors/chunk-43LOEA55.js +63 -0
  16. package/dist/wallets/walletConnectors/chunk-4NLOE5S3.js +63 -0
  17. package/dist/wallets/walletConnectors/chunk-5MSMALF7.js +63 -0
  18. package/dist/wallets/walletConnectors/chunk-6KOHIL7T.js +63 -0
  19. package/dist/wallets/walletConnectors/chunk-7FFIZE76.js +63 -0
  20. package/dist/wallets/walletConnectors/chunk-HS2FAOAJ.js +63 -0
  21. package/dist/wallets/walletConnectors/chunk-IA4EQFSS.js +474 -0
  22. package/dist/wallets/walletConnectors/chunk-IHM7I7D5.js +63 -0
  23. package/dist/wallets/walletConnectors/chunk-NA5G3LSC.js +63 -0
  24. package/dist/wallets/walletConnectors/chunk-NASGGIUS.js +63 -0
  25. package/dist/wallets/walletConnectors/chunk-NVM3JZ4L.js +63 -0
  26. package/dist/wallets/walletConnectors/chunk-PLL7P7HY.js +63 -0
  27. package/dist/wallets/walletConnectors/chunk-RUZBOPMI.js +63 -0
  28. package/dist/wallets/walletConnectors/chunk-SUXK3JW6.js +280 -0
  29. package/dist/wallets/walletConnectors/chunk-XDRZSWHB.js +63 -0
  30. package/dist/wallets/walletConnectors/chunk-XKVRDEDK.js +63 -0
  31. package/dist/wallets/walletConnectors/chunk-XYAAXWWU.js +63 -0
  32. package/dist/wallets/walletConnectors/index.js +67 -67
  33. package/package.json +12 -11
  34. package/LICENSE +0 -9
@@ -0,0 +1,93 @@
1
+ "use client";
2
+
3
+ // src/utils/encryption.ts
4
+ async function hashPin(pin) {
5
+ const encoder = new TextEncoder();
6
+ const data = encoder.encode(pin);
7
+ const hash = await crypto.subtle.digest("SHA-256", data);
8
+ return Array.from(new Uint8Array(hash)).map((b) => b.toString(16).padStart(2, "0")).join("");
9
+ }
10
+ async function encryptWithPin(data, hashedPin, salt) {
11
+ const encoder = new TextEncoder();
12
+ const keyMaterial = await crypto.subtle.importKey(
13
+ "raw",
14
+ encoder.encode(hashedPin),
15
+ "PBKDF2",
16
+ false,
17
+ ["deriveBits", "deriveKey"]
18
+ );
19
+ const key = await crypto.subtle.deriveKey(
20
+ {
21
+ name: "PBKDF2",
22
+ salt,
23
+ iterations: 1e5,
24
+ hash: "SHA-256"
25
+ },
26
+ keyMaterial,
27
+ { name: "AES-GCM", length: 256 },
28
+ false,
29
+ ["encrypt"]
30
+ );
31
+ const iv = crypto.getRandomValues(new Uint8Array(12));
32
+ const encrypted = await crypto.subtle.encrypt(
33
+ { name: "AES-GCM", iv },
34
+ key,
35
+ encoder.encode(data)
36
+ );
37
+ const combined = new Uint8Array(iv.length + encrypted.byteLength);
38
+ combined.set(iv);
39
+ combined.set(new Uint8Array(encrypted), iv.length);
40
+ return Array.from(combined).map((b) => b.toString(16).padStart(2, "0")).join("");
41
+ }
42
+ async function decryptWithPin(encryptedHex, hashedPin, saltHex) {
43
+ try {
44
+ const encoder = new TextEncoder();
45
+ const salt = new Uint8Array(
46
+ saltHex.match(/.{1,2}/g)?.map((byte) => Number.parseInt(byte, 16)) || []
47
+ );
48
+ const encryptedData = new Uint8Array(
49
+ encryptedHex.match(/.{1,2}/g)?.map((byte) => Number.parseInt(byte, 16)) || []
50
+ );
51
+ const keyMaterial = await crypto.subtle.importKey(
52
+ "raw",
53
+ encoder.encode(hashedPin),
54
+ "PBKDF2",
55
+ false,
56
+ ["deriveBits", "deriveKey"]
57
+ );
58
+ const key = await crypto.subtle.deriveKey(
59
+ {
60
+ name: "PBKDF2",
61
+ salt,
62
+ iterations: 1e5,
63
+ hash: "SHA-256"
64
+ },
65
+ keyMaterial,
66
+ { name: "AES-GCM", length: 256 },
67
+ false,
68
+ ["decrypt"]
69
+ );
70
+ const iv = encryptedData.slice(0, 12);
71
+ const ciphertext = encryptedData.slice(12);
72
+ const decrypted = await crypto.subtle.decrypt(
73
+ { name: "AES-GCM", iv },
74
+ key,
75
+ ciphertext
76
+ );
77
+ return new TextDecoder().decode(decrypted);
78
+ } catch (error) {
79
+ console.error("[Encryption] Decryption failed:", error);
80
+ throw new Error("Failed to decrypt data. Invalid PIN or corrupted data.");
81
+ }
82
+ }
83
+ async function verifyPin(pin, storedPinHash) {
84
+ const hashedPin = await hashPin(pin);
85
+ return hashedPin === storedPinHash;
86
+ }
87
+
88
+ export {
89
+ hashPin,
90
+ encryptWithPin,
91
+ decryptWithPin,
92
+ verifyPin
93
+ };
@@ -29,5 +29,15 @@ export interface AbcAuthModalProps {
29
29
  waasUrl: string;
30
30
  environment?: 'development' | 'production';
31
31
  evmChainId?: number;
32
+ /**
33
+ * Pre-fill email and skip email input step
34
+ * @default undefined
35
+ */
36
+ initialEmail?: string;
37
+ /**
38
+ * Initial social provider (for Google/Apple login)
39
+ * @default undefined
40
+ */
41
+ initialProvider?: 'google' | 'apple';
32
42
  }
33
- export declare function AbcAuthModal({ onClose, onSuccess, waasUrl, environment, evmChainId, }: AbcAuthModalProps): React.JSX.Element;
43
+ export declare function AbcAuthModal({ onClose, onSuccess, waasUrl, environment, evmChainId, initialEmail, initialProvider: _initialProvider, }: AbcAuthModalProps): React.JSX.Element;
@@ -0,0 +1,26 @@
1
+ export declare const container: string;
2
+ export declare const header: string;
3
+ export declare const closeButton: string;
4
+ export declare const titleContainer: string;
5
+ export declare const title: string;
6
+ export declare const subtitle: string;
7
+ export declare const socialButtonContainer: string;
8
+ export declare const socialButton: string;
9
+ export declare const googleIcon: string;
10
+ export declare const divider: string;
11
+ export declare const dividerText: string;
12
+ export declare const form: string;
13
+ export declare const inputGroup: string;
14
+ export declare const label: string;
15
+ export declare const input: string;
16
+ export declare const error: string;
17
+ export declare const submitButton: string;
18
+ export declare const footer: string;
19
+ export declare const footerText: string;
20
+ export declare const footerLink: string;
21
+ export declare const loadingContainer: string;
22
+ export declare const spinner: string;
23
+ export declare const loadingText: string;
24
+ export declare const successContainer: string;
25
+ export declare const successIcon: string;
26
+ export declare const successText: string;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Compact Mobile Options - Simplified Login UI
3
+ *
4
+ * Used when mobileMode='compact-login' in RainbowKitProvider.
5
+ * Shows Email and Google login only (no wallet list).
6
+ *
7
+ * Features:
8
+ * - Email login form
9
+ * - Google social login button
10
+ * - Direct ABC Wallet connection
11
+ * - Responsive design (works in existing ConnectModal bottomSheet)
12
+ */
13
+ import React from 'react';
14
+ export interface CompactMobileOptionsProps {
15
+ onClose: () => void;
16
+ waasUrl?: string;
17
+ environment?: 'development' | 'production';
18
+ }
19
+ export declare function CompactMobileOptions({ onClose, waasUrl, environment, }: CompactMobileOptionsProps): React.JSX.Element;
@@ -18,10 +18,17 @@ export declare enum AbcWaasStep {
18
18
  PasswordSetup = "PASSWORD_SETUP",
19
19
  PasswordConfirm = "PASSWORD_CONFIRM"
20
20
  }
21
- export declare function DesktopOptions({ onClose, solanaWallets, onSolanaWalletClick, connectingSolanaWallet, isSolanaConnecting, }: {
21
+ export interface DesktopOptionsProps {
22
22
  onClose: () => void;
23
23
  solanaWallets?: Record<string, any[]>;
24
24
  onSolanaWalletClick?: (walletName: string) => void;
25
25
  connectingSolanaWallet?: string | null;
26
26
  isSolanaConnecting?: boolean;
27
- }): React.JSX.Element;
27
+ /**
28
+ * Enable compact mode for mobile
29
+ * Hides external wallets and simplifies UI
30
+ * @default false
31
+ */
32
+ compact?: boolean;
33
+ }
34
+ export declare function DesktopOptions({ onClose, solanaWallets, onSolanaWalletClick, connectingSolanaWallet, isSolanaConnecting, compact, }: DesktopOptionsProps): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ import React, { type ReactNode } from 'react';
2
+ export type MobileMode = 'compact-login' | 'compact-list' | 'full' | 'auto';
3
+ export interface RainbowKitConfig {
4
+ /**
5
+ * Mobile behavior mode
6
+ * @default 'auto'
7
+ */
8
+ mobileMode: MobileMode;
9
+ /**
10
+ * Wallets to show in compact login mode
11
+ * @default ['abcWallet']
12
+ */
13
+ compactLoginWallets: string[];
14
+ }
15
+ export interface RainbowKitConfigProviderProps {
16
+ config: RainbowKitConfig;
17
+ children: ReactNode;
18
+ }
19
+ export declare function RainbowKitConfigProvider({ config, children, }: RainbowKitConfigProviderProps): React.JSX.Element;
20
+ export declare function useRainbowKitConfig(): RainbowKitConfig;
@@ -6,6 +6,7 @@ import type { SolanaConfig } from '../../solana/config';
6
6
  import { type DisclaimerComponent } from './AppContext';
7
7
  import { type AvatarComponent } from './AvatarContext';
8
8
  import { type ModalSizes } from './ModalSizeContext';
9
+ import { type MobileMode } from './RainbowKitConfigProvider';
9
10
  export declare const useThemeRootProps: () => {
10
11
  "data-rk": string;
11
12
  };
@@ -39,5 +40,19 @@ export interface RainbowKitProviderProps {
39
40
  * @default undefined
40
41
  */
41
42
  solanaConfig?: SolanaConfig;
43
+ /**
44
+ * Mobile behavior mode
45
+ * - 'compact-login': Direct to login on mobile (Email/Google only)
46
+ * - 'compact-list': Show compact wallet list on mobile
47
+ * - 'full': Use desktop flow on mobile
48
+ * - 'auto': Auto-detect based on wallet config
49
+ * @default 'auto'
50
+ */
51
+ mobileMode?: MobileMode;
52
+ /**
53
+ * Wallets to show in compact login mode
54
+ * @default ['abcWallet']
55
+ */
56
+ compactLoginWallets?: string[];
42
57
  }
43
- export declare function RainbowKitProvider({ appInfo, avatar, children, coolMode, disableAutoPinProvider, id, initialChain, locale, modalSize, showRecentTransactions, theme, solanaConfig, }: RainbowKitProviderProps): React.JSX.Element;
58
+ export declare function RainbowKitProvider({ appInfo, avatar, children, coolMode, disableAutoPinProvider, id, initialChain, locale, modalSize, showRecentTransactions, theme, solanaConfig, mobileMode, compactLoginWallets, }: RainbowKitProviderProps): React.JSX.Element;
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import {
3
+ decryptWithPin,
4
+ encryptWithPin,
5
+ hashPin,
6
+ verifyPin
7
+ } from "./chunk-M2CMB5B2.js";
8
+ import "./chunk-TJX4M23U.js";
9
+ export {
10
+ decryptWithPin,
11
+ encryptWithPin,
12
+ hashPin,
13
+ verifyPin
14
+ };
@@ -0,0 +1,9 @@
1
+ export type DeviceType = 'mobile' | 'tablet' | 'desktop';
2
+ export interface DeviceTypeState {
3
+ type: DeviceType;
4
+ isMobile: boolean;
5
+ isTablet: boolean;
6
+ isDesktop: boolean;
7
+ width: number;
8
+ }
9
+ export declare function useDeviceType(): DeviceTypeState;
package/dist/index.d.ts CHANGED
@@ -22,6 +22,10 @@ export { midnightTheme } from './themes/midnightTheme';
22
22
  export { cssStringFromTheme } from './css/cssStringFromTheme';
23
23
  export { cssObjectFromTheme } from './css/cssObjectFromTheme';
24
24
  export { __private__ } from './__private__';
25
+ export { useDeviceType } from './hooks/useDeviceType';
26
+ export type { DeviceType, DeviceTypeState } from './hooks/useDeviceType';
27
+ export { useRainbowKitConfig } from './components/RainbowKitProvider/RainbowKitConfigProvider';
28
+ export type { MobileMode, RainbowKitConfig, } from './components/RainbowKitProvider/RainbowKitConfigProvider';
25
29
  export { useSolSignMessage } from './hooks/useSolSignMessage';
26
30
  export { useSolSignTransaction } from './hooks/useSolSignTransaction';
27
31
  export { getSolanaConfig } from './solana/config';