haskoin-core-1.1.0: Bitcoin & Bitcoin Cash library for Haskell
CopyrightNo rights reserved
LicenseMIT
Maintainerjprupp@protonmail.ch
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe-Inferred
LanguageHaskell2010

Haskoin.Crypto.Keys.Common

Description

ECDSA private and public key functions.

Synopsis

Bitcoin Public & Private Keys

data PublicKey Source #

Elliptic curve public key type with expected serialized compression flag.

Constructors

PublicKey 

Fields

Instances

Instances details
Generic PublicKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

Associated Types

type Rep PublicKey :: Type -> Type #

Read PublicKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

Show PublicKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

NFData PublicKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

Methods

rnf :: PublicKey -> () #

Eq PublicKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

Hashable PublicKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

Marshal Ctx PublicKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

MarshalJSON Ctx PublicKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

type Rep PublicKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

type Rep PublicKey = D1 ('MetaData "PublicKey" "Haskoin.Crypto.Keys.Common" "haskoin-core-1.1.0-EPeWWz60EKPlWai44F9WC" 'False) (C1 ('MetaCons "PublicKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "point") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PubKey) :*: S1 ('MetaSel ('Just "compress") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)))

data PrivateKey Source #

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.

Constructors

PrivateKey 

Fields

Instances

Instances details
Generic PrivateKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

Associated Types

type Rep PrivateKey :: Type -> Type #

Read PrivateKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

Show PrivateKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

Serial PrivateKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

Methods

serialize :: MonadPut m => PrivateKey -> m () #

deserialize :: MonadGet m => m PrivateKey #

NFData PrivateKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

Methods

rnf :: PrivateKey -> () #

Eq PrivateKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

MarshalJSON Network PrivateKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

type Rep PrivateKey Source # 
Instance details

Defined in Haskoin.Crypto.Keys.Common

type Rep PrivateKey = D1 ('MetaData "PrivateKey" "Haskoin.Crypto.Keys.Common" "haskoin-core-1.1.0-EPeWWz60EKPlWai44F9WC" 'False) (C1 ('MetaCons "PrivateKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "key") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SecKey) :*: S1 ('MetaSel ('Just "compress") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Bool)))

wrapPubKey :: Bool -> PubKey -> PublicKey Source #

Wrap a public key from secp256k1 library adding information about compression.

derivePublicKey :: Ctx -> PrivateKey -> PublicKey Source #

Derives a public key from a private key. This function will preserve compression flag.

wrapSecKey :: Bool -> SecKey -> PrivateKey Source #

Wrap private key with corresponding public key compression flag.

fromMiniKey :: ByteString -> Maybe PrivateKey Source #

Decode Casascius mini private keys (22 or 30 characters).

tweakPubKey :: Ctx -> PubKey -> Hash256 -> Maybe PubKey Source #

Tweak a public key.

tweakSecKey :: Ctx -> SecKey -> Hash256 -> Maybe SecKey Source #

Tweak a private key.

Private Key Wallet Import Format (WIF)

fromWif :: Network -> Base58 -> Maybe PrivateKey Source #

Decode private key from WIF (wallet import format) string.

toWif :: Network -> PrivateKey -> Base58 Source #

Encode private key into a WIF string.