unison-credentials-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.Auth.PersonalKey

Synopsis

Documentation

encodePrivateKey :: PersonalPrivateKey -> Value Source #

Encode the private JWK.

I left off a ToJSON instance because I want to be explicit about when we're encoding the private key.

signWithPersonalKey :: MonadIO m => PersonalPrivateKey -> ByteString -> m (Either Error PersonalKeySignature) Source #

Sign arbitrary bytes using a personal private key

>>> key <- generatePersonalKey
>>> let msg = "Hello, world!"
>>> signature <- fromRight (error "failed to sign") <$> signWithPersonalKey key msg
>>> verifyWithPersonalKey (publicKey key) msg signature
True

verifyWithPersonalKey :: MonadIO m => PersonalPublicKey -> ByteString -> PersonalKeySignature -> m Bool Source #

Verify a signature made with a personal private key