web3-0.9.1.0: Web3 API for Haskell.

CopyrightAlexander Krupenkin 2018
LicenseBSD3
Maintainermail@akru.me
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Crypto.Ethereum.Keyfile

Contents

Description

Ethereum Secret Storage implementation. Spec https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition.

Synopsis

Encrypted Ethereum private key

data EncryptedKey Source #

Secret Storage representation on memory.

Constructors

EncryptedKey 

Fields

data Cipher Source #

Cipher parameters.

Constructors

Aes128Ctr 

data Kdf Source #

Key derivation function parameters and salt.

Secret storage packers

decrypt :: (ByteArrayAccess password, ByteArray privateKey) => EncryptedKey -> password -> Maybe privateKey Source #

Decrypt Ethereum private key.

Typically Web3 Secret Storage is JSON-encoded. EncryptedKey data type has FromJSON instance to helps decode it from JSON-encoded string or file.

  let decryptJSON pass = flip decrypt pass <=< decode

encrypt :: (ByteArray privateKey, ByteArrayAccess password, MonadRandom m) => privateKey -> password -> m EncryptedKey Source #

Encrypt Ethereum private key.

  let encryptJSON pass key = encode $ encrypt key pass