notification server TRPL command (#420)

* notification server TRPL command

* test

* client methods

* only remove current token registration
This commit is contained in:
Evgeny Poberezkin
2022-06-23 08:35:33 +01:00
committed by GitHub
parent ef4d4c9e16
commit f10e3f697c
6 changed files with 59 additions and 1 deletions
@@ -112,6 +112,15 @@ removeInactiveTokenRegistrations st NtfTknData {ntfTknId = tId, token} =
TM.delete tId' $ tokens st
pure $ map snd tIds
removeTokenRegistration :: NtfStore -> NtfTknData -> STM ()
removeTokenRegistration st NtfTknData {ntfTknId = tId, token, tknVerifyKey} =
TM.lookup token (tokenRegistrations st) >>= mapM_ removeReg
where
removeReg regs =
TM.lookup k regs
>>= mapM_ (\tId' -> when (tId == tId') $ TM.delete k regs)
k = C.toPubKey C.pubKeyBytes tknVerifyKey
deleteNtfToken :: NtfStore -> NtfTokenId -> STM ()
deleteNtfToken st tknId = do
TM.lookupDelete tknId (tokens st)