Documentation ¶
Overview ¶
Package contract manages contracts and signatures (creation and execution).
Index ¶
- Variables
- func Fetch(db *mgdb.MongoManager, contractUUID string, clientHash []byte) *api.Contract
- func FindAndUpdatePendingSigner(mail string, signersReady *[]bool, signers *[]entities.Signer) (ready bool)
- func GenerateSignSequence(n int) []uint32
- func GetJSON(c *entities.Contract) ([]byte, error)
- func JoinSignature(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, ...)
- func ReadySign(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, ctx *context.Context, ...) *api.LaunchSignature
- func SquaredSignEngine(n uint32) []uint32
- func SquaredSignEngineSlice(n uint32) []uint32
- type Builder
- type FileJSON
- type JSON
- type SignerJSON
Constants ¶
This section is empty.
Variables ¶
var ReadySignTimeout = time.Minute
ReadySignTimeout is the delay users have to confirm the signature. A high value is not recommended, as there is no way to create any other signature on the same contract before the timeout if a client has connection issues.
Functions ¶
func Fetch ¶
Fetch returns the protobuf message when asking a specific contract containing a specific user.
func FindAndUpdatePendingSigner ¶
func FindAndUpdatePendingSigner(mail string, signersReady *[]bool, signers *[]entities.Signer) (ready bool)
FindAndUpdatePendingSigner is a utility function to return the state of current signers readiness. It has absolutely no interaction with the database.
func GenerateSignSequence ¶
GenerateSignSequence for the contract signature
The generated sequence is an array of integers refering to the User array.
func JoinSignature ¶
func JoinSignature(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, in *api.JoinSignatureRequest, stream api.Platform_JoinSignatureServer)
JoinSignature allows a client to wait for other clients connections on a specific contract. Firstly, every client present BEFORE the call of this function is sent to the stream. Then, client information is sent to the stream as it's available.
Please note that the current user will also receive its own information. There is no timeout, this function will shut down on stream disconnection or on error.
func ReadySign ¶
func ReadySign(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, ctx *context.Context, in *api.ReadySignRequest) *api.LaunchSignature
ReadySign is the last job of the platform before the signature can occur. When a new client is ready, it joins a waitingGroup and waits for a master broadcast announcing that everybody is ready.
Doing it this way is efficient in time, as only one goroutine deals with the database and do global checks.
func SquaredSignEngine ¶
SquaredSignEngine is a basic ^2 engine for sequence generation
func SquaredSignEngineSlice ¶
SquaredSignEngineSlice is the same as the above with slicing
Types ¶
type Builder ¶
Builder contains internal information to create a new contract.
func NewContractBuilder ¶
func NewContractBuilder(m *mgdb.MongoManager, in *api.PostContractRequest) *Builder
NewContractBuilder creates a new builder from current context. Call Execute() on the builder to get a result from it.
func (*Builder) SendNewContractMail ¶
func (c *Builder) SendNewContractMail()
SendNewContractMail sends a mail to each known signer in a contract containing the DFSS file
type SignerJSON ¶
SignerJSON is the structure used to store signers information in JSON format