Crypt.NaCl
- Package
- purescript-tweetnacl
- Repository
- AlexaDeWit/purescript-tweetnacl
Re-exports from Crypt.NaCl.Box
#getBoxSecretKey Source
getBoxSecretKey :: BoxKeyPair -> BoxSecretKey
Get a BoxSecretKey
from the given BoxKeyPair
#getBoxPublicKey Source
getBoxPublicKey :: BoxKeyPair -> BoxPublicKey
Get a BoxPublicKey
from the given BoxKeyPair
#getBoxKeyPair Source
getBoxKeyPair :: BoxSecretKey -> BoxKeyPair
Get a BoxKeyPair
from the given BoxSecretKey
#generateBoxKeyPair Source
generateBoxKeyPair :: forall e. Effect BoxKeyPair
Generate a BoxKeyPair
for NaCl Box operations
#boxOpenAfter Source
boxOpenAfter :: Box -> Nonce -> BoxSharedKey -> Maybe Message
Similar 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 Message
Opening 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 -> BoxSharedKey
Create a BoxSharedKey
from one user's BoxPublicKey
and a separate
user's BoxSecretKey
#box Source
box :: Message -> Nonce -> BoxPublicKey -> BoxSecretKey -> Box
Create a Box
, which is an encrypted, authenticated message
Re-exports from Crypt.NaCl.Class
#Uint8ArrayAble Source
class Uint8ArrayAble a where
Denotes a class of NaCl types which are convertable to Uint8Array
s.
Instances of this typeclass will unsafeCoerce
their values to Uint8Array
because we know that everything in/out of the underlying library are,
in fact, Uint8Array
s.
Members
toUint8Array :: a -> Uint8Array
Instances
#Utf8Decodable Source
class Utf8Decodable a where
This 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 where
This 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 -> HashSha512
Compute the SHA-512 hash of any Uint8Array
Re-exports from Crypt.NaCl.Random
#generateNonce Source
generateNonce :: Effect Nonce
Generate a cryptographically secure, random Nonce for NaCl operations
Re-exports from Crypt.NaCl.SecretBox
#secretBoxOpen Source
secretBoxOpen :: SecretBox -> Nonce -> SecretBoxKey -> Maybe Message
Open 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 -> SecretBox
Create a SecretBox, which is an encrypted and authenticated message
#generateSecretBoxKey Source
generateSecretBoxKey :: Effect SecretBoxKey
Generate a key for use with a SecretBox
Re-exports from Crypt.NaCl.Sign
#verifyDetached Source
verifyDetached :: Message -> Signature -> Boolean
Verifies a Signature
, given the Message
#signOpen Source
signOpen :: SignedMessage -> SignPublicKey -> Maybe Message
Varifies 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 -> Signature
Like sign
, but only returns the Signature
, not the message contents
#sign Source
sign :: Message -> SignSecretKey -> SignedMessage
Sign a Message
using the given SignSecretKey
.
Returns the contents of the message, signed, as a SignedMessage
#getSignSecretKey Source
getSignSecretKey :: SignKeyPair -> SignSecretKey
Get the SignSecretKey
for a given SignKeyPair
#getSignPublicKey Source
getSignPublicKey :: SignKeyPair -> SignPublicKey
Get the SignPublicKey
for a given SignKeyPair
#getSignKeyPair Source
getSignKeyPair :: SignSecretKey -> SignKeyPair
Get the signing keypair for a given SignSecretKey
#generateSignKeyPair Source
generateSignKeyPair :: Effect SignKeyPair
Generate a random key pair for signing messages
Re-exports from Crypt.NaCl.Types
#SignedMessage Source
data SignedMessage :: Type
A NaCl SignedMessage, which is represented as a Uint8Array in JS
#SignSecretKey Source
data SignSecretKey :: Type
A NaCl SignSecretKey
#SignPublicKey Source
data SignPublicKey :: Type
A NaCl SignPublicKey
#SignKeyPair Source
newtype SignKeyPair
A NaCl SignKeyPair
containing a SignPublicKey
and a SignSecretKey
Constructors
SignKeyPair { publicKey :: SignPublicKey, secretKey :: SignSecretKey }
#SecretBoxKey Source
data SecretBoxKey :: Type
a NaCL SecretBoxKey
#HashSha512 Source
data HashSha512 :: Type
A NaCl SHA-512 Hash
#BoxSecretKey Source
data BoxSecretKey :: Type
A NaCl BoxSecretKey
#BoxPublicKey Source
data BoxPublicKey :: Type
A NaCl BoxPublicKey
#BoxKeyPair Source
newtype BoxKeyPair
A NaCl BoxKeyPair
containing a BoxPublicKey
and a BoxSecretKey
Constructors
BoxKeyPair { publicKey :: BoxPublicKey, secretKey :: BoxSecretKey }