@magnaflow/keystore
v1.0.2
Published
Standardized keystore management library for secure key storage
Maintainers
Readme
@magnaflow/keystore
Keystore creation, import/export, and encrypted mnemonic storage helpers.
What It Provides
- Ethereum-compatible keystore generation from a mnemonic or private key
- Keystore import and validation helpers
- Browser-friendly export support
- Secure text encryption with
@metamask/browser-passworder - Local storage and in-memory mnemonic persistence helpers
Install
npm install @magnaflow/keystoreKey Exports
createKeystoreimportKeystorevalidateKeystorekeystoreHasMnemonicexportKeystoregenerateAndExportKeystoreencryptTextSecuredecryptTextSecurestoreMnemonicgetMnemonicremoveMnemonichasMnemonicsetInMemoryMnemonicgetInMemoryMnemonicclearInMemoryMnemonic
Example
import { createKeystore, importKeystore, storeMnemonic } from '@magnaflow/keystore';
const keystoreJson = await createKeystore(process.env.MNEMONIC!, {
password: 'strong-password',
walletName: 'merchant-wallet',
});
const imported = await importKeystore(keystoreJson, 'strong-password');
await storeMnemonic(imported.mnemonic ?? '', 'merchant-wallet');Notes
- Browser export uses
Bloband DOM APIs when they are available. - Storage helpers fall back to in-memory storage when
localStorageis unavailable.
Development
bunx nx run keystore:lint
bunx nx run keystore:test
bunx nx run keystore:buildLicense
This package is part of the merchant-v2-sdk monorepo and is covered by the root MIT license.
See ../../LICENSE for details.
