Binary Field Encodings (BFE) for Secure Scuttlebutt (SSB).
Go to file
glyph 02efcefe0a remove doc generation section 2022-09-23 13:53:37 +01:00
lib cleanup docs for multiclause functions and add examples 2022-09-23 13:45:59 +01:00
test formatting 2022-09-23 10:32:15 +01:00
.formatter.exs add elixir project files 2022-05-05 19:50:19 +02:00
.gitignore add lockfile to ignore list 2022-09-20 19:34:41 +01:00
README.md remove doc generation section 2022-09-23 13:53:37 +01:00
mix.exs update manifest 2022-09-19 16:39:48 +01:00

README.md

SsbBfe

Binary Field Encodings (BFE) for Secure Scuttlebutt (SSB).

See the SSB Binary Field Encodings Specification for details.

Encoding

SsbBfe.encode("@HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519")
<<0, 0, 28, 74, 178, 247, 141, 19, 234, 224, 126, 79, 231, 125, 37, 166, 185,
  241, 163, 95, 71, 50, 241, 245, 228, 86, 170, 70, 101, 140, 25, 167, 146,
105>>

Decoding

SsbBfe.decode(
  <<0, 0, 28, 74, 178, 247, 141, 19, 234, 224, 126, 79, 231, 125, 37, 166, 185,
    241, 163, 95, 71, 50, 241, 245, 228, 86, 170, 70, 101, 140, 25, 167, 146,
  105>>
)
"@HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519"

Supported Types

Elixir Types

Encoding of the following Elixir types is supported:

  • List
  • Map
  • Tuple
  • String
  • Boolean
  • Nil
  • Integer
  • Float

Note: encoding of structs is not supported. You may wish to convert your struct to amap and encode it that way.

Scuttlebutt Types

Encoding of the following Scuttlebutt types is supported:

  • Feed (classic)
  • Message (classic)
  • Blob
  • Signature
  • Private message (box, box2)

Note: encoding of URIs is not currently supported, nor are other formats such as Gabby Grove and Bendy Butt.

Installation

If available in Hex, the package can be installed by adding ssb_bfe to your list of dependencies in mix.exs:

def deps do
  [
    {:ssb_bfe, "~> 0.1.0"}
  ]
end

License

LGPL-3.0.