Documentation ¶
Index ¶
- Constants
- Variables
- type Blob
- func (v *Blob) BytesConsumed() int
- func (v Blob) Contains(c []byte) bool
- func (v Blob) ContainsString(s string) bool
- func (v *Blob) Equals(v2 *Blob) bool
- func (v Blob) MarshalBinary() ([]byte, error)
- func (v Blob) MarshalText() ([]byte, error)
- func (v *Blob) UnmarshalBinary(b []byte) error
- func (v *Blob) UnmarshalText(b []byte) error
- type ContentDescriptor
- type ContentLength
- func (c *ContentLength) BytesConsumed() int
- func (c *ContentLength) Equals(c2 *ContentLength) bool
- func (c ContentLength) MarshalBinary() ([]byte, error)
- func (c ContentLength) MarshalText() ([]byte, error)
- func (c *ContentLength) UnmarshalBinary(b []byte) error
- func (c *ContentLength) UnmarshalText(b []byte) error
- type ContentType
- type HashDescriptor
- type HashType
- type KeyDescriptor
- type KeyType
- type NodeType
- type QualifiedContent
- type QualifiedHash
- func (q *QualifiedHash) BytesConsumed() int
- func (q *QualifiedHash) Equals(other *QualifiedHash) bool
- func (q *QualifiedHash) MarshalString() (string, error)
- func (q *QualifiedHash) MarshalText() ([]byte, error)
- func (q *QualifiedHash) String() string
- func (q *QualifiedHash) UnmarshalBinary(b []byte) error
- func (q *QualifiedHash) UnmarshalText(b []byte) error
- func (q *QualifiedHash) Validate() error
- type QualifiedKey
- func (q *QualifiedKey) AsEntity() (*openpgp.Entity, error)
- func (q *QualifiedKey) BytesConsumed() int
- func (q *QualifiedKey) Equals(other *QualifiedKey) bool
- func (q *QualifiedKey) MarshalText() ([]byte, error)
- func (q *QualifiedKey) UnmarshalBinary(b []byte) error
- func (q *QualifiedKey) Validate() error
- type QualifiedSignature
- type SignatureDescriptor
- type SignatureType
- type Timestamp
- type TreeDepth
- type Version
Constants ¶
const ( // CurrentVersion is the Forest version that this library writes CurrentVersion Version = 1 // HashDigestLengthSHA512_256 is the length of the digest produced by the SHA512/256 hash algorithm HashDigestLengthSHA512_256 ContentLength = 32 )
const ( // MaxContentLength is the maximum representable content length in this // version of the Forest MaxContentLength = math.MaxUint16 )
Variables ¶
var ContentNames = map[ContentType]string{ ContentTypeUTF8String: "UTF-8", ContentTypeTwig: "Twig", }
var HashNames = map[HashType]string{ HashTypeNullHash: "NullHash", HashTypeSHA512: "SHA512", }
var KeyNames = map[KeyType]string{ KeyTypeNoKey: "None", KeyTypeOpenPGPRSA: "OpenPGP-RSA", }
var MultiByteSerializationOrder binary.ByteOrder = binary.BigEndian
MultiByteSerializationOrder defines the order in which multi-byte integers are serialized into binary
var NodeTypeNames = map[NodeType]string{ NodeTypeIdentity: "identity", NodeTypeCommunity: "community", NodeTypeReply: "reply", }
var SignatureNames = map[SignatureType]string{ SignatureTypeOpenPGPRSA: "OpenPGP-RSA", }
var ValidContentTypes = map[ContentType]struct{}{ ContentTypeUTF8String: struct{}{}, ContentTypeTwig: struct{}{}, }
var ValidHashTypes = map[HashType][]ContentLength{ HashTypeNullHash: []ContentLength{0}, HashTypeSHA512: []ContentLength{HashDigestLengthSHA512_256}, }
map to valid lengths
var ValidKeyTypes = map[KeyType]struct{}{ KeyTypeNoKey: struct{}{}, KeyTypeOpenPGPRSA: struct{}{}, }
var ValidNodeTypes = map[NodeType]struct{}{ NodeTypeIdentity: struct{}{}, NodeTypeCommunity: struct{}{}, NodeTypeReply: struct{}{}, }
var ValidSignatureTypes = map[SignatureType]struct{}{ SignatureTypeOpenPGPRSA: struct{}{}, }
Functions ¶
This section is empty.
Types ¶
type Blob ¶
type Blob []byte
Blob represents a quantity of arbitrary binary data in the Forest
func (*Blob) BytesConsumed ¶
func (Blob) ContainsString ¶
ContainsString checks if a substing exists in a Blob
func (Blob) MarshalBinary ¶
MarshalBinary converts the Blob into its binary representation
func (Blob) MarshalText ¶
func (*Blob) UnmarshalBinary ¶
UnmarshalBinary converts from the binary representation of a Blob back to its structured form
func (*Blob) UnmarshalText ¶
type ContentDescriptor ¶
type ContentDescriptor struct { Type ContentType `arbor:"order=0"` Length ContentLength `arbor:"order=1"` }
func NewContentDescriptor ¶
func NewContentDescriptor(t ContentType, length int) (*ContentDescriptor, error)
func (*ContentDescriptor) Equals ¶
func (d *ContentDescriptor) Equals(other *ContentDescriptor) bool
func (*ContentDescriptor) MarshalText ¶
func (d *ContentDescriptor) MarshalText() ([]byte, error)
func (*ContentDescriptor) Validate ¶
func (d *ContentDescriptor) Validate() error
type ContentLength ¶
type ContentLength uint16
ContentLength represents the length of a piece of data in the Forest
func NewContentLength ¶
func NewContentLength(size int) (*ContentLength, error)
func (*ContentLength) BytesConsumed ¶
func (c *ContentLength) BytesConsumed() int
func (*ContentLength) Equals ¶
func (c *ContentLength) Equals(c2 *ContentLength) bool
func (ContentLength) MarshalBinary ¶
func (c ContentLength) MarshalBinary() ([]byte, error)
MarshalBinary converts the ContentLength into its binary representation
func (ContentLength) MarshalText ¶
func (c ContentLength) MarshalText() ([]byte, error)
func (*ContentLength) UnmarshalBinary ¶
func (c *ContentLength) UnmarshalBinary(b []byte) error
UnmarshalBinary converts from the binary representation of a ContentLength back to its structured form
func (*ContentLength) UnmarshalText ¶
func (c *ContentLength) UnmarshalText(b []byte) error
type ContentType ¶
type ContentType genericType
const ( ContentTypeUTF8String ContentType = 1 ContentTypeTwig ContentType = 2 )
func (*ContentType) BytesConsumed ¶
func (t *ContentType) BytesConsumed() int
func (*ContentType) Equals ¶
func (t *ContentType) Equals(t2 *ContentType) bool
func (ContentType) MarshalBinary ¶
func (t ContentType) MarshalBinary() ([]byte, error)
func (ContentType) MarshalText ¶
func (t ContentType) MarshalText() ([]byte, error)
func (*ContentType) UnmarshalBinary ¶
func (t *ContentType) UnmarshalBinary(b []byte) error
type HashDescriptor ¶
type HashDescriptor struct { Type HashType `arbor:"order=0"` Length ContentLength `arbor:"order=1"` }
concrete descriptors
func NewHashDescriptor ¶
func NewHashDescriptor(t HashType, length int) (*HashDescriptor, error)
func (*HashDescriptor) Equals ¶
func (d *HashDescriptor) Equals(other *HashDescriptor) bool
func (*HashDescriptor) MarshalText ¶
func (d *HashDescriptor) MarshalText() ([]byte, error)
func (*HashDescriptor) UnmarshalText ¶
func (d *HashDescriptor) UnmarshalText(b []byte) error
func (*HashDescriptor) Validate ¶
func (d *HashDescriptor) Validate() error
type HashType ¶
type HashType genericType
func (*HashType) BytesConsumed ¶
func (HashType) MarshalBinary ¶
func (HashType) MarshalText ¶
func (*HashType) UnmarshalBinary ¶
func (*HashType) UnmarshalText ¶
type KeyDescriptor ¶
type KeyDescriptor struct { Type KeyType `arbor:"order=0"` Length ContentLength `arbor:"order=1"` }
func NewKeyDescriptor ¶
func NewKeyDescriptor(t KeyType, length int) (*KeyDescriptor, error)
func (*KeyDescriptor) Equals ¶
func (d *KeyDescriptor) Equals(other *KeyDescriptor) bool
func (*KeyDescriptor) MarshalText ¶
func (d *KeyDescriptor) MarshalText() ([]byte, error)
func (*KeyDescriptor) Validate ¶
func (d *KeyDescriptor) Validate() error
type KeyType ¶
type KeyType genericType
func (*KeyType) BytesConsumed ¶
func (KeyType) MarshalBinary ¶
func (KeyType) MarshalText ¶
func (*KeyType) UnmarshalBinary ¶
type NodeType ¶
type NodeType genericType
specialized types
func (*NodeType) BytesConsumed ¶
func (NodeType) MarshalBinary ¶
func (NodeType) MarshalText ¶
func (*NodeType) UnmarshalBinary ¶
type QualifiedContent ¶
type QualifiedContent struct { Descriptor ContentDescriptor `arbor:"order=0,recurse=serialize"` Blob `arbor:"order=1"` }
func NewQualifiedContent ¶
func NewQualifiedContent(t ContentType, content []byte) (*QualifiedContent, error)
NewQualifiedContent returns a valid QualifiedContent from the given data
func (*QualifiedContent) BytesConsumed ¶
func (q *QualifiedContent) BytesConsumed() int
func (*QualifiedContent) Equals ¶
func (q *QualifiedContent) Equals(other *QualifiedContent) bool
func (*QualifiedContent) MarshalText ¶
func (q *QualifiedContent) MarshalText() ([]byte, error)
func (*QualifiedContent) UnmarshalBinary ¶
func (q *QualifiedContent) UnmarshalBinary(b []byte) error
func (*QualifiedContent) Validate ¶
func (q *QualifiedContent) Validate() error
type QualifiedHash ¶
type QualifiedHash struct { Descriptor HashDescriptor `arbor:"order=0,recurse=serialize"` Blob `arbor:"order=1"` }
concrete qualified data types
func NewQualifiedHash ¶
func NewQualifiedHash(t HashType, content []byte) (*QualifiedHash, error)
NewQualifiedHash returns a valid QualifiedHash from the given data
func NullHash ¶
func NullHash() *QualifiedHash
func (*QualifiedHash) BytesConsumed ¶
func (q *QualifiedHash) BytesConsumed() int
func (*QualifiedHash) Equals ¶
func (q *QualifiedHash) Equals(other *QualifiedHash) bool
func (*QualifiedHash) MarshalString ¶
func (q *QualifiedHash) MarshalString() (string, error)
func (*QualifiedHash) MarshalText ¶
func (q *QualifiedHash) MarshalText() ([]byte, error)
func (*QualifiedHash) String ¶
func (q *QualifiedHash) String() string
String returns the output of MarshalString, but does not return an error.
func (*QualifiedHash) UnmarshalBinary ¶
func (q *QualifiedHash) UnmarshalBinary(b []byte) error
func (*QualifiedHash) UnmarshalText ¶
func (q *QualifiedHash) UnmarshalText(b []byte) error
func (*QualifiedHash) Validate ¶
func (q *QualifiedHash) Validate() error
type QualifiedKey ¶
type QualifiedKey struct { Descriptor KeyDescriptor `arbor:"order=0,recurse=serialize"` Blob `arbor:"order=1"` }
func NewQualifiedKey ¶
func NewQualifiedKey(t KeyType, content []byte) (*QualifiedKey, error)
NewQualifiedKey returns a valid QualifiedKey from the given data
func (*QualifiedKey) BytesConsumed ¶
func (q *QualifiedKey) BytesConsumed() int
func (*QualifiedKey) Equals ¶
func (q *QualifiedKey) Equals(other *QualifiedKey) bool
func (*QualifiedKey) MarshalText ¶
func (q *QualifiedKey) MarshalText() ([]byte, error)
func (*QualifiedKey) UnmarshalBinary ¶
func (q *QualifiedKey) UnmarshalBinary(b []byte) error
func (*QualifiedKey) Validate ¶
func (q *QualifiedKey) Validate() error
type QualifiedSignature ¶
type QualifiedSignature struct { Descriptor SignatureDescriptor `arbor:"order=0,recurse=serialize"` Blob `arbor:"order=1"` }
func NewQualifiedSignature ¶
func NewQualifiedSignature(t SignatureType, content []byte) (*QualifiedSignature, error)
NewQualifiedSignature returns a valid QualifiedSignature from the given data
func (*QualifiedSignature) BytesConsumed ¶
func (q *QualifiedSignature) BytesConsumed() int
func (*QualifiedSignature) Equals ¶
func (q *QualifiedSignature) Equals(other *QualifiedSignature) bool
func (*QualifiedSignature) MarshalText ¶
func (q *QualifiedSignature) MarshalText() ([]byte, error)
func (*QualifiedSignature) UnmarshalBinary ¶
func (q *QualifiedSignature) UnmarshalBinary(b []byte) error
func (*QualifiedSignature) Validate ¶
func (q *QualifiedSignature) Validate() error
type SignatureDescriptor ¶
type SignatureDescriptor struct { Type SignatureType `arbor:"order=0"` Length ContentLength `arbor:"order=1"` }
func NewSignatureDescriptor ¶
func NewSignatureDescriptor(t SignatureType, length int) (*SignatureDescriptor, error)
func (*SignatureDescriptor) Equals ¶
func (d *SignatureDescriptor) Equals(other *SignatureDescriptor) bool
func (*SignatureDescriptor) MarshalText ¶
func (d *SignatureDescriptor) MarshalText() ([]byte, error)
func (*SignatureDescriptor) Validate ¶
func (d *SignatureDescriptor) Validate() error
type SignatureType ¶
type SignatureType genericType
const (
SignatureTypeOpenPGPRSA SignatureType = 1
)
func (*SignatureType) BytesConsumed ¶
func (t *SignatureType) BytesConsumed() int
func (*SignatureType) Equals ¶
func (t *SignatureType) Equals(t2 *SignatureType) bool
func (SignatureType) MarshalBinary ¶
func (t SignatureType) MarshalBinary() ([]byte, error)
func (SignatureType) MarshalText ¶
func (t SignatureType) MarshalText() ([]byte, error)
func (*SignatureType) UnmarshalBinary ¶
func (t *SignatureType) UnmarshalBinary(b []byte) error
type Timestamp ¶
type Timestamp uint64
Timestamp represents the time at which a node was created. It is measured as milliseconds since the start of the UNIX epoch.
func TimestampFrom ¶
func (*Timestamp) BytesConsumed ¶
func (Timestamp) MarshalBinary ¶
MarshalBinary converts the Timestamp into its binary representation
func (Timestamp) MarshalText ¶
func (*Timestamp) UnmarshalBinary ¶
UnmarshalBinary converts from the binary representation of a Timestamp back to its structured form
type TreeDepth ¶
type TreeDepth uint32
TreeDepth represents the depth of a node within a tree
func (*TreeDepth) BytesConsumed ¶
func (TreeDepth) MarshalBinary ¶
MarshalBinary converts the TreeDepth into its binary representation
func (TreeDepth) MarshalText ¶
func (*TreeDepth) UnmarshalBinary ¶
UnmarshalBinary converts from the binary representation of a TreeDepth back to its structured form
type Version ¶
type Version uint16
Version represents the version of the Arbor Forest Schema used to construct a particular node
func (*Version) BytesConsumed ¶
func (Version) MarshalBinary ¶
MarshalBinary converts the Version into its binary representation
func (Version) MarshalText ¶
func (*Version) UnmarshalBinary ¶
UnmarshalBinary converts from the binary representation of a Version back to its structured form