Crypt.NaCl
- Package
- purescript-tweetnacl
- Repository
- AlexaDeWit/purescript-tweetnacl
Re-exports from Crypt.NaCl.Box
#getBoxSecretKey Source
getBoxSecretKey :: BoxKeyPair -> BoxSecretKeyGet a BoxSecretKey from the given BoxKeyPair
#getBoxPublicKey Source
getBoxPublicKey :: BoxKeyPair -> BoxPublicKeyGet a BoxPublicKey from the given BoxKeyPair
#getBoxKeyPair Source
getBoxKeyPair :: BoxSecretKey -> BoxKeyPairGet a BoxKeyPair from the given BoxSecretKey
#generateBoxKeyPair Source
generateBoxKeyPair :: forall e. Effect BoxKeyPairGenerate a BoxKeyPair for NaCl Box operations
#boxOpenAfter Source
boxOpenAfter :: Box -> Nonce -> BoxSharedKey -> Maybe MessageSimilar to boxOpen, but opens a box with a BoxSharedKey that has been
generated with boxBefore instead of a BoxPublicKey and BoxSecretKey
#boxOpen Source
boxOpen :: Box -> Nonce -> BoxPublicKey -> BoxSecretKey -> Maybe MessageOpening a box decrypts and authenticates the message.
This will return the Message plaintext if decryption and SignatureB64
validation succeeds, and Nothing if authentication or decryption fails.
#boxBefore Source
boxBefore :: BoxPublicKey -> BoxSecretKey -> BoxSharedKeyCreate a BoxSharedKey from one user's BoxPublicKey and a separate
user's BoxSecretKey
#box Source
box :: Message -> Nonce -> BoxPublicKey -> BoxSecretKey -> BoxCreate a Box, which is an encrypted, authenticated message
Re-exports from Crypt.NaCl.Class
#Uint8ArrayAble Source
class Uint8ArrayAble a whereDenotes a class of NaCl types which are convertable to Uint8Arrays.
Instances of this typeclass will unsafeCoerce their values to Uint8Array
because we know that everything in/out of the underlying library are,
in fact, Uint8Arrays.
Members
toUint8Array :: a -> Uint8Array
Instances
#Utf8Decodable Source
class Utf8Decodable a whereThis type class denotes types that can be decoded to a UTF8 String.
The toString function returns Either Error String to handle errors
during the decode. We will generally unsafeCoerce because we know the
underlying type is already of Uint8Array from the wrapped library.
Members
Instances
#Utf8Encodable Source
class Utf8Encodable a whereThis type class denotes types that can be encoded to a UTF8 String.
The fromString function returns the type of the type class instance.
We will generally unsafeCoerce from the Uint8Array type to the
NaCl type we want because all underlying types are Uint8Array
Members
fromString :: String -> a
Instances
Re-exports from Crypt.NaCl.Hash
#hash Source
hash :: Uint8Array -> HashSha512Compute the SHA-512 hash of any Uint8Array
Re-exports from Crypt.NaCl.Random
#generateNonce Source
generateNonce :: Effect NonceGenerate a cryptographically secure, random Nonce for NaCl operations
Re-exports from Crypt.NaCl.SecretBox
#secretBoxOpen Source
secretBoxOpen :: SecretBox -> Nonce -> SecretBoxKey -> Maybe MessageOpen a SecretBox, returning Maybe Message
If decryption and authentication succeed, Just Message will be
returned. If decryption or authentication fail, Nothing will be returned
#secretBox Source
secretBox :: Message -> Nonce -> SecretBoxKey -> SecretBoxCreate a SecretBox, which is an encrypted and authenticated message
#generateSecretBoxKey Source
generateSecretBoxKey :: Effect SecretBoxKeyGenerate a key for use with a SecretBox
Re-exports from Crypt.NaCl.Sign
#verifyDetached Source
verifyDetached :: Message -> Signature -> BooleanVerifies a Signature, given the Message
#signOpen Source
signOpen :: SignedMessage -> SignPublicKey -> Maybe MessageVarifies the signature contained in a SignedMessage against a given
SignPublicKey. Returns Just Message if the signature verifies,
or Nothing otherwise.
#signDetached Source
signDetached :: Message -> SignSecretKey -> SignatureLike sign, but only returns the Signature, not the message contents
#sign Source
sign :: Message -> SignSecretKey -> SignedMessageSign a Message using the given SignSecretKey.
Returns the contents of the message, signed, as a SignedMessage
#getSignSecretKey Source
getSignSecretKey :: SignKeyPair -> SignSecretKeyGet the SignSecretKey for a given SignKeyPair
#getSignPublicKey Source
getSignPublicKey :: SignKeyPair -> SignPublicKeyGet the SignPublicKey for a given SignKeyPair
#getSignKeyPair Source
getSignKeyPair :: SignSecretKey -> SignKeyPairGet the signing keypair for a given SignSecretKey
#generateSignKeyPair Source
generateSignKeyPair :: Effect SignKeyPairGenerate a random key pair for signing messages
Re-exports from Crypt.NaCl.Types
#SignedMessage Source
data SignedMessage :: TypeA NaCl SignedMessage, which is represented as a Uint8Array in JS
#SignSecretKey Source
data SignSecretKey :: TypeA NaCl SignSecretKey
#SignPublicKey Source
data SignPublicKey :: TypeA NaCl SignPublicKey
#SignKeyPair Source
newtype SignKeyPairA NaCl SignKeyPair containing a SignPublicKey and a SignSecretKey
Constructors
SignKeyPair { publicKey :: SignPublicKey, secretKey :: SignSecretKey }
#SecretBoxKey Source
data SecretBoxKey :: Typea NaCL SecretBoxKey
#HashSha512 Source
data HashSha512 :: TypeA NaCl SHA-512 Hash
#BoxSecretKey Source
data BoxSecretKey :: TypeA NaCl BoxSecretKey
#BoxPublicKey Source
data BoxPublicKey :: TypeA NaCl BoxPublicKey
#BoxKeyPair Source
newtype BoxKeyPairA NaCl BoxKeyPair containing a BoxPublicKey and a BoxSecretKey
Constructors
BoxKeyPair { publicKey :: BoxPublicKey, secretKey :: BoxSecretKey }