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 FormatFeedBamboo FormatFeedBendyButt FormatFeedFusionIdentity )
These are the type-format-key feed format values
const ( FormatMessageSHA256 uint8 = iota FormatMessageGabbyGrove FormatMessageCloaked FormatMessageBamboo FormatMessageMetaFeed )
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 ¶
func Encode ¶
Encode returns type-format-key bytes for supported references. Currently only *refs.MessageRef and *refs.FeedRef
func IsValidFeedFormat ¶ added in v0.4.0
IsValidFeedFormat returns true if the passed format is a valid feed format
func IsValidMessageFormat ¶ added in v0.4.0
IsValidMessageFormat returns true if the passed format is a valid message format
Types ¶
type Feed ¶
type Feed struct {
// contains filtered or unexported fields
}
Feed represents a reference to a feed
func FeedFromRef ¶
FeedFromRef creates a new tfk reference for serialization from a plain reference
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
}
Message represents a reference to a message
func MessageFromRef ¶
func MessageFromRef(r refs.MessageRef) (*Message, error)
MessageFromRef creates a new tfk reference for serialization from a plain reference
func (*Message) MarshalBinary ¶
MarshalBinary returns the type-format-key encoding for a message.
func (Message) Message ¶
func (msg Message) Message() (refs.MessageRef, error)
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.