@xchainjs/xchain-crypto
v1.0.7
Published
XChain Crypto is a crypto module needed by all XChain clients.
Maintainers
Keywords
Readme
The XChain Crypto package provides cryptographic utilities used by all XChain clients. It encrypts master phrases to keystores and supports BIP39 compatible phrase import/export across wallets.
Modules
crypto- Core cryptographic functions for keystore encryption/decryptiontypes- TypeScript type definitions for keystores and crypto operations
Installation
yarn add @xchainjs/xchain-cryptoor
npm install @xchainjs/xchain-cryptoDocumentation
xchain crypto
How xchain-crypto worksHow to use xchain-crypto
Features
- BIP39 Compatible: Full support for BIP39 mnemonic phrases
- Secure Encryption: Uses AES-128-CTR with PBKDF2 (262,144 iterations)
- Cross-Chain: Works with all XChain client implementations
- Keystore Export: Compatible with other wallet formats
Constants
// Crypto Constants for xchain
const cipher = 'aes-128-ctr'
const kdf = 'pbkdf2'
const prf = 'hmac-sha256'
const dklen = 32
const c = 262144
const hashFunction = 'sha256'
const meta = 'xchain-keystore'Keystore Type
export type Keystore = {
address: string
crypto: {
cipher: string
ciphertext: string
cipherparams: {
iv: string
}
kdf: string
kdfparams: {
prf: string
dklen: number
salt: string
c: number
}
mac: string
}
id: string
version: number
meta: string
}