From 5b908c86320ee73f2722c85f8a47fa03ec093c6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Tue, 10 Oct 2023 21:36:58 +0200 Subject: Use extended identity data for name --- src/Test.hs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/Test.hs') diff --git a/src/Test.hs b/src/Test.hs index 3f59239..ab9a78c 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -321,7 +321,7 @@ cmdCreateIdentity = do _ -> return [] storeHead st $ LocalState - { lsIdentity = idData identity + { lsIdentity = idExtData identity , lsShared = shared } @@ -427,14 +427,14 @@ cmdUpdateLocalIdentity :: Command cmdUpdateLocalIdentity = do [name] <- asks tiParams updateLocalHead_ $ \ls -> do - Just identity <- return $ validateIdentity $ lsIdentity $ fromStored ls + Just identity <- return $ validateExtendedIdentity $ lsIdentity $ fromStored ls let public = idKeyIdentity identity secret <- loadKey public - nidata <- maybe (error "created invalid identity") (return . idData) . validateIdentity =<< - mstore =<< sign secret =<< mstore (emptyIdentityData public) - { iddPrev = toList $ idDataF identity - , iddName = Just name + nidata <- maybe (error "created invalid identity") (return . idExtData) . validateExtendedIdentity =<< + mstore =<< sign secret =<< mstore . ExtendedIdentityData =<< return (emptyIdentityExtension $ idData identity) + { idePrev = toList $ idExtDataF identity + , ideName = Just name } mstore (fromStored ls) { lsIdentity = nidata } @@ -446,10 +446,11 @@ cmdUpdateSharedIdentity = do Just identity -> do let public = idKeyIdentity identity secret <- loadKey public - maybe (error "created invalid identity") (return . Just . toComposedIdentity) . validateIdentity =<< - mstore =<< sign secret =<< mstore (emptyIdentityData public) - { iddPrev = toList $ idDataF identity - , iddName = Just name + uidentity <- mergeIdentity identity + maybe (error "created invalid identity") (return . Just . toComposedIdentity) . validateExtendedIdentity =<< + mstore =<< sign secret =<< mstore . ExtendedIdentityData =<< return (emptyIdentityExtension $ idData uidentity) + { idePrev = toList $ idExtDataF identity + , ideName = Just name } cmdAttachTo :: Command -- cgit v1.2.3