go-chainscript: github.com/stratumn/go-chainscript Index | Files | Directories

package chainscript

import "github.com/stratumn/go-chainscript"

Package chainscript contains the reference Go ChainScript implementation.

It provides helpers to manipulate ChainScript data structures conveniently and efficiently.

Index

Package Files

chainscript.pb.go const.go doc.go evidence.go link.go linkbuilder.go linkhash.go marshal.go proof.go segment.go signature.go

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.

func MarshalEvidence Uses

func MarshalEvidence(e *Evidence) ([]byte, error)

MarshalEvidence marshals using protobuf.

func MarshalLink(l *Link) ([]byte, error)

MarshalLink marshals using protobuf.

func MarshalSegment Uses

func MarshalSegment(s *Segment) ([]byte, error)

MarshalSegment marshals using protobuf.

type Evidence Uses

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 Uses

func NewEvidence(version, backend, provider string, proofData []byte) (*Evidence, error)

NewEvidence creates a new evidence that can be added to a segment.

func UnmarshalEvidence Uses

func UnmarshalEvidence(b []byte) (*Evidence, error)

UnmarshalEvidence unmarshals protobuf bytes.

func (*Evidence) Descriptor Uses

func (*Evidence) Descriptor() ([]byte, []int)

func (*Evidence) GetBackend Uses

func (m *Evidence) GetBackend() string

func (*Evidence) GetProof Uses

func (m *Evidence) GetProof() []byte

func (*Evidence) GetProvider Uses

func (m *Evidence) GetProvider() string

func (*Evidence) GetVersion Uses

func (m *Evidence) GetVersion() string

func (*Evidence) ProtoMessage Uses

func (*Evidence) ProtoMessage()

func (*Evidence) Reset Uses

func (m *Evidence) Reset()

func (*Evidence) String Uses

func (m *Evidence) String() string

func (*Evidence) Validate Uses

func (e *Evidence) Validate() error

Validate that the evidence is well-formed. The proof is opaque bytes so it isn't validated here.

func (*Evidence) XXX_DiscardUnknown Uses

func (m *Evidence) XXX_DiscardUnknown()

func (*Evidence) XXX_Marshal Uses

func (m *Evidence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Evidence) XXX_Merge Uses

func (dst *Evidence) XXX_Merge(src proto.Message)

func (*Evidence) XXX_Size Uses

func (m *Evidence) XXX_Size() int

func (*Evidence) XXX_Unmarshal Uses

func (m *Evidence) XXX_Unmarshal(b []byte) error
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(b []byte) (*Link, error)

UnmarshalLink unmarshals protobuf bytes.

func (*Link) Clone Uses

func (l *Link) Clone() (*Link, error)

Clone returns a copy of the link.

func (*Link) Descriptor Uses

func (*Link) Descriptor() ([]byte, []int)

func (*Link) GetData Uses

func (m *Link) GetData() []byte

func (*Link) GetMeta Uses

func (m *Link) GetMeta() *LinkMeta

func (*Link) GetSignatures Uses

func (m *Link) GetSignatures() []*Signature

func (*Link) GetVersion Uses

func (m *Link) GetVersion() string

func (*Link) Hash Uses

func (l *Link) Hash() (LinkHash, error)

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 Uses

func (l *Link) PrevLinkHash() LinkHash

PrevLinkHash returns the link's parent hash. If the link doesn't have a parent, it returns nil.

func (*Link) ProtoMessage Uses

func (*Link) ProtoMessage()

func (*Link) Reset Uses

func (m *Link) Reset()

func (*Link) Segmentify Uses

func (l *Link) Segmentify() (*Segment, error)

Segmentify returns a segment from a link, filling the link hash.

func (*Link) SetData Uses

func (l *Link) SetData(data interface{}) error

SetData uses the given object as link's custom data.

func (*Link) SetMetadata Uses

func (l *Link) SetMetadata(metadata interface{}) error

SetMetadata uses the given object as link's custom metadata.

func (*Link) Sign Uses

func (l *Link) Sign(privateKey []byte, payloadPath string) error

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 Uses

func (l *Link) SignedBytes(sigVersion, payloadPath string) ([]byte, error)

SignedBytes computes the bytes that should be signed. The signature version impacts how those bytes are computed.

func (*Link) String Uses

func (m *Link) String() string

func (*Link) StructurizeData Uses

func (l *Link) StructurizeData(data interface{}) error

StructurizeData deserializes the link's data into the given object. The provided argument should be a pointer to a struct.

func (*Link) StructurizeMetadata Uses

func (l *Link) StructurizeMetadata(metadata interface{}) error

StructurizeMetadata deserializes the link's metadata into the given object. The provided argument should be a pointer to a struct.

func (*Link) TagMap Uses

func (l *Link) TagMap() map[string]struct{}

TagMap returns the tags as a map of string to empty structs (a set). It makes it easier to test inclusion.

func (*Link) Validate Uses

func (l *Link) Validate(ctx context.Context) error

Validate checks for errors in a link.

func (*Link) XXX_DiscardUnknown Uses

func (m *Link) XXX_DiscardUnknown()

func (*Link) XXX_Marshal Uses

func (m *Link) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Link) XXX_Merge Uses

func (dst *Link) XXX_Merge(src proto.Message)

func (*Link) XXX_Size Uses

func (m *Link) XXX_Size() int

func (*Link) XXX_Unmarshal Uses

func (m *Link) XXX_Unmarshal(b []byte) error

type LinkBuilder Uses

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 Uses

func NewLinkBuilder(process string, mapID string) *LinkBuilder

NewLinkBuilder creates a new link builder.

func (*LinkBuilder) Build Uses

func (b *LinkBuilder) Build() (*Link, error)

Build returns the corresponding link or an error.

func (*LinkBuilder) WithAction Uses

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 Uses

func (b *LinkBuilder) WithData(data interface{}) *LinkBuilder

WithData uses the given object as link's custom data.

func (*LinkBuilder) WithDegree Uses

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 Uses

func (b *LinkBuilder) WithMetadata(data interface{}) *LinkBuilder

WithMetadata uses the given object as link's custom metadata.

func (*LinkBuilder) WithParent Uses

func (b *LinkBuilder) WithParent(linkHash LinkHash) *LinkBuilder

WithParent sets the link's parent, referenced by its hash.

func (*LinkBuilder) WithPriority Uses

func (b *LinkBuilder) WithPriority(priority float64) *LinkBuilder

WithPriority sets the link's priority.

func (*LinkBuilder) WithProcessState Uses

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 Uses

func (b *LinkBuilder) WithRefs(refs ...*LinkReference) *LinkBuilder

WithRefs references links that are related to the current link.

func (*LinkBuilder) WithStep Uses

func (b *LinkBuilder) WithStep(step string) *LinkBuilder

WithStep sets the specific process step represented by the link.

func (*LinkBuilder) WithTags Uses

func (b *LinkBuilder) WithTags(tags ...string) *LinkBuilder

WithTags adds some tags to the link.

type LinkHash Uses

type LinkHash []byte

LinkHash is a byte array for which we provide utility methods.

func NewLinkHashFromString Uses

func NewLinkHashFromString(lh string) (LinkHash, error)

NewLinkHashFromString decodes a string and returns a link hash.

func (LinkHash) String Uses

func (lh LinkHash) String() string

String encodes the link hash to a string.

type LinkMeta Uses

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 Uses

func (*LinkMeta) Descriptor() ([]byte, []int)

func (*LinkMeta) GetAction Uses

func (m *LinkMeta) GetAction() string

func (*LinkMeta) GetClientId Uses

func (m *LinkMeta) GetClientId() string

func (*LinkMeta) GetData Uses

func (m *LinkMeta) GetData() []byte

func (*LinkMeta) GetMapId Uses

func (m *LinkMeta) GetMapId() string

func (*LinkMeta) GetOutDegree Uses

func (m *LinkMeta) GetOutDegree() int32

func (*LinkMeta) GetPrevLinkHash Uses

func (m *LinkMeta) GetPrevLinkHash() []byte

func (*LinkMeta) GetPriority Uses

func (m *LinkMeta) GetPriority() float64

func (*LinkMeta) GetProcess Uses

func (m *LinkMeta) GetProcess() *Process

func (*LinkMeta) GetRefs Uses

func (m *LinkMeta) GetRefs() []*LinkReference

func (*LinkMeta) GetStep Uses

func (m *LinkMeta) GetStep() string

func (*LinkMeta) GetTags Uses

func (m *LinkMeta) GetTags() []string

func (*LinkMeta) ProtoMessage Uses

func (*LinkMeta) ProtoMessage()

func (*LinkMeta) Reset Uses

func (m *LinkMeta) Reset()

func (*LinkMeta) String Uses

func (m *LinkMeta) String() string

func (*LinkMeta) XXX_DiscardUnknown Uses

func (m *LinkMeta) XXX_DiscardUnknown()

func (*LinkMeta) XXX_Marshal Uses

func (m *LinkMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LinkMeta) XXX_Merge Uses

func (dst *LinkMeta) XXX_Merge(src proto.Message)

func (*LinkMeta) XXX_Size Uses

func (m *LinkMeta) XXX_Size() int

func (*LinkMeta) XXX_Unmarshal Uses

func (m *LinkMeta) XXX_Unmarshal(b []byte) error

type LinkReference Uses

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 Uses

func (*LinkReference) Descriptor() ([]byte, []int)

func (*LinkReference) GetLinkHash Uses

func (m *LinkReference) GetLinkHash() []byte

func (*LinkReference) GetProcess Uses

func (m *LinkReference) GetProcess() string

func (*LinkReference) ProtoMessage Uses

func (*LinkReference) ProtoMessage()

func (*LinkReference) Reset Uses

func (m *LinkReference) Reset()

func (*LinkReference) String Uses

func (m *LinkReference) String() string

func (*LinkReference) XXX_DiscardUnknown Uses

func (m *LinkReference) XXX_DiscardUnknown()

func (*LinkReference) XXX_Marshal Uses

func (m *LinkReference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LinkReference) XXX_Merge Uses

func (dst *LinkReference) XXX_Merge(src proto.Message)

func (*LinkReference) XXX_Size Uses

func (m *LinkReference) XXX_Size() int

func (*LinkReference) XXX_Unmarshal Uses

func (m *LinkReference) XXX_Unmarshal(b []byte) error

type Process Uses

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 Uses

func (*Process) Descriptor() ([]byte, []int)

func (*Process) GetName Uses

func (m *Process) GetName() string

func (*Process) GetState Uses

func (m *Process) GetState() string

func (*Process) ProtoMessage Uses

func (*Process) ProtoMessage()

func (*Process) Reset Uses

func (m *Process) Reset()

func (*Process) String Uses

func (m *Process) String() string

func (*Process) XXX_DiscardUnknown Uses

func (m *Process) XXX_DiscardUnknown()

func (*Process) XXX_Marshal Uses

func (m *Process) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Process) XXX_Merge Uses

func (dst *Process) XXX_Merge(src proto.Message)

func (*Process) XXX_Size Uses

func (m *Process) XXX_Size() int

func (*Process) XXX_Unmarshal Uses

func (m *Process) XXX_Unmarshal(b []byte) error

type Proof Uses

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 Uses

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 Uses

func UnmarshalSegment(b []byte) (*Segment, error)

UnmarshalSegment unmarshals protobuf bytes.

func (*Segment) AddEvidence Uses

func (s *Segment) AddEvidence(evidence *Evidence) error

AddEvidence adds an evidence to the segment.

func (*Segment) Descriptor Uses

func (*Segment) Descriptor() ([]byte, []int)

func (*Segment) FindEvidences Uses

func (s *Segment) FindEvidences(backend string) []*Evidence

FindEvidences finds all evidences from a specific backend.

func (*Segment) GetEvidence Uses

func (s *Segment) GetEvidence(backend, provider string) *Evidence

GetEvidence gets an evidence from a provider in a given backend.

func (m *Segment) GetLink() *Link

func (*Segment) GetMeta Uses

func (m *Segment) GetMeta() *SegmentMeta

func (*Segment) LinkHash Uses

func (s *Segment) LinkHash() LinkHash

LinkHash returns the link hash.

func (*Segment) ProtoMessage Uses

func (*Segment) ProtoMessage()

func (*Segment) Reset Uses

func (m *Segment) Reset()

func (*Segment) SetLinkHash Uses

func (s *Segment) SetLinkHash() error

SetLinkHash computes and sets the link hash.

func (*Segment) String Uses

func (m *Segment) String() string

func (*Segment) Validate Uses

func (s *Segment) Validate(ctx context.Context) error

Validate checks for errors in a segment

func (*Segment) XXX_DiscardUnknown Uses

func (m *Segment) XXX_DiscardUnknown()

func (*Segment) XXX_Marshal Uses

func (m *Segment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Segment) XXX_Merge Uses

func (dst *Segment) XXX_Merge(src proto.Message)

func (*Segment) XXX_Size Uses

func (m *Segment) XXX_Size() int

func (*Segment) XXX_Unmarshal Uses

func (m *Segment) XXX_Unmarshal(b []byte) error

type SegmentMeta Uses

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 Uses

func (*SegmentMeta) Descriptor() ([]byte, []int)

func (*SegmentMeta) GetEvidences Uses

func (m *SegmentMeta) GetEvidences() []*Evidence

func (*SegmentMeta) GetLinkHash Uses

func (m *SegmentMeta) GetLinkHash() []byte

func (*SegmentMeta) ProtoMessage Uses

func (*SegmentMeta) ProtoMessage()

func (*SegmentMeta) Reset Uses

func (m *SegmentMeta) Reset()

func (*SegmentMeta) String Uses

func (m *SegmentMeta) String() string

func (*SegmentMeta) XXX_DiscardUnknown Uses

func (m *SegmentMeta) XXX_DiscardUnknown()

func (*SegmentMeta) XXX_Marshal Uses

func (m *SegmentMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SegmentMeta) XXX_Merge Uses

func (dst *SegmentMeta) XXX_Merge(src proto.Message)

func (*SegmentMeta) XXX_Size Uses

func (m *SegmentMeta) XXX_Size() int

func (*SegmentMeta) XXX_Unmarshal Uses

func (m *SegmentMeta) XXX_Unmarshal(b []byte) error

type Signature Uses

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 Uses

func (*Signature) Descriptor() ([]byte, []int)

func (*Signature) GetPayloadPath Uses

func (m *Signature) GetPayloadPath() string

func (*Signature) GetPublicKey Uses

func (m *Signature) GetPublicKey() []byte

func (*Signature) GetSignature Uses

func (m *Signature) GetSignature() []byte

func (*Signature) GetType Uses

func (m *Signature) GetType() string

func (*Signature) GetVersion Uses

func (m *Signature) GetVersion() string

func (*Signature) ProtoMessage Uses

func (*Signature) ProtoMessage()

func (*Signature) Reset Uses

func (m *Signature) Reset()

func (*Signature) String Uses

func (m *Signature) String() string

func (*Signature) Validate Uses

func (s *Signature) Validate(l *Link) error

Validate the signature.

func (*Signature) XXX_DiscardUnknown Uses

func (m *Signature) XXX_DiscardUnknown()

func (*Signature) XXX_Marshal Uses

func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Signature) XXX_Merge Uses

func (dst *Signature) XXX_Merge(src proto.Message)

func (*Signature) XXX_Size Uses

func (m *Signature) XXX_Size() int

func (*Signature) XXX_Unmarshal Uses

func (m *Signature) XXX_Unmarshal(b []byte) error

Directories

PathSynopsis
chainscripttest
cmdPackage main defines the end-to-end compatibility tests.

Package chainscript imports 11 packages (graph) and is imported by 102 packages. Updated 2018-12-25. Refresh now. Tools for package owners.