Documentation ¶
Overview ¶
Package sign handles contract and signature operations.
Index ¶
- func CheckContractHash(filename string, expectedHash string) (ok bool, err error)
- func FetchContract(passphrase, uuid, path string) error
- func Recover(filename, passphrase string) error
- func SendNewContract(passphrase, filepath, comment string, signers []string) error
- type Archives
- type CreateManager
- type SignatureManager
- func (m *SignatureManager) ConnectToPeers() error
- func (m *SignatureManager) CreatePromise(from, to, at uint32) (*cAPI.Promise, error)
- func (m *SignatureManager) CreateSignature(from, to uint32) (*cAPI.Signature, error)
- func (m *SignatureManager) ExchangeAllSignatures() error
- func (m *SignatureManager) FindID() (uint32, error)
- func (m *SignatureManager) GetClient(to uint32) (client *cAPI.ClientClient, mail string)
- func (m *SignatureManager) GetServer() *grpc.Server
- func (m *SignatureManager) Initialize() (int, error)
- func (m *SignatureManager) IsTerminated() bool
- func (m *SignatureManager) PersistRecoverDataToFile() (string, error)
- func (m *SignatureManager) PersistSignaturesToFile() error
- func (m *SignatureManager) ReceiveAllSignatures(out chan error)
- func (m *SignatureManager) SendEvidence(promise *cAPI.Promise, signature *cAPI.Signature, to uint32) (err error)
- func (m *SignatureManager) SendReadySign() (signatureUUID string, err error)
- func (m *SignatureManager) Sign() error
- type SignedContractJSON
- type SignerStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckContractHash ¶ added in v0.3.0
CheckContractHash computes the hash of the provided file and compares it to the expected one.
func FetchContract ¶
FetchContract tries to download contract metadata from specified uuid, and stores the resulting json at path
func Recover ¶ added in v0.3.0
Recover : performs a recover attempt using the provided recover file, and the user's passphrase to use secured connection
func SendNewContract ¶
SendNewContract tries to create a contract on the platform and returns an error or nil
Types ¶
type Archives ¶
type Archives struct {
// contains filtered or unexported fields
}
Archives stores the received and sent messages, as evidence if needed
type CreateManager ¶
type CreateManager struct {
// contains filtered or unexported fields
}
CreateManager handles the creation of a new contract.
type SignatureManager ¶
type SignatureManager struct { // Callbacks OnSignerStatusUpdate func(mail string, status SignerStatus, data string) OnProgressUpdate func(current int, end int) Cancel chan interface{} // contains filtered or unexported fields }
SignatureManager handles the signature of a contract.
func NewSignatureManager ¶
func NewSignatureManager(passphrase string, c *contract.JSON) (*SignatureManager, error)
NewSignatureManager populates a SignatureManager and connects to the platform.
func (*SignatureManager) ConnectToPeers ¶
func (m *SignatureManager) ConnectToPeers() error
ConnectToPeers tries to fetch the list of users for this contract, and tries to establish a connection to each peer.
func (*SignatureManager) CreatePromise ¶
func (m *SignatureManager) CreatePromise(from, to, at uint32) (*cAPI.Promise, error)
CreatePromise creates a promise from 'from' to 'to', in the context of the SignatureManager provided that the specified sequence indexes are valid
func (*SignatureManager) CreateSignature ¶
func (m *SignatureManager) CreateSignature(from, to uint32) (*cAPI.Signature, error)
CreateSignature creates a signature from a sequence ID to another provided the specified sequence indexes are valid
func (*SignatureManager) ExchangeAllSignatures ¶
func (m *SignatureManager) ExchangeAllSignatures() error
ExchangeAllSignatures creates and sends signatures to all the signers of the contract
func (*SignatureManager) FindID ¶
func (m *SignatureManager) FindID() (uint32, error)
FindID finds the sequence id for the user's email and the contract to sign
func (*SignatureManager) GetClient ¶
func (m *SignatureManager) GetClient(to uint32) (client *cAPI.ClientClient, mail string)
GetClient retrieves the Client to the specified sequence id provided it exists
func (*SignatureManager) GetServer ¶
func (m *SignatureManager) GetServer() *grpc.Server
GetServer create and registers a ClientServer, returning the associated GRPC server
func (*SignatureManager) Initialize ¶
func (m *SignatureManager) Initialize() (int, error)
Initialize computes the values needed for the start of the signing
func (*SignatureManager) IsTerminated ¶ added in v0.3.0
func (m *SignatureManager) IsTerminated() bool
IsTerminated returns true if the signature is cancelled or finished
func (*SignatureManager) PersistRecoverDataToFile ¶ added in v0.3.0
func (m *SignatureManager) PersistRecoverDataToFile() (string, error)
PersistRecoverDataToFile : save recover informations to disk. returns the file name and an error if any occured
func (*SignatureManager) PersistSignaturesToFile ¶
func (m *SignatureManager) PersistSignaturesToFile() error
PersistSignaturesToFile save contract informations and signatures to disk
func (*SignatureManager) ReceiveAllSignatures ¶
func (m *SignatureManager) ReceiveAllSignatures(out chan error)
ReceiveAllSignatures receive all the signatures
func (*SignatureManager) SendEvidence ¶
func (m *SignatureManager) SendEvidence(promise *cAPI.Promise, signature *cAPI.Signature, to uint32) (err error)
SendEvidence factorizes the send code between promises and signatures. You can use it by setting either promise or signature to `nil`. The successfully sent evidence is then added to the archives.
func (*SignatureManager) SendReadySign ¶
func (m *SignatureManager) SendReadySign() (signatureUUID string, err error)
SendReadySign sends the READY signal to the platform, and wait (potentially a long time) for START signal.
func (*SignatureManager) Sign ¶
func (m *SignatureManager) Sign() error
Sign performs all the message exchanges for the contract to be signed
* Initialize the SignatureManager from starter.go * Compute the reversed map [mail -> ID] of signers * Make channels for handlers * Promises rounds * Signature round
type SignedContractJSON ¶
SignedContractJSON is an union of contract and related signatures
type SignerStatus ¶ added in v0.2.0
type SignerStatus int
SignerStatus represents the current state of a signer.
const ( StatusWaiting SignerStatus = iota StatusConnecting StatusConnected StatusError )
These constants represent the different states of a signer.