mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
3b8f3d48f4
commit
2289845078
|
@ -15,6 +15,7 @@ import HBS2.Net.Auth.Schema
|
|||
import HBS2.Base58
|
||||
import HBS2.Hash
|
||||
|
||||
import Control.Applicative
|
||||
import Codec.Serialise
|
||||
import Crypto.Saltine.Core.Sign (Keypair(..))
|
||||
import Crypto.Saltine.Core.Sign qualified as Sign
|
||||
|
@ -161,7 +162,13 @@ parseCredentials :: forall s . ( -- ForHBS2Basic s
|
|||
SerialisedCredentials s
|
||||
)
|
||||
=> AsCredFile ByteString -> Maybe (PeerCredentials s)
|
||||
parseCredentials (AsCredFile bs) = parseSerialisableFromBase58 bs
|
||||
parseCredentials (AsCredFile bs) =
|
||||
parseSerialisableFromBase58 bs <|> parseSerialisableFromCbor (LBS.fromStrict bs)
|
||||
|
||||
parseSerialisableFromCbor :: SerialisedCredentials s => LBS.ByteString -> Maybe (PeerCredentials s)
|
||||
parseSerialisableFromCbor = fromCbor
|
||||
where fromCbor s = deserialiseOrFail s
|
||||
& either (const Nothing) Just
|
||||
|
||||
parseSerialisableFromBase58 :: Serialise a => ByteString -> Maybe a
|
||||
parseSerialisableFromBase58 bs = maybe1 b58_1 Nothing fromCbor
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
extra-container.url = "github:erikarvstedt/extra-container";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
hbs2.url =
|
||||
"git+http://git.hbs2/BTThPdHKF8XnEq4m6wzbKHKA6geLFK4ydYhBXAqBdHSP?ref=dev-0.24.2";
|
||||
"git+http://git.hbs2/BTThPdHKF8XnEq4m6wzbKHKA6geLFK4ydYhBXAqBdHSP?rev=3b8f3d48f486043c7fa2df5990e5ab96b71996e1";
|
||||
hbs2.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
|
|
Loading…
Reference in New Issue