mirror of https://github.com/voidlizard/hbs2
Fixes by comments
This commit is contained in:
parent
b736a37013
commit
4542e6595f
|
@ -72,25 +72,12 @@ instance Serialise (GroupKey e 'NaClAsymm)
|
|||
|
||||
newtype AsGroupKeyFile a = AsGroupKeyFile a
|
||||
|
||||
---- FIXME: integration-regression-test-for-groupkey
|
||||
---- Добавить тест: сгенерировали groupkey/распарсили groupkey
|
||||
-- FIXME: integration-regression-test-for-groupkey
|
||||
-- Добавить тест: сгенерировали groupkey/распарсили groupkey
|
||||
|
||||
parseGroupKey :: forall e . ()
|
||||
=> AsGroupKeyFile ByteString -> Maybe (GroupKey e 'NaClAsymm)
|
||||
|
||||
parseGroupKey (AsGroupKeyFile bs) = maybe1 b58_1 Nothing fromCbor
|
||||
|
||||
where
|
||||
fromCbor s = deserialiseOrFail @(GroupKey e 'NaClAsymm) s
|
||||
& either (const Nothing) Just
|
||||
|
||||
b58_1 = B8.lines bs & dropWhile hdr
|
||||
& filter ( not . B8.null )
|
||||
& B8.concat
|
||||
& fromBase58
|
||||
& fmap LBS.fromStrict
|
||||
|
||||
hdr s = B8.isPrefixOf "#" s || B8.null s
|
||||
parseGroupKey (AsGroupKeyFile bs) = parseSerialisableFromBase58 bs
|
||||
|
||||
instance ( Serialise (GroupKey e s)
|
||||
)
|
||||
|
|
|
@ -125,11 +125,12 @@ parseCredentials :: forall e . ( Signatures e
|
|||
, SerialisedCredentials e
|
||||
)
|
||||
=> AsCredFile ByteString -> Maybe (PeerCredentials e)
|
||||
parseCredentials (AsCredFile bs) = parseSerialisableFromBase58 bs
|
||||
|
||||
parseCredentials (AsCredFile bs) = maybe1 b58_1 Nothing fromCbor
|
||||
|
||||
parseSerialisableFromBase58 :: Serialise a => ByteString -> Maybe a
|
||||
parseSerialisableFromBase58 bs = maybe1 b58_1 Nothing fromCbor
|
||||
where
|
||||
fromCbor s = deserialiseOrFail @(PeerCredentials e) s
|
||||
fromCbor s = deserialiseOrFail s
|
||||
& either (const Nothing) Just
|
||||
|
||||
b58_1 = B8.lines bs & dropWhile hdr
|
||||
|
|
|
@ -351,7 +351,7 @@ main = join . customExecParser (prefs showHelpOnError) $
|
|||
init <- optional $ flag' True ( long "init" <> help "just init storage") <&> OptInit
|
||||
groupkeyFile <- optional $ strOption ( long "groupkey" <> help "path to groupkey file" )
|
||||
encoptKeyringFile <- optional $ strOption ( long "keyring" <> help "path to keyring file" )
|
||||
encoptFromPubKey <- optional $ strOption ( metavar "PUB-KEY-BAS58" )
|
||||
encoptFromPubKey <- optional $ strOption ( metavar "PUB-KEY-BASE58" )
|
||||
pure do
|
||||
let encOps :: Maybe (OptEncryption MerkleEncryptionType)
|
||||
encOps = groupkeyFile <&> \encoptGroupkeyFile -> OptEncryption{..}
|
||||
|
@ -391,7 +391,7 @@ main = join . customExecParser (prefs showHelpOnError) $
|
|||
|
||||
|
||||
pKeyDel = do
|
||||
s <- strArgument ( metavar "PUB-KEY-BAS58" )
|
||||
s <- strArgument ( metavar "PUB-KEY-BASE58" )
|
||||
f <- strArgument ( metavar "KEYRING-FILE" )
|
||||
pure (runKeyDel s f)
|
||||
|
||||
|
|
Loading…
Reference in New Issue