Documentation
¶
Index ¶
- Constants
- Variables
- func IsEveryoneVK(vk []byte) bool
- func NewObjectError(oid int, msg string) error
- func PONumDotForm(ponum int) string
- func PONumFromDotForm(dotform string) (int, error)
- func ReadExactly(s *bufio.Reader, to []byte) error
- type AccessDOTPermissionSet
- type BossWaveObject
- type DChain
- func (ro *DChain) AugmentBy(d *DOT)
- func (ro *DChain) CheckAllSigs() bool
- func (ro *DChain) ConvertToDChainHash() (*DChain, error)
- func (ro *DChain) GetAccessURIPermString() string
- func (ro *DChain) GetAccessURISuffix() (string, error)
- func (ro *DChain) GetChainHash() []byte
- func (ro *DChain) GetContent() []byte
- func (ro *DChain) GetDOT(num int) *DOT
- func (ro *DChain) GetDotHash(num int) []byte
- func (ro *DChain) GetGiverVK() []byte
- func (ro *DChain) GetMVK() []byte
- func (ro *DChain) GetRONum() int
- func (ro *DChain) GetReceiverVK() []byte
- func (ro *DChain) GetTTL() int
- func (ro *DChain) IsAccess() bool
- func (ro *DChain) IsElaborated() bool
- func (ro *DChain) IsPayloadObject() bool
- func (ro *DChain) NumHashes() int
- func (ro *DChain) SetDOT(num int, d *DOT)
- func (ro *DChain) UnElaborate()
- func (ro *DChain) WriteToStream(s io.Writer, fullObjNum bool) error
- type DOT
- func (ro *DOT) AddRevoker(rvk []byte)
- func (ro *DOT) Encode(sk []byte)
- func (ro *DOT) GetAccessURIMVK() []byte
- func (ro *DOT) GetAccessURISuffix() string
- func (ro *DOT) GetComment() string
- func (ro *DOT) GetContact() string
- func (ro *DOT) GetContent() []byte
- func (ro *DOT) GetCreated() *time.Time
- func (ro *DOT) GetExpiry() *time.Time
- func (ro *DOT) GetGiverVK() []byte
- func (ro *DOT) GetHash() []byte
- func (ro *DOT) GetPermString() string
- func (ro *DOT) GetPermissionSet() *AccessDOTPermissionSet
- func (ro *DOT) GetRONum() int
- func (ro *DOT) GetReceiverVK() []byte
- func (ro *DOT) GetRevokers() [][]byte
- func (ro *DOT) GetTTL() int
- func (ro *DOT) IsAccess() bool
- func (ro *DOT) IsPayloadObject() bool
- func (ro *DOT) OverrideSetSignatureValid()
- func (ro *DOT) SetAccessURI(mvk []byte, suffix string)
- func (ro *DOT) SetCanConsume(normal bool, plus bool, star bool)
- func (ro *DOT) SetCanList(value bool)
- func (ro *DOT) SetCanPublish(value bool)
- func (ro *DOT) SetCanTap(normal bool, plus bool, star bool)
- func (ro *DOT) SetComment(v string)
- func (ro *DOT) SetContact(v string)
- func (ro *DOT) SetCreation(time time.Time)
- func (ro *DOT) SetCreationToNow()
- func (ro *DOT) SetExpireFromNow(delta time.Duration)
- func (ro *DOT) SetExpiry(time time.Time)
- func (ro *DOT) SetPermString(v string) bool
- func (ro *DOT) SetPermission(key string, value string)
- func (ro *DOT) SetTTL(v int)
- func (ro *DOT) SigValid() bool
- func (ro *DOT) String() string
- func (ro *DOT) WriteToStream(s io.Writer, fullObjNum bool) error
- type Entity
- func (ro *Entity) AddRevoker(rvk []byte)
- func (ro *Entity) Encode()
- func (ro *Entity) FullString() string
- func (ro *Entity) GetComment() string
- func (ro *Entity) GetContact() string
- func (ro *Entity) GetContent() []byte
- func (ro *Entity) GetCreated() *time.Time
- func (ro *Entity) GetExpiry() *time.Time
- func (ro *Entity) GetRONum() int
- func (ro *Entity) GetRevokers() [][]byte
- func (ro *Entity) GetSK() []byte
- func (ro *Entity) GetSigningBlob() []byte
- func (ro *Entity) GetVK() []byte
- func (ro *Entity) IsPayloadObject() bool
- func (ro *Entity) OverrideSetSignatureValid()
- func (ro *Entity) SetCreationToNow()
- func (ro *Entity) SetExpiry(t time.Time)
- func (ro *Entity) SetSK(sk []byte)
- func (ro *Entity) SetVK(vk []byte)
- func (ro *Entity) SigValid() bool
- func (ro *Entity) StringKey() string
- func (ro *Entity) WriteToStream(s io.Writer, fullObjNum bool) error
- type Expiry
- type Frame
- func (f *Frame) AddHeader(k string, v string)
- func (f *Frame) AddHeaderB(k string, v []byte)
- func (f *Frame) AddPayloadObject(po PayloadObject)
- func (f *Frame) AddRoutingObject(ro RoutingObject)
- func (f *Frame) GetAllHeaders(k string) []string
- func (f *Frame) GetAllHeadersB(k string) [][]byte
- func (f *Frame) GetAllPOs() []PayloadObject
- func (f *Frame) GetAllROs() []RoutingObject
- func (f *Frame) GetFirstHeader(k string) (string, bool)
- func (f *Frame) GetFirstHeaderB(k string) ([]byte, bool)
- func (f *Frame) WriteToStream(s *bufio.Writer)
- type GenericPO
- type Header
- type ObjectError
- type OriginVK
- type POEntry
- type PayloadObject
- type PublishLimits
- type ROEntry
- type RoutingObject
- func LoadRoutingObject(ronum int, content []byte) (RoutingObject, error)
- func NewDChain(ronum int, content []byte) (rv RoutingObject, err error)
- func NewDOT(ronum int, content []byte) (rv RoutingObject, err error)
- func NewEntity(ronum int, content []byte) (RoutingObject, error)
- func NewExpiry(ronum int, content []byte) (RoutingObject, error)
- func NewOriginVK(ronum int, content []byte) (RoutingObject, error)
Constants ¶
const ( ROAccessDChainHash = 0x01 ROPermissionDChainHash = 0x11 ROAccessDChain = 0x02 ROPermissionDChain = 0x12 ROAccessDOT = 0x20 ROPermissionDOT = 0x21 ROEntity = 0x30 ROEntityWKey = 0x32 ROOriginVK = 0x31 ROExpiry = 0x40 )
const ( CmdHello = "helo" CmdPublish = "publ" CmdSubscribe = "subs" CmdPersist = "pers" CmdList = "list" CmdQuery = "quer" CmdTapSubscribe = "tsub" CmdTapQuery = "tque" CmdPutDot = "putd" CmdPutEntity = "pute" CmdPutChain = "putc" CmdMakeDot = "makd" CmdMakeEntity = "make" CmdMakeChain = "makc" CmdBuildChain = "bldc" CmdAddPrefDot = "adpd" CmdAddPrefChain = "adpc" CmdDelPrefDot = "dlpd" CmdDelPrefChain = "dlpc" CmdSetEntity = "sete" CmdResponse = "resp" CmdResult = "rslt" )
const SaneObjectSize = 16 * 1024 * 1024
We allocate buffers for objects. Lets not get too exciteable about how big an object we are willing to accept
Variables ¶
var RoutingObjectConstructor = map[int]func(ronum int, content []byte) (RoutingObject, error){ ROAccessDChain: NewDChain, ROAccessDChainHash: NewDChain, ROPermissionDChain: NewDChain, ROPermissionDChainHash: NewDChain, ROAccessDOT: NewDOT, ROPermissionDOT: NewDOT, ROEntity: NewEntity, ROOriginVK: NewOriginVK, ROExpiry: NewExpiry, }
RoutingObjectConstruct allows you to map a ROnum into a constructor that takes a binary representation and returns a Routing Object
Functions ¶
func NewObjectError ¶
NewObjectError constructs an ObjectError
func PONumDotForm ¶
func PONumFromDotForm ¶
Types ¶
type AccessDOTPermissionSet ¶
type AccessDOTPermissionSet struct {
CanPublish bool
CanConsume bool
CanConsumePlus bool
CanConsumeStar bool
CanTap bool
CanTapPlus bool
CanTapStar bool
CanList bool
}
func GetADPSFromPermString ¶
func GetADPSFromPermString(v string) *AccessDOTPermissionSet
func (*AccessDOTPermissionSet) GetPermString ¶
func (ps *AccessDOTPermissionSet) GetPermString() string
func (*AccessDOTPermissionSet) ReduceBy ¶
func (ps *AccessDOTPermissionSet) ReduceBy(rhs *AccessDOTPermissionSet)
type BossWaveObject ¶
type BossWaveObject interface {
IsPayloadObject() bool
}
func LoadBosswaveObject ¶
func LoadBosswaveObject(s io.Reader) (BossWaveObject, error)
LoadBosswaveObject loads an object from a reader. all objects will need to have the full length header
type DChain ¶
type DChain struct {
// contains filtered or unexported fields
}
DChain is a list of DOT hashes
func CreateDChain ¶
CreateDChain creates a dot chain from the given DOTs. The DOTs must have the hash field populated
func (*DChain) AugmentBy ¶
AugmentBy fills the given dot into the right position in the chain assuming it is referred to at all
func (*DChain) CheckAllSigs ¶
func (*DChain) ConvertToDChainHash ¶
ConvertToDChainHash creates a hash RO from a dchain RO that may or may not be fully elaborated. Note that there are shared resources in the result
func (*DChain) GetAccessURIPermString ¶
func (*DChain) GetAccessURISuffix ¶
func (*DChain) GetChainHash ¶
GetChainHash returns the hash of the chain
func (*DChain) GetContent ¶
GetContent returns the serialised content for this object
func (*DChain) GetDOT ¶
GetDOT returns the DOT at the given index if it has been stored in the chain, otherwise nil
func (*DChain) GetDotHash ¶
GetDotHash returns the dot hash at the specific index
func (*DChain) GetGiverVK ¶
func (*DChain) GetReceiverVK ¶
func (*DChain) IsElaborated ¶
IsElaborated returns true if the dot hashes are populated
func (*DChain) IsPayloadObject ¶
func (*DChain) UnElaborate ¶
func (ro *DChain) UnElaborate()
type DOT ¶
type DOT struct {
// contains filtered or unexported fields
}
DOT is a declaration of trust. This is a shared object that implements both an access dot and a permission dot
func CreateDOT ¶
CreateDOT is used to create a DOT from scratch. The DOT is incomplete until Encode() is called later.
func (*DOT) AddRevoker ¶
func (*DOT) Encode ¶
Encode will work out the content of the DOT based on the fields that have been set, and sign it with the given sk (must match the vk)
func (*DOT) GetAccessURIMVK ¶
GetAccessURIMVK gets the mvk if this is an access DOT
func (*DOT) GetAccessURISuffix ¶
GetAccessURISuffix returns the suffix if this is an access DOT
func (*DOT) GetComment ¶
func (*DOT) GetContact ¶
func (*DOT) GetContent ¶
GetContent returns the binary representation of the DOT if Encode has been called
func (*DOT) GetCreated ¶
func (*DOT) GetGiverVK ¶
GetGiverVK returns the verifying key of the entity that created this DOT
func (*DOT) GetHash ¶
GetHash returns the dot hash or panics if it has not been set by encoding/reading from stream etc.
func (*DOT) GetPermString ¶
GetPermString gets the human readable permission string for an access dot
func (*DOT) GetPermissionSet ¶
func (ro *DOT) GetPermissionSet() *AccessDOTPermissionSet
func (*DOT) GetReceiverVK ¶
GetReceiverVK gets the verifying key of the entity that is the recipient of trust in this DOT
func (*DOT) GetRevokers ¶
func (*DOT) IsPayloadObject ¶
func (*DOT) OverrideSetSignatureValid ¶
func (ro *DOT) OverrideSetSignatureValid()
OverrideSetSigValid sets this dots signature as valid without checking it this is used if the DOT is known good (say from the store)
func (*DOT) SetAccessURI ¶
SetAccessURI sets the URI of an Access DOT
func (*DOT) SetCanConsume ¶
SetCanConsume sets the consume privileges on an access dot
func (*DOT) SetCanList ¶
SetCanList sets the list capability on an access DOT
func (*DOT) SetCanPublish ¶
SetCanPublish sets the publish capability on an access DOT
func (*DOT) SetComment ¶
func (*DOT) SetContact ¶
func (*DOT) SetCreation ¶
SetCreation sets the creation timestamp on the DOT
func (*DOT) SetCreationToNow ¶
func (ro *DOT) SetCreationToNow()
SetCreationToNow sets the creation timestamp to the current time
func (*DOT) SetExpireFromNow ¶
SetExpireFromNow is a convenience function that sets the creation time to now, and sets the expiry to the given delta from the creation time
func (*DOT) SetPermString ¶
SetPermString sets the permissions of this (access) dot. it returns true on success, false if the string is bad or this was not an access dot
func (*DOT) SetPermission ¶
SetPermission sets the given key in a Permission DOT's table
func (*DOT) SigValid ¶
SigValid returns if the DOT's signature is valid. This only checks the signature on the first call, so the content must not change after encoding for this to be valid. As a plus it also verifies that the topic is sane
type Entity ¶
type Entity struct {
// contains filtered or unexported fields
}
func CreateLightEntity ¶
func CreateNewEntity ¶
func (*Entity) AddRevoker ¶
func (*Entity) FullString ¶
func (*Entity) GetComment ¶
func (*Entity) GetContact ¶
func (*Entity) GetContent ¶
func (*Entity) GetCreated ¶
func (*Entity) GetRevokers ¶
func (*Entity) GetSigningBlob ¶
GetSigningBlob returns the full entity, including the private key
func (*Entity) IsPayloadObject ¶
func (*Entity) OverrideSetSignatureValid ¶
func (ro *Entity) OverrideSetSignatureValid()
func (*Entity) SetCreationToNow ¶
func (ro *Entity) SetCreationToNow()
type Expiry ¶
type Expiry struct {
// contains filtered or unexported fields
}
func CreateNewExpiry ¶
func CreateNewExpiryFromNow ¶
func (*Expiry) GetContent ¶
func (*Expiry) IsPayloadObject ¶
type Frame ¶
func CreateFrame ¶
func (*Frame) AddHeaderB ¶
func (*Frame) AddPayloadObject ¶
func (f *Frame) AddPayloadObject(po PayloadObject)
func (*Frame) AddRoutingObject ¶
func (f *Frame) AddRoutingObject(ro RoutingObject)
func (*Frame) GetAllHeaders ¶
func (*Frame) GetAllHeadersB ¶
func (*Frame) GetAllPOs ¶
func (f *Frame) GetAllPOs() []PayloadObject
func (*Frame) GetAllROs ¶
func (f *Frame) GetAllROs() []RoutingObject
func (*Frame) WriteToStream ¶
type GenericPO ¶
type GenericPO struct {
// contains filtered or unexported fields
}
func (*GenericPO) GetContent ¶
type ObjectError ¶
ObjectError is thrown by object parsing function
func (ObjectError) Error ¶
func (oe ObjectError) Error() string
type OriginVK ¶
type OriginVK struct {
// contains filtered or unexported fields
}
func CreateOriginVK ¶
func (*OriginVK) GetContent ¶
func (*OriginVK) IsPayloadObject ¶
type PayloadObject ¶
PayloadObject is the interface that is common among all objects that appear in the payload block
func CreateOpaquePayloadObject ¶
func CreateOpaquePayloadObject(ponum int, content []byte) (PayloadObject, error)
func CreateOpaquePayloadObjectDF ¶
func CreateOpaquePayloadObjectDF(dotform string, content []byte) (PayloadObject, error)
func LoadPayloadObject ¶
func LoadPayloadObject(ponum int, content []byte) (PayloadObject, error)
type PublishLimits ¶
PublishLimits is an option found in an AccessDOT that governs the resources that may be used by messages authorised via the DOT
type ROEntry ¶
type ROEntry struct {
RO RoutingObject
RONum string
Length string
}
type RoutingObject ¶
type RoutingObject interface {
GetRONum() int
GetContent() []byte
WriteToStream(w io.Writer, fullObjNum bool) error
IsPayloadObject() bool
}
RoutingObject is the interface that is common among all objects that appear in the routing object block
func LoadRoutingObject ¶
func LoadRoutingObject(ronum int, content []byte) (RoutingObject, error)
LoadRoutingObject takes the ronum and the content and returns the object
func NewDChain ¶
func NewDChain(ronum int, content []byte) (rv RoutingObject, err error)
NewDChain deserialises a DChain from a byte array
func NewDOT ¶
func NewDOT(ronum int, content []byte) (rv RoutingObject, err error)
NewDOT constructs a DOT from its packed form
func NewOriginVK ¶
func NewOriginVK(ronum int, content []byte) (RoutingObject, error)