diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2019-11-09 21:24:57 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2019-11-09 21:24:57 +0100 |
commit | 2169f1030cded87e6ab38b4ae8293e7f147b5e96 (patch) | |
tree | b5de80318e48c2a59f657d17567e1f6085ae8714 /src/State.hs | |
parent | 4521fc3c4a898f046b030985159c63c5379df46f (diff) |
Attach device service
Diffstat (limited to 'src/State.hs')
-rw-r--r-- | src/State.hs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/State.hs b/src/State.hs index 91fff2b..515391d 100644 --- a/src/State.hs +++ b/src/State.hs @@ -4,6 +4,10 @@ module State ( loadLocalState, updateLocalState, updateLocalState_, + updateSharedState, updateSharedState_, + mergeSharedStates, + + mergeSharedIdentity, updateIdentity, ) where @@ -119,6 +123,15 @@ mergeSharedStates ss@(s:_) = wrappedStore (storedStorage s) $ SharedState } mergeSharedStates [] = error "mergeSharedStates: empty list" + +mergeSharedIdentity :: Storage -> IO UnifiedIdentity +mergeSharedIdentity st = updateSharedState st $ \sshared -> do + let shared = fromStored sshared + Just cidentity = verifyIdentityF $ ssIdentity shared + identity <- mergeIdentity cidentity + sshared' <- wrappedStore st $ shared { ssIdentity = [idData identity] } + return (sshared', identity) + updateIdentity :: Storage -> IO () updateIdentity st = updateSharedState_ st $ \sshared -> do let shared = fromStored sshared |