Documentation ¶
Overview ¶
Package tfk implements the type-format-key encoding for SSB references.
See https://github.com/ssbc/envelope-spec/ ... encoding/tfk.md
Index ¶
Constants ¶
const ( TypeFeed uint8 = iota TypeMessage TypeBlob TypeDiffieHellmanKey )
Type are the type-format-key type values
const ( FormatFeedEd25519 uint8 = iota FormatFeedGabbyGrove )
These are the type-format-key feed format values
const ( FormatMessageSHA256 uint8 = iota FormatMessageGabbyGrove )
These are the type-format-key message format values
Variables ¶
var ( ErrTooShort = errors.New("ssb/tfk: data too short") ErrWrongType = errors.New("ssb/tfk: unexpected type value") ErrUnhandledFormat = errors.New("ssb/tfk: unhandled format value") )
Common errors
Functions ¶
Types ¶
type Feed ¶
type Feed struct {
// contains filtered or unexported fields
}
func (Feed) Feed ¶
Feed retruns the ssb-ref type after a successfull unmarshal. It returns a new copy to discourage tampering with the internal values of this reference.
func (*Feed) MarshalBinary ¶
MarshalBinary returns the type-format-key encoding for a feed.
func (*Feed) UnmarshalBinary ¶
UnmarshalBinary takes some data, unboxes the t-f-k and does some validity checks to make sure it's an understood feed reference.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
func MessageFromRef ¶
func MessageFromRef(r *refs.MessageRef) (*Message, error)
func (*Message) MarshalBinary ¶
MarshalBinary returns the type-format-key encoding for a message.
func (Message) Message ¶
func (msg Message) Message() *refs.MessageRef
Message retruns the ssb-ref type after a successfull unmarshal. It returns a new copy to discourage tampering with the internal values of this reference.
func (*Message) UnmarshalBinary ¶
UnmarshalBinary takes some data, unboxes the t-f-k and does some validity checks to make sure it's an understood message reference.