Generate a fresh random Ed25519 keypair.
Modulesolana-haskell-sdk-1.3.0.0GHC2021
Network.Solana.Core.Crypto
Wrappers around Crypto.Sign.Ed25519 providing the core cryptographic types: SolanaPublicKey, SolanaPrivateKey and SolanaSignature. All three show as the Base58 strings used across the Solana ecosystem.
- 3 types
- 23 values
- Packagesolana-haskell-sdk-1.3.0.0
- Exports26
- LanguageGHC2021
- LicenceApache-2.0
- SourceCrypto.hs
Derive a keypair deterministically from a seed. Nothing unless the seed is exactly 32 bytes.
The public key corresponding to a private key.
Sign a message, returning the joined signed message (signature prepended to the message). For transaction signatures use dsign.
Verify a joined signed message produced by sign.
Produce a detached SolanaSignature over a byte string. This is the primitive used to sign transaction messages.
Verify a detached SolanaSignature over a byte string.
A 32-byte Ed25519 public key: the address of an account, program or signer. Show and the JSON instances use the Base58 rendering; the IsString instance is partial (see unsafeSolanaPublicKey).
Instances9Eq, Ord, Show, IsString, Binary, FromJSON, …
Eq SolanaPublicKeyDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoOrd SolanaPublicKeyDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoShow SolanaPublicKeyDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoIsString SolanaPublicKeyDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoBinary SolanaPublicKeyDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoFromJSON SolanaPublicKeyDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoFromJSONKey SolanaPublicKeyDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoToJSON SolanaPublicKeyDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoToJSONKey SolanaPublicKeyDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.Crypto
A 64-byte Ed25519 secret key (seed plus public key, NaCl layout). Show renders it in Base58 — avoid logging values of this type.
Instances3Eq, Ord, Show
Eq SolanaPrivateKeyDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoOrd SolanaPrivateKeyDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoShow SolanaPrivateKeyDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.Crypto
A 64-byte detached Ed25519 signature. Show and the JSON instances use the Base58 rendering.
Instances6Eq, Ord, Show, Binary, FromJSON, ToJSON
Eq SolanaSignatureDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoOrd SolanaSignatureDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoShow SolanaSignatureDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoBinary SolanaSignatureDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoFromJSON SolanaSignatureDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CryptoToJSON SolanaSignatureDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.Crypto
Partial version of mkPublicKeyFromString: calls error on invalid input. Prefer the total variant outside of literals and tests.
Build a SolanaPublicKey directly from raw bytes. Calls error unless exactly 32 bytes are supplied.
Partial version of mkPrivateKeyFromString: calls error on invalid input.
Build a SolanaPrivateKey directly from the raw 64 bytes of a NaCl
secret key. Calls error on any other length; the public-key half is not
checked — prefer mkPrivateKeyFromBytes (or readSigningKeyFromFile for
solana-keygen files).
Build a SolanaSignature from Base58 text. Calls error unless the input decodes to exactly 64 bytes.
The raw 32 bytes of a public key.
The raw bytes of a secret key. Handle with care.
The raw 64 bytes of a signature.
Encode a byte string as Base58 text (Bitcoin alphabet), the encoding Solana uses for addresses, signatures and hashes.
Encode a byte string as Base64 text.
Decode Base64 text leniently: invalid characters are skipped rather than reported, so this never fails but may silently accept malformed input.
Decode Base58 text (Bitcoin alphabet); Nothing if the input contains characters outside the alphabet.
Read a private key from a solana-keygen-style keypair file: a JSON
array of the 64 byte values of the secret key (e.g. [1,2,...]). Throws
an IOError if the file cannot be read, is not an array of exactly 64
integers in 0..255, or fails the checks of mkPrivateKeyFromBytes.
Parse Base58 text into a SolanaPublicKey. Left if the input is not Base58 or does not decode to exactly 32 bytes.
Parse Base58 text into a SolanaPrivateKey. Left if the input is not Base58 or fails the checks of mkPrivateKeyFromBytes (64 bytes whose public-key half is derived from the seed).
Build a SolanaPrivateKey from the raw 64 bytes of a NaCl secret key
(32-byte seed followed by the 32-byte public key). Left unless the input
is exactly 64 bytes and its public-key half is the one derived from the
seed — the checks solana-sdk's Keypair::from_bytes performs.