Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data KeyRole
- class HasKeyRole (a ∷ KeyRole → Type → Type) where
- coerceKeyRole ∷ a r c → a r' c
- asWitness ∷ HasKeyRole a ⇒ a r c → a 'Witness c
- type DSignable c = Signable (DSIGN c)
- newtype VKey (kd ∷ KeyRole) c = VKey {
- unVKey ∷ VerKeyDSIGN (DSIGN c)
- signedDSIGN ∷ (Crypto c, Signable (DSIGN c) a) ⇒ SignKeyDSIGN (DSIGN c) → a → SignedDSIGN c a
- verifySignedDSIGN ∷ (Crypto c, Signable (DSIGN c) a) ⇒ VKey kd c → a → SignedDSIGN c a → Bool
- hashSignature ∷ Crypto c ⇒ SignedDSIGN c (Hash c h) → Hash c (SignedDSIGN c (Hash c h))
- newtype KeyHash (r ∷ KeyRole) c = KeyHash {
- unKeyHash ∷ Hash (ADDRHASH c) (VerKeyDSIGN (DSIGN c))
- hashKey ∷ Crypto c ⇒ VKey kd c → KeyHash kd c
- data KeyRoleVRF
- newtype VRFVerKeyHash (r ∷ KeyRoleVRF) c = VRFVerKeyHash {
- unVRFVerKeyHash ∷ Hash (HASH c) KeyRoleVRF
- hashVerKeyVRF ∷ Crypto c ⇒ VerKeyVRF c → VRFVerKeyHash (r ∷ KeyRoleVRF) c
- data GenDelegPair c = GenDelegPair {
- genDelegKeyHash ∷ !(KeyHash 'GenesisDelegate c)
- genDelegVrfHash ∷ !(VRFVerKeyHash 'GenDelegVRF c)
- newtype GenDelegs c = GenDelegs {
- unGenDelegs ∷ Map (KeyHash 'Genesis c) (GenDelegPair c)
- type KESignable c = Signable (KES c)
- type VRFSignable c = Signable (VRF c)
- decodeSignedDSIGN ∷ DSIGNAlgorithm v ⇒ Decoder s (SignedDSIGN v a)
- encodeSignedDSIGN ∷ DSIGNAlgorithm v ⇒ SignedDSIGN v a → Encoding
- hashWithSerialiser ∷ HashAlgorithm h ⇒ (a → Encoding) → a → Hash h a
- decodeSignedKES ∷ KESAlgorithm v ⇒ Decoder s (SignedKES v a)
- decodeVerKeyKES ∷ KESAlgorithm v ⇒ Decoder s (VerKeyKES v)
- encodeSignedKES ∷ KESAlgorithm v ⇒ SignedKES v a → Encoding
- encodeVerKeyKES ∷ KESAlgorithm v ⇒ VerKeyKES v → Encoding
- signedKES ∷ (KESAlgorithm v, Signable v a) ⇒ ContextKES v → Period → a → SignKeyKES v → SignedKES v a
- updateKES ∷ KESAlgorithm v ⇒ ContextKES v → SignKeyKES v → Period → Maybe (SignKeyKES v)
- verifyKES ∷ (KESAlgorithm v, Signable v a, HasCallStack) ⇒ ContextKES v → VerKeyKES v → Period → a → SigKES v → Either String ()
- verifySignedKES ∷ (KESAlgorithm v, Signable v a) ⇒ ContextKES v → VerKeyKES v → Period → a → SignedKES v a → Either String ()
- decodeVerKeyVRF ∷ VRFAlgorithm v ⇒ Decoder s (VerKeyVRF v)
- encodeVerKeyVRF ∷ VRFAlgorithm v ⇒ VerKeyVRF v → Encoding
- verifyVRF ∷ (VRFAlgorithm v, HasCallStack, Signable v a) ⇒ ContextVRF v → VerKeyVRF v → a → CertVRF v → Maybe (OutputVRF v)
- type CertifiedVRF c = CertifiedVRF (VRF c)
- type Hash c = Hash (HASH c)
- type SignedDSIGN c = SignedDSIGN (DSIGN c)
- type SignKeyDSIGN c = SignKeyDSIGN (DSIGN c)
- type SignedKES c = SignedKES (KES c)
- type SignKeyKES c = SignKeyKES (KES c)
- type SignKeyVRF c = SignKeyVRF (VRF c)
- type VerKeyKES c = VerKeyKES (KES c)
- type VerKeyVRF c = VerKeyVRF (VRF c)
- module Cardano.Ledger.Keys.WitVKey
- module Cardano.Ledger.Keys.Bootstrap
Documentation
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.
class HasKeyRole (a ∷ KeyRole → Type → Type) where Source #
Nothing
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 coerceKeyRole ∷ Coercible (a r c) (a r' c) ⇒ a r c → a r' c Source #
Instances
HasKeyRole Credential Source # | |
Defined in Cardano.Ledger.Credential coerceKeyRole ∷ ∀ (r ∷ KeyRole) c (r' ∷ KeyRole). Credential r c → Credential r' c Source # | |
HasKeyRole KeyHash Source # | |
Defined in Cardano.Ledger.Keys.Internal | |
HasKeyRole VKey Source # | |
Defined in Cardano.Ledger.Keys.Internal |
asWitness ∷ HasKeyRole 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.
VKey | |
|
Instances
HasKeyRole VKey Source # | |
Defined in Cardano.Ledger.Keys.Internal | |
Generic (VKey kd c) Source # | |
Crypto c ⇒ Show (VKey kd c) Source # | |
(Crypto c, Typeable kd) ⇒ FromCBOR (VKey kd c) Source # | |
(Crypto c, Typeable kd) ⇒ ToCBOR (VKey kd c) Source # | |
(Crypto c, Typeable kd) ⇒ DecCBOR (VKey kd c) Source # | |
(Crypto c, Typeable kd) ⇒ EncCBOR (VKey kd c) Source # | |
(Crypto c, NFData (VerKeyDSIGN (DSIGN c))) ⇒ NFData (VKey kd c) Source # | |
Defined in Cardano.Ledger.Keys.Internal | |
Crypto c ⇒ Eq (VKey kd c) Source # | |
Crypto c ⇒ NoThunks (VKey kd c) Source # | |
type Rep (VKey kd c) Source # | |
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
hashSignature ∷ Crypto 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
Instances
VRF Key Hashes
newtype VRFVerKeyHash (r ∷ KeyRoleVRF) c Source #
Discriminated hash of VRF Verification Key
Instances
hashVerKeyVRF ∷ Crypto c ⇒ VerKeyVRF c → VRFVerKeyHash (r ∷ KeyRoleVRF) c Source #
Genesis delegations
data GenDelegPair c Source #
GenDelegPair | |
|
Instances
GenDelegs | |
|
Instances
Crypto c ⇒ FromJSON (GenDelegs c) Source # | |
Crypto c ⇒ ToJSON (GenDelegs c) Source # | |
Generic (GenDelegs c) Source # | |
Show (GenDelegs c) Source # | |
Crypto c ⇒ DecCBOR (GenDelegs c) Source # | |
Crypto c ⇒ EncCBOR (GenDelegs c) Source # | |
NFData (GenDelegs c) Source # | |
Defined in Cardano.Ledger.Keys.Internal | |
Eq (GenDelegs c) Source # | |
NoThunks (GenDelegs c) Source # | |
type Rep (GenDelegs c) Source # | |
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
type KESignable c = Signable (KES c) Source #
VRF
type VRFSignable c = Signable (VRF c) Source #
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.
decodeSignedKES ∷ KESAlgorithm v ⇒ Decoder s (SignedKES v a) Source #
decodeVerKeyKES ∷ KESAlgorithm v ⇒ Decoder s (VerKeyKES v) Source #
encodeSignedKES ∷ KESAlgorithm v ⇒ SignedKES v a → Encoding Source #
encodeVerKeyKES ∷ KESAlgorithm v ⇒ VerKeyKES v → Encoding Source #
signedKES ∷ (KESAlgorithm v, Signable v a) ⇒ ContextKES v → Period → a → SignKeyKES v → SignedKES v a Source #
∷ 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.
∷ (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 #
decodeVerKeyVRF ∷ VRFAlgorithm v ⇒ Decoder s (VerKeyVRF v) Source #
encodeVerKeyVRF ∷ VRFAlgorithm v ⇒ VerKeyVRF v → Encoding Source #
verifyVRF ∷ (VRFAlgorithm v, HasCallStack, Signable v a) ⇒ ContextVRF v → VerKeyVRF v → a → CertVRF v → Maybe (OutputVRF v) Source #
Re-parametrised types over crypto
type CertifiedVRF c = CertifiedVRF (VRF c) Source #
type SignedDSIGN c = SignedDSIGN (DSIGN c) Source #
type SignKeyDSIGN c = SignKeyDSIGN (DSIGN c) Source #
type SignKeyKES c = SignKeyKES (KES c) Source #
type SignKeyVRF c = SignKeyVRF (VRF c) Source #
module Cardano.Ledger.Keys.WitVKey