wip, stable nonce for encryptBlock

This commit is contained in:
Dmitry Zuikov 2024-07-26 13:46:06 +03:00
parent 794ea341a9
commit 19dec623dd
2 changed files with 5 additions and 2 deletions

View File

@ -127,7 +127,6 @@ main = do
_ -> display cli
entry $ bindMatch "hbs2:reflog:tx:create-raw" $ \case
[SymbolVal "stdin", StringLike reflog] -> do
mkRefLogUpdateFrom ( liftIO BS.getContents ) reflog

View File

@ -6,6 +6,7 @@ module HBS2.CLI.Run.Internal.GroupKey
import HBS2.CLI.Prelude hiding (mapMaybe)
import HBS2.CLI.Run.Internal
import HBS2.Hash
import HBS2.Storage
import HBS2.Data.Types.Refs
import HBS2.Data.Types.SmallEncryptedBlock
@ -33,10 +34,13 @@ encryptBlock :: (MonadUnliftIO m, Serialise t)
-> m (SmallEncryptedBlock t)
encryptBlock sto gk x = do
let HbSyncHash non = hashObject (serialise x)
gks <- runKeymanClient (extractGroupKeySecret gk)
>>= orThrowUser "can't extract group key secret"
Symm.encryptBlock sto gks (Right gk) Nothing x
Symm.encryptBlock sto gks (Right gk) (Just non) x
decryptBlock :: (MonadUnliftIO m, Serialise t)
=> AnyStorage