| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Simplex.Messaging.Notifications.Protocol
Documentation
Constructors
| Token | |
| Subscription |
Instances
| Show NtfEntity Source # | |
| TestEquality SNtfEntity Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods testEquality :: forall (a :: k) (b :: k). SNtfEntity a -> SNtfEntity b -> Maybe (a :~: b) | |
data SNtfEntity :: NtfEntity -> Type where Source #
Constructors
| SToken :: SNtfEntity 'Token | |
| SSubscription :: SNtfEntity 'Subscription |
Instances
| TestEquality SNtfEntity Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods testEquality :: forall (a :: k) (b :: k). SNtfEntity a -> SNtfEntity b -> Maybe (a :~: b) | |
| Show (SNtfEntity e) Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods showsPrec :: Int -> SNtfEntity e -> ShowS show :: SNtfEntity e -> String showList :: [SNtfEntity e] -> ShowS | |
class NtfEntityI (e :: NtfEntity) where Source #
Methods
sNtfEntity :: SNtfEntity e Source #
Instances
| NtfEntityI 'Subscription Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods | |
| NtfEntityI 'Token Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods sNtfEntity :: SNtfEntity 'Token Source # | |
data NtfCommandTag (e :: NtfEntity) where Source #
Constructors
| TNEW_ :: NtfCommandTag 'Token | |
| TVFY_ :: NtfCommandTag 'Token | |
| TCHK_ :: NtfCommandTag 'Token | |
| TRPL_ :: NtfCommandTag 'Token | |
| TDEL_ :: NtfCommandTag 'Token | |
| TCRN_ :: NtfCommandTag 'Token | |
| SNEW_ :: NtfCommandTag 'Subscription | |
| SCHK_ :: NtfCommandTag 'Subscription | |
| SDEL_ :: NtfCommandTag 'Subscription | |
| PING_ :: NtfCommandTag 'Subscription |
Instances
| Show (NtfCommandTag e) Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods showsPrec :: Int -> NtfCommandTag e -> ShowS show :: NtfCommandTag e -> String showList :: [NtfCommandTag e] -> ShowS | |
| NtfEntityI e => Encoding (NtfCommandTag e) Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods smpEncode :: NtfCommandTag e -> ByteString Source # smpDecode :: ByteString -> Either String (NtfCommandTag e) Source # smpP :: Parser (NtfCommandTag e) Source # | |
| NtfEntityI e => ProtocolMsgTag (NtfCommandTag e) Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods decodeTag :: ByteString -> Maybe (NtfCommandTag e) Source # | |
Constructors
| forall e.NtfEntityI e => NCT (SNtfEntity e) (NtfCommandTag e) |
Instances
newtype NtfRegCode Source #
Constructors
| NtfRegCode ByteString |
Instances
data NewNtfEntity (e :: NtfEntity) where Source #
Constructors
| NewNtfTkn :: DeviceToken -> NtfPublicAuthKey -> PublicKeyX25519 -> NewNtfEntity 'Token | |
| NewNtfSub :: NtfTokenId -> SMPQueueNtf -> NtfPrivateAuthKey -> NewNtfEntity 'Subscription |
Instances
| Show (NewNtfEntity e) Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods showsPrec :: Int -> NewNtfEntity e -> ShowS show :: NewNtfEntity e -> String showList :: [NewNtfEntity e] -> ShowS | |
| NtfEntityI e => Encoding (NewNtfEntity e) Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods smpEncode :: NewNtfEntity e -> ByteString Source # smpDecode :: ByteString -> Either String (NewNtfEntity e) Source # smpP :: Parser (NewNtfEntity e) Source # | |
data ANewNtfEntity Source #
Constructors
| forall e.NtfEntityI e => ANE (SNtfEntity e) (NewNtfEntity e) |
Instances
| Show ANewNtfEntity Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods showsPrec :: Int -> ANewNtfEntity -> ShowS show :: ANewNtfEntity -> String showList :: [ANewNtfEntity] -> ShowS | |
| Encoding ANewNtfEntity Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods smpEncode :: ANewNtfEntity -> ByteString Source # smpDecode :: ByteString -> Either String ANewNtfEntity Source # smpP :: Parser ANewNtfEntity Source # | |
data NtfCommand (e :: NtfEntity) where Source #
Constructors
| TNEW :: NewNtfEntity 'Token -> NtfCommand 'Token | register new device token for notifications |
| TVFY :: NtfRegCode -> NtfCommand 'Token | verify token - uses e2e encrypted random string sent to the device via PN to confirm that the device has the token |
| TCHK :: NtfCommand 'Token | check token status |
| TRPL :: DeviceToken -> NtfCommand 'Token | replace device token (while keeping all existing subscriptions) |
| TDEL :: NtfCommand 'Token | delete token - all subscriptions will be removed and no more notifications will be sent |
| TCRN :: Word16 -> NtfCommand 'Token | enable periodic background notification to fetch the new messages - interval is in minutes, minimum is 20, 0 to disable |
| SNEW :: NewNtfEntity 'Subscription -> NtfCommand 'Subscription | create SMP subscription |
| SCHK :: NtfCommand 'Subscription | check SMP subscription status (response is SUB) |
| SDEL :: NtfCommand 'Subscription | delete SMP subscription |
| PING :: NtfCommand 'Subscription | keep-alive command |
Instances
| NtfEntityI e => ProtocolEncoding NTFVersion ErrorType (NtfCommand e) Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Associated Types type Tag (NtfCommand e) Source # Methods encodeProtocol :: Version NTFVersion -> NtfCommand e -> ByteString Source # protocolP :: Version NTFVersion -> Tag (NtfCommand e) -> Parser (NtfCommand e) Source # fromProtocolError :: ProtocolErrorType -> ErrorType Source # checkCredentials :: Maybe TAuthorizations -> EntityId -> NtfCommand e -> Either ErrorType (NtfCommand e) Source # | |
| Show (NtfCommand e) Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods showsPrec :: Int -> NtfCommand e -> ShowS show :: NtfCommand e -> String showList :: [NtfCommand e] -> ShowS | |
| type Tag (NtfCommand e) Source # | |
Defined in Simplex.Messaging.Notifications.Protocol | |
Constructors
| forall e.NtfEntityI e => NtfCmd (SNtfEntity e) (NtfCommand e) |
Instances
| Show NtfCmd Source # | |
| ProtocolEncoding NTFVersion ErrorType NtfCmd Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods encodeProtocol :: Version NTFVersion -> NtfCmd -> ByteString Source # protocolP :: Version NTFVersion -> Tag NtfCmd -> Parser NtfCmd Source # fromProtocolError :: ProtocolErrorType -> ErrorType Source # checkCredentials :: Maybe TAuthorizations -> EntityId -> NtfCmd -> Either ErrorType NtfCmd Source # | |
| type Tag NtfCmd Source # | |
Defined in Simplex.Messaging.Notifications.Protocol | |
data NtfResponseTag Source #
Instances
| Show NtfResponseTag Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods showsPrec :: Int -> NtfResponseTag -> ShowS show :: NtfResponseTag -> String showList :: [NtfResponseTag] -> ShowS | |
| Encoding NtfResponseTag Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods smpEncode :: NtfResponseTag -> ByteString Source # smpDecode :: ByteString -> Either String NtfResponseTag Source # smpP :: Parser NtfResponseTag Source # | |
| ProtocolMsgTag NtfResponseTag Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods decodeTag :: ByteString -> Maybe NtfResponseTag Source # | |
data NtfResponse Source #
Constructors
| NRTknId NtfEntityId PublicKeyX25519 | |
| NRSubId NtfEntityId | |
| NROk | |
| NRErr ErrorType | |
| NRTkn NtfTknStatus | |
| NRSub NtfSubStatus | |
| NRPong |
Instances
data SMPQueueNtf Source #
Constructors
| SMPQueueNtf | |
Fields | |
Instances
data PushProvider Source #
Constructors
| PPApnsDev | |
| PPApnsProd | |
| PPApnsTest | |
| PPApnsNull |
Instances
data DeviceToken Source #
Constructors
| DeviceToken PushProvider ByteString |
Instances
data PNMessageData Source #
Constructors
| PNMessageData | |
Fields
| |
Instances
| Show PNMessageData Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods showsPrec :: Int -> PNMessageData -> ShowS show :: PNMessageData -> String showList :: [PNMessageData] -> ShowS | |
| StrEncoding PNMessageData Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods strEncode :: PNMessageData -> ByteString Source # strDecode :: ByteString -> Either String PNMessageData Source # strP :: Parser PNMessageData Source # | |
type NtfEntityId = EntityId Source #
type NtfSubscriptionId = NtfEntityId Source #
type NtfTokenId = NtfEntityId Source #
data NtfSubStatus Source #
Constructors
| NSNew | state after SNEW |
| NSPending | pending connection/subscription to SMP server |
| NSActive | connected and subscribed to SMP server |
| NSInactive | disconnected/unsubscribed from SMP server |
| NSEnd | END received |
| NSDeleted | DELD received (connection was deleted) |
| NSAuth | SMP AUTH error |
| NSService | SMP SERVICE error - rejected service signature on individual subscriptions |
| NSErr ByteString | SMP error other than AUTH |
Instances
data NtfTknStatus Source #
Constructors
| NTNew | Token created in DB |
| NTRegistered | state after registration (TNEW) |
| NTInvalid (Maybe NTInvalidReason) | if initial notification failed (push provider error) or verification failed |
| NTConfirmed | Token confirmed via notification (accepted by push provider or verification code received by client) |
| NTActive | after successful verification (TVFY) |
| NTExpired | after it is no longer valid (push provider error) |
Instances
data NTInvalidReason Source #
Instances
| Show NTInvalidReason Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods showsPrec :: Int -> NTInvalidReason -> ShowS show :: NTInvalidReason -> String showList :: [NTInvalidReason] -> ShowS | |
| Eq NTInvalidReason Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods (==) :: NTInvalidReason -> NTInvalidReason -> Bool (/=) :: NTInvalidReason -> NTInvalidReason -> Bool | |
| Encoding NTInvalidReason Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods smpEncode :: NTInvalidReason -> ByteString Source # smpDecode :: ByteString -> Either String NTInvalidReason Source # smpP :: Parser NTInvalidReason Source # | |
| StrEncoding NTInvalidReason Source # | |
Defined in Simplex.Messaging.Notifications.Protocol Methods strEncode :: NTInvalidReason -> ByteString Source # strDecode :: ByteString -> Either String NTInvalidReason Source # strP :: Parser NTInvalidReason Source # | |
encodePNMessages :: NonEmpty PNMessageData -> ByteString Source #
pnMessagesP :: Parser (NonEmpty PNMessageData) Source #
ntfShouldSubscribe :: NtfSubStatus -> Bool Source #
allowTokenVerification :: NtfTknStatus -> Bool Source #
allowNtfSubCommands :: NtfTknStatus -> Bool Source #
checkEntity :: forall t e e'. (NtfEntityI e, NtfEntityI e') => t e' -> Either String (t e) Source #