Safe Haskell | Safe-Infered |
---|

- class Identity a where
- identityName :: a -> String
- writeIdentity :: (Functor m, MonadIO m) => a -> m ByteString
- readIdentity :: (Functor m, MonadIO m) => ByteString -> m a

- data PeerIdentity
- data LocalIdentity
- toPeerIdentity :: LocalIdentity -> PeerIdentity
- newLocalIdentity :: MonadIO m => String -> Int -> m LocalIdentity
- piX509 :: PeerIdentity -> X509
- liX509 :: LocalIdentity -> X509
- liKey :: LocalIdentity -> RSAKeyPair
- fromX509 :: X509 -> IO PeerIdentity

# Documentation

An identity, public or private.

identityName :: a -> StringSource

Return the description that was associated with the identity when it was created.

writeIdentity :: (Functor m, MonadIO m) => a -> m ByteStringSource

Serialize an identity to a `ByteString`

for storage or
transmission.

readIdentity :: (Functor m, MonadIO m) => ByteString -> m aSource

Read back an identity previously serialized with writeIdentity.

data PeerIdentity Source

The public identity of a peer. This kind of identity can be used to authenticate the remote ends of connections.

data LocalIdentity Source

A local identity. This kind of identity can be used to
authenticate *to* remote ends of connections.

toPeerIdentity :: LocalIdentity -> PeerIdentitySource

Extract the public parts of a `LocalIdentity`

into a
`PeerIdentity`

suitable for sharing with peers. The resulting
`PeerIdentity`

will allow them to verify your identity when you
authenticate using the corresponding `LocalIdentity`

.

newLocalIdentity :: MonadIO m => String -> Int -> m LocalIdentitySource

Generate a new `LocalIdentity`

, giving it an identifying name and
a validity period in days.

Note that this function may take quite a while to execute, as it is generating key material for the identity.

piX509 :: PeerIdentity -> X509Source

liX509 :: LocalIdentity -> X509Source

fromX509 :: X509 -> IO PeerIdentitySource