interface CryptoApi { bufferFromString(string: string,
encoding?: Encoding): Uint8Array; computeHmac(algorithm: "sha256" | "sha512",
key: BytesLike,
data: BytesLike): string; decrypt<T>(password: string,
keystore: Keystore): Promise<T>; decryptJsonWalletData(data: Uint8Array,
key: Uint8Array,
iv: Uint8Array): Promise<Uint8Array>; encrypt<T>(password: string,
data: T): Promise<Keystore>; encryptJsonWalletData(data: Uint8Array,
key: Uint8Array,
iv: Uint8Array): Promise<Uint8Array>; keccak256(data: Uint8Array): Uint8Array; keyFromPassword(password: string,
saltBuffer: Uint8Array): Uint8Array; pbkdf2(password: BytesLike,
salt: BytesLike,
iterations: number,
keylen: number,
algo: "sha256" | "sha512"): string; randomBytes(length: number): Uint8Array; randomUUID(): string; ripemd160(data: BytesLike): Uint8Array; scrypt(params: IScryptParams): Uint8Array; stringFromBuffer(buffer: Uint8Array,
encoding?: Encoding): string; } Methods
bufferFromString
- bufferFromString(string, encoding?): Uint8Array
Parameters
- string: string
Optional
encoding: Encoding
Returns Uint8Array
computeHmac
- computeHmac(algorithm, key, data): string
Returns string
decrypt
- decrypt<T>(password, keystore): Promise<T>
Returns Promise<T>
decryptJsonWalletData
- decryptJsonWalletData(data, key, iv): Promise<Uint8Array>
Parameters
- data: Uint8Array
- key: Uint8Array
- iv: Uint8Array
Returns Promise<Uint8Array>
encryptJsonWalletData
- encryptJsonWalletData(data, key, iv): Promise<Uint8Array>
Parameters
- data: Uint8Array
- key: Uint8Array
- iv: Uint8Array
Returns Promise<Uint8Array>
keccak256
- keccak256(data): Uint8Array
Returns Uint8Array
keyFromPassword
- keyFromPassword(password, saltBuffer): Uint8Array
Parameters
- password: string
- saltBuffer: Uint8Array
Returns Uint8Array
pbkdf2
- pbkdf2(password, salt, iterations, keylen, algo): string
Parameters
- password: BytesLike
- salt: BytesLike
- iterations: number
- keylen: number
- algo: "sha256" | "sha512"
Returns string
randomBytes
- randomBytes(length): Uint8Array
Returns Uint8Array
randomUUID
- randomUUID(): string
Returns string
ripemd160
- ripemd160(data): Uint8Array
Returns Uint8Array
scrypt
- scrypt(params): Uint8Array
Returns Uint8Array
stringFromBuffer
- stringFromBuffer(buffer, encoding?): string
Parameters
- buffer: Uint8Array
Optional
encoding: Encoding
Returns string