| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Network.Matrix.Identity
Description
This module contains the Identity service API https://matrix.org/docs/spec/identity_service/r0.3.0.html
Synopsis
- data IdentitySession
- newtype MatrixToken = MatrixToken Text
- getTokenFromEnv :: Text -> IO MatrixToken
- createIdentitySession :: Text -> MatrixToken -> IO IdentitySession
- type MatrixIO a = MatrixM IO a
- data MatrixError = MatrixError {}
- retry :: (MonadIO m, MonadMask m) => MatrixM m a -> MatrixM m a
- retryWithLog :: (MonadMask m, MonadIO m) => Int -> (Text -> m ()) -> MatrixM m a -> MatrixM m a
- newtype UserID = UserID Text
- getIdentityTokenOwner :: IdentitySession -> MatrixIO UserID
- data HashDetails = HashDetails {
- hdAlgorithms :: NonEmpty Text
- hdPepper :: Text
- hashDetails :: IdentitySession -> MatrixIO HashDetails
- data Identity
- identityLookup :: IdentitySession -> HashDetails -> Identity -> MatrixIO (Maybe UserID)
- data HashedAddress
- data IdentityLookupRequest
- data IdentityLookupResponse
- identitiesLookup :: IdentitySession -> IdentityLookupRequest -> MatrixIO IdentityLookupResponse
- mkIdentityLookupRequest :: HashDetails -> [HashedAddress] -> IdentityLookupRequest
- toHashedAddress :: HashDetails -> Identity -> HashedAddress
- lookupIdentity :: HashedAddress -> IdentityLookupResponse -> Maybe UserID
Client
data IdentitySession Source #
The session record, use createSession to create it.
newtype MatrixToken Source #
Constructors
| MatrixToken Text |
Arguments
| :: Text | The envirnoment variable name |
| -> IO MatrixToken |
createIdentitySession Source #
Arguments
| :: Text | The matrix identity base url, e.g. "https://matrix.org" |
| -> MatrixToken | The user identity token |
| -> IO IdentitySession |
createSession creates the session record.
API
data MatrixError Source #
Constructors
| MatrixError | |
Instances
| Eq MatrixError Source # | |
Defined in Network.Matrix.Internal | |
| Show MatrixError Source # | |
Defined in Network.Matrix.Internal Methods showsPrec :: Int -> MatrixError -> ShowS # show :: MatrixError -> String # showList :: [MatrixError] -> ShowS # | |
| FromJSON MatrixError Source # | |
Defined in Network.Matrix.Internal | |
Arguments
| :: (MonadMask m, MonadIO m) | |
| => Int | Maximum number of retry |
| -> (Text -> m ()) | A log function, can be used to measure errors |
| -> MatrixM m a | The action to retry |
| -> MatrixM m a |
Retry a network action
User data
getIdentityTokenOwner :: IdentitySession -> MatrixIO UserID Source #
getIdentityTokenOwner gets information about the owner of a given access token.
Association lookup
data HashDetails Source #
Constructors
| HashDetails | |
Fields
| |
Instances
| Eq HashDetails Source # | |
Defined in Network.Matrix.Identity | |
| Show HashDetails Source # | |
Defined in Network.Matrix.Identity Methods showsPrec :: Int -> HashDetails -> ShowS # show :: HashDetails -> String # showList :: [HashDetails] -> ShowS # | |
| FromJSON HashDetails Source # | |
Defined in Network.Matrix.Identity | |
identityLookup :: IdentitySession -> HashDetails -> Identity -> MatrixIO (Maybe UserID) Source #
Use identityLookup to lookup a single identity, otherwise uses the full identitiesLookup.
data HashedAddress Source #
Instances
| Eq HashedAddress Source # | |
Defined in Network.Matrix.Identity Methods (==) :: HashedAddress -> HashedAddress -> Bool # (/=) :: HashedAddress -> HashedAddress -> Bool # | |
| Show HashedAddress Source # | |
Defined in Network.Matrix.Identity Methods showsPrec :: Int -> HashedAddress -> ShowS # show :: HashedAddress -> String # showList :: [HashedAddress] -> ShowS # | |
data IdentityLookupRequest Source #
Instances
| Eq IdentityLookupRequest Source # | |
Defined in Network.Matrix.Identity Methods (==) :: IdentityLookupRequest -> IdentityLookupRequest -> Bool # (/=) :: IdentityLookupRequest -> IdentityLookupRequest -> Bool # | |
| Show IdentityLookupRequest Source # | |
Defined in Network.Matrix.Identity Methods showsPrec :: Int -> IdentityLookupRequest -> ShowS # show :: IdentityLookupRequest -> String # showList :: [IdentityLookupRequest] -> ShowS # | |
data IdentityLookupResponse Source #
A newtype wrapper to decoded nested list
>>>decode "{\"mappings\": {\"hash\": \"user\"}}" :: Maybe IdentityLookupResponseJust (IdentityLookupResponse [(HashedAddress "hash",UserID "user")])
Instances
| Show IdentityLookupResponse Source # | |
Defined in Network.Matrix.Identity Methods showsPrec :: Int -> IdentityLookupResponse -> ShowS # show :: IdentityLookupResponse -> String # showList :: [IdentityLookupResponse] -> ShowS # | |
| FromJSON IdentityLookupResponse Source # | |
Defined in Network.Matrix.Identity Methods parseJSON :: Value -> Parser IdentityLookupResponse # parseJSONList :: Value -> Parser [IdentityLookupResponse] # | |
identitiesLookup :: IdentitySession -> IdentityLookupRequest -> MatrixIO IdentityLookupResponse Source #
toHashedAddress :: HashDetails -> Identity -> HashedAddress Source #