Documentation ¶
Index ¶
- Constants
- func GenerateServiceKey() (key string, err error)
- func NewServiceEncryption(db storage.ServiceStorage, cfg encryption.ExternalEncryptionConfig, key string) (encryption.Encrypter, encryption.Decrypter, error)
- type GetKeyDetailsRequest
- type GetKeyDetailsResponse
- type GetKeyRequest
- type GetKeyResponse
- type KeyDetails
- type RevokeKeyRequest
- type Service
- func (s Service) Config() config.KeyStoreServiceConfig
- func (s Service) GetKey(ctx context.Context, request GetKeyRequest) (*GetKeyResponse, error)
- func (s Service) GetKeyDetails(ctx context.Context, request GetKeyDetailsRequest) (*GetKeyDetailsResponse, error)
- func (s Service) RevokeKey(ctx context.Context, request RevokeKeyRequest) error
- func (s Service) Sign(ctx context.Context, keyID string, data any) (*keyaccess.JWT, error)
- func (s Service) Status() framework.Status
- func (s Service) StoreKey(ctx context.Context, request StoreKeyRequest) error
- func (s Service) Type() framework.Type
- type ServiceFactory
- type ServiceKey
- type Storage
- func (kss *Storage) GetKey(ctx context.Context, id string) (*StoredKey, error)
- func (kss *Storage) GetKeyDetails(ctx context.Context, id string) (*KeyDetails, error)
- func (kss *Storage) RevokeKey(ctx context.Context, id string) error
- func (kss *Storage) StoreKey(ctx context.Context, key StoredKey) error
- type StoreKeyRequest
- type StoredKey
Constants ¶
View Source
const ( ServiceKeyEncryptionKey = "onchain-access-control-key-encryption-key" ServiceDataEncryptionKey = "onchain-access-control-data-key" )
Variables ¶
This section is empty.
Functions ¶
func GenerateServiceKey ¶
GenerateServiceKey creates a random key that's 32 bytes encoded using base58.
func NewServiceEncryption ¶
func NewServiceEncryption(db storage.ServiceStorage, cfg encryption.ExternalEncryptionConfig, key string) (encryption.Encrypter, encryption.Decrypter, error)
NewServiceEncryption creates a pair of Encrypter and Decrypter with the given configuration.
Types ¶
type GetKeyDetailsRequest ¶
type GetKeyDetailsRequest struct {
ID string
}
type GetKeyDetailsResponse ¶
type GetKeyRequest ¶
type GetKeyRequest struct {
ID string
}
type GetKeyResponse ¶
type KeyDetails ¶
type KeyDetails struct { ID string `json:"id"` Controller string `json:"controller"` KeyType crypto.KeyType `json:"keyType"` Revoked bool `json:"revoked"` RevokedAt string `json:"revokedAt"` CreatedAt string `json:"createdAt"` PublicKeyJWK jwx.PublicKeyJWK `json:"publicKeyJwk"` }
KeyDetails represents a common data model to get information about a key, without revealing the key itself
type RevokeKeyRequest ¶
type RevokeKeyRequest struct {
ID string
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewKeyStoreService ¶
func NewKeyStoreService(config config.KeyStoreServiceConfig, s storage.ServiceStorage) (*Service, error)
func (Service) Config ¶
func (s Service) Config() config.KeyStoreServiceConfig
func (Service) GetKey ¶
func (s Service) GetKey(ctx context.Context, request GetKeyRequest) (*GetKeyResponse, error)
func (Service) GetKeyDetails ¶
func (s Service) GetKeyDetails(ctx context.Context, request GetKeyDetailsRequest) (*GetKeyDetailsResponse, error)
func (Service) RevokeKey ¶
func (s Service) RevokeKey(ctx context.Context, request RevokeKeyRequest) error
func (Service) Sign ¶
Sign fetches the key in the store, and uses it to sign data. Data should be json or json-serializable.
type ServiceFactory ¶
func NewKeyStoreServiceFactory ¶
func NewKeyStoreServiceFactory(config config.KeyStoreServiceConfig, s storage.ServiceStorage, encrypter encryption.Encrypter, decrypter encryption.Decrypter) ServiceFactory
type ServiceKey ¶
type Storage ¶
func NewKeyStoreStorage ¶
func NewKeyStoreStorage(db storage.ServiceStorage, e encryption.Encrypter, d encryption.Decrypter, writer storage.Tx) (*Storage, error)
func (*Storage) GetKeyDetails ¶
type StoreKeyRequest ¶
type StoredKey ¶
type StoredKey struct { ID string `json:"id"` Controller string `json:"controller"` KeyType crypto.KeyType `json:"keyType"` Base58Key string `json:"key"` Revoked bool `json:"revoked"` RevokedAt string `json:"revokedAt"` CreatedAt string `json:"createdAt"` }
StoredKey represents a common data model to store data on all key types
Click to show internal directories.
Click to hide internal directories.