Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.CLI.Shelley.Key
Description
Shelley CLI option data types and functions for cryptographic keys.
Synopsis
- data InputFormat a where
- InputFormatBech32 :: SerialiseAsBech32 a => InputFormat a
- InputFormatHex :: SerialiseAsRawBytes a => InputFormat a
- InputFormatTextEnvelope :: HasTextEnvelope a => InputFormat a
- data InputDecodeError
- deserialiseInput :: forall a. AsType a -> NonEmpty (InputFormat a) -> ByteString -> Either InputDecodeError a
- deserialiseInputAnyOf :: forall b. [FromSomeType SerialiseAsBech32 b] -> [FromSomeType HasTextEnvelope b] -> ByteString -> Either InputDecodeError b
- renderInputDecodeError :: InputDecodeError -> Text
- readKeyFile :: AsType a -> NonEmpty (InputFormat a) -> FilePath -> IO (Either (FileError InputDecodeError) a)
- readKeyFileAnyOf :: forall b. [FromSomeType SerialiseAsBech32 b] -> [FromSomeType HasTextEnvelope b] -> FilePath -> IO (Either (FileError InputDecodeError) b)
- readKeyFileTextEnvelope :: HasTextEnvelope a => AsType a -> FilePath -> IO (Either (FileError InputDecodeError) a)
- readSigningKeyFile :: forall keyrole. (HasTextEnvelope (SigningKey keyrole), SerialiseAsBech32 (SigningKey keyrole)) => AsType keyrole -> SigningKeyFile -> IO (Either (FileError InputDecodeError) (SigningKey keyrole))
- readSigningKeyFileAnyOf :: forall b. [FromSomeType SerialiseAsBech32 b] -> [FromSomeType HasTextEnvelope b] -> SigningKeyFile -> IO (Either (FileError InputDecodeError) b)
- data VerificationKeyOrFile keyrole
- = VerificationKeyValue !(VerificationKey keyrole)
- | VerificationKeyFilePath !VerificationKeyFile
- readVerificationKeyOrFile :: (HasTextEnvelope (VerificationKey keyrole), SerialiseAsBech32 (VerificationKey keyrole)) => AsType keyrole -> VerificationKeyOrFile keyrole -> IO (Either (FileError InputDecodeError) (VerificationKey keyrole))
- readVerificationKeyOrTextEnvFile :: HasTextEnvelope (VerificationKey keyrole) => AsType keyrole -> VerificationKeyOrFile keyrole -> IO (Either (FileError InputDecodeError) (VerificationKey keyrole))
- data VerificationKeyTextOrFile
- data VerificationKeyTextOrFileError
- readVerificationKeyTextOrFileAnyOf :: forall b. [FromSomeType SerialiseAsBech32 b] -> [FromSomeType HasTextEnvelope b] -> VerificationKeyTextOrFile -> IO (Either VerificationKeyTextOrFileError b)
- renderVerificationKeyTextOrFileError :: VerificationKeyTextOrFileError -> Text
- data VerificationKeyOrHashOrFile keyrole
- = VerificationKeyOrFile !(VerificationKeyOrFile keyrole)
- | VerificationKeyHash !(Hash keyrole)
- readVerificationKeyOrHashOrFile :: (Key keyrole, SerialiseAsBech32 (VerificationKey keyrole)) => AsType keyrole -> VerificationKeyOrHashOrFile keyrole -> IO (Either (FileError InputDecodeError) (Hash keyrole))
- readVerificationKeyOrHashOrTextEnvFile :: Key keyrole => AsType keyrole -> VerificationKeyOrHashOrFile keyrole -> IO (Either (FileError InputDecodeError) (Hash keyrole))
Documentation
data InputFormat a where Source #
Input format/encoding.
Constructors
InputFormatBech32 :: SerialiseAsBech32 a => InputFormat a | Bech32 encoding. |
InputFormatHex :: SerialiseAsRawBytes a => InputFormat a | Hex/Base16 encoding. |
InputFormatTextEnvelope :: HasTextEnvelope a => InputFormat a | Text envelope format. |
data InputDecodeError Source #
Input decoding error.
Constructors
InputTextEnvelopeError !TextEnvelopeError | The provided data seems to be a valid text envelope, but some error occurred in deserialising it. |
InputBech32DecodeError !Bech32DecodeError | The provided data is valid Bech32, but some error occurred in deserialising it. |
InputInvalidError | The provided data does not represent a valid value of the provided type. |
Instances
Eq InputDecodeError Source # | |
Defined in Cardano.CLI.Shelley.Key Methods (==) :: InputDecodeError -> InputDecodeError -> Bool # (/=) :: InputDecodeError -> InputDecodeError -> Bool # | |
Show InputDecodeError Source # | |
Defined in Cardano.CLI.Shelley.Key Methods showsPrec :: Int -> InputDecodeError -> ShowS # show :: InputDecodeError -> String # showList :: [InputDecodeError] -> ShowS # | |
Error InputDecodeError Source # | |
Defined in Cardano.CLI.Shelley.Key Methods |
deserialiseInput :: forall a. AsType a -> NonEmpty (InputFormat a) -> ByteString -> Either InputDecodeError a Source #
Deserialise an input of some type that is formatted in some way.
deserialiseInputAnyOf :: forall b. [FromSomeType SerialiseAsBech32 b] -> [FromSomeType HasTextEnvelope b] -> ByteString -> Either InputDecodeError b Source #
Deserialise an input of some type that is formatted in some way.
The provided ByteString
can either be Bech32-encoded or in the text
envelope format.
renderInputDecodeError :: InputDecodeError -> Text Source #
Render an error message for a InputDecodeError
.
readKeyFile :: AsType a -> NonEmpty (InputFormat a) -> FilePath -> IO (Either (FileError InputDecodeError) a) Source #
Read a cryptographic key from a file.
The contents of the file can either be Bech32-encoded, hex-encoded, or in the text envelope format.
readKeyFileAnyOf :: forall b. [FromSomeType SerialiseAsBech32 b] -> [FromSomeType HasTextEnvelope b] -> FilePath -> IO (Either (FileError InputDecodeError) b) Source #
Read a cryptographic key from a file given that it is one of the provided types.
The contents of the file can either be Bech32-encoded or in the text envelope format.
readKeyFileTextEnvelope :: HasTextEnvelope a => AsType a -> FilePath -> IO (Either (FileError InputDecodeError) a) Source #
Read a cryptographic key from a file.
The contents of the file must be in the text envelope format.
readSigningKeyFile :: forall keyrole. (HasTextEnvelope (SigningKey keyrole), SerialiseAsBech32 (SigningKey keyrole)) => AsType keyrole -> SigningKeyFile -> IO (Either (FileError InputDecodeError) (SigningKey keyrole)) Source #
Read a signing key from a file.
The contents of the file can either be Bech32-encoded, hex-encoded, or in the text envelope format.
readSigningKeyFileAnyOf :: forall b. [FromSomeType SerialiseAsBech32 b] -> [FromSomeType HasTextEnvelope b] -> SigningKeyFile -> IO (Either (FileError InputDecodeError) b) Source #
Read a signing key from a file given that it is one of the provided types of signing key.
The contents of the file can either be Bech32-encoded or in the text envelope format.
data VerificationKeyOrFile keyrole Source #
Either a verification key or path to a verification key file.
Constructors
VerificationKeyValue !(VerificationKey keyrole) | A verification key. |
VerificationKeyFilePath !VerificationKeyFile | A path to a verification key file. Note that this file hasn't been validated at all (whether it exists, contains a key of the correct type, etc.) |
Instances
Eq (VerificationKey keyrole) => Eq (VerificationKeyOrFile keyrole) Source # | |
Defined in Cardano.CLI.Shelley.Key Methods (==) :: VerificationKeyOrFile keyrole -> VerificationKeyOrFile keyrole -> Bool # (/=) :: VerificationKeyOrFile keyrole -> VerificationKeyOrFile keyrole -> Bool # | |
Show (VerificationKey keyrole) => Show (VerificationKeyOrFile keyrole) Source # | |
Defined in Cardano.CLI.Shelley.Key Methods showsPrec :: Int -> VerificationKeyOrFile keyrole -> ShowS # show :: VerificationKeyOrFile keyrole -> String # showList :: [VerificationKeyOrFile keyrole] -> ShowS # |
readVerificationKeyOrFile :: (HasTextEnvelope (VerificationKey keyrole), SerialiseAsBech32 (VerificationKey keyrole)) => AsType keyrole -> VerificationKeyOrFile keyrole -> IO (Either (FileError InputDecodeError) (VerificationKey keyrole)) Source #
Read a verification key or verification key file and return a verification key.
If a filepath is provided, the file can either be formatted as Bech32, hex, or text envelope.
readVerificationKeyOrTextEnvFile :: HasTextEnvelope (VerificationKey keyrole) => AsType keyrole -> VerificationKeyOrFile keyrole -> IO (Either (FileError InputDecodeError) (VerificationKey keyrole)) Source #
Read a verification key or verification key file and return a verification key.
If a filepath is provided, it will be interpreted as a text envelope formatted file.
data VerificationKeyTextOrFile Source #
Either an unvalidated text representation of a verification key or a path to a verification key file.
Instances
Eq VerificationKeyTextOrFile Source # | |
Defined in Cardano.CLI.Shelley.Key Methods (==) :: VerificationKeyTextOrFile -> VerificationKeyTextOrFile -> Bool # (/=) :: VerificationKeyTextOrFile -> VerificationKeyTextOrFile -> Bool # | |
Show VerificationKeyTextOrFile Source # | |
Defined in Cardano.CLI.Shelley.Key Methods showsPrec :: Int -> VerificationKeyTextOrFile -> ShowS # show :: VerificationKeyTextOrFile -> String # showList :: [VerificationKeyTextOrFile] -> ShowS # |
data VerificationKeyTextOrFileError Source #
An error in deserializing a VerificationKeyTextOrFile
to a
VerificationKey
.
Constructors
VerificationKeyTextError !InputDecodeError | |
VerificationKeyFileError !(FileError InputDecodeError) |
Instances
Show VerificationKeyTextOrFileError Source # | |
Defined in Cardano.CLI.Shelley.Key Methods showsPrec :: Int -> VerificationKeyTextOrFileError -> ShowS # show :: VerificationKeyTextOrFileError -> String # showList :: [VerificationKeyTextOrFileError] -> ShowS # |
readVerificationKeyTextOrFileAnyOf :: forall b. [FromSomeType SerialiseAsBech32 b] -> [FromSomeType HasTextEnvelope b] -> VerificationKeyTextOrFile -> IO (Either VerificationKeyTextOrFileError b) Source #
Deserialise a verification key from text or a verification key file given that it is one of the provided types.
If a filepath is provided, the file can either be formatted as Bech32, hex, or text envelope.
renderVerificationKeyTextOrFileError :: VerificationKeyTextOrFileError -> Text Source #
Render an error message for a VerificationKeyTextOrFileError
.
data VerificationKeyOrHashOrFile keyrole Source #
Verification key, verification key hash, or path to a verification key file.
Constructors
VerificationKeyOrFile !(VerificationKeyOrFile keyrole) | Either a verification key or path to a verification key file. |
VerificationKeyHash !(Hash keyrole) | A verification key hash. |
Instances
(Eq (VerificationKeyOrFile keyrole), Eq (Hash keyrole)) => Eq (VerificationKeyOrHashOrFile keyrole) Source # | |
Defined in Cardano.CLI.Shelley.Key Methods (==) :: VerificationKeyOrHashOrFile keyrole -> VerificationKeyOrHashOrFile keyrole -> Bool # (/=) :: VerificationKeyOrHashOrFile keyrole -> VerificationKeyOrHashOrFile keyrole -> Bool # | |
(Show (VerificationKeyOrFile keyrole), Show (Hash keyrole)) => Show (VerificationKeyOrHashOrFile keyrole) Source # | |
Defined in Cardano.CLI.Shelley.Key Methods showsPrec :: Int -> VerificationKeyOrHashOrFile keyrole -> ShowS # show :: VerificationKeyOrHashOrFile keyrole -> String # showList :: [VerificationKeyOrHashOrFile keyrole] -> ShowS # |
readVerificationKeyOrHashOrFile :: (Key keyrole, SerialiseAsBech32 (VerificationKey keyrole)) => AsType keyrole -> VerificationKeyOrHashOrFile keyrole -> IO (Either (FileError InputDecodeError) (Hash keyrole)) Source #
Read a verification key or verification key hash or verification key file and return a verification key hash.
If a filepath is provided, the file can either be formatted as Bech32, hex, or text envelope.
readVerificationKeyOrHashOrTextEnvFile :: Key keyrole => AsType keyrole -> VerificationKeyOrHashOrFile keyrole -> IO (Either (FileError InputDecodeError) (Hash keyrole)) Source #
Read a verification key or verification key hash or verification key file and return a verification key hash.
If a filepath is provided, it will be interpreted as a text envelope formatted file.