| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Ledger.Keys
Synopsis
- newtype VKey (kd ∷ KeyRole) = VKey {}
- data KeyRole
- class HasKeyRole (a ∷ KeyRole → Type) where
- coerceKeyRole ∷ ∀ (r ∷ KeyRole) (r' ∷ KeyRole). a r → a r'
- asWitness ∷ ∀ a (r ∷ KeyRole). HasKeyRole a ⇒ a r → a 'Witness
- newtype KeyHash (r ∷ KeyRole) = KeyHash {}
- hashKey ∷ ∀ (kd ∷ KeyRole). VKey kd → KeyHash kd
- type DSIGN = Ed25519DSIGN
- type DSignable = Signable DSIGN
- signedDSIGN ∷ Signable DSIGN a ⇒ SignKeyDSIGN DSIGN → a → SignedDSIGN DSIGN a
- verifySignedDSIGN ∷ ∀ a (kd ∷ KeyRole). Signable DSIGN a ⇒ VKey kd → a → SignedDSIGN DSIGN a → Bool
- data KeyRoleVRF
- newtype VRFVerKeyHash (r ∷ KeyRoleVRF) = VRFVerKeyHash {}
- toVRFVerKeyHash ∷ ∀ v (r ∷ KeyRoleVRF). Hash HASH (VerKeyVRF v) → VRFVerKeyHash r
- fromVRFVerKeyHash ∷ ∀ (r ∷ KeyRoleVRF) v. VRFVerKeyHash r → Hash HASH (VerKeyVRF v)
- data GenDelegPair = GenDelegPair {}
- newtype GenDelegs = GenDelegs {}
- module Cardano.Ledger.Keys.WitVKey
- module Cardano.Ledger.Keys.Bootstrap
- decodeSignedDSIGN ∷ DSIGNAlgorithm v ⇒ Decoder s (SignedDSIGN v a)
- encodeSignedDSIGN ∷ DSIGNAlgorithm v ⇒ SignedDSIGN v a → Encoding
- hashWithSerialiser ∷ HashAlgorithm h ⇒ (a → Encoding) → a → Hash h a
VKey
newtype VKey (kd ∷ KeyRole) Source #
Discriminated verification key
We wrap the basic VerKeyDSIGN in order to add the key role.
Constructors
| VKey | |
Fields | |
Instances
Key Roles
The role of a key.
All key roles are fixed and unique, except for the Witness role. In particular,
keys can be cast to a Witness role with the help of asWitness, because same witness
can be valid for many roles.
In fact, it is perfectly allowable for a key to be used in many roles by the end user; there is nothing prohibiting somebody using the same underlying key or a script as their payment and staking credential, as well as the key for their stake pool. However, in the ledger code mixing up keys with different roles could be catastrophic, that is why we have this separation.
class HasKeyRole (a ∷ KeyRole → Type) where Source #
Minimal complete definition
Nothing
Methods
coerceKeyRole ∷ ∀ (r ∷ KeyRole) (r' ∷ KeyRole). a r → a r' Source #
General coercion of key roles.
The presence of this function is mostly to help the user realise where they are converting key roles.
Instances
| HasKeyRole Credential Source # | |
Defined in Cardano.Ledger.Credential Methods coerceKeyRole ∷ ∀ (r ∷ KeyRole) (r' ∷ KeyRole). Credential r → Credential r' Source # | |
| HasKeyRole KeyHash Source # | |
Defined in Cardano.Ledger.Hashes | |
| HasKeyRole VKey Source # | |
Defined in Cardano.Ledger.Keys.Internal | |
asWitness ∷ ∀ a (r ∷ KeyRole). HasKeyRole a ⇒ a r → a 'Witness Source #
Use a key as a witness.
This is the most common coercion between key roles, because most keys can be used as witnesses to some types of transaction. As such, we provide an explicit coercion for it.
Key Hashes
newtype KeyHash (r ∷ KeyRole) Source #
Discriminated hash of public Key
Instances
| HasKeyRole KeyHash Source # | |
Defined in Cardano.Ledger.Hashes | |
| FromJSON (KeyHash r) Source # | |
| FromJSONKey (KeyHash r) Source # | |
Defined in Cardano.Ledger.Hashes Methods | |
| ToJSON (KeyHash r) Source # | |
| ToJSONKey (KeyHash r) Source # | |
Defined in Cardano.Ledger.Hashes Methods toJSONKey ∷ ToJSONKeyFunction (KeyHash r) Source # | |
| Typeable r ⇒ FromCBOR (KeyHash r) Source # | |
| Typeable r ⇒ ToCBOR (KeyHash r) Source # | |
| Typeable r ⇒ DecCBOR (KeyHash r) Source # | |
| EncCBOR (KeyHash r) Source # | |
| Default (KeyHash r) Source # | |
Defined in Cardano.Ledger.Hashes | |
| NFData (KeyHash r) Source # | |
Defined in Cardano.Ledger.Hashes | |
| Generic (KeyHash r) Source # | |
| Show (KeyHash r) Source # | |
| Eq (KeyHash r) Source # | |
| Ord (KeyHash r) Source # | |
Defined in Cardano.Ledger.Hashes | |
| MemPack (KeyHash r) Source # | |
| NoThunks (KeyHash r) Source # | |
| type Rep (KeyHash r) Source # | |
Defined in Cardano.Ledger.Hashes | |
Signature
type DSIGN = Ed25519DSIGN Source #
Cryptographic signing algorithm used on Cardano blockchain.
signedDSIGN ∷ Signable DSIGN a ⇒ SignKeyDSIGN DSIGN → a → SignedDSIGN DSIGN a Source #
Produce a digital signature
verifySignedDSIGN ∷ ∀ a (kd ∷ KeyRole). Signable DSIGN a ⇒ VKey kd → a → SignedDSIGN DSIGN a → Bool Source #
Verify a digital signature
VRF Key Hashes
data KeyRoleVRF Source #
Constructors
| StakePoolVRF | |
| GenDelegVRF | |
| BlockIssuerVRF |
newtype VRFVerKeyHash (r ∷ KeyRoleVRF) Source #
Discriminated hash of VRF Verification Key
Constructors
| VRFVerKeyHash | |
Fields | |
Instances
| FromJSON (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes Methods parseJSON ∷ Value → Parser (VRFVerKeyHash r) Source # parseJSONList ∷ Value → Parser [VRFVerKeyHash r] Source # omittedField ∷ Maybe (VRFVerKeyHash r) Source # | |||||
| FromJSONKey (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes Methods fromJSONKey ∷ FromJSONKeyFunction (VRFVerKeyHash r) Source # fromJSONKeyList ∷ FromJSONKeyFunction [VRFVerKeyHash r] Source # | |||||
| ToJSON (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes Methods toJSON ∷ VRFVerKeyHash r → Value Source # toEncoding ∷ VRFVerKeyHash r → Encoding Source # toJSONList ∷ [VRFVerKeyHash r] → Value Source # toEncodingList ∷ [VRFVerKeyHash r] → Encoding Source # omitField ∷ VRFVerKeyHash r → Bool Source # | |||||
| ToJSONKey (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes Methods toJSONKey ∷ ToJSONKeyFunction (VRFVerKeyHash r) Source # toJSONKeyList ∷ ToJSONKeyFunction [VRFVerKeyHash r] Source # | |||||
| Typeable r ⇒ FromCBOR (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes | |||||
| Typeable r ⇒ ToCBOR (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes Methods toCBOR ∷ VRFVerKeyHash r → Encoding Source # encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (VRFVerKeyHash r) → Size Source # encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [VRFVerKeyHash r] → Size Source # | |||||
| Typeable r ⇒ DecCBOR (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes | |||||
| EncCBOR (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes Methods encCBOR ∷ VRFVerKeyHash r → Encoding Source # | |||||
| Default (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes Methods def ∷ VRFVerKeyHash r Source # | |||||
| NFData (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes Methods rnf ∷ VRFVerKeyHash r → () # | |||||
| Generic (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes Associated Types
Methods from ∷ VRFVerKeyHash r → Rep (VRFVerKeyHash r) x # to ∷ Rep (VRFVerKeyHash r) x → VRFVerKeyHash r # | |||||
| Show (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes Methods showsPrec ∷ Int → VRFVerKeyHash r → ShowS # show ∷ VRFVerKeyHash r → String # showList ∷ [VRFVerKeyHash r] → ShowS # | |||||
| Eq (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes Methods (==) ∷ VRFVerKeyHash r → VRFVerKeyHash r → Bool # (/=) ∷ VRFVerKeyHash r → VRFVerKeyHash r → Bool # | |||||
| Ord (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes Methods compare ∷ VRFVerKeyHash r → VRFVerKeyHash r → Ordering # (<) ∷ VRFVerKeyHash r → VRFVerKeyHash r → Bool # (<=) ∷ VRFVerKeyHash r → VRFVerKeyHash r → Bool # (>) ∷ VRFVerKeyHash r → VRFVerKeyHash r → Bool # (>=) ∷ VRFVerKeyHash r → VRFVerKeyHash r → Bool # max ∷ VRFVerKeyHash r → VRFVerKeyHash r → VRFVerKeyHash r # min ∷ VRFVerKeyHash r → VRFVerKeyHash r → VRFVerKeyHash r # | |||||
| NoThunks (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes | |||||
| type Rep (VRFVerKeyHash r) Source # | |||||
Defined in Cardano.Ledger.Hashes | |||||
toVRFVerKeyHash ∷ ∀ v (r ∷ KeyRoleVRF). Hash HASH (VerKeyVRF v) → VRFVerKeyHash r Source #
fromVRFVerKeyHash ∷ ∀ (r ∷ KeyRoleVRF) v. VRFVerKeyHash r → Hash HASH (VerKeyVRF v) Source #
Genesis delegations
data GenDelegPair Source #
Constructors
| GenDelegPair | |
Fields | |
Instances
| FromJSON GenDelegPair Source # | |||||
Defined in Cardano.Ledger.Hashes Methods parseJSON ∷ Value → Parser GenDelegPair Source # parseJSONList ∷ Value → Parser [GenDelegPair] Source # | |||||
| ToJSON GenDelegPair Source # | |||||
Defined in Cardano.Ledger.Hashes Methods toJSON ∷ GenDelegPair → Value Source # toEncoding ∷ GenDelegPair → Encoding Source # toJSONList ∷ [GenDelegPair] → Value Source # toEncodingList ∷ [GenDelegPair] → Encoding Source # omitField ∷ GenDelegPair → Bool Source # | |||||
| DecCBOR GenDelegPair Source # | |||||
Defined in Cardano.Ledger.Hashes | |||||
| EncCBOR GenDelegPair Source # | |||||
Defined in Cardano.Ledger.Hashes Methods | |||||
| NFData GenDelegPair Source # | |||||
Defined in Cardano.Ledger.Hashes Methods rnf ∷ GenDelegPair → () # | |||||
| Generic GenDelegPair Source # | |||||
Defined in Cardano.Ledger.Hashes Associated Types
| |||||
| Show GenDelegPair Source # | |||||
Defined in Cardano.Ledger.Hashes Methods showsPrec ∷ Int → GenDelegPair → ShowS # show ∷ GenDelegPair → String # showList ∷ [GenDelegPair] → ShowS # | |||||
| Eq GenDelegPair Source # | |||||
Defined in Cardano.Ledger.Hashes | |||||
| Ord GenDelegPair Source # | |||||
Defined in Cardano.Ledger.Hashes Methods compare ∷ GenDelegPair → GenDelegPair → Ordering # (<) ∷ GenDelegPair → GenDelegPair → Bool # (<=) ∷ GenDelegPair → GenDelegPair → Bool # (>) ∷ GenDelegPair → GenDelegPair → Bool # (>=) ∷ GenDelegPair → GenDelegPair → Bool # max ∷ GenDelegPair → GenDelegPair → GenDelegPair # min ∷ GenDelegPair → GenDelegPair → GenDelegPair # | |||||
| NoThunks GenDelegPair Source # | |||||
Defined in Cardano.Ledger.Hashes | |||||
| type Rep GenDelegPair Source # | |||||
Defined in Cardano.Ledger.Hashes type Rep GenDelegPair = D1 ('MetaData "GenDelegPair" "Cardano.Ledger.Hashes" "cardano-ledger-core-1.19.0.0-inplace" 'False) (C1 ('MetaCons "GenDelegPair" 'PrefixI 'True) (S1 ('MetaSel ('Just "genDelegKeyHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (KeyHash 'GenesisDelegate)) :*: S1 ('MetaSel ('Just "genDelegVrfHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (VRFVerKeyHash 'GenDelegVRF)))) | |||||
Constructors
| GenDelegs | |
Fields | |
Instances
| FromJSON GenDelegs Source # | |||||
| ToJSON GenDelegs Source # | |||||
| DecCBOR GenDelegs Source # | |||||
| EncCBOR GenDelegs Source # | |||||
| NFData GenDelegs Source # | |||||
Defined in Cardano.Ledger.Hashes | |||||
| Generic GenDelegs Source # | |||||
Defined in Cardano.Ledger.Hashes Associated Types
| |||||
| Show GenDelegs Source # | |||||
| Eq GenDelegs Source # | |||||
| NoThunks GenDelegs Source # | |||||
| type Rep GenDelegs Source # | |||||
Defined in Cardano.Ledger.Hashes type Rep GenDelegs = D1 ('MetaData "GenDelegs" "Cardano.Ledger.Hashes" "cardano-ledger-core-1.19.0.0-inplace" 'True) (C1 ('MetaCons "GenDelegs" 'PrefixI 'True) (S1 ('MetaSel ('Just "unGenDelegs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (KeyHash 'GenesisRole) GenDelegPair)))) | |||||
module Cardano.Ledger.Keys.WitVKey
To be removed
Re-exports from cardano-crypto-class
decodeSignedDSIGN ∷ DSIGNAlgorithm v ⇒ Decoder s (SignedDSIGN v a) Source #
encodeSignedDSIGN ∷ DSIGNAlgorithm v ⇒ SignedDSIGN v a → Encoding Source #
hashWithSerialiser ∷ HashAlgorithm h ⇒ (a → Encoding) → a → Hash h a Source #
A variation on hashWith, but specially for CBOR encodings.