cardano-ledger-core-1.14.0.0: Core components of Cardano ledgers from the Shelley release on.
Safe HaskellNone
LanguageHaskell2010

Cardano.Ledger.Keys.Internal

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.14.0.0-inplace" 'True) (C1 ('MetaCons "VKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unVKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (VerKeyDSIGN (DSIGN c)))))

data KeyPair (kd ∷ KeyRole) c Source #

Deprecated: Use `Test.Cardano.Ledger.Core.KeyPair (KeyPair)` instead

Constructors

KeyPair

Deprecated: Use `Test.Cardano.Ledger.Core.KeyPair (KeyPair)` instead

Fields

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 (discriminator ∷ 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 disc c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

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

Defined in Cardano.Ledger.Keys.Internal

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

Defined in Cardano.Ledger.Keys.Internal

Methods

toJSONKeyHash disc c → Value Source #

toEncodingKeyHash disc c → Encoding Source #

toJSONList ∷ [KeyHash disc c] → Value Source #

toEncodingList ∷ [KeyHash disc c] → Encoding Source #

omitFieldKeyHash disc c → Bool Source #

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

Defined in Cardano.Ledger.Keys.Internal

Generic (KeyHash discriminator c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Associated Types

type Rep (KeyHash discriminator c) ∷ TypeType Source #

Methods

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

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

Show (KeyHash discriminator c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

showsPrecIntKeyHash discriminator c → ShowS Source #

showKeyHash discriminator c → String Source #

showList ∷ [KeyHash discriminator c] → ShowS Source #

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

Defined in Cardano.Ledger.Keys.Internal

Methods

fromCBORDecoder s (KeyHash disc c) Source #

labelProxy (KeyHash disc c) → Text Source #

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

Defined in Cardano.Ledger.Keys.Internal

Methods

toCBORKeyHash disc c → Encoding Source #

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

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

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

Defined in Cardano.Ledger.Keys.Internal

Methods

decCBORDecoder s (KeyHash disc c) Source #

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

labelProxy (KeyHash disc c) → Text Source #

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

Defined in Cardano.Ledger.Keys.Internal

Methods

encCBORKeyHash disc c → Encoding Source #

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

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

Crypto b ⇒ Default (KeyHash a b) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

defKeyHash a b Source #

NFData (KeyHash discriminator c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

rnfKeyHash discriminator c → () Source #

Eq (KeyHash discriminator c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

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

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

Ord (KeyHash discriminator c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

compareKeyHash discriminator c → KeyHash discriminator c → Ordering Source #

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

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

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

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

maxKeyHash discriminator c → KeyHash discriminator c → KeyHash discriminator c Source #

minKeyHash discriminator c → KeyHash discriminator c → KeyHash discriminator c Source #

NoThunks (KeyHash discriminator c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

noThunksContextKeyHash discriminator c → IO (Maybe ThunkInfo) Source #

wNoThunksContextKeyHash discriminator c → IO (Maybe ThunkInfo) Source #

showTypeOfProxy (KeyHash discriminator c) → String Source #

type Rep (KeyHash discriminator c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

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

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

Hash a given public key

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.14.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 (Hash c (VerKeyVRF 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.14.0.0-inplace" 'True) (C1 ('MetaCons "GenDelegs" 'PrefixI 'True) (S1 ('MetaSel ('Just "unGenDelegs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (KeyHash 'Genesis c) (GenDelegPair c)))))

newtype GKeys c Source #

Constructors

GKeys 

Fields

Instances

Instances details
Generic (GKeys c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Associated Types

type Rep (GKeys c) ∷ TypeType Source #

Methods

fromGKeys c → Rep (GKeys c) x Source #

toRep (GKeys c) x → GKeys c Source #

Crypto c ⇒ Show (GKeys c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

showsPrecIntGKeys c → ShowS Source #

showGKeys c → String Source #

showList ∷ [GKeys c] → ShowS Source #

Crypto c ⇒ Eq (GKeys c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

Methods

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

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

Crypto c ⇒ NoThunks (GKeys c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

type Rep (GKeys c) Source # 
Instance details

Defined in Cardano.Ledger.Keys.Internal

type Rep (GKeys c) = D1 ('MetaData "GKeys" "Cardano.Ledger.Keys.Internal" "cardano-ledger-core-1.14.0.0-inplace" 'True) (C1 ('MetaCons "GKeys" 'PrefixI 'True) (S1 ('MetaSel ('Just "unGKeys") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set (VKey 'Genesis 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 #