Copyright | No rights reserved |
---|---|
License | UNLICENSE |
Maintainer | xenog@protonmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
ECDSA private and public keys, extended keys (BIP-32) and mnemonic sentences (BIP-39).
Synopsis
- type Entropy = ByteString
- type Mnemonic = Text
- type Passphrase = ByteString
- type Seed = ByteString
- toMnemonic :: Entropy -> Either String Mnemonic
- fromMnemonic :: Mnemonic -> Either String Entropy
- mnemonicToSeed :: Passphrase -> Mnemonic -> Either String Seed
- data XPubKey = XPubKey {
- xPubDepth :: !Word8
- xPubParent :: !Fingerprint
- xPubIndex :: !KeyIndex
- xPubChain :: !ChainCode
- xPubKey :: !PubKey
- data XPrvKey = XPrvKey {
- xPrvDepth :: !Word8
- xPrvParent :: !Fingerprint
- xPrvIndex :: !KeyIndex
- xPrvChain :: !ChainCode
- xPrvKey :: !SecKey
- type ChainCode = Hash256
- type KeyIndex = Word32
- type Fingerprint = Word32
- newtype DerivationException = DerivationException String
- makeXPrvKey :: ByteString -> XPrvKey
- deriveXPubKey :: XPrvKey -> XPubKey
- prvSubKey :: XPrvKey -> KeyIndex -> XPrvKey
- pubSubKey :: XPubKey -> KeyIndex -> XPubKey
- hardSubKey :: XPrvKey -> KeyIndex -> XPrvKey
- xPrvIsHard :: XPrvKey -> Bool
- xPubIsHard :: XPubKey -> Bool
- xPrvChild :: XPrvKey -> KeyIndex
- xPubChild :: XPubKey -> KeyIndex
- xPubID :: XPubKey -> Hash160
- xPrvID :: XPrvKey -> Hash160
- xPubFP :: XPubKey -> Fingerprint
- xPrvFP :: XPrvKey -> Fingerprint
- xPubAddr :: XPubKey -> Address
- xPubExport :: Network -> XPubKey -> Base58
- xPubToJSON :: Network -> XPubKey -> Value
- xPubFromJSON :: Network -> Value -> Parser XPubKey
- xPrvExport :: Network -> XPrvKey -> Base58
- xPrvToJSON :: Network -> XPrvKey -> Value
- xPrvFromJSON :: Network -> Value -> Parser XPrvKey
- xPubImport :: Network -> Base58 -> Maybe XPubKey
- xPrvImport :: Network -> Base58 -> Maybe XPrvKey
- xPrvWif :: Network -> XPrvKey -> Base58
- putXPrvKey :: Network -> Putter XPrvKey
- putXPubKey :: Network -> Putter XPubKey
- getXPrvKey :: Network -> Get XPrvKey
- getXPubKey :: Network -> Get XPubKey
- prvSubKeys :: XPrvKey -> KeyIndex -> [(XPrvKey, KeyIndex)]
- pubSubKeys :: XPubKey -> KeyIndex -> [(XPubKey, KeyIndex)]
- hardSubKeys :: XPrvKey -> KeyIndex -> [(XPrvKey, KeyIndex)]
- deriveAddr :: XPubKey -> KeyIndex -> (Address, PubKey)
- deriveAddrs :: XPubKey -> KeyIndex -> [(Address, PubKey, KeyIndex)]
- deriveMSAddr :: [XPubKey] -> Int -> KeyIndex -> (Address, RedeemScript)
- deriveMSAddrs :: [XPubKey] -> Int -> KeyIndex -> [(Address, RedeemScript, KeyIndex)]
- cycleIndex :: KeyIndex -> [KeyIndex]
- data DerivPathI t where
- (:|) :: HardOrAny t => !(DerivPathI t) -> !KeyIndex -> DerivPathI t
- (:/) :: AnyOrSoft t => !(DerivPathI t) -> !KeyIndex -> DerivPathI t
- Deriv :: DerivPathI t
- data AnyDeriv
- data HardDeriv
- data SoftDeriv
- class HardOrAny a
- class AnyOrSoft a
- type DerivPath = DerivPathI AnyDeriv
- type HardPath = DerivPathI HardDeriv
- type SoftPath = DerivPathI SoftDeriv
- data Bip32PathIndex
- derivePath :: DerivPathI t -> XPrvKey -> XPrvKey
- derivePubPath :: SoftPath -> XPubKey -> XPubKey
- toHard :: DerivPathI t -> Maybe HardPath
- toSoft :: DerivPathI t -> Maybe SoftPath
- toGeneric :: DerivPathI t -> DerivPath
- (++/) :: DerivPathI t1 -> DerivPathI t2 -> DerivPath
- pathToStr :: DerivPathI t -> String
- listToPath :: [KeyIndex] -> DerivPath
- pathToList :: DerivPathI t -> [KeyIndex]
- data XKey
- = XPrv {
- getXKeyPrv :: !XPrvKey
- getXKeyNet :: !Network
- | XPub {
- getXKeyPub :: !XPubKey
- getXKeyNet :: !Network
- = XPrv {
- data ParsedPath
- = ParsedPrv { }
- | ParsedPub { }
- | ParsedEmpty { }
- parsePath :: String -> Maybe ParsedPath
- parseHard :: String -> Maybe HardPath
- parseSoft :: String -> Maybe SoftPath
- applyPath :: ParsedPath -> XKey -> Either String XKey
- derivePathAddr :: XPubKey -> SoftPath -> KeyIndex -> (Address, PubKey)
- derivePathAddrs :: XPubKey -> SoftPath -> KeyIndex -> [(Address, PubKey, KeyIndex)]
- derivePathMSAddr :: [XPubKey] -> SoftPath -> Int -> KeyIndex -> (Address, RedeemScript)
- derivePathMSAddrs :: [XPubKey] -> SoftPath -> Int -> KeyIndex -> [(Address, RedeemScript, KeyIndex)]
- concatBip32Segments :: [Bip32PathIndex] -> DerivPath
- data PubKeyI = PubKeyI {
- pubKeyPoint :: !PubKey
- pubKeyCompressed :: !Bool
- data SecKeyI = SecKeyI {
- secKeyData :: !SecKey
- secKeyCompressed :: !Bool
- exportPubKey :: Bool -> PubKey -> ByteString
- importPubKey :: ByteString -> Maybe PubKey
- wrapPubKey :: Bool -> PubKey -> PubKeyI
- derivePubKeyI :: SecKeyI -> PubKeyI
- wrapSecKey :: Bool -> SecKey -> SecKeyI
- fromMiniKey :: ByteString -> Maybe SecKeyI
- tweakPubKey :: PubKey -> Hash256 -> Maybe PubKey
- tweakSecKey :: SecKey -> Hash256 -> Maybe SecKey
- secKeyPut :: Putter SecKey
- secKeyGet :: Get SecKey
- getSecKey :: SecKey -> ByteString
- secKey :: ByteString -> Maybe SecKey
Mnemonic Sentences
type Entropy = ByteString Source #
Random data used to create a mnemonic sentence. Use a good entropy source. You will get your coins stolen if you don't. You have been warned.
type Passphrase = ByteString Source #
Optional passphrase for mnemnoic sentence.
type Seed = ByteString Source #
Seed for a private key from a mnemonic sentence.
toMnemonic :: Entropy -> Either String Mnemonic Source #
Provide intial Entropy
as a ByteString
of length multiple of 4 bytes.
Output a Mnemonic
sentence.
fromMnemonic :: Mnemonic -> Either String Entropy Source #
Revert toMnemonic
. Do not use this to generate a Seed
. Instead use
mnemonicToSeed
. This outputs the original Entropy
used to generate a
Mnemonic
sentence.
mnemonicToSeed :: Passphrase -> Mnemonic -> Either String Seed Source #
Get a 512-bit Seed
from a Mnemonic
sentence. Will validate checksum.
Passphrase
can be used to protect the Mnemonic
. Use an empty string as
Passphrase
if none is required.
Extended Keys
Data type representing an extended BIP32 public key.
XPubKey | |
|
Instances
Eq XPubKey Source # | |
Read XPubKey Source # | |
Show XPubKey Source # | |
Generic XPubKey Source # | |
type Rep XPubKey Source # | |
Defined in Network.Haskoin.Keys.Extended type Rep XPubKey = D1 (MetaData "XPubKey" "Network.Haskoin.Keys.Extended" "haskoin-core-0.8.4-AWaCExKDMsg51o0OUGuqyW" False) (C1 (MetaCons "XPubKey" PrefixI True) ((S1 (MetaSel (Just "xPubDepth") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Word8) :*: S1 (MetaSel (Just "xPubParent") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Fingerprint)) :*: (S1 (MetaSel (Just "xPubIndex") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 KeyIndex) :*: (S1 (MetaSel (Just "xPubChain") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ChainCode) :*: S1 (MetaSel (Just "xPubKey") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 PubKey))))) |
Data type representing an extended BIP32 private key. An extended key is a node in a tree of key derivations. It has a depth in the tree, a parent node and an index to differentiate it from other siblings.
XPrvKey | |
|
Instances
Eq XPrvKey Source # | |
Read XPrvKey Source # | |
Show XPrvKey Source # | |
Generic XPrvKey Source # | |
type Rep XPrvKey Source # | |
Defined in Network.Haskoin.Keys.Extended type Rep XPrvKey = D1 (MetaData "XPrvKey" "Network.Haskoin.Keys.Extended" "haskoin-core-0.8.4-AWaCExKDMsg51o0OUGuqyW" False) (C1 (MetaCons "XPrvKey" PrefixI True) ((S1 (MetaSel (Just "xPrvDepth") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Word8) :*: S1 (MetaSel (Just "xPrvParent") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Fingerprint)) :*: (S1 (MetaSel (Just "xPrvIndex") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 KeyIndex) :*: (S1 (MetaSel (Just "xPrvChain") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ChainCode) :*: S1 (MetaSel (Just "xPrvKey") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 SecKey))))) |
type Fingerprint = Word32 Source #
Fingerprint of parent
newtype DerivationException Source #
A derivation exception is thrown in the very unlikely event that a derivation is invalid.
Instances
Eq DerivationException Source # | |
Defined in Network.Haskoin.Keys.Extended (==) :: DerivationException -> DerivationException -> Bool # (/=) :: DerivationException -> DerivationException -> Bool # | |
Read DerivationException Source # | |
Defined in Network.Haskoin.Keys.Extended | |
Show DerivationException Source # | |
Defined in Network.Haskoin.Keys.Extended showsPrec :: Int -> DerivationException -> ShowS # show :: DerivationException -> String # showList :: [DerivationException] -> ShowS # | |
Exception DerivationException Source # | |
makeXPrvKey :: ByteString -> XPrvKey Source #
Build a BIP32 compatible extended private key from a bytestring. This will
produce a root node (depth=0
and parent=0
).
deriveXPubKey :: XPrvKey -> XPubKey Source #
Derive an extended public key from an extended private key. This function will preserve the depth, parent, index and chaincode fields of the extended private keys.
:: XPrvKey | extended parent private key |
-> KeyIndex | child derivation index |
-> XPrvKey | extended child private key |
Compute a private, soft child key derivation. A private soft derivation will allow the equivalent extended public key to derive the public key for this child. Given a parent key m and a derivation index i, this function will compute m/i.
Soft derivations allow for more flexibility such as read-only wallets. However, care must be taken not the leak both the parent extended public key and one of the extended child private keys as this would compromise the extended parent private key.
:: XPubKey | extended parent public key |
-> KeyIndex | child derivation index |
-> XPubKey | extended child public key |
Compute a public, soft child key derivation. Given a parent key M and a derivation index i, this function will compute M/i.
:: XPrvKey | extended parent private key |
-> KeyIndex | child derivation index |
-> XPrvKey | extended child private key |
Compute a hard child key derivation. Hard derivations can only be computed for private keys. Hard derivations do not allow the parent public key to derive the child public keys. However, they are safer as a breach of the parent public key and child private keys does not lead to a breach of the parent private key. Given a parent key m and a derivation index i, this function will compute m/i'.
xPrvIsHard :: XPrvKey -> Bool Source #
Returns true if the extended private key was derived through a hard derivation.
xPubIsHard :: XPubKey -> Bool Source #
Returns true if the extended public key was derived through a hard derivation.
xPrvChild :: XPrvKey -> KeyIndex Source #
Returns the derivation index of this extended private key without the hard bit set.
xPubChild :: XPubKey -> KeyIndex Source #
Returns the derivation index of this extended public key without the hard bit set.
xPubFP :: XPubKey -> Fingerprint Source #
Computes the key fingerprint of an extended public key.
xPrvFP :: XPrvKey -> Fingerprint Source #
Computes the key fingerprint of an extended private key.
xPubExport :: Network -> XPubKey -> Base58 Source #
Exports an extended public key to the BIP32 key export format (Base58
).
xPubFromJSON :: Network -> Value -> Parser XPubKey Source #
Decode an extended public key from a JSON string
xPrvExport :: Network -> XPrvKey -> Base58 Source #
Exports an extended private key to the BIP32 key export format (Base58
).
xPrvFromJSON :: Network -> Value -> Parser XPrvKey Source #
Decode an extended private key from a JSON string
xPubImport :: Network -> Base58 -> Maybe XPubKey Source #
Decodes a BIP32 encoded extended public key. This function will fail if invalid base 58 characters are detected or if the checksum fails.
xPrvImport :: Network -> Base58 -> Maybe XPrvKey Source #
Decodes a BIP32 encoded extended private key. This function will fail if invalid base 58 characters are detected or if the checksum fails.
xPrvWif :: Network -> XPrvKey -> Base58 Source #
Export an extended private key to WIF (Wallet Import Format).
Helper Functions
prvSubKeys :: XPrvKey -> KeyIndex -> [(XPrvKey, KeyIndex)] Source #
Cyclic list of all private soft child key derivations of a parent key starting from an offset index.
pubSubKeys :: XPubKey -> KeyIndex -> [(XPubKey, KeyIndex)] Source #
Cyclic list of all public soft child key derivations of a parent key starting from an offset index.
hardSubKeys :: XPrvKey -> KeyIndex -> [(XPrvKey, KeyIndex)] Source #
Cyclic list of all hard child key derivations of a parent key starting from an offset index.
deriveAddr :: XPubKey -> KeyIndex -> (Address, PubKey) Source #
Derive an address from a public key and an index. The derivation type is a public, soft derivation.
deriveAddrs :: XPubKey -> KeyIndex -> [(Address, PubKey, KeyIndex)] Source #
Cyclic list of all addresses derived from a public key starting from an offset index. The derivation types are public, soft derivations.
deriveMSAddr :: [XPubKey] -> Int -> KeyIndex -> (Address, RedeemScript) Source #
Derive a multisig address from a list of public keys, the number of required signatures m and a derivation index. The derivation type is a public, soft derivation.
deriveMSAddrs :: [XPubKey] -> Int -> KeyIndex -> [(Address, RedeemScript, KeyIndex)] Source #
Cyclic list of all multisig addresses derived from a list of public keys, a number of required signatures m and starting from an offset index. The derivation type is a public, soft derivation.
cycleIndex :: KeyIndex -> [KeyIndex] Source #
Helper function to go through derivation indices.
Derivation Paths
data DerivPathI t where Source #
Data type representing a derivation path. Two constructors are provided
for specifying soft or hard derivations. The path /0/1'/2 for example can be
expressed as
. The Deriv
:/ 0 :| 1 :/ 2HardOrAny
and AnyOrSoft
type
classes are used to constrain the valid values for the phantom type t. If
you mix hard '(:|)' and soft '(:/)' paths, the only valid type for t is AnyDeriv
.
Otherwise, t can be HardDeriv
if you only have hard derivation or SoftDeriv
if you only have soft derivations.
Using this type is as easy as writing the required derivation like in these example:
Deriv :/ 0 :/ 1 :/ 2 :: SoftPath Deriv :| 0 :| 1 :| 2 :: HardPath Deriv :| 0 :/ 1 :/ 2 :: DerivPath
(:|) :: HardOrAny t => !(DerivPathI t) -> !KeyIndex -> DerivPathI t | |
(:/) :: AnyOrSoft t => !(DerivPathI t) -> !KeyIndex -> DerivPathI t | |
Deriv :: DerivPathI t |
Instances
Read SoftPath Source # | |
Read DerivPath Source # | |
Read HardPath Source # | |
Show SoftPath Source # | |
Show DerivPath Source # | |
Show HardPath Source # | |
IsString SoftPath Source # | |
Defined in Network.Haskoin.Keys.Extended fromString :: String -> SoftPath # | |
IsString DerivPath Source # | |
Defined in Network.Haskoin.Keys.Extended fromString :: String -> DerivPath # | |
IsString HardPath Source # | |
Defined in Network.Haskoin.Keys.Extended fromString :: String -> HardPath # | |
FromJSON SoftPath Source # | |
FromJSON DerivPath Source # | |
FromJSON HardPath Source # | |
Serialize DerivPath Source # | |
Eq (DerivPathI t) Source # | |
Defined in Network.Haskoin.Keys.Extended (==) :: DerivPathI t -> DerivPathI t -> Bool # (/=) :: DerivPathI t -> DerivPathI t -> Bool # | |
ToJSON (DerivPathI t) Source # | |
Defined in Network.Haskoin.Keys.Extended toJSON :: DerivPathI t -> Value # toEncoding :: DerivPathI t -> Encoding # toJSONList :: [DerivPathI t] -> Value # toEncodingList :: [DerivPathI t] -> Encoding # |
Phantom type signaling no knowledge about derivation path: can be hardened or not.
Instances
Read DerivPath Source # | |
Show DerivPath Source # | |
IsString DerivPath Source # | |
Defined in Network.Haskoin.Keys.Extended fromString :: String -> DerivPath # | |
FromJSON DerivPath Source # | |
Serialize DerivPath Source # | |
AnyOrSoft AnyDeriv Source # | |
Defined in Network.Haskoin.Keys.Extended | |
HardOrAny AnyDeriv Source # | |
Defined in Network.Haskoin.Keys.Extended |
Phantom type signaling a hardened derivation path that can only be computed from private extended key.
Phantom type signaling derivation path including only non-hardened paths that can be computed from an extended public key.
Helper class to perform validations on a hardened derivation path.
Instances
HardOrAny AnyDeriv Source # | |
Defined in Network.Haskoin.Keys.Extended | |
HardOrAny HardDeriv Source # | |
Defined in Network.Haskoin.Keys.Extended |
Helper class to perform validations on a non-hardened derivation path.
Instances
AnyOrSoft SoftDeriv Source # | |
Defined in Network.Haskoin.Keys.Extended | |
AnyOrSoft AnyDeriv Source # | |
Defined in Network.Haskoin.Keys.Extended |
type DerivPath = DerivPathI AnyDeriv Source #
Any derivation path.
type HardPath = DerivPathI HardDeriv Source #
Hardened derivation path. Can be computed from extended private key only.
type SoftPath = DerivPathI SoftDeriv Source #
Non-hardened derivation path can be computed from extended public key.
data Bip32PathIndex Source #
Type for BIP32 path index element.
Instances
Eq Bip32PathIndex Source # | |
Defined in Network.Haskoin.Keys.Extended (==) :: Bip32PathIndex -> Bip32PathIndex -> Bool # (/=) :: Bip32PathIndex -> Bip32PathIndex -> Bool # | |
Read Bip32PathIndex Source # | |
Defined in Network.Haskoin.Keys.Extended readsPrec :: Int -> ReadS Bip32PathIndex # readList :: ReadS [Bip32PathIndex] # | |
Show Bip32PathIndex Source # | |
Defined in Network.Haskoin.Keys.Extended showsPrec :: Int -> Bip32PathIndex -> ShowS # show :: Bip32PathIndex -> String # showList :: [Bip32PathIndex] -> ShowS # |
derivePath :: DerivPathI t -> XPrvKey -> XPrvKey Source #
Derive a private key from a derivation path
derivePubPath :: SoftPath -> XPubKey -> XPubKey Source #
Derive a public key from a soft derivation path
toHard :: DerivPathI t -> Maybe HardPath Source #
Turn a derivation path into a hard derivation path. Will fail if the path contains soft derivations.
toSoft :: DerivPathI t -> Maybe SoftPath Source #
Turn a derivatino path into a soft derivation path. Will fail if the path has hard derivations.
toGeneric :: DerivPathI t -> DerivPath Source #
Make a derivation path generic.
(++/) :: DerivPathI t1 -> DerivPathI t2 -> DerivPath Source #
Append two derivation paths together. The result will be a mixed derivation path.
pathToStr :: DerivPathI t -> String Source #
Convert a derivation path to a human-readable string.
listToPath :: [KeyIndex] -> DerivPath Source #
Convert a list of derivation indices to a derivation path.
pathToList :: DerivPathI t -> [KeyIndex] Source #
Get a list of derivation indices from a derivation path.
Derivation Path Parser
Data type representing a private or public key with its respective network.
XPrv | |
| |
XPub | |
|
data ParsedPath Source #
Type for parsing derivation paths of the form m/1/2'/3 or M/1/2'/3.
Instances
parsePath :: String -> Maybe ParsedPath Source #
Parse derivation path string for extended key. Forms: m/0'/2, M/2/3/4.
applyPath :: ParsedPath -> XKey -> Either String XKey Source #
Apply a parsed path to an extended key to derive the new key defined in the path. If the path starts with m, a private key will be returned and if the path starts with M, a public key will be returned. Private derivations on a public key, and public derivations with a hard segment, return an error value.
derivePathAddr :: XPubKey -> SoftPath -> KeyIndex -> (Address, PubKey) Source #
Derive an address from a given parent path.
derivePathAddrs :: XPubKey -> SoftPath -> KeyIndex -> [(Address, PubKey, KeyIndex)] Source #
Cyclic list of all addresses derived from a given parent path and starting from the given offset index.
derivePathMSAddr :: [XPubKey] -> SoftPath -> Int -> KeyIndex -> (Address, RedeemScript) Source #
Derive a multisig address from a given parent path. The number of required signatures (m in m of n) is also needed.
derivePathMSAddrs :: [XPubKey] -> SoftPath -> Int -> KeyIndex -> [(Address, RedeemScript, KeyIndex)] Source #
Cyclic list of all multisig addresses derived from a given parent path and starting from the given offset index. The number of required signatures (m in m of n) is also needed.
concatBip32Segments :: [Bip32PathIndex] -> DerivPath Source #
Concatenate derivation path indices into a derivation path.
Public & Private Keys
Elliptic curve public key type with expected serialized compression flag.
PubKeyI | |
|
Instances
Eq PubKeyI Source # | |
Read PubKeyI Source # | |
Show PubKeyI Source # | |
IsString PubKeyI Source # | |
Defined in Network.Haskoin.Keys.Common fromString :: String -> PubKeyI # | |
Generic PubKeyI Source # | |
Hashable PubKeyI Source # | |
Defined in Network.Haskoin.Keys.Common | |
ToJSON PubKeyI Source # | |
Defined in Network.Haskoin.Keys.Common | |
FromJSON PubKeyI Source # | |
Serialize PubKeyI Source # | |
type Rep PubKeyI Source # | |
Defined in Network.Haskoin.Keys.Common type Rep PubKeyI = D1 (MetaData "PubKeyI" "Network.Haskoin.Keys.Common" "haskoin-core-0.8.4-AWaCExKDMsg51o0OUGuqyW" False) (C1 (MetaCons "PubKeyI" PrefixI True) (S1 (MetaSel (Just "pubKeyPoint") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 PubKey) :*: S1 (MetaSel (Just "pubKeyCompressed") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Bool))) |
Elliptic curve private key type with expected public key compression information. Compression information is stored in private key WIF formats and needs to be preserved to generate the correct address from the corresponding public key.
SecKeyI | |
|
exportPubKey :: Bool -> PubKey -> ByteString #
Encode public key as DER. First argument True
for compressed output.
importPubKey :: ByteString -> Maybe PubKey #
Import DER-encoded public key.
wrapPubKey :: Bool -> PubKey -> PubKeyI Source #
Wrap a public key from secp256k1 library adding information about compression.
derivePubKeyI :: SecKeyI -> PubKeyI Source #
Derives a public key from a private key. This function will preserve compression flag.
wrapSecKey :: Bool -> SecKey -> SecKeyI Source #
Wrap private key with corresponding public key compression flag.
fromMiniKey :: ByteString -> Maybe SecKeyI Source #
Decode Casascius mini private keys (22 or 30 characters).
getSecKey :: SecKey -> ByteString #
Get 32-byte secret key.
secKey :: ByteString -> Maybe SecKey #
Import 32-byte ByteString
as SecKey
.