cometa-0.1.0.0: Idiomatic Haskell bindings to cardano-c
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cometa.Crypto.Bip32

Description

Derive Cardano Ed25519-BIP32 public keys from BIP39 entropy and validated wallet paths. Passwords are raw bytes, without text normalization. These operations accept entropy, not a mnemonic sentence or a 64-byte BIP39 seed.

import qualified Cometa.Crypto.Bip32 as Bip32
import qualified Cometa.Crypto.DerivationPath as Path

firstAccount password entropy =
  Bip32.deriveAccountPublicKey password entropy (Path.standardAccountPath minBound)
Synopsis

Documentation

deriveAccountPublicKey :: ByteString -> ByteString -> AccountPath -> IO (Either Error PublicKey) Source #

Derive an extended account public key from password bytes, BIP39 entropy bytes and an account path, respectively. Entropy must contain 16, 20, 24, 28 or 32 bytes; other lengths return InvalidBip39EntropyLength. Passwords may be empty or contain NUL bytes. Native failures return NativeError. The result includes the chain code and supports public derivation of role/index suffixes.

derivePublicKey :: ByteString -> ByteString -> DerivationPath -> IO (Either Error PublicKey) Source #

Derive an extended public key from password bytes, BIP39 entropy bytes and a five-component wallet path, respectively. Entropy and passwords follow deriveAccountPublicKey; native failures return NativeError. The result includes the chain code and remains usable after this operation returns.