Documentation ¶
Index ¶
- func DefaultVersionString(in FORMAT) string
- func Digest(data []byte, code derivation.Code) ([]byte, error)
- func DigestString(data []byte, code derivation.Code) (string, error)
- func MarshalReceipt(rct *Event, sig derivation.Derivation) ([]byte, error)
- func NextDigest(threshold string, code derivation.Code, keys ...prefix.Prefix) (string, error)
- func Serialize(e *Event, to FORMAT) ([]byte, error)
- func VersionString(in FORMAT, keriVer string, size int) string
- type Attachment
- type AttachmentParser
- type Couplet
- type Event
- func Deserialize(data []byte, from FORMAT) (*Event, error)
- func NewEvent(opts ...EventOption) (*Event, error)
- func NewInceptionEvent(opts ...EventOption) (*Event, error)
- func NewInteractionEvent(opts ...EventOption) (*Event, error)
- func NewRotationEvent(opts ...EventOption) (*Event, error)
- func UnmarshalReceipt(d []byte) (*Event, derivation.Derivation, error)
- func (e *Event) GetDigest() (string, error)
- func (e *Event) ILK() ILK
- func (e *Event) IsEstablishment() bool
- func (e *Event) KeyDerivation(index int) (*derivation.Derivation, error)
- func (e *Event) MarshalJSON() ([]byte, error)
- func (e *Event) NextDigest(code derivation.Code) (string, error)
- func (e *Event) SequenceInt() int
- func (e *Event) Serialize() ([]byte, error)
- func (e *Event) WitnessDerivation(index int) (*derivation.Derivation, error)
- type EventOption
- func WithDefaultVersion(in FORMAT) EventOption
- func WithDigest(digest string) EventOption
- func WithKeys(keys ...prefix.Prefix) EventOption
- func WithMultiWeightedThesholds(thresholds ...[]string) EventOption
- func WithNext(threshold string, code derivation.Code, keys ...prefix.Prefix) EventOption
- func WithPrefix(prefix string) EventOption
- func WithSeals(seals SealArray) EventOption
- func WithSequence(sequence int) EventOption
- func WithThreshold(threshold int64) EventOption
- func WithType(eventType ILK) EventOption
- func WithWeightedTheshold(conditions ...string) EventOption
- func WithWitnessThreshold(threshold int) EventOption
- func WithWitnesses(keys ...prefix.Prefix) EventOption
- type FORMAT
- type ILK
- type Message
- type MessageOption
- type Quadlet
- type Receipt
- type ReceiptOpt
- type Seal
- func NewDigestSeal(dig string) (*Seal, error)
- func NewEventLocationSeal(dig, pre, sn string, ilk ILK) (*Seal, error)
- func NewEventSeal(dig, pre, sn string) (*Seal, error)
- func NewRootSeal(rt string) (*Seal, error)
- func NewSeal(typ SealType, opts ...SealOption) (*Seal, error)
- func SealEstablishment(evt *Event) (*Seal, error)
- type SealArray
- type SealOption
- type SealType
- type SigThreshold
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultVersionString ¶
DefaultVersionString returns a weGetDigestll formated version string for the provided format, with 0s for size
func Digest ¶
func Digest(data []byte, code derivation.Code) ([]byte, error)
Digest returns the raw derived data of code for provided data
func DigestString ¶
func DigestString(data []byte, code derivation.Code) (string, error)
DigestString returns a prefix for the provided data
func MarshalReceipt ¶
func MarshalReceipt(rct *Event, sig derivation.Derivation) ([]byte, error)
func NextDigest ¶
Types ¶
type Attachment ¶
type Attachment struct { Code derivation.CountCode Signatures []derivation.Derivation TransferableReceipts []*Quadlet NonTransferableReceipts []*Couplet WitnessReceipts []*Couplet }
func ParseAttached ¶
func ParseAttached(c derivation.CountCode, buf io.Reader) (*Attachment, error)
func ParseAttachment ¶
func ParseAttachment(rd io.Reader) (*Attachment, error)
type AttachmentParser ¶
type AttachmentParser func(buf io.Reader) ([]derivation.Derivation, error)
type Couplet ¶
type Couplet struct { Prefix *derivation.Derivation Signature *derivation.Derivation }
type Event ¶
type Event struct { Version string `json:"v"` Prefix string `json:"i,omitempty"` Sequence string `json:"s,omitempty"` EventType string `json:"t"` EventDigest string `json:"d,omitempty"` PriorEventDigest string `json:"p,omitempty"` SigThreshold *SigThreshold `json:"kt,omitempty"` Keys []string `json:"k,omitempty"` Next string `json:"n,omitempty"` WitnessThreshold string `json:"wt,omitempty"` Witnesses []string `json:"w,omitempty"` AddWitness []string `json:"wa,omitempty"` RemoveWitness []string `json:"wr,omitempty"` Config []prefix.Trait `json:"c,omitempty" cbor:",omitempty"` Seals SealArray `json:"a,omitempty"` DelegatorSeal *Seal `json:"da,omitempty"` LastEvent *Seal `json:"e,omitempty"` LastEstablishment *Seal `json:"ee,omitempty"` // contains filtered or unexported fields }
func NewEvent ¶
func NewEvent(opts ...EventOption) (*Event, error)
NewEvent returns a new event with the specified options applied
func NewInceptionEvent ¶
func NewInceptionEvent(opts ...EventOption) (*Event, error)
NewInceptionEvent returns and incpetion configured with the provided parameters New Inception Events will have empty 'v' and 'i' strings
func NewInteractionEvent ¶
func NewInteractionEvent(opts ...EventOption) (*Event, error)
NewRotationEvent returns and incpetion configured with the provided parameters New Rotation Events will have empty 'v' and 'i' strings
func NewRotationEvent ¶
func NewRotationEvent(opts ...EventOption) (*Event, error)
NewRotationEvent returns and incpetion configured with the provided parameters New Rotation Events will have empty 'v' and 'i' strings
func UnmarshalReceipt ¶
func UnmarshalReceipt(d []byte) (*Event, derivation.Derivation, error)
func (*Event) IsEstablishment ¶
func (*Event) KeyDerivation ¶
func (e *Event) KeyDerivation(index int) (*derivation.Derivation, error)
KeyDerivation returns a dervation for the key prefix at the provided index
func (*Event) MarshalJSON ¶
MarshalJSON interface implementation. not all events requrie all fields, and some event types requrie empty arrays in place of null values. This allows us to correctly marhsal the Event data to JSON
func (*Event) NextDigest ¶
func (e *Event) NextDigest(code derivation.Code) (string, error)
NextDigest returns the calculated next digest for the event
func (*Event) SequenceInt ¶
SequenceInt returns an integer representation of the hex sequence string
func (*Event) Serialize ¶
Serialize returns a byte array of the current event serialized according to its Version
func (*Event) WitnessDerivation ¶
func (e *Event) WitnessDerivation(index int) (*derivation.Derivation, error)
WitnessDerivation returns a dervation for the key prefix at the provided index
type EventOption ¶
func WithDefaultVersion ¶
func WithDefaultVersion(in FORMAT) EventOption
func WithDigest ¶
func WithDigest(digest string) EventOption
WithDigest sets the digest for the event
func WithKeys ¶
func WithKeys(keys ...prefix.Prefix) EventOption
WithKeys sets the keys that are applicable for the event
func WithMultiWeightedThesholds ¶
func WithMultiWeightedThesholds(thresholds ...[]string) EventOption
WithMultiWeightedThesholds sets multiple weighted signing thresholds using provided string values.
func WithNext ¶
func WithNext(threshold string, code derivation.Code, keys ...prefix.Prefix) EventOption
WithNext keys must be self adressing prefixs. Do not use a basic prefix otherwise the public key data will be exposed in the log breaking post-quantum security. To support multi-sig, next is a prefix of the commitment to a signing threshold along with all of the keys to be rotated to, combined using XOR. Each of the provided keys, along with the derivation to use for the next, must use the same derivaiton code.
func WithPrefix ¶
func WithPrefix(prefix string) EventOption
func WithSeals ¶
func WithSeals(seals SealArray) EventOption
func WithSequence ¶
func WithSequence(sequence int) EventOption
/ WithSequence sets the sequence number for this event
func WithThreshold ¶
func WithThreshold(threshold int64) EventOption
WithThreshold sets the key threshold
func WithWeightedTheshold ¶
func WithWeightedTheshold(conditions ...string) EventOption
WithWeightedTheshold sets a weighted signing threshold using provided string int or fraction values. The total for all conditions must be >= 1 otherwise the threshold can not be met. The order in which the conditions are provided is important: they map to the specific key index in the keys list, e.g, the second condition provided to this configuration function would be the weight of a signature by the second key in the keys list.
func WithWitnessThreshold ¶
func WithWitnessThreshold(threshold int) EventOption
WithWitnessThreshold sets the witness duplicity threshold for the event
func WithWitnesses ¶
func WithWitnesses(keys ...prefix.Prefix) EventOption
WithWitnesses sets the witness keys for the event
type FORMAT ¶
type FORMAT int
EDS stands for Extracted Data Set format that is used to create cryptographic digests
and signatures for Events but does not have to be deserialized therefore does not have to preserve symantic structure.
func FormatFromVersion ¶
FormatFromVersion returns the message format parsed from the given version string
type ILK ¶
type ILK int
func (ILK) Establishment ¶
Establishment returns true if the ILK is an establishment event type
type Message ¶
type Message struct { Event *Event Signatures []derivation.Derivation TransferableReceipts []*Receipt NonTransferableReceipts []*Receipt WitnessReceipts []*Receipt }
an event message holds the deserialized event along with the provided signature
func NewMessage ¶
func NewMessage(evt *Event, opts ...MessageOption) (*Message, error)
type MessageOption ¶
func WithNonTransferableReceipts ¶
func WithNonTransferableReceipts(couples []*Couplet) MessageOption
func WithSignatures ¶
func WithSignatures(sigs []derivation.Derivation) MessageOption
func WithTransferableReceipts ¶
func WithTransferableReceipts(quads []*Quadlet) MessageOption
func WithWitnessReceipts ¶
func WithWitnessReceipts(couples []*Couplet) MessageOption
type Quadlet ¶
type Quadlet struct { Prefix *derivation.Derivation Signature *derivation.Derivation Digest *derivation.Derivation Sequence int }
type Receipt ¶
type Receipt struct { Prefix string Digest string Sequence int RctType ILK Signature *derivation.Derivation //The Signature of the receipted event EstPrefix string // The Witness Identifier Prefix for Receipt Signatures (Transferable and Non-Transferable) EstSequence int // The sn of Latest Establishment Event for Transferable Receipt signatures EstDigest string // The dig of Latest Establishment Event for Transferable Receipt signatures // contains filtered or unexported fields }
func NewReceipt ¶
func NewReceipt(evt *Event, opts ...ReceiptOpt) (*Receipt, error)
type ReceiptOpt ¶
func WithEstablishmentEvent ¶
func WithEstablishmentEvent(est *Event) ReceiptOpt
func WithEstablishmentSeal ¶
func WithEstablishmentSeal(s *Seal) ReceiptOpt
func WithQB64 ¶
func WithQB64(qb64 []byte) ReceiptOpt
func WithSignature ¶
func WithSignature(der *derivation.Derivation) ReceiptOpt
func WithSignerPrefix ¶
func WithSignerPrefix(pre string) ReceiptOpt
type Seal ¶
type Seal struct { Type SealType `json:"-"` Root string `json:"rd,omitempty"` Prefix string `json:"i,omitempty"` Sequence string `json:"s,omitempty"` EventType string `json:"t,omitempty"` Digest string `json:"d,omitempty"` }
Seal is used to anchor particular data to an event There are multiple types of seals, each with a different combination of data points.
func NewDigestSeal ¶
func NewEventSeal ¶
func NewRootSeal ¶
func SealEstablishment ¶
func (*Seal) SequenceInt ¶
SequenceInt returns an integer representation of the hex sequence string
type SealArray ¶
type SealArray []*Seal
func (*SealArray) MarshalJSON ¶
func (*SealArray) UnmarshalJSON ¶
type SealOption ¶
func WithRoot ¶
func WithRoot(rt string) SealOption
func WithSealDigest ¶
func WithSealDigest(dig string) SealOption
func WithSealEventType ¶
func WithSealEventType(eventType ILK) SealOption
func WithSealPrefix ¶
func WithSealPrefix(pre string) SealOption
func WithSealSequence ¶
func WithSealSequence(sn string) SealOption
type SigThreshold ¶
type SigThreshold struct {
// contains filtered or unexported fields
}
func NewMultiWeighted ¶
func NewMultiWeighted(conditions ...[]string) (*SigThreshold, error)
NewMultiWeighted creates a new signing threshold with multiple conditions
func NewSigThreshold ¶
func NewSigThreshold(threshold int64) (*SigThreshold, error)
New returns a signing threshold requiring 'threshold' signatures
func NewWeighted ¶
func NewWeighted(conditions ...string) (*SigThreshold, error)
NewWeighted creates a new sighing threshold with a weighted multisig
func (*SigThreshold) MarshalJSON ¶
func (s *SigThreshold) MarshalJSON() ([]byte, error)
MarshalJSON is used to correctly output the JSON since this field can contain a single int, a list, or a list of lists
func (*SigThreshold) Satisfied ¶
func (s *SigThreshold) Satisfied(sigs []derivation.Derivation) bool
Satisfied takes the provided signature derivations and checkes each weighted threshold
func (*SigThreshold) String ¶
func (s *SigThreshold) String() string
String returns the threshold as a raw string representation sufficient for use in the next digest commitment
func (*SigThreshold) UnmarshalJSON ¶
func (s *SigThreshold) UnmarshalJSON(in []byte) error
func (*SigThreshold) Weighted ¶
func (s *SigThreshold) Weighted() bool
returns true if this is a weighted threshold - i.e. there is one or more lists of weights