Documentation ¶
Overview ¶
Package entities contains database entities and helpers on these entities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Contract ¶
type Contract struct { ID bson.ObjectId `key:"_id" bson:"_id"` Date time.Time `key:"date" bson:"date"` Comment string `key:"comment" bson:"comment"` Ready bool `key:"ready" bson:"ready"` File *File `key:"file" bson:"file"` Signers []Signer `key:"signers" bson:"signers"` }
Contract : Informations about a contract to be signed
func (*Contract) GetHashChain ¶
GetHashChain returns the ordered slice of signers hashes. It's used to check the dfss file if needed.
type ContractRepository ¶
type ContractRepository struct {
Collection *mgdb.MongoCollection
}
ContractRepository to contains every complex methods related to contract
func NewContractRepository ¶
func NewContractRepository(collection *mgdb.MongoCollection) *ContractRepository
NewContractRepository : Creates a new Contract Repository
func (*ContractRepository) GetWaitingForUser ¶
func (r *ContractRepository) GetWaitingForUser(email string) ([]Contract, error)
GetWaitingForUser returns contracts waiting a specific unauthenticated user to start
func (*ContractRepository) GetWithSigner ¶
func (r *ContractRepository) GetWithSigner(signerHash []byte, contractUUID bson.ObjectId) (contract *Contract, err error)
GetWithSigner returns the contract corresponding to an UUID and containing a specific signer, or nil if no contract matches.
type File ¶
type File struct { Name string `key:"name" bson:"name"` // Name of the File Hash []byte `key:"hash" bson:"hash"` // Hash of the File Hosted bool `key:"hosted" bson:"hosted"` // True if hosted on the platform, else false }
File : Represents a file structure
type Signer ¶
type Signer struct { UserID bson.ObjectId `key:"userId" bson:"userId"` Email string `key:"email" bson:"email"` Hash []byte `key:"hash" bson:"hash"` }
Signer : Informations about the signer of a contract
type User ¶
type User struct { ID bson.ObjectId `key:"_id" bson:"_id"` // Internal id of a User Email string `key:"email" bson:"email"` // Email of a User Registration time.Time `key:"registration" bson:"registration"` // Time of registration of the User Expiration time.Time `key:"expiration" bson:"expiration"` // Certificate expiration of the User RegToken string `key:"regToken" bson:"regToken"` // Token used for registering a User Csr string `key:"csr" bson:"csr"` // Certificate request at PEM format Certificate string `key:"certificate" bson:"certificate"` // Certificate of the User CertHash []byte `key:"certHash" bson:"certHash"` // Hash of the certificate }
User : User stored in mongo
type UserRepository ¶
type UserRepository struct {
Collection *mgdb.MongoCollection
}
UserRepository : Holds all the complex methods regarding a user
func NewUserRepository ¶
func NewUserRepository(collection *mgdb.MongoCollection) *UserRepository
NewUserRepository : Creates a new user repository from the given connection
func (*UserRepository) FetchByMailAndHash ¶
func (repository *UserRepository) FetchByMailAndHash(email string, hash []byte) (*User, error)
FetchByMailAndHash : Fetches a User from its email and certificate hash