cardano-ledger-core-1.16.0.0: Core components of Cardano ledgers from the Shelley release on.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Ledger.Keys

Synopsis

Documentation

data KeyRole Source #

The role of a key.

Note that a role is not _fixed_, nor is it unique. In particular, keys may variously be used as witnesses, and so in many case we will change the role of a key to the Witness role.

It is also perfectly allowable for a key to be used in many roles; there is nothing prohibiting somebody using the same underlying key as their payment and staking key, as well as the key for their stake pool. So these roles are more intended for two purposes:

  • To make explicit how we are using a key in the specifications
  • To provide a guide to downstream implementors, for whom the profusion of keys may be confusing.

Instances

Instances details
Show KeyRole Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

class HasKeyRole (a ∷ KeyRoleTypeType) where Source #

Minimal complete definition

Nothing

Methods

coerceKeyRole ∷ a r c → a r' c Source #

General coercion of key roles.

The presence of this function is mostly to help the user realise where they are converting key roles.

default coerceKeyRoleCoercible (a r c) (a r' c) ⇒ a r c → a r' c Source #

Instances

Instances details
HasKeyRole Credential Source # 
Instance details

Defined in Cardano.Ledger.Credential

Methods

coerceKeyRole ∷ ∀ (r ∷ KeyRole) c (r' ∷ KeyRole). Credential r c → Credential r' c Source #

HasKeyRole KeyHash Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

coerceKeyRole ∷ ∀ (r ∷ KeyRole) c (r' ∷ KeyRole). KeyHash r c → KeyHash r' c Source #

HasKeyRole VKey Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

coerceKeyRole ∷ ∀ (r ∷ KeyRole) c (r' ∷ KeyRole). VKey r c → VKey r' c Source #

asWitnessHasKeyRole a ⇒ a r c → a 'Witness c 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.

DSIGN

newtype VKey (kd ∷ KeyRole) c Source #

Discriminated verification key

We wrap the basic VerKeyDSIGN in order to add the key role.

Constructors

VKey 

Fields

Instances

Instances details
HasKeyRole VKey Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

coerceKeyRole ∷ ∀ (r ∷ KeyRole) c (r' ∷ KeyRole). VKey r c → VKey r' c Source #

Generic (VKey kd c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Associated Types

type Rep (VKey kd c) ∷ TypeType Source #

Methods

fromVKey kd c → Rep (VKey kd c) x Source #

toRep (VKey kd c) x → VKey kd c Source #

Crypto c ⇒ Show (VKey kd c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

showsPrecIntVKey kd c → ShowS Source #

showVKey kd c → String Source #

showList ∷ [VKey kd c] → ShowS Source #

(Crypto c, Typeable kd) ⇒ FromCBOR (VKey kd c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

fromCBORDecoder s (VKey kd c) Source #

labelProxy (VKey kd c) → Text Source #

(Crypto c, Typeable kd) ⇒ ToCBOR (VKey kd c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

toCBORVKey kd c → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (VKey kd c) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [VKey kd c] → Size Source #

(Crypto c, Typeable kd) ⇒ DecCBOR (VKey kd c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

decCBORDecoder s (VKey kd c) Source #

dropCBORProxy (VKey kd c) → Decoder s () Source #

labelProxy (VKey kd c) → Text Source #

(Crypto c, Typeable kd) ⇒ EncCBOR (VKey kd c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

encCBORVKey kd c → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (VKey kd c) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [VKey kd c] → Size Source #

(Crypto c, NFData (VerKeyDSIGN (DSIGN c))) ⇒ NFData (VKey kd c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

rnfVKey kd c → () Source #

Crypto c ⇒ Eq (VKey kd c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

(==)VKey kd c → VKey kd c → Bool Source #

(/=)VKey kd c → VKey kd c → Bool Source #

Crypto c ⇒ NoThunks (VKey kd c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

noThunksContextVKey kd c → IO (Maybe ThunkInfo) Source #

wNoThunksContextVKey kd c → IO (Maybe ThunkInfo) Source #

showTypeOfProxy (VKey kd c) → String Source #

type Rep (VKey kd c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

type Rep (VKey kd c) = D1 ('MetaData "VKey" "Cardano.Ledger.Keys.Internal" "cardano-ledger-core-1.16.0.0-inplace" 'True) (C1 ('MetaCons "VKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unVKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (VerKeyDSIGN (DSIGN c)))))

signedDSIGN ∷ (Crypto c, Signable (DSIGN c) a) ⇒ SignKeyDSIGN (DSIGN c) → a → SignedDSIGN c a Source #

Produce a digital signature

verifySignedDSIGN ∷ (Crypto c, Signable (DSIGN c) a) ⇒ VKey kd c → a → SignedDSIGN c a → Bool Source #

Verify a digital signature

hashSignatureCrypto c ⇒ SignedDSIGN c (Hash c h) → Hash c (SignedDSIGN c (Hash c h)) Source #

Hash a given signature

Key hashes

newtype KeyHash (r ∷ KeyRole) c Source #

Discriminated hash of public Key

Constructors

KeyHash 

Fields

Instances

Instances details
HasKeyRole KeyHash Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

coerceKeyRole ∷ ∀ (r ∷ KeyRole) c (r' ∷ KeyRole). KeyHash r c → KeyHash r' c Source #

Crypto c ⇒ FromJSON (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Crypto c ⇒ FromJSONKey (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Crypto c ⇒ ToJSON (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Crypto c ⇒ ToJSONKey (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Generic (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Associated Types

type Rep (KeyHash r c) ∷ TypeType Source #

Methods

fromKeyHash r c → Rep (KeyHash r c) x Source #

toRep (KeyHash r c) x → KeyHash r c Source #

Show (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

showsPrecIntKeyHash r c → ShowS Source #

showKeyHash r c → String Source #

showList ∷ [KeyHash r c] → ShowS Source #

(Crypto c, Typeable r) ⇒ FromCBOR (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

fromCBORDecoder s (KeyHash r c) Source #

labelProxy (KeyHash r c) → Text Source #

(Crypto c, Typeable r) ⇒ ToCBOR (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

toCBORKeyHash r c → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (KeyHash r c) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [KeyHash r c] → Size Source #

(Crypto c, Typeable r) ⇒ DecCBOR (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

decCBORDecoder s (KeyHash r c) Source #

dropCBORProxy (KeyHash r c) → Decoder s () Source #

labelProxy (KeyHash r c) → Text Source #

(Crypto c, Typeable r) ⇒ EncCBOR (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

encCBORKeyHash r c → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (KeyHash r c) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [KeyHash r c] → Size Source #

Crypto c ⇒ Default (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

defKeyHash r c Source #

NFData (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

rnfKeyHash r c → () Source #

Eq (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

(==)KeyHash r c → KeyHash r c → Bool Source #

(/=)KeyHash r c → KeyHash r c → Bool Source #

Ord (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

compareKeyHash r c → KeyHash r c → Ordering Source #

(<)KeyHash r c → KeyHash r c → Bool Source #

(<=)KeyHash r c → KeyHash r c → Bool Source #

(>)KeyHash r c → KeyHash r c → Bool Source #

(>=)KeyHash r c → KeyHash r c → Bool Source #

maxKeyHash r c → KeyHash r c → KeyHash r c Source #

minKeyHash r c → KeyHash r c → KeyHash r c Source #

NoThunks (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

type Rep (KeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

type Rep (KeyHash r c) = Rep (Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c)))

hashKeyCrypto c ⇒ VKey kd c → KeyHash kd c Source #

Hash a given public key

VRF Key Hashes

newtype VRFVerKeyHash (r ∷ KeyRoleVRF) c Source #

Discriminated hash of VRF Verification Key

Constructors

VRFVerKeyHash 

Instances

Instances details
Crypto c ⇒ FromJSON (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Crypto c ⇒ FromJSONKey (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Crypto c ⇒ ToJSON (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Crypto c ⇒ ToJSONKey (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Generic (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Associated Types

type Rep (VRFVerKeyHash r c) ∷ TypeType Source #

Methods

fromVRFVerKeyHash r c → Rep (VRFVerKeyHash r c) x Source #

toRep (VRFVerKeyHash r c) x → VRFVerKeyHash r c Source #

Show (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

(Crypto c, Typeable r) ⇒ FromCBOR (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

(Crypto c, Typeable r) ⇒ ToCBOR (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

toCBORVRFVerKeyHash r c → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (VRFVerKeyHash r c) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [VRFVerKeyHash r c] → Size Source #

(Crypto c, Typeable r) ⇒ DecCBOR (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

(Crypto c, Typeable r) ⇒ EncCBOR (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

encCBORVRFVerKeyHash r c → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (VRFVerKeyHash r c) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [VRFVerKeyHash r c] → Size Source #

Crypto c ⇒ Default (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

defVRFVerKeyHash r c Source #

NFData (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

rnfVRFVerKeyHash r c → () Source #

Eq (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

(==)VRFVerKeyHash r c → VRFVerKeyHash r c → Bool Source #

(/=)VRFVerKeyHash r c → VRFVerKeyHash r c → Bool Source #

Ord (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

NoThunks (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

type Rep (VRFVerKeyHash r c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Genesis delegations

data GenDelegPair c Source #

Instances

Instances details
Crypto c ⇒ FromJSON (GenDelegPair c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Crypto c ⇒ ToJSON (GenDelegPair c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Generic (GenDelegPair c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Associated Types

type Rep (GenDelegPair c) ∷ TypeType Source #

Show (GenDelegPair c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Crypto c ⇒ DecCBOR (GenDelegPair c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Crypto c ⇒ EncCBOR (GenDelegPair c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

encCBORGenDelegPair c → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (GenDelegPair c) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [GenDelegPair c] → Size Source #

NFData (GenDelegPair c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

rnfGenDelegPair c → () Source #

Eq (GenDelegPair c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Ord (GenDelegPair c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

NoThunks (GenDelegPair c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

type Rep (GenDelegPair c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

type Rep (GenDelegPair c) = D1 ('MetaData "GenDelegPair" "Cardano.Ledger.Keys.Internal" "cardano-ledger-core-1.16.0.0-inplace" 'False) (C1 ('MetaCons "GenDelegPair" 'PrefixI 'True) (S1 ('MetaSel ('Just "genDelegKeyHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (KeyHash 'GenesisDelegate c)) :*: S1 ('MetaSel ('Just "genDelegVrfHash") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (VRFVerKeyHash 'GenDelegVRF c))))

newtype GenDelegs c Source #

Constructors

GenDelegs 

Instances

Instances details
Crypto c ⇒ FromJSON (GenDelegs c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Crypto c ⇒ ToJSON (GenDelegs c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Generic (GenDelegs c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Associated Types

type Rep (GenDelegs c) ∷ TypeType Source #

Methods

fromGenDelegs c → Rep (GenDelegs c) x Source #

toRep (GenDelegs c) x → GenDelegs c Source #

Show (GenDelegs c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Crypto c ⇒ DecCBOR (GenDelegs c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Crypto c ⇒ EncCBOR (GenDelegs c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

encCBORGenDelegs c → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (GenDelegs c) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [GenDelegs c] → Size Source #

NFData (GenDelegs c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

rnfGenDelegs c → () Source #

Eq (GenDelegs c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

(==)GenDelegs c → GenDelegs c → Bool Source #

(/=)GenDelegs c → GenDelegs c → Bool Source #

NoThunks (GenDelegs c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

type Rep (GenDelegs c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

type Rep (GenDelegs c) = D1 ('MetaData "GenDelegs" "Cardano.Ledger.Keys.Internal" "cardano-ledger-core-1.16.0.0-inplace" 'True) (C1 ('MetaCons "GenDelegs" 'PrefixI 'True) (S1 ('MetaSel ('Just "unGenDelegs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (KeyHash 'Genesis c) (GenDelegPair c)))))

KES

VRF

Re-exports from cardano-crypto-class

hashWithSerialiserHashAlgorithm h ⇒ (a → Encoding) → a → Hash h a Source #

A variation on hashWith, but specially for CBOR encodings.

signedKES ∷ (KESAlgorithm v, Signable v a) ⇒ ContextKES v → Period → a → SignKeyKES v → SignedKES v a Source #

updateKES Source #

Arguments

KESAlgorithm v 
ContextKES v 
SignKeyKES v 
Period

The current period for the key, not the target period.

Maybe (SignKeyKES v) 

Update the KES signature key to the next period, given the current period.

It returns Nothing if the cannot be evolved any further.

The precondition (to get a Just result) is that the current KES period of the input key is not the last period. The given period must be the current KES period of the input key (not the next or target).

The postcondition is that in case a key is returned, its current KES period is incremented by one compared to before.

Note that you must track the current period separately, and to skip to a later period requires repeated use of this function, since it only increments one period at once.

verifyKES Source #

Arguments

∷ (KESAlgorithm v, Signable v a, HasCallStack) 
ContextKES v 
VerKeyKES v 
Period

The current period for the key

→ a 
SigKES v 
Either String () 

Full KES verification. This method checks that the signature itself checks out (as per verifySigKES), and also makes sure that it matches the provided VerKey.

verifySignedKES ∷ (KESAlgorithm v, Signable v a) ⇒ ContextKES v → VerKeyKES v → Period → a → SignedKES v a → Either String () Source #

Re-parametrised types over crypto

type Hash c = Hash (HASH c) Source #