Documentation ¶
Overview ¶
Package chainscript contains the reference Go ChainScript implementation.
It provides helpers to manipulate ChainScript data structures conveniently and efficiently.
Index ¶
- Constants
- Variables
- func MarshalEvidence(e *Evidence) ([]byte, error)
- func MarshalLink(l *Link) ([]byte, error)
- func MarshalSegment(s *Segment) ([]byte, error)
- type Evidence
- func (*Evidence) Descriptor() ([]byte, []int)
- func (m *Evidence) GetBackend() string
- func (m *Evidence) GetProof() []byte
- func (m *Evidence) GetProvider() string
- func (m *Evidence) GetVersion() string
- func (*Evidence) ProtoMessage()
- func (m *Evidence) Reset()
- func (m *Evidence) String() string
- func (e *Evidence) Validate() error
- func (m *Evidence) XXX_DiscardUnknown()
- func (m *Evidence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Evidence) XXX_Merge(src proto.Message)
- func (m *Evidence) XXX_Size() int
- func (m *Evidence) XXX_Unmarshal(b []byte) error
- type Link
- func (l *Link) Clone() (*Link, error)
- func (*Link) Descriptor() ([]byte, []int)
- func (m *Link) GetData() []byte
- func (m *Link) GetMeta() *LinkMeta
- func (m *Link) GetSignatures() []*Signature
- func (m *Link) GetVersion() string
- func (l *Link) Hash() (LinkHash, error)
- func (l *Link) PrevLinkHash() LinkHash
- func (*Link) ProtoMessage()
- func (m *Link) Reset()
- func (l *Link) Segmentify() (*Segment, error)
- func (l *Link) SetData(data interface{}) error
- func (l *Link) SetMetadata(metadata interface{}) error
- func (l *Link) Sign(privateKey []byte, payloadPath string) error
- func (l *Link) SignedBytes(sigVersion, payloadPath string) ([]byte, error)
- func (m *Link) String() string
- func (l *Link) StructurizeData(data interface{}) error
- func (l *Link) StructurizeMetadata(metadata interface{}) error
- func (l *Link) TagMap() map[string]struct{}
- func (l *Link) Validate(ctx context.Context) error
- func (m *Link) XXX_DiscardUnknown()
- func (m *Link) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Link) XXX_Merge(src proto.Message)
- func (m *Link) XXX_Size() int
- func (m *Link) XXX_Unmarshal(b []byte) error
- type LinkBuilder
- func (b *LinkBuilder) Build() (*Link, error)
- func (b *LinkBuilder) WithAction(action string) *LinkBuilder
- func (b *LinkBuilder) WithData(data interface{}) *LinkBuilder
- func (b *LinkBuilder) WithDegree(d int) *LinkBuilder
- func (b *LinkBuilder) WithMetadata(data interface{}) *LinkBuilder
- func (b *LinkBuilder) WithParent(linkHash LinkHash) *LinkBuilder
- func (b *LinkBuilder) WithPriority(priority float64) *LinkBuilder
- func (b *LinkBuilder) WithProcessState(state string) *LinkBuilder
- func (b *LinkBuilder) WithRefs(refs ...*LinkReference) *LinkBuilder
- func (b *LinkBuilder) WithStep(step string) *LinkBuilder
- func (b *LinkBuilder) WithTags(tags ...string) *LinkBuilder
- type LinkHash
- type LinkMeta
- func (*LinkMeta) Descriptor() ([]byte, []int)
- func (m *LinkMeta) GetAction() string
- func (m *LinkMeta) GetClientId() string
- func (m *LinkMeta) GetData() []byte
- func (m *LinkMeta) GetMapId() string
- func (m *LinkMeta) GetOutDegree() int32
- func (m *LinkMeta) GetPrevLinkHash() []byte
- func (m *LinkMeta) GetPriority() float64
- func (m *LinkMeta) GetProcess() *Process
- func (m *LinkMeta) GetRefs() []*LinkReference
- func (m *LinkMeta) GetStep() string
- func (m *LinkMeta) GetTags() []string
- func (*LinkMeta) ProtoMessage()
- func (m *LinkMeta) Reset()
- func (m *LinkMeta) String() string
- func (m *LinkMeta) XXX_DiscardUnknown()
- func (m *LinkMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *LinkMeta) XXX_Merge(src proto.Message)
- func (m *LinkMeta) XXX_Size() int
- func (m *LinkMeta) XXX_Unmarshal(b []byte) error
- type LinkReference
- func (*LinkReference) Descriptor() ([]byte, []int)
- func (m *LinkReference) GetLinkHash() []byte
- func (m *LinkReference) GetProcess() string
- func (*LinkReference) ProtoMessage()
- func (m *LinkReference) Reset()
- func (m *LinkReference) String() string
- func (m *LinkReference) XXX_DiscardUnknown()
- func (m *LinkReference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *LinkReference) XXX_Merge(src proto.Message)
- func (m *LinkReference) XXX_Size() int
- func (m *LinkReference) XXX_Unmarshal(b []byte) error
- type Process
- func (*Process) Descriptor() ([]byte, []int)
- func (m *Process) GetName() string
- func (m *Process) GetState() string
- func (*Process) ProtoMessage()
- func (m *Process) Reset()
- func (m *Process) String() string
- func (m *Process) XXX_DiscardUnknown()
- func (m *Process) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Process) XXX_Merge(src proto.Message)
- func (m *Process) XXX_Size() int
- func (m *Process) XXX_Unmarshal(b []byte) error
- type Proof
- type Segment
- func (s *Segment) AddEvidence(evidence *Evidence) error
- func (*Segment) Descriptor() ([]byte, []int)
- func (s *Segment) FindEvidences(backend string) []*Evidence
- func (s *Segment) GetEvidence(backend, provider string) *Evidence
- func (m *Segment) GetLink() *Link
- func (m *Segment) GetMeta() *SegmentMeta
- func (s *Segment) LinkHash() LinkHash
- func (*Segment) ProtoMessage()
- func (m *Segment) Reset()
- func (s *Segment) SetLinkHash() error
- func (m *Segment) String() string
- func (s *Segment) Validate(ctx context.Context) error
- func (m *Segment) XXX_DiscardUnknown()
- func (m *Segment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Segment) XXX_Merge(src proto.Message)
- func (m *Segment) XXX_Size() int
- func (m *Segment) XXX_Unmarshal(b []byte) error
- type SegmentMeta
- func (*SegmentMeta) Descriptor() ([]byte, []int)
- func (m *SegmentMeta) GetEvidences() []*Evidence
- func (m *SegmentMeta) GetLinkHash() []byte
- func (*SegmentMeta) ProtoMessage()
- func (m *SegmentMeta) Reset()
- func (m *SegmentMeta) String() string
- func (m *SegmentMeta) XXX_DiscardUnknown()
- func (m *SegmentMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *SegmentMeta) XXX_Merge(src proto.Message)
- func (m *SegmentMeta) XXX_Size() int
- func (m *SegmentMeta) XXX_Unmarshal(b []byte) error
- type Signature
- func (*Signature) Descriptor() ([]byte, []int)
- func (m *Signature) GetPayloadPath() string
- func (m *Signature) GetPublicKey() []byte
- func (m *Signature) GetSignature() []byte
- func (m *Signature) GetType() string
- func (m *Signature) GetVersion() string
- func (*Signature) ProtoMessage()
- func (m *Signature) Reset()
- func (m *Signature) String() string
- func (s *Signature) Validate(l *Link) error
- func (m *Signature) XXX_DiscardUnknown()
- func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Signature) XXX_Merge(src proto.Message)
- func (m *Signature) XXX_Size() int
- func (m *Signature) XXX_Unmarshal(b []byte) error
Constants ¶
const ( // LinkVersion1_0_0 is the first version of the link encoding. // In that version we encode interfaces (link.data and link.meta.data) with // canonical JSON and hash the protobuf-encoded link bytes with SHA-256. LinkVersion1_0_0 = "1.0.0" // LinkVersion is the version used for new links. LinkVersion = LinkVersion1_0_0 )
const ( // SignatureVersion1_0_0 is the first version of the link signature. // In that version we use canonical JSON to encode the link parts. // We use JMESPATH to select what parts of the link need to be signed. // We use SHA-256 on the JSON-encoded bytes and sign the resulting hash. // We use github.com/stratumn/go-crypto's 1.0.0 release to produce the // signature (which uses PEM-encoded private keys). SignatureVersion1_0_0 = "1.0.0" // SignatureVersion is the version used for new signatures. SignatureVersion = SignatureVersion1_0_0 )
const ( // ClientID allows segment receivers to figure out how the segment was // encoded and can be decoded. ClientID = "github.com/stratumn/go-chainscript" )
Variables ¶
var ( ErrMissingVersion = errors.New("version is missing") ErrOutDegree = errors.New("cannot create link: parent has too many children") ErrUnknownLinkVersion = errors.New("unknown link version") ErrUnknownClientID = errors.New("link was created with a unknown client: can't deserialize it") )
Link errors.
var ( ErrMissingProcess = errors.New("link process is missing") ErrMissingMapID = errors.New("link map id is missing") ErrMissingLinkHash = errors.New("link hash is missing") ErrMissingLink = errors.New("link is missing") ErrInvalidPriority = errors.New("priority needs to be positive") )
Link errors.
var ( ErrLinkHashMismatch = errors.New("link hash from meta doesn't equal hashed link") ErrMissingBackend = errors.New("evidence backend is missing") ErrMissingProvider = errors.New("evidence provider is missing") ErrMissingProof = errors.New("evidence proof is missing") ErrDuplicateEvidence = errors.New("evidence already exists for the given backend and provider") )
Segment errors.
var ( ErrUnknownSignatureVersion = errors.New("unknown signature version") ErrInvalidSignature = errors.New("signature is invalid") )
Signature errors.
Functions ¶
func MarshalEvidence ¶
MarshalEvidence marshals using protobuf.
func MarshalSegment ¶
MarshalSegment marshals using protobuf.
Types ¶
type Evidence ¶
type Evidence struct { // Version of the evidence format. Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Identifier of the evidence type. // For example, in the case of a timestamp on the Bitcoin blockchain, // this would be "bitcoin". Backend string `protobuf:"bytes,10,opt,name=backend,proto3" json:"backend,omitempty"` // Instance of the backend used. // For example, in the case of a timestamp on the Bitcoin blockchain, // this would be the chain ID (to identify testnet from mainnet). Provider string `protobuf:"bytes,11,opt,name=provider,proto3" json:"provider,omitempty"` // Data that should be usable offline by any client wishing to validate // the evidence. // For backwards compatibility, you should update the evidence version // when the structure of this proof changes. Proof []byte `protobuf:"bytes,20,opt,name=proof,proto3" json:"proof,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Evidences can be used to externally verify a link's existence at a given moment in time. An evidence can be a proof of inclusion in a public blockchain, a timestamp signed by a trusted authority or anything that you trust to provide an immutable ordering of your process' steps.
func NewEvidence ¶
NewEvidence creates a new evidence that can be added to a segment.
func UnmarshalEvidence ¶
UnmarshalEvidence unmarshals protobuf bytes.
func (*Evidence) Descriptor ¶
func (*Evidence) GetBackend ¶
func (*Evidence) GetProvider ¶
func (*Evidence) GetVersion ¶
func (*Evidence) ProtoMessage ¶
func (*Evidence) ProtoMessage()
func (*Evidence) Validate ¶
Validate that the evidence is well-formed. The proof is opaque bytes so it isn't validated here.
func (*Evidence) XXX_DiscardUnknown ¶
func (m *Evidence) XXX_DiscardUnknown()
func (*Evidence) XXX_Marshal ¶
func (*Evidence) XXX_Unmarshal ¶
type Link ¶
type Link struct { // Version of the link format. // You can for example use the git tag of the code used to create the link. Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Data representing the process' step details. // For backwards compatibility, you should update the link version // in meta when the structure/encoding of this field changes. Data []byte `protobuf:"bytes,10,opt,name=data,proto3" json:"data,omitempty"` // Metadata associated to the process' step. // Some of this metadata is used to provide filtering options when // fetching links. Meta *LinkMeta `protobuf:"bytes,11,opt,name=meta,proto3" json:"meta,omitempty"` // (Optional) Signatures of configurable parts of the link. Signatures []*Signature `protobuf:"bytes,20,rep,name=signatures,proto3" json:"signatures,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A link is the immutable part of a segment. A link contains all the data that represents a process' step.
func UnmarshalLink ¶
UnmarshalLink unmarshals protobuf bytes.
func (*Link) Descriptor ¶
func (*Link) GetSignatures ¶
func (*Link) GetVersion ¶
func (*Link) Hash ¶
Hash serializes the link and computes a hash of the resulting bytes. The serialization and hashing algorithm used depend on the link version.
func (*Link) PrevLinkHash ¶
PrevLinkHash returns the link's parent hash. If the link doesn't have a parent, it returns nil.
func (*Link) ProtoMessage ¶
func (*Link) ProtoMessage()
func (*Link) Segmentify ¶
Segmentify returns a segment from a link, filling the link hash.
func (*Link) SetMetadata ¶
SetMetadata uses the given object as link's custom metadata.
func (*Link) Sign ¶
Sign configurable parts of the link with the current signature version. The payloadPath is used to select what parts of the link need to be signed with the given private key. If no payloadPath is provided, the whole link is signed.
func (*Link) SignedBytes ¶
SignedBytes computes the bytes that should be signed. The signature version impacts how those bytes are computed.
func (*Link) StructurizeData ¶
StructurizeData deserializes the link's data into the given object. The provided argument should be a pointer to a struct.
func (*Link) StructurizeMetadata ¶
StructurizeMetadata deserializes the link's metadata into the given object. The provided argument should be a pointer to a struct.
func (*Link) TagMap ¶
TagMap returns the tags as a map of string to empty structs (a set). It makes it easier to test inclusion.
func (*Link) XXX_DiscardUnknown ¶
func (m *Link) XXX_DiscardUnknown()
func (*Link) XXX_Unmarshal ¶
type LinkBuilder ¶
type LinkBuilder struct {
// contains filtered or unexported fields
}
LinkBuilder makes it easy to create links that adhere to the ChainScript spec. It provides valid default values for required fields and allows the user to set fields to valid values. Note that link builders are not thread safe. They are meant to build an object instance which is generally done in a single go routine.
func NewLinkBuilder ¶
func NewLinkBuilder(process string, mapID string) *LinkBuilder
NewLinkBuilder creates a new link builder.
func (*LinkBuilder) Build ¶
func (b *LinkBuilder) Build() (*Link, error)
Build returns the corresponding link or an error.
func (*LinkBuilder) WithAction ¶
func (b *LinkBuilder) WithAction(action string) *LinkBuilder
WithAction sets the link's action. The action is what caused the link to be created.
func (*LinkBuilder) WithData ¶
func (b *LinkBuilder) WithData(data interface{}) *LinkBuilder
WithData uses the given object as link's custom data.
func (*LinkBuilder) WithDegree ¶
func (b *LinkBuilder) WithDegree(d int) *LinkBuilder
WithDegree sets the maximum number of children a link is allowed to have. By default this is set to -1 to allow any number of children.
func (*LinkBuilder) WithMetadata ¶
func (b *LinkBuilder) WithMetadata(data interface{}) *LinkBuilder
WithMetadata uses the given object as link's custom metadata.
func (*LinkBuilder) WithParent ¶
func (b *LinkBuilder) WithParent(linkHash LinkHash) *LinkBuilder
WithParent sets the link's parent, referenced by its hash.
func (*LinkBuilder) WithPriority ¶
func (b *LinkBuilder) WithPriority(priority float64) *LinkBuilder
WithPriority sets the link's priority.
func (*LinkBuilder) WithProcessState ¶
func (b *LinkBuilder) WithProcessState(state string) *LinkBuilder
WithProcessState sets the state of the process. If your process can be represented as a state machine and the current link changes the state machine, it allows easy tracking of the process evolution.
func (*LinkBuilder) WithRefs ¶
func (b *LinkBuilder) WithRefs(refs ...*LinkReference) *LinkBuilder
WithRefs references links that are related to the current link.
func (*LinkBuilder) WithStep ¶
func (b *LinkBuilder) WithStep(step string) *LinkBuilder
WithStep sets the specific process step represented by the link.
func (*LinkBuilder) WithTags ¶
func (b *LinkBuilder) WithTags(tags ...string) *LinkBuilder
WithTags adds some tags to the link.
type LinkHash ¶
type LinkHash []byte
LinkHash is a byte array for which we provide utility methods.
func NewLinkHashFromString ¶
NewLinkHashFromString decodes a string and returns a link hash.
type LinkMeta ¶
type LinkMeta struct { // The Client ID should be set by the client code creating the link. // Use a unique ID that easily identifies your library, for example the // github url of your repository. ClientId string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3" json:"clientId,omitempty"` // Hash of the previous link (in the same process). PrevLinkHash []byte `protobuf:"bytes,10,opt,name=prev_link_hash,json=prevLinkHash,proto3" json:"prevLinkHash,omitempty"` // Priority of the link. // Can be used to order and filter search results. Priority float64 `protobuf:"fixed64,11,opt,name=priority,proto3" json:"priority,omitempty"` // References to related links (potentially in other processes). Refs []*LinkReference `protobuf:"bytes,12,rep,name=refs,proto3" json:"refs,omitempty"` // Maximum number of children the current link is allowed to have. // A reference doesn't count as a child, only usage of prev_link_hash // counts as a link child. // It is the application's responsibility to comply with this property. // If set to -1, the link can have as many children as it wants. // If set to 0, the link can't have any children. // If set to n > 0, the link can have at most n children. OutDegree int32 `protobuf:"varint,13,opt,name=out_degree,json=outDegree,proto3" json:"outDegree,omitempty"` // A link is a step in a given process. Process *Process `protobuf:"bytes,20,opt,name=process,proto3" json:"process,omitempty"` // A link always belongs to a specific map in that process. // A map is an instance of a process. MapId string `protobuf:"bytes,21,opt,name=map_id,json=mapId,proto3" json:"mapId,omitempty"` // (Optional) Action in the process that resulted in the link's creation. // Can be used to filter link search results. Action string `protobuf:"bytes,30,opt,name=action,proto3" json:"action,omitempty"` // (Optional) Step of the process that results from the action. // Can be used to help deserialize link data or filter link search results. Step string `protobuf:"bytes,31,opt,name=step,proto3" json:"step,omitempty"` // (Optional) Tags that can be used to filter link search results. Tags []string `protobuf:"bytes,32,rep,name=tags,proto3" json:"tags,omitempty"` // (Optional) Additional metadata needed by your business logic. // For backwards compatibility, you should update the link version when the // structure of this field changes. Data []byte `protobuf:"bytes,100,opt,name=data,proto3" json:"data,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Metadata associated to a process' step. Once included in a segment, this is immutable.
func (*LinkMeta) Descriptor ¶
func (*LinkMeta) GetClientId ¶
func (*LinkMeta) GetOutDegree ¶
func (*LinkMeta) GetPrevLinkHash ¶
func (*LinkMeta) GetPriority ¶
func (*LinkMeta) GetProcess ¶
func (*LinkMeta) GetRefs ¶
func (m *LinkMeta) GetRefs() []*LinkReference
func (*LinkMeta) ProtoMessage ¶
func (*LinkMeta) ProtoMessage()
func (*LinkMeta) XXX_DiscardUnknown ¶
func (m *LinkMeta) XXX_DiscardUnknown()
func (*LinkMeta) XXX_Marshal ¶
func (*LinkMeta) XXX_Unmarshal ¶
type LinkReference ¶
type LinkReference struct { // Hash of the referenced link. LinkHash []byte `protobuf:"bytes,1,opt,name=link_hash,json=linkHash,proto3" json:"linkHash,omitempty"` // Process containing the referenced link. Process string `protobuf:"bytes,10,opt,name=process,proto3" json:"process,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A reference to a link that can be in another process.
func (*LinkReference) Descriptor ¶
func (*LinkReference) Descriptor() ([]byte, []int)
func (*LinkReference) GetLinkHash ¶
func (m *LinkReference) GetLinkHash() []byte
func (*LinkReference) GetProcess ¶
func (m *LinkReference) GetProcess() string
func (*LinkReference) ProtoMessage ¶
func (*LinkReference) ProtoMessage()
func (*LinkReference) Reset ¶
func (m *LinkReference) Reset()
func (*LinkReference) String ¶
func (m *LinkReference) String() string
func (*LinkReference) XXX_DiscardUnknown ¶
func (m *LinkReference) XXX_DiscardUnknown()
func (*LinkReference) XXX_Marshal ¶
func (m *LinkReference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*LinkReference) XXX_Merge ¶
func (dst *LinkReference) XXX_Merge(src proto.Message)
func (*LinkReference) XXX_Size ¶
func (m *LinkReference) XXX_Size() int
func (*LinkReference) XXX_Unmarshal ¶
func (m *LinkReference) XXX_Unmarshal(b []byte) error
type Process ¶
type Process struct { // The name of the process. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // The current state of the process. State string `protobuf:"bytes,10,opt,name=state,proto3" json:"state,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A process represents a real-world process that is shared between multiple independent actors.
func (*Process) Descriptor ¶
func (*Process) ProtoMessage ¶
func (*Process) ProtoMessage()
func (*Process) XXX_DiscardUnknown ¶
func (m *Process) XXX_DiscardUnknown()
func (*Process) XXX_Marshal ¶
func (*Process) XXX_Unmarshal ¶
type Proof ¶
type Proof interface { // Time returns the timestamp (UNIX format) of the proof Time() uint64 // Verify the validity of the proof. // For most proof an input is required. For example, a proof containing a // merkle path would require the link's hash to verify that it is correctly // contained in the merkle path. Verify(interface{}) bool }
Proof is the generic interface an evidence's proof should implement.
type Segment ¶
type Segment struct { // The link is the immutable part of a segment. // It contains the details of the step. Link *Link `protobuf:"bytes,1,opt,name=link,proto3" json:"link,omitempty"` // The link can be enriched with potentially mutable metadata. Meta *SegmentMeta `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A segment describes an atomic step in your process.
func UnmarshalSegment ¶
UnmarshalSegment unmarshals protobuf bytes.
func (*Segment) AddEvidence ¶
AddEvidence adds an evidence to the segment.
func (*Segment) Descriptor ¶
func (*Segment) FindEvidences ¶
FindEvidences finds all evidences from a specific backend.
func (*Segment) GetEvidence ¶
GetEvidence gets an evidence from a provider in a given backend.
func (*Segment) GetMeta ¶
func (m *Segment) GetMeta() *SegmentMeta
func (*Segment) ProtoMessage ¶
func (*Segment) ProtoMessage()
func (*Segment) SetLinkHash ¶
SetLinkHash computes and sets the link hash.
func (*Segment) XXX_DiscardUnknown ¶
func (m *Segment) XXX_DiscardUnknown()
func (*Segment) XXX_Marshal ¶
func (*Segment) XXX_Unmarshal ¶
type SegmentMeta ¶
type SegmentMeta struct { // Hash of the segment's link. LinkHash []byte `protobuf:"bytes,1,opt,name=link_hash,json=linkHash,proto3" json:"linkHash,omitempty"` // Evidences produced for the segment's link. Evidences []*Evidence `protobuf:"bytes,10,rep,name=evidences,proto3" json:"evidences,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Segment metadata. This is the potentially mutable part of a segment. It contains some invariants (hash of the immutable link) and evidences for the link that can be produced after the link is created.
func (*SegmentMeta) Descriptor ¶
func (*SegmentMeta) Descriptor() ([]byte, []int)
func (*SegmentMeta) GetEvidences ¶
func (m *SegmentMeta) GetEvidences() []*Evidence
func (*SegmentMeta) GetLinkHash ¶
func (m *SegmentMeta) GetLinkHash() []byte
func (*SegmentMeta) ProtoMessage ¶
func (*SegmentMeta) ProtoMessage()
func (*SegmentMeta) Reset ¶
func (m *SegmentMeta) Reset()
func (*SegmentMeta) String ¶
func (m *SegmentMeta) String() string
func (*SegmentMeta) XXX_DiscardUnknown ¶
func (m *SegmentMeta) XXX_DiscardUnknown()
func (*SegmentMeta) XXX_Marshal ¶
func (m *SegmentMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SegmentMeta) XXX_Merge ¶
func (dst *SegmentMeta) XXX_Merge(src proto.Message)
func (*SegmentMeta) XXX_Size ¶
func (m *SegmentMeta) XXX_Size() int
func (*SegmentMeta) XXX_Unmarshal ¶
func (m *SegmentMeta) XXX_Unmarshal(b []byte) error
type Signature ¶
type Signature struct { // Version of the signature format. Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` // Signature algorithm used (for example, "EdDSA"). Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` // A description of the parts of the links that are signed. // This should unambiguously let the verifier recompute the signed payload // bytes from the link's content. PayloadPath string `protobuf:"bytes,10,opt,name=payload_path,json=payloadPath,proto3" json:"payloadPath,omitempty"` // Encoded signer's public key. // For backwards compatibility, you should update the signature version // or the signature type when changing the encoding used. PublicKey []byte `protobuf:"bytes,20,opt,name=public_key,json=publicKey,proto3" json:"publicKey,omitempty"` // Signature bytes. Signature []byte `protobuf:"bytes,21,opt,name=signature,proto3" json:"signature,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
A signature of configurable parts of a link. Different signature types and versions are allowed to sign different encodings of the data, but we recommend signing a hash of the protobuf-encoded bytes.
func (*Signature) Descriptor ¶
func (*Signature) GetPayloadPath ¶
func (*Signature) GetPublicKey ¶
func (*Signature) GetSignature ¶
func (*Signature) GetVersion ¶
func (*Signature) ProtoMessage ¶
func (*Signature) ProtoMessage()
func (*Signature) XXX_DiscardUnknown ¶
func (m *Signature) XXX_DiscardUnknown()
func (*Signature) XXX_Marshal ¶
func (*Signature) XXX_Unmarshal ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package main defines the end-to-end compatibility tests.
|
Package main defines the end-to-end compatibility tests. |