Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateSchema ¶
func MustCreateSchema ¶
Types ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func NewPrivateKey ¶
func NewPrivateKey(db Database) *PrivateKey
func (PrivateKey) CreatePrivateKey ¶
func (svc PrivateKey) CreatePrivateKey() (int64, error)
CreatePrivateKey creates a new private key in the database and returns its ID.
func (PrivateKey) FindPrivateKey ¶
func (svc PrivateKey) FindPrivateKey(id int64) (*rsa.PrivateKey, error)
FindPrivateKey returns the private key with the given ID.
func (PrivateKey) Lease ¶
func (svc PrivateKey) Lease(recordIDs []int64) error
Lease finds an available private key and leases it for the given record IDs. Must be used with a transaction to prevent races.
func (PrivateKey) ResetLeases ¶
func (svc PrivateKey) ResetLeases() error
ResetLeases resets the leases on all private keys which have signed all associated records. TODO: Return how many leases were reset.
type Signature ¶
type Signature struct {
// contains filtered or unexported fields
}
func NewSignature ¶
func (Signature) CreateSignature ¶
CreateSignature creates a new signature for the given record and private key. It does not set the value of the signature, which must be updated later.
func (Signature) EmptySignature ¶
func (svc Signature) EmptySignature() (SignatureRow, error)
EmptySignature returns the first signature that has yet to be signed.
func (Signature) SignWithKey ¶
func (svc Signature) SignWithKey(pkey *rsa.PrivateKey, sigID int64) error
SignWithKey signs the associated record with the given signature ID using the given private key.