libp2p-hs-0.1.0.0: Haskell implementation of the libp2p networking stack
Safe HaskellNone
LanguageGHC2021

Network.LibP2P.Crypto.Protobuf

Description

Deterministic protobuf encoding for libp2p PublicKey/PrivateKey messages.

Hand-rolled encoding to guarantee deterministic output: - Minimal varint encoding - Fields in field number order (Type=1, Data=2) - All fields present, no extras

Synopsis

Documentation

encodePublicKey :: PublicKey -> ByteString Source #

Deterministic protobuf encoding of a PublicKey message.

Layout: Field 1 (Type): tag=0x08 (field 1, wire type 0=varint), value=keytype Field 2 (Data): tag=0x12 (field 2, wire type 2=length-delimited), length, bytes

decodePublicKey :: ByteString -> Either String PublicKey Source #

Decode a protobuf-encoded PublicKey message.