diff options
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 |