@cedros/login-react 0.0.1
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/LICENSE +21 -0
- package/README.md +1183 -0
- package/dist/EmailRegisterForm-D_uCEdX9.cjs +1 -0
- package/dist/EmailRegisterForm-D_uCEdX9.cjs.map +1 -0
- package/dist/EmailRegisterForm-m3rX3A6X.js +2923 -0
- package/dist/EmailRegisterForm-m3rX3A6X.js.map +1 -0
- package/dist/ErrorMessage-Bm1j5mBT.js +2042 -0
- package/dist/ErrorMessage-Bm1j5mBT.js.map +1 -0
- package/dist/ErrorMessage-CntMyn93.cjs +1 -0
- package/dist/ErrorMessage-CntMyn93.cjs.map +1 -0
- package/dist/GoogleLoginButton-CJNJ-THo.cjs +1 -0
- package/dist/GoogleLoginButton-CJNJ-THo.cjs.map +1 -0
- package/dist/GoogleLoginButton-CvDoOc-0.js +227 -0
- package/dist/GoogleLoginButton-CvDoOc-0.js.map +1 -0
- package/dist/SolanaLoginButton-BlSgPW50.cjs +1 -0
- package/dist/SolanaLoginButton-BlSgPW50.cjs.map +1 -0
- package/dist/SolanaLoginButton-h32xN2PQ.js +261 -0
- package/dist/SolanaLoginButton-h32xN2PQ.js.map +1 -0
- package/dist/assets/argon2Worker-Bi5TuQvD.js +1 -0
- package/dist/assets/argon2Worker-Bi5TuQvD.js.map +1 -0
- package/dist/components/LoginButton.d.ts +23 -0
- package/dist/components/LoginForm.d.ts +9 -0
- package/dist/components/LoginModal.d.ts +9 -0
- package/dist/components/admin/AdminUserDetail.d.ts +21 -0
- package/dist/components/admin/AdminUserList.d.ts +25 -0
- package/dist/components/admin/CedrosAdminDashboard.d.ts +48 -0
- package/dist/components/admin/SystemSettings.d.ts +19 -0
- package/dist/components/apple/AppleLoginButton.d.ts +29 -0
- package/dist/components/deposit/CreditBalance.d.ts +19 -0
- package/dist/components/deposit/DepositFlow.d.ts +118 -0
- package/dist/components/deposit/FeeConfigDisplay.d.ts +15 -0
- package/dist/components/deposit/History.d.ts +21 -0
- package/dist/components/deposit/TieredAmountSlider.d.ts +19 -0
- package/dist/components/deposit/TokenSelector.d.ts +23 -0
- package/dist/components/deposit/admin/AdminDepositList.d.ts +21 -0
- package/dist/components/deposit/admin/AdminDepositStats.d.ts +15 -0
- package/dist/components/deposit/admin/AdminPrivacyPeriodDeposits.d.ts +19 -0
- package/dist/components/deposit/admin/AdminWithdrawalHistory.d.ts +19 -0
- package/dist/components/deposit/admin/AdminWithdrawalQueue.d.ts +23 -0
- package/dist/components/deposit/admin/PrivacySystemStatus.d.ts +15 -0
- package/dist/components/deposit/admin/index.d.ts +17 -0
- package/dist/components/deposit/index.d.ts +12 -0
- package/dist/components/deposit/tierUtils.d.ts +8 -0
- package/dist/components/deposit/tokens.d.ts +19 -0
- package/dist/components/email/EmailLoginForm.d.ts +11 -0
- package/dist/components/email/EmailRegisterForm.d.ts +14 -0
- package/dist/components/email/ForgotPasswordForm.d.ts +17 -0
- package/dist/components/email/PasswordInput.d.ts +14 -0
- package/dist/components/email/ResetPasswordForm.d.ts +22 -0
- package/dist/components/google/GoogleLoginButton.d.ts +12 -0
- package/dist/components/invites/InviteForm.d.ts +38 -0
- package/dist/components/invites/InviteList.d.ts +40 -0
- package/dist/components/members/MemberList.d.ts +47 -0
- package/dist/components/org/CreateOrgForm.d.ts +7 -0
- package/dist/components/org/OrgAvatar.d.ts +7 -0
- package/dist/components/org/OrgListView.d.ts +9 -0
- package/dist/components/org/OrgSelector.d.ts +51 -0
- package/dist/components/org/OrgSwitcher.d.ts +47 -0
- package/dist/components/org/icons.d.ts +8 -0
- package/dist/components/sessions/SessionList.d.ts +33 -0
- package/dist/components/shared/ErrorBoundary.d.ts +38 -0
- package/dist/components/shared/ErrorMessage.d.ts +14 -0
- package/dist/components/shared/LoadingSpinner.d.ts +16 -0
- package/dist/components/solana/SolanaLoginButton.d.ts +49 -0
- package/dist/components/templates/FullPageLayout.d.ts +40 -0
- package/dist/components/templates/SplitPageLayout.d.ts +44 -0
- package/dist/components/templates/index.d.ts +4 -0
- package/dist/components/totp/OtpInput.d.ts +32 -0
- package/dist/components/totp/QrCode.d.ts +21 -0
- package/dist/components/totp/TotpSettings.d.ts +38 -0
- package/dist/components/totp/TotpSetup.d.ts +23 -0
- package/dist/components/totp/TotpVerify.d.ts +25 -0
- package/dist/components/totp/index.d.ts +10 -0
- package/dist/components/wallet/CapabilityWarning.d.ts +11 -0
- package/dist/components/wallet/PasskeyPrompt.d.ts +34 -0
- package/dist/components/wallet/RecoveryPhraseDisplay.d.ts +18 -0
- package/dist/components/wallet/RecoveryPhraseInput.d.ts +21 -0
- package/dist/components/wallet/WalletAddressRow.d.ts +10 -0
- package/dist/components/wallet/WalletEnrollment.d.ts +15 -0
- package/dist/components/wallet/WalletManager.d.ts +9 -0
- package/dist/components/wallet/WalletRecovery.d.ts +19 -0
- package/dist/components/wallet/WalletStatus.d.ts +28 -0
- package/dist/components/wallet/WalletUnlock.d.ts +23 -0
- package/dist/components/wallet/index.d.ts +23 -0
- package/dist/components/webauthn/PasskeyLoginButton.d.ts +8 -0
- package/dist/context/CedrosLoginContext.d.ts +24 -0
- package/dist/context/CedrosLoginProvider.d.ts +17 -0
- package/dist/context/EmbeddedWalletExposure.d.ts +19 -0
- package/dist/context/useCedrosLogin.d.ts +12 -0
- package/dist/crypto/aesGcm.d.ts +89 -0
- package/dist/crypto/argon2.d.ts +65 -0
- package/dist/crypto/argon2Worker.d.ts +1 -0
- package/dist/crypto/argon2WorkerClient.d.ts +28 -0
- package/dist/crypto/bip39.d.ts +106 -0
- package/dist/crypto/capabilities.d.ts +35 -0
- package/dist/crypto/entropy.d.ts +56 -0
- package/dist/crypto/hkdf.d.ts +38 -0
- package/dist/crypto/index.d.ts +30 -0
- package/dist/crypto/secureWipe.d.ts +90 -0
- package/dist/crypto/shamir.d.ts +52 -0
- package/dist/crypto/solanaKeypair.d.ts +63 -0
- package/dist/crypto/types.d.ts +134 -0
- package/dist/crypto/webauthnPrf.d.ts +118 -0
- package/dist/email-only.cjs +1 -0
- package/dist/email-only.cjs.map +1 -0
- package/dist/email-only.d.ts +16 -0
- package/dist/email-only.js +15 -0
- package/dist/email-only.js.map +1 -0
- package/dist/google-only.cjs +1 -0
- package/dist/google-only.cjs.map +1 -0
- package/dist/google-only.d.ts +13 -0
- package/dist/google-only.js +11 -0
- package/dist/google-only.js.map +1 -0
- package/dist/hooks/useAdminDeposits.d.ts +10 -0
- package/dist/hooks/useAdminUsers.d.ts +28 -0
- package/dist/hooks/useAppleAuth.d.ts +52 -0
- package/dist/hooks/useAuth.d.ts +34 -0
- package/dist/hooks/useAuthSession.d.ts +19 -0
- package/dist/hooks/useAuthorize.d.ts +62 -0
- package/dist/hooks/useCredits.d.ts +11 -0
- package/dist/hooks/useDeposit.d.ts +16 -0
- package/dist/hooks/useEmailAuth.d.ts +60 -0
- package/dist/hooks/useGoogleAuth.d.ts +67 -0
- package/dist/hooks/useInstantLink.d.ts +42 -0
- package/dist/hooks/useInvites.d.ts +57 -0
- package/dist/hooks/useMembers.d.ts +52 -0
- package/dist/hooks/useOrgs.d.ts +49 -0
- package/dist/hooks/usePasswordReset.d.ts +32 -0
- package/dist/hooks/usePendingRecovery.d.ts +34 -0
- package/dist/hooks/useRateLimiter.d.ts +58 -0
- package/dist/hooks/useSessions.d.ts +45 -0
- package/dist/hooks/useSolanaAuth.d.ts +30 -0
- package/dist/hooks/useSystemSettings.d.ts +47 -0
- package/dist/hooks/useThemeManager.d.ts +11 -0
- package/dist/hooks/useTotp.d.ts +52 -0
- package/dist/hooks/useTotpVerify.d.ts +38 -0
- package/dist/hooks/useTransactionSigning.d.ts +45 -0
- package/dist/hooks/useWallet.d.ts +10 -0
- package/dist/hooks/useWalletDiscovery.d.ts +24 -0
- package/dist/hooks/useWalletEnrollment.d.ts +9 -0
- package/dist/hooks/useWalletMaterial.d.ts +10 -0
- package/dist/hooks/useWalletRecovery.d.ts +9 -0
- package/dist/hooks/useWalletSigning.d.ts +31 -0
- package/dist/hooks/useWebAuthn.d.ts +25 -0
- package/dist/i18n/I18nProvider.d.ts +16 -0
- package/dist/i18n/context.d.ts +6 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/translations.d.ts +66 -0
- package/dist/i18n/useI18n.d.ts +9 -0
- package/dist/index.cjs +2061 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +126 -0
- package/dist/index.js +14910 -0
- package/dist/index.js.map +1 -0
- package/dist/login-react.css +1 -0
- package/dist/solana-only.cjs +1 -0
- package/dist/solana-only.cjs.map +1 -0
- package/dist/solana-only.d.ts +13 -0
- package/dist/solana-only.js +11 -0
- package/dist/solana-only.js.map +1 -0
- package/dist/style.cjs +1 -0
- package/dist/style.cjs.map +1 -0
- package/dist/style.js +1 -0
- package/dist/style.js.map +1 -0
- package/dist/types/adminUser.d.ts +112 -0
- package/dist/types/auth.d.ts +122 -0
- package/dist/types/config.d.ts +266 -0
- package/dist/types/deposit.d.ts +488 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/invite.d.ts +71 -0
- package/dist/types/member.d.ts +45 -0
- package/dist/types/org.d.ts +101 -0
- package/dist/types/session.d.ts +28 -0
- package/dist/types/systemSettings.d.ts +81 -0
- package/dist/types/totp.d.ts +52 -0
- package/dist/types/wallet.d.ts +309 -0
- package/dist/utils/adminUserApi.d.ts +51 -0
- package/dist/utils/apiClient.d.ts +78 -0
- package/dist/utils/cryptoShim.d.ts +17 -0
- package/dist/utils/csrf.d.ts +1 -0
- package/dist/utils/deviceDetection.d.ts +17 -0
- package/dist/utils/embeddedWallet.d.ts +75 -0
- package/dist/utils/inviteApi.d.ts +31 -0
- package/dist/utils/memberApi.d.ts +23 -0
- package/dist/utils/orgApi.d.ts +36 -0
- package/dist/utils/sanitization.d.ts +66 -0
- package/dist/utils/sessionApi.d.ts +16 -0
- package/dist/utils/silentWalletEnroll.d.ts +41 -0
- package/dist/utils/systemSettingsApi.d.ts +18 -0
- package/dist/utils/tabSync.d.ts +46 -0
- package/dist/utils/tokenManager.d.ts +107 -0
- package/dist/utils/unlockCredential.d.ts +5 -0
- package/dist/utils/validation.d.ts +48 -0
- package/dist/utils/walletDetection.d.ts +23 -0
- package/dist/utils/webauthnJson.d.ts +21 -0
- package/dist/validation-BeXIfuHB.cjs +1 -0
- package/dist/validation-BeXIfuHB.cjs.map +1 -0
- package/dist/validation-BebL7hMF.js +56 -0
- package/dist/validation-BebL7hMF.js.map +1 -0
- package/package.json +109 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TOTP Setup component for enabling two-factor authentication
|
|
3
|
+
*
|
|
4
|
+
* Guides users through:
|
|
5
|
+
* 1. Scanning QR code with authenticator app
|
|
6
|
+
* 2. Saving backup codes
|
|
7
|
+
* 3. Verifying setup with a code
|
|
8
|
+
*/
|
|
9
|
+
export interface TotpSetupProps {
|
|
10
|
+
/** Called when setup is completed successfully */
|
|
11
|
+
onSuccess?: () => void;
|
|
12
|
+
/** Called when user cancels setup */
|
|
13
|
+
onCancel?: () => void;
|
|
14
|
+
/** Additional CSS class */
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Two-factor authentication setup wizard.
|
|
19
|
+
*
|
|
20
|
+
* Displays QR code for authenticator app scanning,
|
|
21
|
+
* recovery codes for account recovery, and verification step.
|
|
22
|
+
*/
|
|
23
|
+
export declare function TotpSetup({ onSuccess, onCancel, className }: TotpSetupProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TOTP Verification component for login flow
|
|
3
|
+
*
|
|
4
|
+
* Displayed when a user with 2FA enabled needs to
|
|
5
|
+
* enter their verification code to complete login.
|
|
6
|
+
*/
|
|
7
|
+
export interface TotpVerifyProps {
|
|
8
|
+
/** Temporary token from password authentication */
|
|
9
|
+
mfaToken: string;
|
|
10
|
+
/** Email address (for display) */
|
|
11
|
+
email?: string;
|
|
12
|
+
/** Called when verification succeeds */
|
|
13
|
+
onSuccess?: () => void;
|
|
14
|
+
/** Called when user wants to go back */
|
|
15
|
+
onBack?: () => void;
|
|
16
|
+
/** Additional CSS class */
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Two-factor authentication verification for login.
|
|
21
|
+
*
|
|
22
|
+
* Accepts 6-digit codes from authenticator apps
|
|
23
|
+
* or recovery codes for account recovery.
|
|
24
|
+
*/
|
|
25
|
+
export declare function TotpVerify({ mfaToken, email, onSuccess, onBack, className, }: TotpVerifyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { OtpInput } from './OtpInput';
|
|
2
|
+
export type { OtpInputProps } from './OtpInput';
|
|
3
|
+
export { QrCode } from './QrCode';
|
|
4
|
+
export type { QrCodeProps } from './QrCode';
|
|
5
|
+
export { TotpSetup } from './TotpSetup';
|
|
6
|
+
export type { TotpSetupProps } from './TotpSetup';
|
|
7
|
+
export { TotpVerify } from './TotpVerify';
|
|
8
|
+
export type { TotpVerifyProps } from './TotpVerify';
|
|
9
|
+
export { TotpSettings } from './TotpSettings';
|
|
10
|
+
export type { TotpSettingsProps } from './TotpSettings';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CryptoCapabilities } from '../../crypto';
|
|
2
|
+
export interface CapabilityWarningProps {
|
|
3
|
+
/** Capability check results */
|
|
4
|
+
capabilities: CryptoCapabilities;
|
|
5
|
+
/** Optional class name */
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Warning display for missing capabilities
|
|
10
|
+
*/
|
|
11
|
+
export declare function CapabilityWarning({ capabilities, className }: CapabilityWarningProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Passkey prompt component for WebAuthn interactions
|
|
3
|
+
*
|
|
4
|
+
* Provides visual feedback during WebAuthn ceremonies:
|
|
5
|
+
* - Registration of new passkeys
|
|
6
|
+
* - Authentication with existing passkeys
|
|
7
|
+
* - PRF extension operations
|
|
8
|
+
*/
|
|
9
|
+
export interface PasskeyPromptProps {
|
|
10
|
+
/** Type of WebAuthn operation */
|
|
11
|
+
mode: 'register' | 'authenticate';
|
|
12
|
+
/** Whether the operation is in progress */
|
|
13
|
+
isLoading?: boolean;
|
|
14
|
+
/** Error message if operation failed */
|
|
15
|
+
error?: string;
|
|
16
|
+
/** Callback to trigger the operation */
|
|
17
|
+
onPrompt?: () => void;
|
|
18
|
+
/** Callback to retry after error */
|
|
19
|
+
onRetry?: () => void;
|
|
20
|
+
/** Callback to cancel the operation */
|
|
21
|
+
onCancel?: () => void;
|
|
22
|
+
/** Optional custom title */
|
|
23
|
+
title?: string;
|
|
24
|
+
/** Optional custom description */
|
|
25
|
+
description?: string;
|
|
26
|
+
/** Additional CSS classes */
|
|
27
|
+
className?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* WebAuthn passkey interaction prompt
|
|
31
|
+
*
|
|
32
|
+
* Displays appropriate UI and messaging for passkey operations.
|
|
33
|
+
*/
|
|
34
|
+
export declare function PasskeyPrompt({ mode, isLoading, error, onPrompt, onRetry, onCancel, title, description, className, }: PasskeyPromptProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component to display BIP-39 recovery phrase
|
|
3
|
+
*
|
|
4
|
+
* Shows 12 words in a grid format with copy functionality.
|
|
5
|
+
* Includes security warnings about storing the phrase safely.
|
|
6
|
+
*/
|
|
7
|
+
export interface RecoveryPhraseDisplayProps {
|
|
8
|
+
/** Array of 12 mnemonic words */
|
|
9
|
+
words: string[];
|
|
10
|
+
/** Callback when user confirms they've saved the phrase */
|
|
11
|
+
onConfirm: () => void;
|
|
12
|
+
/** Optional class name */
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Display recovery phrase with security warnings
|
|
17
|
+
*/
|
|
18
|
+
export declare function RecoveryPhraseDisplay({ words, onConfirm, className, }: RecoveryPhraseDisplayProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component for entering BIP-39 recovery phrase
|
|
3
|
+
*
|
|
4
|
+
* Provides input fields for 12 words with validation and autocomplete.
|
|
5
|
+
*/
|
|
6
|
+
export interface RecoveryPhraseInputProps {
|
|
7
|
+
/** Callback when valid phrase is entered */
|
|
8
|
+
onSubmit: (words: string[]) => void;
|
|
9
|
+
/** Callback to cancel */
|
|
10
|
+
onCancel?: () => void;
|
|
11
|
+
/** Whether submission is in progress */
|
|
12
|
+
isSubmitting?: boolean;
|
|
13
|
+
/** Error message to display */
|
|
14
|
+
error?: string;
|
|
15
|
+
/** Optional class name */
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Input form for recovery phrase
|
|
20
|
+
*/
|
|
21
|
+
export declare function RecoveryPhraseInput({ onSubmit, onCancel, isSubmitting, error, className, }: RecoveryPhraseInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface WalletAddressRowProps {
|
|
2
|
+
address: string;
|
|
3
|
+
label?: string;
|
|
4
|
+
showCopy?: boolean;
|
|
5
|
+
showExplorerLink?: boolean;
|
|
6
|
+
/** If address is long, show a truncated preview with a reveal toggle. */
|
|
7
|
+
allowReveal?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function WalletAddressRow({ address, label, showCopy, showExplorerLink, allowReveal, className, }: WalletAddressRowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ShareAAuthMethod } from '../../types/wallet';
|
|
2
|
+
export interface WalletEnrollmentProps {
|
|
3
|
+
/** Callback when enrollment completes */
|
|
4
|
+
onComplete?: (solanaPubkey: string) => void;
|
|
5
|
+
/** Callback to cancel enrollment */
|
|
6
|
+
onCancel?: () => void;
|
|
7
|
+
/** Optional class name */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Force a specific auth method (otherwise auto-detected) */
|
|
10
|
+
forceAuthMethod?: ShareAAuthMethod;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Wallet enrollment wizard
|
|
14
|
+
*/
|
|
15
|
+
export declare function WalletEnrollment({ onComplete, onCancel, className, forceAuthMethod, }: WalletEnrollmentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface WalletManagerProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
showActions?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Orchestrates embedded wallet flows in one cohesive surface:
|
|
7
|
+
* status -> enroll/unlock/recover.
|
|
8
|
+
*/
|
|
9
|
+
export declare function WalletManager({ className, showActions }: WalletManagerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ShareAAuthMethod } from '../../types/wallet';
|
|
2
|
+
export interface WalletRecoveryProps {
|
|
3
|
+
/** Callback when recovery completes successfully */
|
|
4
|
+
onComplete?: () => void;
|
|
5
|
+
/** Callback when user cancels recovery */
|
|
6
|
+
onCancel?: () => void;
|
|
7
|
+
/** Additional CSS classes */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Default auth method (optional) */
|
|
10
|
+
defaultAuthMethod?: ShareAAuthMethod;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Wallet recovery wizard
|
|
14
|
+
*
|
|
15
|
+
* Two-phase flow:
|
|
16
|
+
* 1. Enter recovery phrase
|
|
17
|
+
* 2. Enter new credential (password/passkey)
|
|
18
|
+
*/
|
|
19
|
+
export declare function WalletRecovery({ onComplete, onCancel, className, defaultAuthMethod, }: WalletRecoveryProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { WalletStatus as WalletStatusType } from '../../types/wallet';
|
|
2
|
+
export interface WalletStatusProps {
|
|
3
|
+
/** Controlled mode: Override wallet status (for demos/stories) */
|
|
4
|
+
status?: WalletStatusType;
|
|
5
|
+
/** Controlled mode: Override public key display */
|
|
6
|
+
publicKey?: string;
|
|
7
|
+
/** Controlled mode: Override lock state */
|
|
8
|
+
onLock?: () => void;
|
|
9
|
+
/** Callback when user wants to create a wallet */
|
|
10
|
+
onEnroll?: () => void;
|
|
11
|
+
/** Callback when user wants to unlock wallet */
|
|
12
|
+
onUnlock?: () => void;
|
|
13
|
+
/** Callback when user wants to recover wallet */
|
|
14
|
+
onRecover?: () => void;
|
|
15
|
+
/** Whether to show action buttons */
|
|
16
|
+
showActions?: boolean;
|
|
17
|
+
/** Compact display mode */
|
|
18
|
+
compact?: boolean;
|
|
19
|
+
/** Additional CSS classes */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Wallet status indicator
|
|
24
|
+
*
|
|
25
|
+
* Shows current wallet state with optional action buttons.
|
|
26
|
+
* Pass `status` prop to use in controlled mode (bypasses hook).
|
|
27
|
+
*/
|
|
28
|
+
export declare function WalletStatus({ status: controlledStatus, publicKey: controlledPubkey, onLock: _onLock, onEnroll, onUnlock, onRecover, showActions, compact, className, }: WalletStatusProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ShareAAuthMethod } from '../../types/wallet';
|
|
2
|
+
export interface WalletUnlockProps {
|
|
3
|
+
/** Callback when wallet is successfully unlocked */
|
|
4
|
+
onUnlock?: () => void;
|
|
5
|
+
/** Callback when unlock is cancelled */
|
|
6
|
+
onCancel?: () => void;
|
|
7
|
+
/** Whether to show the cancel button */
|
|
8
|
+
showCancel?: boolean;
|
|
9
|
+
/** The wallet's auth method (if known) */
|
|
10
|
+
authMethod?: ShareAAuthMethod;
|
|
11
|
+
/** Additional CSS classes */
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Wallet unlock form
|
|
16
|
+
*
|
|
17
|
+
* Simple single-credential flow:
|
|
18
|
+
* - Password users: Enter password
|
|
19
|
+
* - Passkey users: Authenticate with passkey
|
|
20
|
+
*
|
|
21
|
+
* Server validates credential and caches derived key for session signing.
|
|
22
|
+
*/
|
|
23
|
+
export declare function WalletUnlock({ onUnlock, onCancel, showCancel, authMethod: propAuthMethod, className, }: WalletUnlockProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wallet component exports
|
|
3
|
+
*/
|
|
4
|
+
export { RecoveryPhraseDisplay } from './RecoveryPhraseDisplay';
|
|
5
|
+
export type { RecoveryPhraseDisplayProps } from './RecoveryPhraseDisplay';
|
|
6
|
+
export { RecoveryPhraseInput } from './RecoveryPhraseInput';
|
|
7
|
+
export type { RecoveryPhraseInputProps } from './RecoveryPhraseInput';
|
|
8
|
+
export { CapabilityWarning } from './CapabilityWarning';
|
|
9
|
+
export type { CapabilityWarningProps } from './CapabilityWarning';
|
|
10
|
+
export { WalletEnrollment } from './WalletEnrollment';
|
|
11
|
+
export type { WalletEnrollmentProps } from './WalletEnrollment';
|
|
12
|
+
export { WalletUnlock } from './WalletUnlock';
|
|
13
|
+
export type { WalletUnlockProps } from './WalletUnlock';
|
|
14
|
+
export { WalletRecovery } from './WalletRecovery';
|
|
15
|
+
export type { WalletRecoveryProps } from './WalletRecovery';
|
|
16
|
+
export { WalletManager } from './WalletManager';
|
|
17
|
+
export type { WalletManagerProps } from './WalletManager';
|
|
18
|
+
export { WalletStatus } from './WalletStatus';
|
|
19
|
+
export type { WalletStatusProps } from './WalletStatus';
|
|
20
|
+
export { WalletAddressRow } from './WalletAddressRow';
|
|
21
|
+
export type { WalletAddressRowProps } from './WalletAddressRow';
|
|
22
|
+
export { PasskeyPrompt } from './PasskeyPrompt';
|
|
23
|
+
export type { PasskeyPromptProps } from './PasskeyPrompt';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface PasskeyLoginButtonProps {
|
|
3
|
+
onSuccess?: () => void;
|
|
4
|
+
className?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function PasskeyLoginButton({ onSuccess, className, children, disabled, }: PasskeyLoginButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CedrosLoginConfig, AuthUser, AuthState, AuthError, TokenPair } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Internal helpers for auth hooks (not part of public API)
|
|
4
|
+
*/
|
|
5
|
+
export interface CedrosLoginInternalAPI {
|
|
6
|
+
handleLoginSuccess: (user: AuthUser, tokens?: TokenPair) => void;
|
|
7
|
+
getAccessToken: () => string | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Context value provided by CedrosLoginProvider
|
|
11
|
+
*/
|
|
12
|
+
export interface CedrosLoginContextValue {
|
|
13
|
+
config: CedrosLoginConfig;
|
|
14
|
+
user: AuthUser | null;
|
|
15
|
+
authState: AuthState;
|
|
16
|
+
error: AuthError | null;
|
|
17
|
+
logout: () => Promise<void>;
|
|
18
|
+
refreshUser: () => Promise<void>;
|
|
19
|
+
isModalOpen: boolean;
|
|
20
|
+
openModal: () => void;
|
|
21
|
+
closeModal: () => void;
|
|
22
|
+
_internal?: CedrosLoginInternalAPI;
|
|
23
|
+
}
|
|
24
|
+
export declare const CedrosLoginContext: import('react').Context<CedrosLoginContextValue | null>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CedrosLoginConfig } from '../types';
|
|
3
|
+
export interface CedrosLoginProviderProps {
|
|
4
|
+
config: CedrosLoginConfig;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Provider component that wraps your app and provides authentication context.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <CedrosLoginProvider config={{ serverUrl: 'https://api.example.com' }}>
|
|
13
|
+
* <App />
|
|
14
|
+
* </CedrosLoginProvider>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function CedrosLoginProvider({ config, children }: CedrosLoginProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal component that exposes embedded wallet availability
|
|
3
|
+
*
|
|
4
|
+
* This component must be rendered inside CedrosLoginProvider since
|
|
5
|
+
* it uses hooks that depend on the login context.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Exposes embedded wallet availability via window global when enabled
|
|
11
|
+
*
|
|
12
|
+
* Only exposes info when:
|
|
13
|
+
* 1. config.wallet.exposeAvailability is true
|
|
14
|
+
* 2. User is logged in
|
|
15
|
+
* 3. Wallet status is known
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare function EmbeddedWalletExposure(): null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CedrosLoginContextValue } from './CedrosLoginContext';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to access the Cedros Login context.
|
|
4
|
+
* Must be used within a CedrosLoginProvider.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useCedrosLogin(): CedrosLoginContextValue;
|
|
7
|
+
/**
|
|
8
|
+
* Optional version of useCedrosLogin that returns null instead of throwing
|
|
9
|
+
* when used outside a CedrosLoginProvider. Useful for components that need
|
|
10
|
+
* to work in both provider and non-provider contexts (e.g., Storybook demos).
|
|
11
|
+
*/
|
|
12
|
+
export declare function useCedrosLoginOptional(): CedrosLoginContextValue | null;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { EncryptionKey, AesNonce } from './types';
|
|
2
|
+
/** Result of AES-GCM encryption */
|
|
3
|
+
export interface AesGcmEncryptResult {
|
|
4
|
+
/** Ciphertext including authentication tag */
|
|
5
|
+
ciphertext: Uint8Array;
|
|
6
|
+
/** 12-byte nonce used */
|
|
7
|
+
nonce: AesNonce;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Encrypt plaintext using AES-256-GCM
|
|
11
|
+
*
|
|
12
|
+
* @param plaintext - Data to encrypt
|
|
13
|
+
* @param key - 32-byte encryption key
|
|
14
|
+
* @param nonce - Optional 12-byte nonce (generated if not provided)
|
|
15
|
+
* @returns Ciphertext and nonce
|
|
16
|
+
* @throws Error if encryption fails
|
|
17
|
+
*/
|
|
18
|
+
export declare function aesGcmEncrypt(plaintext: Uint8Array, key: EncryptionKey, nonce?: AesNonce): Promise<AesGcmEncryptResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Decrypt ciphertext using AES-256-GCM
|
|
21
|
+
*
|
|
22
|
+
* @param ciphertext - Data to decrypt (includes auth tag)
|
|
23
|
+
* @param key - 32-byte encryption key
|
|
24
|
+
* @param nonce - 12-byte nonce used during encryption
|
|
25
|
+
* @returns Decrypted plaintext
|
|
26
|
+
* @throws Error if decryption or authentication fails
|
|
27
|
+
*/
|
|
28
|
+
export declare function aesGcmDecrypt(ciphertext: Uint8Array, key: EncryptionKey, nonce: AesNonce): Promise<Uint8Array>;
|
|
29
|
+
/**
|
|
30
|
+
* Encrypt plaintext and return base64-encoded results
|
|
31
|
+
*
|
|
32
|
+
* @param plaintext - Data to encrypt
|
|
33
|
+
* @param key - 32-byte encryption key
|
|
34
|
+
* @returns Base64-encoded ciphertext and nonce
|
|
35
|
+
*/
|
|
36
|
+
export declare function aesGcmEncryptToBase64(plaintext: Uint8Array, key: EncryptionKey): Promise<{
|
|
37
|
+
ciphertext: string;
|
|
38
|
+
nonce: string;
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* Decrypt base64-encoded ciphertext
|
|
42
|
+
*
|
|
43
|
+
* @param ciphertextB64 - Base64-encoded ciphertext
|
|
44
|
+
* @param nonceB64 - Base64-encoded nonce
|
|
45
|
+
* @param key - 32-byte encryption key
|
|
46
|
+
* @returns Decrypted plaintext
|
|
47
|
+
*/
|
|
48
|
+
export declare function aesGcmDecryptFromBase64(ciphertextB64: string, nonceB64: string, key: EncryptionKey): Promise<Uint8Array>;
|
|
49
|
+
/**
|
|
50
|
+
* Encrypt with automatic key derivation from password
|
|
51
|
+
*
|
|
52
|
+
* This is a convenience wrapper that combines Argon2 KDF with AES-GCM.
|
|
53
|
+
* For more control, use argon2 and aesGcmEncrypt separately.
|
|
54
|
+
*
|
|
55
|
+
* @param plaintext - Data to encrypt
|
|
56
|
+
* @param passwordKey - Key derived from password via Argon2
|
|
57
|
+
* @returns Encrypted result with nonce
|
|
58
|
+
*/
|
|
59
|
+
export declare function encryptWithPasswordKey(plaintext: Uint8Array, passwordKey: Uint8Array): Promise<AesGcmEncryptResult>;
|
|
60
|
+
/**
|
|
61
|
+
* Decrypt with password-derived key
|
|
62
|
+
*
|
|
63
|
+
* @param ciphertext - Data to decrypt
|
|
64
|
+
* @param nonce - Nonce used during encryption
|
|
65
|
+
* @param passwordKey - Key derived from password via Argon2
|
|
66
|
+
* @returns Decrypted plaintext
|
|
67
|
+
*/
|
|
68
|
+
export declare function decryptWithPasswordKey(ciphertext: Uint8Array, nonce: AesNonce, passwordKey: Uint8Array): Promise<Uint8Array>;
|
|
69
|
+
/**
|
|
70
|
+
* Convert Uint8Array to base64 string
|
|
71
|
+
*
|
|
72
|
+
* MAINT-01: Uses chunked String.fromCharCode for O(n) performance.
|
|
73
|
+
* Simple concatenation (`binary += char`) would be O(n²).
|
|
74
|
+
*/
|
|
75
|
+
export declare function uint8ArrayToBase64(bytes: Uint8Array): string;
|
|
76
|
+
/**
|
|
77
|
+
* Convert base64 string to Uint8Array
|
|
78
|
+
*
|
|
79
|
+
* @throws Error if input is not valid base64
|
|
80
|
+
*/
|
|
81
|
+
export declare function base64ToUint8Array(base64: string): Uint8Array;
|
|
82
|
+
/**
|
|
83
|
+
* Encrypt and securely wipe plaintext after encryption
|
|
84
|
+
*
|
|
85
|
+
* @param plaintext - Data to encrypt (will be wiped)
|
|
86
|
+
* @param key - Encryption key
|
|
87
|
+
* @returns Encrypted result
|
|
88
|
+
*/
|
|
89
|
+
export declare function encryptAndWipe(plaintext: Uint8Array, key: EncryptionKey): Promise<AesGcmEncryptResult>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { EncryptionKey, Argon2Salt, KdfParams } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Derive an encryption key from a password using Argon2id
|
|
4
|
+
*
|
|
5
|
+
* @security H-01: The password string cannot be wiped from memory after use.
|
|
6
|
+
* For sensitive applications, prefer argon2DeriveFromBytes() which accepts
|
|
7
|
+
* Uint8Array that CAN be securely wiped.
|
|
8
|
+
*
|
|
9
|
+
* @param password - User password or PIN
|
|
10
|
+
* @param salt - Unique salt (16+ bytes)
|
|
11
|
+
* @param params - KDF parameters (memory, time, parallelism)
|
|
12
|
+
* @returns 32-byte encryption key
|
|
13
|
+
*/
|
|
14
|
+
export declare function argon2Derive(password: string, salt: Argon2Salt, params?: KdfParams): Promise<EncryptionKey>;
|
|
15
|
+
/**
|
|
16
|
+
* Derive key from password bytes (for non-string passwords like PINs)
|
|
17
|
+
*
|
|
18
|
+
* @param passwordBytes - Password as bytes
|
|
19
|
+
* @param salt - Unique salt
|
|
20
|
+
* @param params - KDF parameters
|
|
21
|
+
* @returns 32-byte encryption key
|
|
22
|
+
*/
|
|
23
|
+
export declare function argon2DeriveFromBytes(passwordBytes: Uint8Array, salt: Argon2Salt, params?: KdfParams): Promise<EncryptionKey>;
|
|
24
|
+
/**
|
|
25
|
+
* Validate KDF parameters are within safe bounds
|
|
26
|
+
*
|
|
27
|
+
* Prevents DoS attacks via excessive resource consumption.
|
|
28
|
+
*
|
|
29
|
+
* @param params - Parameters to validate
|
|
30
|
+
* @throws Error if parameters are out of bounds
|
|
31
|
+
*/
|
|
32
|
+
export declare function validateKdfParams(params: KdfParams): void;
|
|
33
|
+
/**
|
|
34
|
+
* Check if Argon2 WASM is available and working
|
|
35
|
+
*
|
|
36
|
+
* @returns true if Argon2 can be used
|
|
37
|
+
*/
|
|
38
|
+
export declare function isArgon2Supported(): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Verify a password against stored parameters
|
|
41
|
+
*
|
|
42
|
+
* This is primarily for testing/validation, not for authentication
|
|
43
|
+
* (the server handles authentication).
|
|
44
|
+
*
|
|
45
|
+
* M-06: Timing Leak Note
|
|
46
|
+
* The length check at the start of comparison returns early on mismatch,
|
|
47
|
+
* creating a timing side-channel. This is acceptable because:
|
|
48
|
+
* 1. Server handles real authentication (not this client-side code)
|
|
49
|
+
* 2. Key lengths are fixed (32 bytes), so mismatch indicates corruption not attack
|
|
50
|
+
* 3. Argon2 derivation dominates timing regardless of comparison path
|
|
51
|
+
*
|
|
52
|
+
* @param password - Password to verify
|
|
53
|
+
* @param salt - Salt used during original derivation
|
|
54
|
+
* @param params - KDF parameters used
|
|
55
|
+
* @param expectedKey - Expected derived key
|
|
56
|
+
* @returns true if password produces the same key
|
|
57
|
+
*/
|
|
58
|
+
export declare function verifyPassword(password: string, salt: Argon2Salt, params: KdfParams, expectedKey: Uint8Array): Promise<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Get recommended KDF parameters based on target duration
|
|
61
|
+
*
|
|
62
|
+
* @param targetMs - Target duration in milliseconds (default: 500ms)
|
|
63
|
+
* @returns Recommended parameters
|
|
64
|
+
*/
|
|
65
|
+
export declare function getRecommendedParams(targetMs?: number): KdfParams;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Argon2Salt, EncryptionKey, KdfParams } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Derive an encryption key from password using Argon2id in a Web Worker.
|
|
4
|
+
*
|
|
5
|
+
* Offloads CPU-intensive Argon2id KDF to a background thread to avoid
|
|
6
|
+
* blocking the main thread. Falls back to synchronous derivation if
|
|
7
|
+
* Web Workers are not available.
|
|
8
|
+
*
|
|
9
|
+
* @param password - User's password
|
|
10
|
+
* @param salt - 16-byte random salt
|
|
11
|
+
* @param params - KDF parameters (memory, iterations, parallelism)
|
|
12
|
+
* @returns 32-byte encryption key
|
|
13
|
+
*
|
|
14
|
+
* @security **CALLER MUST WIPE RETURNED KEY AFTER USE**
|
|
15
|
+
* The returned key contains sensitive cryptographic material.
|
|
16
|
+
* Callers are responsible for wiping it when no longer needed:
|
|
17
|
+
* ```ts
|
|
18
|
+
* const key = await argon2DeriveInWorker(password, salt);
|
|
19
|
+
* try {
|
|
20
|
+
* // use key for encryption/decryption
|
|
21
|
+
* } finally {
|
|
22
|
+
* wipeBytes(key);
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
* Failure to wipe may leave key material in memory, vulnerable to memory
|
|
26
|
+
* dump attacks.
|
|
27
|
+
*/
|
|
28
|
+
export declare function argon2DeriveInWorker(password: string, salt: Argon2Salt, params?: KdfParams): Promise<EncryptionKey>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Seed, ShamirShare } from './types';
|
|
2
|
+
/** Number of words in recovery phrase (12 = 128 bits, standard Solana format) */
|
|
3
|
+
export declare const MNEMONIC_WORD_COUNT = 12;
|
|
4
|
+
/**
|
|
5
|
+
* Encode a Shamir share as a BIP-39 mnemonic phrase
|
|
6
|
+
*
|
|
7
|
+
* @param share - 16-byte share to encode
|
|
8
|
+
* @returns Array of 12 mnemonic words
|
|
9
|
+
*/
|
|
10
|
+
export declare function shareToMnemonic(share: ShamirShare): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Decode a BIP-39 mnemonic phrase back to a Shamir share
|
|
13
|
+
*
|
|
14
|
+
* @param words - Array of 12 mnemonic words
|
|
15
|
+
* @returns 16-byte share
|
|
16
|
+
* @throws Error if mnemonic is invalid
|
|
17
|
+
*/
|
|
18
|
+
export declare function mnemonicToShare(words: string[]): ShamirShare;
|
|
19
|
+
/**
|
|
20
|
+
* Encode a 16-byte seed as a BIP-39 mnemonic phrase
|
|
21
|
+
*
|
|
22
|
+
* This is used for the recovery phrase which encodes the FULL SEED
|
|
23
|
+
* (not a Shamir share) to allow complete wallet recovery.
|
|
24
|
+
*
|
|
25
|
+
* @param seed - 16-byte seed to encode
|
|
26
|
+
* @returns Array of 12 mnemonic words
|
|
27
|
+
*/
|
|
28
|
+
export declare function seedToMnemonic(seed: Seed): string[];
|
|
29
|
+
/**
|
|
30
|
+
* Decode a BIP-39 mnemonic phrase back to a seed
|
|
31
|
+
*
|
|
32
|
+
* This is used during recovery to restore the full wallet seed.
|
|
33
|
+
*
|
|
34
|
+
* @param words - Array of 12 mnemonic words
|
|
35
|
+
* @returns 16-byte seed
|
|
36
|
+
* @throws Error if mnemonic is invalid
|
|
37
|
+
*/
|
|
38
|
+
export declare function mnemonicToSeed(words: string[]): Seed;
|
|
39
|
+
/**
|
|
40
|
+
* Validate a mnemonic phrase without decoding
|
|
41
|
+
*
|
|
42
|
+
* @param words - Array of words to validate
|
|
43
|
+
* @returns true if valid BIP-39 mnemonic
|
|
44
|
+
*/
|
|
45
|
+
export declare function isValidMnemonic(words: string[]): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Check if a single word is in the BIP-39 wordlist
|
|
48
|
+
*
|
|
49
|
+
* @param word - Word to check
|
|
50
|
+
* @returns true if word is in the wordlist
|
|
51
|
+
*/
|
|
52
|
+
export declare function isValidWord(word: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Get word suggestions for autocomplete
|
|
55
|
+
*
|
|
56
|
+
* @param prefix - Partial word input
|
|
57
|
+
* @param limit - Maximum number of suggestions
|
|
58
|
+
* @returns Array of matching words from wordlist
|
|
59
|
+
*/
|
|
60
|
+
export declare function getWordSuggestions(prefix: string, limit?: number): string[];
|
|
61
|
+
/**
|
|
62
|
+
* Generate a random mnemonic for testing purposes
|
|
63
|
+
*
|
|
64
|
+
* WARNING: Do not use this for actual wallet generation.
|
|
65
|
+
* Use the proper enrollment flow which generates a seed and splits it.
|
|
66
|
+
*
|
|
67
|
+
* @returns Array of 12 random words
|
|
68
|
+
*/
|
|
69
|
+
export declare function generateRandomMnemonic(): string[];
|
|
70
|
+
/**
|
|
71
|
+
* Format mnemonic words for display (groups of 4)
|
|
72
|
+
*
|
|
73
|
+
* @param words - Array of mnemonic words
|
|
74
|
+
* @returns Array of word groups
|
|
75
|
+
*/
|
|
76
|
+
export declare function formatMnemonicForDisplay(words: string[]): string[][];
|
|
77
|
+
/**
|
|
78
|
+
* Parse user input into word array, handling various formats
|
|
79
|
+
*
|
|
80
|
+
* @param input - User input (space/comma/newline separated)
|
|
81
|
+
* @returns Array of normalized words
|
|
82
|
+
*/
|
|
83
|
+
export declare function parseMnemonicInput(input: string): string[];
|
|
84
|
+
/**
|
|
85
|
+
* Securely wipe mnemonic array
|
|
86
|
+
*
|
|
87
|
+
* @security CRYPTO-2: This is BEST-EFFORT only. JavaScript strings are immutable
|
|
88
|
+
* and the original word values WILL persist in memory until garbage collected.
|
|
89
|
+
* See secureWipe.ts wipeString() for details on JS string wiping limitations.
|
|
90
|
+
*
|
|
91
|
+
* @param words - Array of words to wipe
|
|
92
|
+
*/
|
|
93
|
+
export declare function wipeMnemonic(words: string[]): void;
|
|
94
|
+
/**
|
|
95
|
+
* Get the BIP-39 wordlist for UI purposes (e.g., validation indicators)
|
|
96
|
+
*
|
|
97
|
+
* @returns Copy of the wordlist
|
|
98
|
+
*/
|
|
99
|
+
export declare function getWordlist(): readonly string[];
|
|
100
|
+
/**
|
|
101
|
+
* Calculate the index of a word in the wordlist
|
|
102
|
+
*
|
|
103
|
+
* @param word - Word to look up
|
|
104
|
+
* @returns Index (0-2047) or -1 if not found
|
|
105
|
+
*/
|
|
106
|
+
export declare function getWordIndex(word: string): number;
|