Documentation ¶
Overview ¶
Package keys provides key management functions.
Index ¶
Constants ¶
View Source
const ( AccountKeyTypeLocal = "local" AccountKeyTypeGoogleKMS = "google_kms" AccountKeyTypeAWSKMS = "aws_kms" )
Variables ¶
View Source
var ErrAdminProposalKeyCountMismatch = errors.New("admin-proposal-key count mismatch")
Functions ¶
This section is empty.
Types ¶
type Authorizer ¶
Authorizer groups the necessary items for transaction signing.
func (*Authorizer) Equals ¶
func (a *Authorizer) Equals(t Authorizer) bool
type GormStore ¶
type GormStore struct {
// contains filtered or unexported fields
}
func (*GormStore) DeleteAllProposalKeys ¶
func (*GormStore) InsertProposalKey ¶
func (s *GormStore) InsertProposalKey(p ProposalKey) error
func (*GormStore) ProposalKeyCount ¶ added in v0.9.0
type Manager ¶
type Manager interface { // Generate generates a new Key using provided key index and weight. Generate(ctx context.Context, keyIndex, weight int) (*flow.AccountKey, *Private, error) // GenerateDefault generates a new Key using application defaults. GenerateDefault(context.Context) (*flow.AccountKey, *Private, error) // Save is responsible for converting an "in flight" key to a storable key. Save(Private) (Storable, error) // Load is responsible for converting a storable key to an "in flight" key. Load(Storable) (Private, error) // AdminAuthorizer returns an Authorizer for the applications admin account. AdminAuthorizer(context.Context) (Authorizer, error) // UserAuthorizer returns an Authorizer for the given address. UserAuthorizer(ctx context.Context, address flow.Address) (Authorizer, error) // CheckAdminProposalKeyCount checks if admin proposal keys have been correctly initiated (counts match). CheckAdminProposalKeyCount(ctx context.Context) error // InitAdminProposalKeys will init the admin proposal keys in the database // and return current count. InitAdminProposalKeys(ctx context.Context) (uint16, error) // AdminProposalKey returns Authorizer to be used as proposer. AdminProposalKey(ctx context.Context) (Authorizer, error) }
Manager provides the functions needed for key management.
type Private ¶
type Private struct { Index int `json:"index"` Type string `json:"type"` Value string `json:"-"` SignAlgo crypto.SignatureAlgorithm `json:"-"` HashAlgo crypto.HashAlgorithm `json:"-"` }
Private is an "in flight" account private key meaning its Value should be the actual private key or resource id (unencrypted).
type ProposalKey ¶
type ProposalKey struct { ID int `json:"-" gorm:"primaryKey"` KeyIndex int `gorm:"unique"` CreatedAt time.Time UpdatedAt time.Time }
func (ProposalKey) TableName ¶
func (ProposalKey) TableName() string
type Storable ¶
type Storable struct { ID int `json:"-" gorm:"primaryKey"` AccountAddress string `json:"-" gorm:"index"` Index int `json:"index" gorm:"index"` Type string `json:"type"` Value []byte `json:"-"` PublicKey string `json:"publicKey"` SignAlgo string `json:"signAlgo"` HashAlgo string `json:"hashAlgo"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` DeletedAt gorm.DeletedAt `json:"-" gorm:"index"` }
Storable struct represents a storable account private key. Storable.Value is an encrypted byte representation of the actual private key when using local key management or resource id when using a remote key management system (e.g. Google KMS).
type Store ¶
type Store interface { AccountKey(address string) (Storable, error) ProposalKeyIndex(limitKeyCount int) (int, error) ProposalKeyCount() (int64, error) InsertProposalKey(proposalKey ProposalKey) error DeleteAllProposalKeys() error }
Store is the interface required by key manager for data storage.
func NewGormStore ¶
Directories ¶
Path | Synopsis |
---|---|
Package aws provides functions for key and signer generation in AWS KMS.
|
Package aws provides functions for key and signer generation in AWS KMS. |
Package basic provides straightforward implementation for key management.
|
Package basic provides straightforward implementation for key management. |
Package encryption provides encryption and decryption.
|
Package encryption provides encryption and decryption. |
Package google provides functions for key and signer generation in Google KMS.
|
Package google provides functions for key and signer generation in Google KMS. |
Package local provides functions for local key and signer generation.
|
Package local provides functions for local key and signer generation. |
Click to show internal directories.
Click to hide internal directories.