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/Attach.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/Attach.hs') diff --git a/src/Attach.hs b/src/Attach.hs index 48d18d8..436f786 100644 --- a/src/Attach.hs +++ b/src/Attach.hs @@ -42,13 +42,13 @@ instance PairingResult AttachIdentity where pairingVerifyResult (AttachIdentity sdata keys) = do curid <- lsIdentity . fromStored <$> svcGetLocal - secret <- loadKey $ iddKeyIdentity $ fromStored $ signedData $ fromStored curid + secret <- loadKey $ eiddKeyIdentity $ fromSigned curid sdata' <- mstore =<< signAdd secret (fromStored sdata) return $ do - guard $ iddKeyIdentity (fromStored $ signedData $ fromStored sdata) == - iddKeyIdentity (fromStored $ signedData $ fromStored curid) + guard $ iddKeyIdentity (fromSigned sdata) == + eiddKeyIdentity (fromSigned curid) identity <- validateIdentity sdata' - guard $ iddPrev (fromStored $ signedData $ fromStored $ idData identity) == [curid] + guard $ iddPrev (fromSigned $ idData identity) == [eiddStoredBase curid] return (identity, keys) pairingFinalizeRequest (identity, keys) = updateLocalHead_ $ \slocal -> do @@ -57,9 +57,10 @@ instance PairingResult AttachIdentity where pkeys <- mapM (copyStored st) [ idKeyIdentity owner, idKeyMessage owner ] liftIO $ mapM_ storeKey $ catMaybes [ keyFromData sec pub | sec <- keys, pub <- pkeys ] + identity' <- mergeIdentity $ updateIdentity [ lsIdentity $ fromStored slocal ] identity shared <- makeSharedStateUpdate st (Just owner) (lsShared $ fromStored slocal) mstore (fromStored slocal) - { lsIdentity = idData identity + { lsIdentity = idExtData identity' , lsShared = [ shared ] } -- cgit v1.2.3