import { PlainObject, Vault, VaultService } from "../vault"; import { BIP44HDPath, ExportedKeyRingVault, ExtendedKey, KeyInfo, KeyRing, KeyRingStatus } from "./types"; import { Env, MessageRequester } from "@keplr-wallet/router"; import { PubKeyBitcoinCompatible, PubKeySecp256k1, PubKeyStarknet } from "@keplr-wallet/crypto"; import { ChainsService } from "../chains"; import { KVStore } from "@keplr-wallet/common"; import { InteractionService } from "../interaction"; import { ChainInfo, ModularChainInfo, SignPsbtOptions } from "@keplr-wallet/types"; import * as Legacy from "./legacy"; import { ChainsUIService } from "../chains-ui"; import { MultiAccounts } from "../keyring-keystone"; import { AnalyticsService } from "../analytics"; import { Primitive } from "utility-types"; import { Network as BitcoinNetwork, Psbt } from "bitcoinjs-lib"; import { Buffer as NodeBuffer } from "buffer"; export declare class KeyRingService { protected readonly kvStore: KVStore; protected readonly migrations: { readonly kvStore: KVStore; readonly commonCrypto: Legacy.CommonCrypto; readonly chainsUIService: ChainsUIService; readonly getDisabledChainIdentifiers: () => Promise; }; protected readonly eventMsgRequester: MessageRequester; protected readonly chainsService: ChainsService; protected readonly chainsUIService: ChainsUIService; protected readonly interactionService: InteractionService; protected readonly vaultService: VaultService; protected readonly analyticsService: AnalyticsService; protected readonly keyRings: KeyRing[]; protected _needMigration: boolean; protected _isMigrating: boolean; protected _selectedVaultId: string | undefined; protected cacheKeySearchHexToBech32: Map; constructor(kvStore: KVStore, migrations: { readonly kvStore: KVStore; readonly commonCrypto: Legacy.CommonCrypto; readonly chainsUIService: ChainsUIService; readonly getDisabledChainIdentifiers: () => Promise; }, eventMsgRequester: MessageRequester, chainsService: ChainsService, chainsUIService: ChainsUIService, interactionService: InteractionService, vaultService: VaultService, analyticsService: AnalyticsService, keyRings: KeyRing[]); init(): Promise; lockKeyRing(): void; ensureUnlockInteractive(env: Env): Promise; get needMigration(): boolean; get isMigrating(): boolean; unlockKeyRing(password: string): Promise; checkLegacyKeyRingPassword(password: string): Promise; getLegacyKeyringInfos(): Promise; showSensitiveLegacyKeyringData(index: string, password: string): Promise; protected migrate(password: string): Promise; selectKeyRing(vaultId: string): void; get keyRingStatus(): KeyRingStatus; getKeyRingVaults(): Vault[]; getKeyInfos(): KeyInfo[]; getKeyInfo(vaultId: string): KeyInfo | undefined; get selectedVaultId(): string; finalizeKeyCoinType(vaultId: string, chainId: string, coinType: number): void; needKeyCoinTypeFinalize(vaultId: string, chainId: string): boolean; createMnemonicKeyRing(mnemonic: string, bip44Path: BIP44HDPath, name: string, password?: string, meta?: PlainObject): Promise; createLedgerKeyRing(pubKey: Uint8Array, app: string, bip44Path: BIP44HDPath, name: string, password?: string): Promise; createKeystoneKeyRing(multiAccounts: MultiAccounts, name: string, password?: string): Promise; createPrivateKeyKeyRing(privateKey: Uint8Array, meta: PlainObject, name: string, password?: string): Promise; appendLedgerKeyRing(id: string, pubKey: Uint8Array, app: string): void; appendLedgerExtendedKeyRings(vaultId: string, extendedKeys: ExtendedKey[], app: string): void; getPubKeySelected(chainId: string): Promise; getKeyRingNameSelected(): string; getKeyRingName(vaultId: string): string; changeKeyRingName(vaultId: string, name: string): void; changeKeyRingNameInteractive(env: Env, vaultId: string, defaultName: string, editable: boolean): Promise; switchAccountInteractive(env: Env, vaultId: string, origin: string): Promise; deleteKeyRing(vaultId: string, password: string): Promise; signSelected(chainId: string, data: Uint8Array, digestMethod: "sha256" | "keccak256"): Promise<{ readonly r: Uint8Array; readonly s: Uint8Array; readonly v: number | null; }>; getPubKey(chainId: string, vaultId: string): Promise; getPubKeyStarknet(chainId: string, vaultId: string): Promise; getPubKeyBitcoin(chainId: string, vaultId: string, network: BitcoinNetwork): Promise; getPubKeyWithNotFinalizedCoinType(chainId: string, vaultId: string, purpose: number, coinType: number): Promise; sign(chainId: string, vaultId: string, data: Uint8Array, digestMethod: "sha256" | "keccak256" | "hash256" | "noop"): Promise<{ readonly r: Uint8Array; readonly s: Uint8Array; readonly v: number | null; }>; signPsbt(chainId: string, vaultId: string, psbt: Psbt, inputsToSign: { index: number; address: string; hdPath?: string; tapLeafHashesToSign?: NodeBuffer[]; }[], network: BitcoinNetwork, options?: SignPsbtOptions): Promise; getStarknetPubKeyWithVault(vault: Vault, modularChainInfo: ModularChainInfo): Promise; getPubKeyWithVault(vault: Vault, purpose: number, coinType: number, modularChainInfo: ModularChainInfo): Promise; getPubKeyBitcoinWithVault(vault: Vault, purpose: number, coinType: number, network: BitcoinNetwork, modularChainInfo: ModularChainInfo): Promise; signWithVault(vault: Vault, purpose: number, coinType: number, data: Uint8Array, digestMethod: "sha256" | "keccak256" | "hash256" | "noop", modularChainInfo: ModularChainInfo): Promise<{ readonly r: Uint8Array; readonly s: Uint8Array; readonly v: number | null; }>; signPsbtWithVault(vault: Vault, purpose: number, coinType: number, psbt: Psbt, inputsToSign: { index: number; address: string; hdPath?: string; tapLeafHashesToSign?: NodeBuffer[]; }[], network: BitcoinNetwork, modularChainInfo: ModularChainInfo, options?: SignPsbtOptions): Promise; showSensitiveKeyRingData(vaultId: string, password: string): Promise; checkUserPassword(password: string): Promise; changeUserPassword(prevUserPassword: string, newUserPassword: string): Promise; exportKeyRingVaults(password: string): Promise; exportKeyRingData(password: string): Promise; protected getVaultKeyRing(vault: Vault): KeyRing; protected getKeyRing(type: string): KeyRing; searchKeyRings(searchText: string, ignoreChainEnabled?: boolean): KeyInfo[]; protected getKeySearchBech32FromHex(prefix: string, hex: string): string; protected static getAddressHexStringFromKeyInfo(chainInfo: ChainInfo, keyInfo: KeyInfo, key: string, value: PlainObject | Primitive | undefined, isEVM: boolean): string; static parseBIP44Path(bip44Path: string): { purpose: number; coinType: number; path: BIP44HDPath; }; protected static validateBIP44Path(bip44Path: BIP44HDPath): void; }