commands

package
Version: v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2019 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package commands define command types used by coconut server.

Index

Constants

This section is empty.

Variables

View Source
var StatusCode_name = map[int32]string{
	0:  "OK",
	1:  "UNKNOWN",
	2:  "INVALID_COMMAND",
	3:  "INVALID_ARGUMENTS",
	4:  "PROCESSING_ERROR",
	5:  "NOT_IMPLEMENTED",
	6:  "REQUEST_TIMEOUT",
	7:  "UNAVAILABLE",
	8:  "INVALID_TRANSACTION",
	9:  "INVALID_BINDING",
	10: "INVALID_SIGNATURE",
	11: "TX_NOT_ON_CHAIN",
	12: "NOT_PROCESSED_YET",
	13: "DOUBLE_SPENDING_ATTEMPT",
}
View Source
var StatusCode_value = map[string]int32{
	"OK":                      0,
	"UNKNOWN":                 1,
	"INVALID_COMMAND":         2,
	"INVALID_ARGUMENTS":       3,
	"PROCESSING_ERROR":        4,
	"NOT_IMPLEMENTED":         5,
	"REQUEST_TIMEOUT":         6,
	"UNAVAILABLE":             7,
	"INVALID_TRANSACTION":     8,
	"INVALID_BINDING":         9,
	"INVALID_SIGNATURE":       10,
	"TX_NOT_ON_CHAIN":         11,
	"NOT_PROCESSED_YET":       12,
	"DOUBLE_SPENDING_ATTEMPT": 13,
}

Functions

func CommandToMarshalledPacket

func CommandToMarshalledPacket(cmd Command) ([]byte, error)

CommandToMarshalledPacket transforms the given command into a marshalled instance of a packet sent to a TCP socket.

Types

type BlindSignRequest

type BlindSignRequest struct {
	PubM                 [][]byte                `protobuf:"bytes,1,rep,name=pubM,proto3" json:"pubM,omitempty"`
	Lambda               *scheme.ProtoLambda     `protobuf:"bytes,2,opt,name=lambda,proto3" json:"lambda,omitempty"`
	EgPub                *elgamal.ProtoPublicKey `protobuf:"bytes,3,opt,name=egPub,proto3" json:"egPub,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                `json:"-"`
	XXX_unrecognized     []byte                  `json:"-"`
	XXX_sizecache        int32                   `json:"-"`
}

func NewBlindSignRequest

func NewBlindSignRequest(lambda *coconut.Lambda,
	egPub *elgamal.PublicKey,
	pubM []*Curve.BIG,
) (*BlindSignRequest, error)

NewBlindSignRequest returns new instance of a BlindSignRequest given set of public attributes, lambda and corresponding ElGamal public key.

func (*BlindSignRequest) Descriptor

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

func (*BlindSignRequest) GetEgPub

func (m *BlindSignRequest) GetEgPub() *elgamal.ProtoPublicKey

func (*BlindSignRequest) GetLambda

func (m *BlindSignRequest) GetLambda() *scheme.ProtoLambda

func (*BlindSignRequest) GetPubM

func (m *BlindSignRequest) GetPubM() [][]byte

func (*BlindSignRequest) ProtoMessage

func (*BlindSignRequest) ProtoMessage()

func (*BlindSignRequest) Reset

func (m *BlindSignRequest) Reset()

func (*BlindSignRequest) String

func (m *BlindSignRequest) String() string

func (*BlindSignRequest) XXX_DiscardUnknown

func (m *BlindSignRequest) XXX_DiscardUnknown()

func (*BlindSignRequest) XXX_Marshal

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

func (*BlindSignRequest) XXX_Merge

func (m *BlindSignRequest) XXX_Merge(src proto.Message)

func (*BlindSignRequest) XXX_Size

func (m *BlindSignRequest) XXX_Size() int

func (*BlindSignRequest) XXX_Unmarshal

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

type BlindSignResponse

type BlindSignResponse struct {
	Sig                  *scheme.ProtoBlindedSignature `protobuf:"bytes,1,opt,name=sig,proto3" json:"sig,omitempty"`
	IssuerID             int64                         `protobuf:"varint,2,opt,name=IssuerID,json=issuerID,proto3" json:"IssuerID,omitempty"`
	Status               *Status                       `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                      `json:"-"`
	XXX_unrecognized     []byte                        `json:"-"`
	XXX_sizecache        int32                         `json:"-"`
}

func (*BlindSignResponse) Descriptor

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

func (*BlindSignResponse) GetIssuerID

func (m *BlindSignResponse) GetIssuerID() int64

func (*BlindSignResponse) GetSig

func (*BlindSignResponse) GetStatus

func (m *BlindSignResponse) GetStatus() *Status

func (*BlindSignResponse) ProtoMessage

func (*BlindSignResponse) ProtoMessage()

func (*BlindSignResponse) Reset

func (m *BlindSignResponse) Reset()

func (*BlindSignResponse) String

func (m *BlindSignResponse) String() string

func (*BlindSignResponse) XXX_DiscardUnknown

func (m *BlindSignResponse) XXX_DiscardUnknown()

func (*BlindSignResponse) XXX_Marshal

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

func (*BlindSignResponse) XXX_Merge

func (m *BlindSignResponse) XXX_Merge(src proto.Message)

func (*BlindSignResponse) XXX_Size

func (m *BlindSignResponse) XXX_Size() int

func (*BlindSignResponse) XXX_Unmarshal

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

type BlindVerifyRequest

type BlindVerifyRequest struct {
	Sig                  *scheme.ProtoSignature `protobuf:"bytes,1,opt,name=sig,proto3" json:"sig,omitempty"`
	PubM                 [][]byte               `protobuf:"bytes,2,rep,name=pubM,proto3" json:"pubM,omitempty"`
	Theta                *scheme.ProtoTheta     `protobuf:"bytes,3,opt,name=theta,proto3" json:"theta,omitempty"`
	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
	XXX_unrecognized     []byte                 `json:"-"`
	XXX_sizecache        int32                  `json:"-"`
}

func NewBlindVerifyRequest

func NewBlindVerifyRequest(theta *coconut.Theta,
	sig *coconut.Signature,
	pubM []*Curve.BIG,
) (*BlindVerifyRequest, error)

NewBlindVerifyRequest returns new instance of a BlinfVerifyRequest given set of public attributes, theta and a coconut signature on them.

func (*BlindVerifyRequest) Descriptor

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

func (*BlindVerifyRequest) GetPubM

func (m *BlindVerifyRequest) GetPubM() [][]byte

func (*BlindVerifyRequest) GetSig

func (*BlindVerifyRequest) GetTheta

func (m *BlindVerifyRequest) GetTheta() *scheme.ProtoTheta

func (*BlindVerifyRequest) ProtoMessage

func (*BlindVerifyRequest) ProtoMessage()

func (*BlindVerifyRequest) Reset

func (m *BlindVerifyRequest) Reset()

func (*BlindVerifyRequest) String

func (m *BlindVerifyRequest) String() string

func (*BlindVerifyRequest) XXX_DiscardUnknown

func (m *BlindVerifyRequest) XXX_DiscardUnknown()

func (*BlindVerifyRequest) XXX_Marshal

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

func (*BlindVerifyRequest) XXX_Merge

func (m *BlindVerifyRequest) XXX_Merge(src proto.Message)

func (*BlindVerifyRequest) XXX_Size

func (m *BlindVerifyRequest) XXX_Size() int

func (*BlindVerifyRequest) XXX_Unmarshal

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

type BlindVerifyResponse

type BlindVerifyResponse struct {
	IsValid              bool     `protobuf:"varint,1,opt,name=isValid,proto3" json:"isValid,omitempty"`
	Status               *Status  `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*BlindVerifyResponse) Descriptor

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

func (*BlindVerifyResponse) GetIsValid

func (m *BlindVerifyResponse) GetIsValid() bool

func (*BlindVerifyResponse) GetStatus

func (m *BlindVerifyResponse) GetStatus() *Status

func (*BlindVerifyResponse) ProtoMessage

func (*BlindVerifyResponse) ProtoMessage()

func (*BlindVerifyResponse) Reset

func (m *BlindVerifyResponse) Reset()

func (*BlindVerifyResponse) String

func (m *BlindVerifyResponse) String() string

func (*BlindVerifyResponse) XXX_DiscardUnknown

func (m *BlindVerifyResponse) XXX_DiscardUnknown()

func (*BlindVerifyResponse) XXX_Marshal

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

func (*BlindVerifyResponse) XXX_Merge

func (m *BlindVerifyResponse) XXX_Merge(src proto.Message)

func (*BlindVerifyResponse) XXX_Size

func (m *BlindVerifyResponse) XXX_Size() int

func (*BlindVerifyResponse) XXX_Unmarshal

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

type Command

type Command interface {
	// basically generated protocol buffer messages
	Reset()
	String() string
	ProtoMessage()
}

Command defines interface that is implemented by all commands defined in the package.

func FromBytes

func FromBytes(b []byte) (Command, error)

FromBytes creates a given Command object out of stream of bytes.

type CommandID

type CommandID byte

CommandID is wrapper for a byte defining ID of particular command.

const (
	// GetVerificationKeyID is commandID for getting server's verification key.
	GetVerificationKeyID CommandID = 100

	// SignID is commandID for signing public attributes.
	SignID CommandID = 101

	// VerifyID is commandID for verifying a signature on public attributes.
	VerifyID CommandID = 102

	// BlindSignID is commandID for blindly signing public and private attributes.
	BlindSignID CommandID = 103

	// BlindVerifyID is commandID for verifying a blind signature on public and private attributes.
	BlindVerifyID CommandID = 104

	// SpendCredentialID is commandID for spending given credential at particular provider.
	SpendCredentialID CommandID = 129

	// LookUpCredentialID is commandID for looking up credential issued at particular block height
	// identified by particular Gamma.
	LookUpCredentialID CommandID = 130

	// LookUpBlockCredentialsID is commandID for looking up all credentials issued at particular block height.
	LookUpBlockCredentialsID CommandID = 131

	// DefaultResponseErrorStatusCode defines default value for the error status code of a server response.
	DefaultResponseErrorStatusCode = StatusCode_UNKNOWN
	// DefaultResponseErrorMessage defines default value for the error message of a server response.
	DefaultResponseErrorMessage = ""
)

type CommandRequest

type CommandRequest struct {
	// contains filtered or unexported fields
}

CommandRequest defines set of Command and chan that is used by client workers.

func NewCommandRequest

func NewCommandRequest(cmd Command, ch chan *Response) *CommandRequest

NewCommandRequest creates new instance of CommandRequest.

func (*CommandRequest) Cmd

func (cr *CommandRequest) Cmd() Command

Cmd returns command of CommandRequest.

func (*CommandRequest) Ctx

func (cr *CommandRequest) Ctx() context.Context

Ctx returns context attached to the CommandRequest.

func (*CommandRequest) RetCh

func (cr *CommandRequest) RetCh() chan *Response

RetCh returns return channel of CommandRequest.

func (*CommandRequest) WithContext

func (cr *CommandRequest) WithContext(ctx context.Context)

WithContext attaches context to given CommandRequest.

type CredentialPair

type CredentialPair struct {
	Gamma                []byte            `protobuf:"bytes,1,opt,name=gamma,proto3" json:"gamma,omitempty"`
	Credential           *IssuedCredential `protobuf:"bytes,2,opt,name=credential,proto3" json:"credential,omitempty"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

defines blinded credential and gamma to which it was issued unless client reused gamma which they shouldn't have, it will be identical to what they sent before, otherwise it will have additional suffix to indicate a duplicate (in given block)

func (*CredentialPair) Descriptor

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

func (*CredentialPair) GetCredential

func (m *CredentialPair) GetCredential() *IssuedCredential

func (*CredentialPair) GetGamma

func (m *CredentialPair) GetGamma() []byte

func (*CredentialPair) ProtoMessage

func (*CredentialPair) ProtoMessage()

func (*CredentialPair) Reset

func (m *CredentialPair) Reset()

func (*CredentialPair) String

func (m *CredentialPair) String() string

func (*CredentialPair) XXX_DiscardUnknown

func (m *CredentialPair) XXX_DiscardUnknown()

func (*CredentialPair) XXX_Marshal

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

func (*CredentialPair) XXX_Merge

func (m *CredentialPair) XXX_Merge(src proto.Message)

func (*CredentialPair) XXX_Size

func (m *CredentialPair) XXX_Size() int

func (*CredentialPair) XXX_Unmarshal

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

type IssuedCredential

type IssuedCredential struct {
	// sig is defined as bytes rather than protoBlindedSignature as it in fact is marshalled proto blinded signature
	// there is no point in extra unmarshaling and further marshaling just for the sake of it.
	Sig                  []byte   `protobuf:"bytes,1,opt,name=Sig,json=sig,proto3" json:"Sig,omitempty"`
	IssuerID             int64    `protobuf:"varint,2,opt,name=IssuerID,json=issuerID,proto3" json:"IssuerID,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*IssuedCredential) Descriptor

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

func (*IssuedCredential) GetIssuerID

func (m *IssuedCredential) GetIssuerID() int64

func (*IssuedCredential) GetSig

func (m *IssuedCredential) GetSig() []byte

func (*IssuedCredential) ProtoMessage

func (*IssuedCredential) ProtoMessage()

func (*IssuedCredential) Reset

func (m *IssuedCredential) Reset()

func (*IssuedCredential) String

func (m *IssuedCredential) String() string

func (*IssuedCredential) XXX_DiscardUnknown

func (m *IssuedCredential) XXX_DiscardUnknown()

func (*IssuedCredential) XXX_Marshal

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

func (*IssuedCredential) XXX_Merge

func (m *IssuedCredential) XXX_Merge(src proto.Message)

func (*IssuedCredential) XXX_Size

func (m *IssuedCredential) XXX_Size() int

func (*IssuedCredential) XXX_Unmarshal

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

type LookUpBlockCredentialsRequest

type LookUpBlockCredentialsRequest struct {
	Height               int64    `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func NewLookUpBlockCredentialsRequest

func NewLookUpBlockCredentialsRequest(height int64) (*LookUpBlockCredentialsRequest, error)

NewLookUpBlockCredentialsRequest returns new instance of a LookUpBlockCredentialsRequest given height of the desired block.

func (*LookUpBlockCredentialsRequest) Descriptor

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

func (*LookUpBlockCredentialsRequest) GetHeight

func (m *LookUpBlockCredentialsRequest) GetHeight() int64

func (*LookUpBlockCredentialsRequest) ProtoMessage

func (*LookUpBlockCredentialsRequest) ProtoMessage()

func (*LookUpBlockCredentialsRequest) Reset

func (m *LookUpBlockCredentialsRequest) Reset()

func (*LookUpBlockCredentialsRequest) String

func (*LookUpBlockCredentialsRequest) XXX_DiscardUnknown

func (m *LookUpBlockCredentialsRequest) XXX_DiscardUnknown()

func (*LookUpBlockCredentialsRequest) XXX_Marshal

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

func (*LookUpBlockCredentialsRequest) XXX_Merge

func (m *LookUpBlockCredentialsRequest) XXX_Merge(src proto.Message)

func (*LookUpBlockCredentialsRequest) XXX_Size

func (m *LookUpBlockCredentialsRequest) XXX_Size() int

func (*LookUpBlockCredentialsRequest) XXX_Unmarshal

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

type LookUpBlockCredentialsResponse

type LookUpBlockCredentialsResponse struct {
	Credentials          []*CredentialPair `protobuf:"bytes,1,rep,name=credentials,proto3" json:"credentials,omitempty"`
	Status               *Status           `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*LookUpBlockCredentialsResponse) Descriptor

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

func (*LookUpBlockCredentialsResponse) GetCredentials

func (m *LookUpBlockCredentialsResponse) GetCredentials() []*CredentialPair

func (*LookUpBlockCredentialsResponse) GetStatus

func (m *LookUpBlockCredentialsResponse) GetStatus() *Status

func (*LookUpBlockCredentialsResponse) ProtoMessage

func (*LookUpBlockCredentialsResponse) ProtoMessage()

func (*LookUpBlockCredentialsResponse) Reset

func (m *LookUpBlockCredentialsResponse) Reset()

func (*LookUpBlockCredentialsResponse) String

func (*LookUpBlockCredentialsResponse) XXX_DiscardUnknown

func (m *LookUpBlockCredentialsResponse) XXX_DiscardUnknown()

func (*LookUpBlockCredentialsResponse) XXX_Marshal

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

func (*LookUpBlockCredentialsResponse) XXX_Merge

func (m *LookUpBlockCredentialsResponse) XXX_Merge(src proto.Message)

func (*LookUpBlockCredentialsResponse) XXX_Size

func (m *LookUpBlockCredentialsResponse) XXX_Size() int

func (*LookUpBlockCredentialsResponse) XXX_Unmarshal

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

type LookUpCredentialRequest

type LookUpCredentialRequest struct {
	Height               int64    `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	Gamma                []byte   `protobuf:"bytes,2,opt,name=gamma,proto3" json:"gamma,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func NewLookUpCredentialRequest

func NewLookUpCredentialRequest(height int64, egPub *elgamal.PublicKey) (*LookUpCredentialRequest, error)

NewLookUpCredentialRequest returns new instance of a LookUpCredentialRequest given height of the desired block and public ElGamal key used during the blind issuance.

func (*LookUpCredentialRequest) Descriptor

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

func (*LookUpCredentialRequest) GetGamma

func (m *LookUpCredentialRequest) GetGamma() []byte

func (*LookUpCredentialRequest) GetHeight

func (m *LookUpCredentialRequest) GetHeight() int64

func (*LookUpCredentialRequest) ProtoMessage

func (*LookUpCredentialRequest) ProtoMessage()

func (*LookUpCredentialRequest) Reset

func (m *LookUpCredentialRequest) Reset()

func (*LookUpCredentialRequest) String

func (m *LookUpCredentialRequest) String() string

func (*LookUpCredentialRequest) XXX_DiscardUnknown

func (m *LookUpCredentialRequest) XXX_DiscardUnknown()

func (*LookUpCredentialRequest) XXX_Marshal

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

func (*LookUpCredentialRequest) XXX_Merge

func (m *LookUpCredentialRequest) XXX_Merge(src proto.Message)

func (*LookUpCredentialRequest) XXX_Size

func (m *LookUpCredentialRequest) XXX_Size() int

func (*LookUpCredentialRequest) XXX_Unmarshal

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

type LookUpCredentialResponse

type LookUpCredentialResponse struct {
	CredentialPair       *CredentialPair `protobuf:"bytes,1,opt,name=credentialPair,proto3" json:"credentialPair,omitempty"`
	Status               *Status         `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	XXX_NoUnkeyedLiteral struct{}        `json:"-"`
	XXX_unrecognized     []byte          `json:"-"`
	XXX_sizecache        int32           `json:"-"`
}

func (*LookUpCredentialResponse) Descriptor

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

func (*LookUpCredentialResponse) GetCredentialPair

func (m *LookUpCredentialResponse) GetCredentialPair() *CredentialPair

func (*LookUpCredentialResponse) GetStatus

func (m *LookUpCredentialResponse) GetStatus() *Status

func (*LookUpCredentialResponse) ProtoMessage

func (*LookUpCredentialResponse) ProtoMessage()

func (*LookUpCredentialResponse) Reset

func (m *LookUpCredentialResponse) Reset()

func (*LookUpCredentialResponse) String

func (m *LookUpCredentialResponse) String() string

func (*LookUpCredentialResponse) XXX_DiscardUnknown

func (m *LookUpCredentialResponse) XXX_DiscardUnknown()

func (*LookUpCredentialResponse) XXX_Marshal

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

func (*LookUpCredentialResponse) XXX_Merge

func (m *LookUpCredentialResponse) XXX_Merge(src proto.Message)

func (*LookUpCredentialResponse) XXX_Size

func (m *LookUpCredentialResponse) XXX_Size() int

func (*LookUpCredentialResponse) XXX_Unmarshal

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

type ProtoResponse

type ProtoResponse interface {
	Reset()
	String() string
	ProtoMessage()
	GetStatus() *Status
}

ProtoResponse is a protobuf server response.

type RawCommand

type RawCommand struct {
	// contains filtered or unexported fields
}

RawCommand encapsulates arbitrary marshalled command and ID that defines it.

func NewRawCommand

func NewRawCommand(id CommandID, payload []byte) *RawCommand

NewRawCommand creates new instance of RawCommand given ID and its payload.

func (*RawCommand) ID

func (c *RawCommand) ID() CommandID

ID returns CommandID of RawCommand.

func (*RawCommand) Payload

func (c *RawCommand) Payload() []byte

Payload returns Payload of RawCommand.

func (*RawCommand) ToBytes

func (c *RawCommand) ToBytes() []byte

ToBytes marshals RawCommand into a stream of bytes so that it could be turned into a packet.

type Response

type Response struct {
	Data         interface{}
	ErrorStatus  StatusCode
	ErrorMessage string
}

Response represents a server response to client's query.

type SignRequest

type SignRequest struct {
	PubM                 [][]byte `protobuf:"bytes,1,rep,name=pubM,proto3" json:"pubM,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func NewSignRequest

func NewSignRequest(pubM []*Curve.BIG) (*SignRequest, error)

NewSignRequest returns new instance of a SignRequest given set of public attributes.

func (*SignRequest) Descriptor

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

func (*SignRequest) GetPubM

func (m *SignRequest) GetPubM() [][]byte

func (*SignRequest) ProtoMessage

func (*SignRequest) ProtoMessage()

func (*SignRequest) Reset

func (m *SignRequest) Reset()

func (*SignRequest) String

func (m *SignRequest) String() string

func (*SignRequest) XXX_DiscardUnknown

func (m *SignRequest) XXX_DiscardUnknown()

func (*SignRequest) XXX_Marshal

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

func (*SignRequest) XXX_Merge

func (m *SignRequest) XXX_Merge(src proto.Message)

func (*SignRequest) XXX_Size

func (m *SignRequest) XXX_Size() int

func (*SignRequest) XXX_Unmarshal

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

type SignResponse

type SignResponse struct {
	Sig                  *scheme.ProtoSignature `protobuf:"bytes,1,opt,name=sig,proto3" json:"sig,omitempty"`
	IssuerID             int64                  `protobuf:"varint,2,opt,name=IssuerID,json=issuerID,proto3" json:"IssuerID,omitempty"`
	Status               *Status                `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
	XXX_unrecognized     []byte                 `json:"-"`
	XXX_sizecache        int32                  `json:"-"`
}

func (*SignResponse) Descriptor

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

func (*SignResponse) GetIssuerID

func (m *SignResponse) GetIssuerID() int64

func (*SignResponse) GetSig

func (m *SignResponse) GetSig() *scheme.ProtoSignature

func (*SignResponse) GetStatus

func (m *SignResponse) GetStatus() *Status

func (*SignResponse) ProtoMessage

func (*SignResponse) ProtoMessage()

func (*SignResponse) Reset

func (m *SignResponse) Reset()

func (*SignResponse) String

func (m *SignResponse) String() string

func (*SignResponse) XXX_DiscardUnknown

func (m *SignResponse) XXX_DiscardUnknown()

func (*SignResponse) XXX_Marshal

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

func (*SignResponse) XXX_Merge

func (m *SignResponse) XXX_Merge(src proto.Message)

func (*SignResponse) XXX_Size

func (m *SignResponse) XXX_Size() int

func (*SignResponse) XXX_Unmarshal

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

type SpendCredentialRequest

type SpendCredentialRequest struct {
	// The actual credential
	Sig *scheme.ProtoSignature `protobuf:"bytes,1,opt,name=Sig,json=sig,proto3" json:"Sig,omitempty"`
	// The public attributes in credential. Note that pubM[0] = BIG(value)
	PubM [][]byte `protobuf:"bytes,2,rep,name=PubM,json=pubM,proto3" json:"PubM,omitempty"`
	// Crypto materials to verify the credential + required NIZK; also contains g^s
	Theta *scheme.ProtoThetaTumbler `protobuf:"bytes,3,opt,name=Theta,json=theta,proto3" json:"Theta,omitempty"`
	// Value of the credential
	Value int64 `protobuf:"varint,4,opt,name=Value,json=value,proto3" json:"Value,omitempty"`
	// Address of the merchant to which the proof is bound. Included so that the provider could verify it
	MerchantAddress      []byte   `protobuf:"bytes,5,opt,name=MerchantAddress,json=merchantAddress,proto3" json:"MerchantAddress,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Sent by user to some service provider

func NewSpendCredentialRequest

func NewSpendCredentialRequest(sig *coconut.Signature,
	pubM []*Curve.BIG,
	theta *coconut.ThetaTumbler,
	val int64,
	address ethcommon.Address,
) (*SpendCredentialRequest, error)

NewSpendCredentialRequest returns new instance of a SpendCredentialRequest given credential and the required cryptographic materials.

func (*SpendCredentialRequest) Descriptor

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

func (*SpendCredentialRequest) GetMerchantAddress

func (m *SpendCredentialRequest) GetMerchantAddress() []byte

func (*SpendCredentialRequest) GetPubM

func (m *SpendCredentialRequest) GetPubM() [][]byte

func (*SpendCredentialRequest) GetSig

func (*SpendCredentialRequest) GetTheta

func (*SpendCredentialRequest) GetValue

func (m *SpendCredentialRequest) GetValue() int64

func (*SpendCredentialRequest) ProtoMessage

func (*SpendCredentialRequest) ProtoMessage()

func (*SpendCredentialRequest) Reset

func (m *SpendCredentialRequest) Reset()

func (*SpendCredentialRequest) String

func (m *SpendCredentialRequest) String() string

func (*SpendCredentialRequest) XXX_DiscardUnknown

func (m *SpendCredentialRequest) XXX_DiscardUnknown()

func (*SpendCredentialRequest) XXX_Marshal

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

func (*SpendCredentialRequest) XXX_Merge

func (m *SpendCredentialRequest) XXX_Merge(src proto.Message)

func (*SpendCredentialRequest) XXX_Size

func (m *SpendCredentialRequest) XXX_Size() int

func (*SpendCredentialRequest) XXX_Unmarshal

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

type SpendCredentialResponse

type SpendCredentialResponse struct {
	WasSuccessful        bool     `protobuf:"varint,1,opt,name=wasSuccessful,proto3" json:"wasSuccessful,omitempty"`
	Status               *Status  `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SpendCredentialResponse) Descriptor

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

func (*SpendCredentialResponse) GetStatus

func (m *SpendCredentialResponse) GetStatus() *Status

func (*SpendCredentialResponse) GetWasSuccessful

func (m *SpendCredentialResponse) GetWasSuccessful() bool

func (*SpendCredentialResponse) ProtoMessage

func (*SpendCredentialResponse) ProtoMessage()

func (*SpendCredentialResponse) Reset

func (m *SpendCredentialResponse) Reset()

func (*SpendCredentialResponse) String

func (m *SpendCredentialResponse) String() string

func (*SpendCredentialResponse) XXX_DiscardUnknown

func (m *SpendCredentialResponse) XXX_DiscardUnknown()

func (*SpendCredentialResponse) XXX_Marshal

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

func (*SpendCredentialResponse) XXX_Merge

func (m *SpendCredentialResponse) XXX_Merge(src proto.Message)

func (*SpendCredentialResponse) XXX_Size

func (m *SpendCredentialResponse) XXX_Size() int

func (*SpendCredentialResponse) XXX_Unmarshal

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

type Status

type Status struct {
	Code                 int32    `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message              string   `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Status) Descriptor

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

func (*Status) GetCode

func (m *Status) GetCode() int32

func (*Status) GetMessage

func (m *Status) GetMessage() string

func (*Status) ProtoMessage

func (*Status) ProtoMessage()

func (*Status) Reset

func (m *Status) Reset()

func (*Status) String

func (m *Status) String() string

func (*Status) XXX_DiscardUnknown

func (m *Status) XXX_DiscardUnknown()

func (*Status) XXX_Marshal

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

func (*Status) XXX_Merge

func (m *Status) XXX_Merge(src proto.Message)

func (*Status) XXX_Size

func (m *Status) XXX_Size() int

func (*Status) XXX_Unmarshal

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

type StatusCode

type StatusCode int32
const (
	StatusCode_OK                      StatusCode = 0
	StatusCode_UNKNOWN                 StatusCode = 1
	StatusCode_INVALID_COMMAND         StatusCode = 2
	StatusCode_INVALID_ARGUMENTS       StatusCode = 3
	StatusCode_PROCESSING_ERROR        StatusCode = 4
	StatusCode_NOT_IMPLEMENTED         StatusCode = 5
	StatusCode_REQUEST_TIMEOUT         StatusCode = 6
	StatusCode_UNAVAILABLE             StatusCode = 7
	StatusCode_INVALID_TRANSACTION     StatusCode = 8
	StatusCode_INVALID_BINDING         StatusCode = 9
	StatusCode_INVALID_SIGNATURE       StatusCode = 10
	StatusCode_TX_NOT_ON_CHAIN         StatusCode = 11
	StatusCode_NOT_PROCESSED_YET       StatusCode = 12
	StatusCode_DOUBLE_SPENDING_ATTEMPT StatusCode = 13
)

func (StatusCode) EnumDescriptor

func (StatusCode) EnumDescriptor() ([]byte, []int)

func (StatusCode) String

func (x StatusCode) String() string

type VerificationKeyRequest

type VerificationKeyRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func NewVerificationKeyRequest

func NewVerificationKeyRequest() (*VerificationKeyRequest, error)

NewVerificationKeyRequest returns new instance of a VerificationKeyRequest.

func (*VerificationKeyRequest) Descriptor

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

func (*VerificationKeyRequest) ProtoMessage

func (*VerificationKeyRequest) ProtoMessage()

func (*VerificationKeyRequest) Reset

func (m *VerificationKeyRequest) Reset()

func (*VerificationKeyRequest) String

func (m *VerificationKeyRequest) String() string

func (*VerificationKeyRequest) XXX_DiscardUnknown

func (m *VerificationKeyRequest) XXX_DiscardUnknown()

func (*VerificationKeyRequest) XXX_Marshal

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

func (*VerificationKeyRequest) XXX_Merge

func (m *VerificationKeyRequest) XXX_Merge(src proto.Message)

func (*VerificationKeyRequest) XXX_Size

func (m *VerificationKeyRequest) XXX_Size() int

func (*VerificationKeyRequest) XXX_Unmarshal

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

type VerificationKeyResponse

type VerificationKeyResponse struct {
	Vk                   *scheme.ProtoVerificationKey `protobuf:"bytes,1,opt,name=vk,proto3" json:"vk,omitempty"`
	IssuerID             int64                        `protobuf:"varint,2,opt,name=IssuerID,json=issuerID,proto3" json:"IssuerID,omitempty"`
	Status               *Status                      `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                     `json:"-"`
	XXX_unrecognized     []byte                       `json:"-"`
	XXX_sizecache        int32                        `json:"-"`
}

func (*VerificationKeyResponse) Descriptor

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

func (*VerificationKeyResponse) GetIssuerID

func (m *VerificationKeyResponse) GetIssuerID() int64

func (*VerificationKeyResponse) GetStatus

func (m *VerificationKeyResponse) GetStatus() *Status

func (*VerificationKeyResponse) GetVk

func (*VerificationKeyResponse) ProtoMessage

func (*VerificationKeyResponse) ProtoMessage()

func (*VerificationKeyResponse) Reset

func (m *VerificationKeyResponse) Reset()

func (*VerificationKeyResponse) String

func (m *VerificationKeyResponse) String() string

func (*VerificationKeyResponse) XXX_DiscardUnknown

func (m *VerificationKeyResponse) XXX_DiscardUnknown()

func (*VerificationKeyResponse) XXX_Marshal

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

func (*VerificationKeyResponse) XXX_Merge

func (m *VerificationKeyResponse) XXX_Merge(src proto.Message)

func (*VerificationKeyResponse) XXX_Size

func (m *VerificationKeyResponse) XXX_Size() int

func (*VerificationKeyResponse) XXX_Unmarshal

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

type VerifyRequest

type VerifyRequest struct {
	Sig                  *scheme.ProtoSignature `protobuf:"bytes,1,opt,name=sig,proto3" json:"sig,omitempty"`
	PubM                 [][]byte               `protobuf:"bytes,2,rep,name=pubM,proto3" json:"pubM,omitempty"`
	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
	XXX_unrecognized     []byte                 `json:"-"`
	XXX_sizecache        int32                  `json:"-"`
}

func NewVerifyRequest

func NewVerifyRequest(pubM []*Curve.BIG, sig *coconut.Signature) (*VerifyRequest, error)

NewVerifyRequest returns new instance of a VerifyRequest given set of public attributes and a coconut signature on them.

func (*VerifyRequest) Descriptor

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

func (*VerifyRequest) GetPubM

func (m *VerifyRequest) GetPubM() [][]byte

func (*VerifyRequest) GetSig

func (m *VerifyRequest) GetSig() *scheme.ProtoSignature

func (*VerifyRequest) ProtoMessage

func (*VerifyRequest) ProtoMessage()

func (*VerifyRequest) Reset

func (m *VerifyRequest) Reset()

func (*VerifyRequest) String

func (m *VerifyRequest) String() string

func (*VerifyRequest) XXX_DiscardUnknown

func (m *VerifyRequest) XXX_DiscardUnknown()

func (*VerifyRequest) XXX_Marshal

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

func (*VerifyRequest) XXX_Merge

func (m *VerifyRequest) XXX_Merge(src proto.Message)

func (*VerifyRequest) XXX_Size

func (m *VerifyRequest) XXX_Size() int

func (*VerifyRequest) XXX_Unmarshal

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

type VerifyResponse

type VerifyResponse struct {
	IsValid              bool     `protobuf:"varint,1,opt,name=isValid,proto3" json:"isValid,omitempty"`
	Status               *Status  `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*VerifyResponse) Descriptor

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

func (*VerifyResponse) GetIsValid

func (m *VerifyResponse) GetIsValid() bool

func (*VerifyResponse) GetStatus

func (m *VerifyResponse) GetStatus() *Status

func (*VerifyResponse) ProtoMessage

func (*VerifyResponse) ProtoMessage()

func (*VerifyResponse) Reset

func (m *VerifyResponse) Reset()

func (*VerifyResponse) String

func (m *VerifyResponse) String() string

func (*VerifyResponse) XXX_DiscardUnknown

func (m *VerifyResponse) XXX_DiscardUnknown()

func (*VerifyResponse) XXX_Marshal

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

func (*VerifyResponse) XXX_Merge

func (m *VerifyResponse) XXX_Merge(src proto.Message)

func (*VerifyResponse) XXX_Size

func (m *VerifyResponse) XXX_Size() int

func (*VerifyResponse) XXX_Unmarshal

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL