bigblocks
Version:
Complete Bitcoin UI component library - authentication, social, wallet, market, inscriptions, and blockchain interactions for React
147 lines • 3.89 kB
TypeScript
export type MigrationState = "ready" | "migrating" | "completed" | "failed";
export type BackupFormat = "legacy" | "type42";
export interface LegacyMasterBackup {
ids: string;
xprv: string;
mnemonic: string;
label?: string;
createdAt?: string;
}
export interface Type42MasterBackup {
ids: string;
rootPk: string;
label?: string;
createdAt?: string;
}
export interface MigrationResult {
success: boolean;
newBackup?: Type42MasterBackup;
error?: Error;
warning?: string;
}
export interface MasterKeyMigrationProps {
/**
* Callback when migration completes successfully
*/
onMigrationComplete?: (newBackup: Type42MasterBackup) => void;
/**
* Callback when user chooses to skip migration
*/
onSkipMigration?: () => void;
/**
* Theme variant for the component
*/
variant?: "surface" | "ghost" | "classic";
/**
* Size of the component
*/
size?: "1" | "2" | "3";
}
export interface BackupFormatDetectionResult {
format: BackupFormat;
isValid: boolean;
hasEncryptedData: boolean;
keyInfo: {
hasXprv: boolean;
hasMnemonic: boolean;
hasRootPk: boolean;
hasIds: boolean;
};
estimatedCreationDate?: string;
}
export interface MigrationOptions {
/**
* Whether to preserve the original backup alongside the new one
*/
preserveOriginal?: boolean;
/**
* Custom label for the migrated backup
*/
newLabel?: string;
/**
* Whether to automatically sign in with the new backup after migration
*/
autoSignIn?: boolean;
/**
* Custom password for the new backup (uses current password if not provided)
*/
newPassword?: string;
}
export interface IdentityMigrationData {
legacyIdentities: Array<{
idKey: string;
addresses: string[];
attestations: unknown[];
currentPath: string;
rootPath: string;
}>;
newIdentities: Array<{
idKey: string;
counter: number;
address: string;
}>;
}
export interface UseMasterKeyMigrationResult {
/**
* Detect the format of a backup
*/
detectBackupFormat: (backup: unknown) => BackupFormatDetectionResult;
/**
* Check if current user has legacy master backup that can be migrated
*/
canMigrate: boolean;
/**
* Check if current user already has Type 42 backup
*/
hasType42Backup: boolean;
/**
* Perform the migration
*/
migrate: (options?: MigrationOptions) => Promise<MigrationResult>;
/**
* Get current backup format info
*/
currentBackupInfo: BackupFormatDetectionResult | null;
/**
* Migration state
*/
isLoading: boolean;
error: Error | null;
progress: number;
}
export interface BackupFormatDetectorProps {
/**
* Backup data to analyze
*/
backup: unknown;
/**
* Callback when format is detected
*/
onFormatDetected?: (result: BackupFormatDetectionResult) => void;
/**
* Whether to show detailed information
*/
showDetails?: boolean;
/**
* Component size
*/
size?: "1" | "2" | "3";
}
export interface BackupValidationError {
field: string;
message: string;
severity: "error" | "warning";
}
export interface BackupValidationResult extends BackupFormatDetectionResult {
errors: BackupValidationError[];
warnings: BackupValidationError[];
canProceed: boolean;
}
export type MigrationWarning = "identity_keys_will_change" | "attestations_not_transferable" | "legacy_backup_preserved" | "new_addresses_generated" | "requires_new_attestations";
export interface MigrationWarningInfo {
type: MigrationWarning;
title: string;
description: string;
severity: "info" | "warning" | "critical";
}
//# sourceMappingURL=migration.d.ts.map