export async function _create (wallet: Wallet, vault: Vault, password: string, mnemonicSalt?: string): Promise<NamedData<ArrayBuffer>>
export async function _create (wallet: Wallet, vault: Vault, password: unknown, mnemonicSalt?: unknown): Promise<NamedData<ArrayBuffer>> {
- if (typeof password !== 'string') {
- throw new TypeError('Invalid password', { cause: typeof password })
- }
- if (mnemonicSalt !== undefined && typeof mnemonicSalt !== 'string') {
- throw new TypeError('Mnemonic salt must be a string')
- }
try {
+ if (typeof password !== 'string') {
+ throw new TypeError('Invalid password', { cause: typeof password })
+ }
+ if (mnemonicSalt !== undefined && typeof mnemonicSalt !== 'string') {
+ throw new TypeError('Mnemonic salt must be a string')
+ }
const { iv, salt, encrypted, seed, mnemonic } = await vault.request<ArrayBuffer>({
action: 'create',
type: wallet.type,
export async function _load (wallet: Wallet, vault: Vault, password: string, secret: string, mnemonicSalt?: string): Promise<void>
export async function _load (wallet: Wallet, vault: Vault, password: unknown, secret: unknown, mnemonicSalt?: unknown): Promise<void> {
- if (typeof password !== 'string') {
- throw new TypeError('Password must be a string')
- }
- if (typeof secret !== 'string') {
- throw new TypeError('Wallet secret must be a string')
- }
- if (mnemonicSalt !== undefined && typeof mnemonicSalt !== 'string') {
- throw new TypeError('Mnemonic salt must be a string')
- }
try {
+ if (typeof password !== 'string') {
+ throw new TypeError('Password must be a string')
+ }
+ if (typeof secret !== 'string') {
+ throw new TypeError('Wallet secret must be a string')
+ }
+ if (mnemonicSalt !== undefined && typeof mnemonicSalt !== 'string') {
+ throw new TypeError('Mnemonic salt must be a string')
+ }
const data: NamedData = {
action: 'load',
type: wallet.type,