mirror of https://github.com/voidlizard/hbs2
wip, stable nonce for encryptBlock
This commit is contained in:
parent
794ea341a9
commit
19dec623dd
|
|
@ -127,7 +127,6 @@ main = do
|
||||||
_ -> display cli
|
_ -> display cli
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
entry $ bindMatch "hbs2:reflog:tx:create-raw" $ \case
|
entry $ bindMatch "hbs2:reflog:tx:create-raw" $ \case
|
||||||
[SymbolVal "stdin", StringLike reflog] -> do
|
[SymbolVal "stdin", StringLike reflog] -> do
|
||||||
mkRefLogUpdateFrom ( liftIO BS.getContents ) reflog
|
mkRefLogUpdateFrom ( liftIO BS.getContents ) reflog
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ module HBS2.CLI.Run.Internal.GroupKey
|
||||||
import HBS2.CLI.Prelude hiding (mapMaybe)
|
import HBS2.CLI.Prelude hiding (mapMaybe)
|
||||||
import HBS2.CLI.Run.Internal
|
import HBS2.CLI.Run.Internal
|
||||||
|
|
||||||
|
import HBS2.Hash
|
||||||
import HBS2.Storage
|
import HBS2.Storage
|
||||||
import HBS2.Data.Types.Refs
|
import HBS2.Data.Types.Refs
|
||||||
import HBS2.Data.Types.SmallEncryptedBlock
|
import HBS2.Data.Types.SmallEncryptedBlock
|
||||||
|
|
@ -33,10 +34,13 @@ encryptBlock :: (MonadUnliftIO m, Serialise t)
|
||||||
-> m (SmallEncryptedBlock t)
|
-> m (SmallEncryptedBlock t)
|
||||||
|
|
||||||
encryptBlock sto gk x = do
|
encryptBlock sto gk x = do
|
||||||
|
|
||||||
|
let HbSyncHash non = hashObject (serialise x)
|
||||||
|
|
||||||
gks <- runKeymanClient (extractGroupKeySecret gk)
|
gks <- runKeymanClient (extractGroupKeySecret gk)
|
||||||
>>= orThrowUser "can't extract group key secret"
|
>>= 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)
|
decryptBlock :: (MonadUnliftIO m, Serialise t)
|
||||||
=> AnyStorage
|
=> AnyStorage
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue