Crate ssb_json_msg_data

Source
Expand description

This crate implements the ssb legacy data format, i.e. the free-form data that forms the content of legacy messages.

Two encodings are implemented: the signing encoding, and the json transport encoding.

Modules§

json
This module implements the json encodings of the legacy ssb data format, both signing and json transport.
value
Data structures for storing and manipulating arbitrary legacy data.

Structs§

LegacyF64
A wrapper around f64 to indicate that the float is compatible with the ssb legacy message data model, i.e. it is neither an infinity, nor -0.0, nor a NaN.
WeirdEncodingIterator
An iterator that yields the bytes needed to compute a hash of some legacy data.

Functions§

is_i64_valid
Checks whether a given i64 is allowed for usage in ssb data (its absolute value is not larger than 2^53).
is_u64_valid
Checks whether a given u64 is allowed for usage in ssb data (it is not larger than 2^53).
legacy_length
Compute the length of some data. Note that this takes time linear in the length of the data, so you might want to use a WeirdEncodingIterator for computing hash and length in one go.
to_weird_encoding
Create an owned representation of the weird encoding used for hash computation of legacy ssb messages. The number of bytes yielded by this iterator coincides with the length of the data.