Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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 #
:: Text | The envirnoment variable name |
-> IO MatrixToken |
createIdentitySession Source #
:: 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 #
Instances
FromJSON MatrixError Source # | |
Defined in Network.Matrix.Internal parseJSON :: Value -> Parser MatrixError # parseJSONList :: Value -> Parser [MatrixError] # | |
Show MatrixError Source # | |
Defined in Network.Matrix.Internal showsPrec :: Int -> MatrixError -> ShowS # show :: MatrixError -> String # showList :: [MatrixError] -> ShowS # | |
Eq MatrixError Source # | |
Defined in Network.Matrix.Internal (==) :: MatrixError -> MatrixError -> Bool # (/=) :: MatrixError -> MatrixError -> Bool # |
:: (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 #
Instances
FromJSON HashDetails Source # | |
Defined in Network.Matrix.Identity parseJSON :: Value -> Parser HashDetails # parseJSONList :: Value -> Parser [HashDetails] # | |
Show HashDetails Source # | |
Defined in Network.Matrix.Identity showsPrec :: Int -> HashDetails -> ShowS # show :: HashDetails -> String # showList :: [HashDetails] -> ShowS # | |
Eq HashDetails Source # | |
Defined in Network.Matrix.Identity (==) :: HashDetails -> HashDetails -> Bool # (/=) :: HashDetails -> HashDetails -> Bool # |
Instances
identityLookup :: IdentitySession -> HashDetails -> Identity -> MatrixIO (Maybe UserID) Source #
Use identityLookup
to lookup a single identity, otherwise uses the full identitiesLookup
.
data HashedAddress Source #
Instances
Show HashedAddress Source # | |
Defined in Network.Matrix.Identity showsPrec :: Int -> HashedAddress -> ShowS # show :: HashedAddress -> String # showList :: [HashedAddress] -> ShowS # | |
Eq HashedAddress Source # | |
Defined in Network.Matrix.Identity (==) :: HashedAddress -> HashedAddress -> Bool # (/=) :: HashedAddress -> HashedAddress -> Bool # |
data IdentityLookupRequest Source #
Instances
Show IdentityLookupRequest Source # | |
Defined in Network.Matrix.Identity showsPrec :: Int -> IdentityLookupRequest -> ShowS # show :: IdentityLookupRequest -> String # showList :: [IdentityLookupRequest] -> ShowS # | |
Eq IdentityLookupRequest Source # | |
Defined in Network.Matrix.Identity (==) :: IdentityLookupRequest -> IdentityLookupRequest -> Bool # (/=) :: IdentityLookupRequest -> IdentityLookupRequest -> Bool # |
data IdentityLookupResponse Source #
A newtype wrapper to decoded nested list
>>>
decode "{\"mappings\": {\"hash\": \"user\"}}" :: Maybe IdentityLookupResponse
Just (IdentityLookupResponse [(HashedAddress "hash",UserID "user")])
Instances
FromJSON IdentityLookupResponse Source # | |
Defined in Network.Matrix.Identity | |
Show IdentityLookupResponse Source # | |
Defined in Network.Matrix.Identity showsPrec :: Int -> IdentityLookupResponse -> ShowS # show :: IdentityLookupResponse -> String # showList :: [IdentityLookupResponse] -> ShowS # |
identitiesLookup :: IdentitySession -> IdentityLookupRequest -> MatrixIO IdentityLookupResponse Source #
toHashedAddress :: HashDetails -> Identity -> HashedAddress Source #