Documentation ¶
Index ¶
- Constants
- type CmdHandler
- type Command
- func (c *Command) ComputeMAC(w io.Writer, r io.Reader) error
- func (c *Command) CreateDID(w io.Writer, _ io.Reader) error
- func (c *Command) CreateKey(w io.Writer, r io.Reader) error
- func (c *Command) CreateKeyStore(w io.Writer, r io.Reader) error
- func (c *Command) Decrypt(w io.Writer, r io.Reader) error
- func (c *Command) DeriveProof(w io.Writer, r io.Reader) error
- func (c *Command) Easy(w io.Writer, r io.Reader) error
- func (c *Command) EasyOpen(w io.Writer, r io.Reader) error
- func (c *Command) Encrypt(w io.Writer, r io.Reader) error
- func (c *Command) ExportKey(w io.Writer, r io.Reader) error
- func (c *Command) ImportKey(w io.Writer, r io.Reader) error
- func (c *Command) RotateKey(w io.Writer, r io.Reader) error
- func (c *Command) SealOpen(w io.Writer, r io.Reader) error
- func (c *Command) Sign(w io.Writer, r io.Reader) error
- func (c *Command) SignMulti(w io.Writer, r io.Reader) error
- func (c *Command) UnwrapKey(w io.Writer, r io.Reader) error
- func (c *Command) Verify(_ io.Writer, r io.Reader) error
- func (c *Command) VerifyMAC(_ io.Writer, r io.Reader) error
- func (c *Command) VerifyMulti(_ io.Writer, r io.Reader) error
- func (c *Command) VerifyProof(_ io.Writer, r io.Reader) error
- func (c *Command) WrapKey(w io.Writer, r io.Reader) error
- type ComputeMACRequest
- type ComputeMACResponse
- type Config
- type CreateDIDResponse
- type CreateKeyRequest
- type CreateKeyResponse
- type CreateKeyStoreRequest
- type CreateKeyStoreResponse
- type CryptoBox
- type DecryptRequest
- type DecryptResponse
- type DeriveProofRequest
- type DeriveProofResponse
- type EDVOptions
- type EasyOpenRequest
- type EasyOpenResponse
- type EasyRequest
- type EasyResponse
- type EncryptRequest
- type EncryptResponse
- type Exec
- type ExportKeyResponse
- type Handler
- type ImportKeyRequest
- type ImportKeyResponse
- type RotateKeyRequest
- type RotateKeyResponse
- type SealOpenRequest
- type SealOpenResponse
- type SignMultiRequest
- type SignMultiResponse
- type SignRequest
- type SignResponse
- type UnwrapKeyRequest
- type UnwrapKeyResponse
- type VerifyMACRequest
- type VerifyMultiRequest
- type VerifyProofRequest
- type VerifyRequest
- type WrapKeyRequest
- type WrapKeyResponse
- type WrappedRequest
Constants ¶
const ( ActionCreateDID = "createDID" ActionCreateKeyStore = "createKeyStore" ActionCreateKey = "createKey" ActionImportKey = "importKey" ActionExportKey = "exportKey" ActionRotateKey = "rotateKey" ActionSign = "sign" ActionVerify = "verify" ActionEncrypt = "encrypt" ActionDecrypt = "decrypt" ActionComputeMac = "computeMAC" ActionVerifyMAC = "verifyMAC" ActionSignMulti = "signMulti" ActionVerifyMulti = "verifyMulti" ActionDeriveProof = "deriveProof" ActionVerifyProof = "verifyProof" ActionEasy = "easy" ActionEasyOpen = "easyOpen" ActionSealOpen = "sealOpen" ActionWrap = "wrap" ActionUnwrap = "unwrap" ActionStoreCapability = "updateEDVCapability" )
List of actions supported by KMS.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CmdHandler ¶
type CmdHandler struct {
// contains filtered or unexported fields
}
CmdHandler contains command handling details which can be used to build controller commands.
func NewCmdHandler ¶
func NewCmdHandler(method string, exec Exec) *CmdHandler
NewCmdHandler returns instance of CmdHandler which can be used handle controller commands.
func (*CmdHandler) Handle ¶
func (c *CmdHandler) Handle() Exec
Handle returns execute function of the command handler.
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command is a controller for commands.
func (*Command) ComputeMAC ¶
ComputeMAC computes message authentication code for data.
func (*Command) CreateKeyStore ¶
CreateKeyStore creates a new key store.
func (*Command) DeriveProof ¶
DeriveProof creates a BBS+ signature proof for a list of revealed messages.
func (*Command) VerifyMulti ¶
VerifyMulti verifies a signature of messages (BBS+).
func (*Command) VerifyProof ¶
VerifyProof verifies a BBS+ signature proof for revealed messages.
type ComputeMACRequest ¶
type ComputeMACRequest struct {
Data []byte `json:"data"`
}
ComputeMACRequest is a request to compute MAC for data.
type ComputeMACResponse ¶
type ComputeMACResponse struct {
MAC []byte `json:"mac"`
}
ComputeMACResponse is a response for ComputeMAC request.
type Config ¶
type Config struct { StorageProvider storage.Provider KeyStorageProvider storage.Provider // storage provider for users' key stores KMS kms.KeyManager Crypto crypto.Crypto VDRResolver zcapld.VDRResolver DocumentLoader ld.DocumentLoader KeyStoreCreator keyStoreCreator ShamirSecretLockCreator shamirSecretLockCreator CryptBoxCreator cryptoBoxCreator ZCAPService zcapService EnableZCAPs bool HeaderSigner headerSigner TLSConfig *tls.Config BaseKeyStoreURL string ShamirProvider shamirProvider MainKeyType kms.KeyType EDVRecipientKeyType kms.KeyType EDVMACKeyType kms.KeyType MetricsProvider metricsProvider CacheProvider cacheProvider KeyStoreCacheTTL time.Duration }
Config is a configuration for Command.
type CreateDIDResponse ¶
type CreateDIDResponse struct {
DID string `json:"did"`
}
CreateDIDResponse is a response for CreateDID request.
type CreateKeyRequest ¶
CreateKeyRequest is a request to create a key.
type CreateKeyResponse ¶
type CreateKeyResponse struct { KeyURL string `json:"key_url"` PublicKey []byte `json:"public_key"` }
CreateKeyResponse is a response for CreateKey request.
type CreateKeyStoreRequest ¶
type CreateKeyStoreRequest struct { Controller string `json:"controller"` EDV *EDVOptions `json:"edv"` }
CreateKeyStoreRequest is a request to create user's key store.
func (*CreateKeyStoreRequest) Validate ¶
func (r *CreateKeyStoreRequest) Validate() error
Validate validates CreateKeyStore request.
type CreateKeyStoreResponse ¶
type CreateKeyStoreResponse struct { KeyStoreURL string `json:"key_store_url"` Capability []byte `json:"capability,omitempty"` }
CreateKeyStoreResponse is a response for CreateKeyStore request.
type CryptoBox ¶
type CryptoBox interface { Easy(payload, nonce, theirPub []byte, myKID string) ([]byte, error) EasyOpen(ciphertext, nonce, theirPub, myPub []byte) ([]byte, error) SealOpen(ciphertext, myPub []byte) ([]byte, error) }
CryptoBox represents crypto box API.
type DecryptRequest ¶
type DecryptRequest struct { Ciphertext []byte `json:"ciphertext"` AssociatedData []byte `json:"associated_data,omitempty"` Nonce []byte `json:"nonce"` }
DecryptRequest is a request to decrypt a ciphertext.
type DecryptResponse ¶
type DecryptResponse struct {
Plaintext []byte `json:"plaintext"`
}
DecryptResponse is a response for Decrypt request.
type DeriveProofRequest ¶
type DeriveProofRequest struct { Messages [][]byte `json:"messages"` Signature []byte `json:"signature"` Nonce []byte `json:"nonce"` RevealedIndexes []int `json:"revealed_indexes"` }
DeriveProofRequest is a request to create a BBS+ signature proof for a list of revealed messages.
type DeriveProofResponse ¶
type DeriveProofResponse struct {
Proof []byte `json:"proof"`
}
DeriveProofResponse is a response for DeriveProof request.
type EDVOptions ¶
EDVOptions represents options for creating data vault on EDV.
type EasyOpenRequest ¶
type EasyOpenRequest struct { Ciphertext []byte `json:"ciphertext"` Nonce []byte `json:"nonce"` TheirPub []byte `json:"their_pub"` MyPub []byte `json:"my_pub"` }
EasyOpenRequest is a request to unseal a ciphertext sealed with Easy.
type EasyOpenResponse ¶
type EasyOpenResponse struct {
Plaintext []byte `json:"plaintext"`
}
EasyOpenResponse is a response for EasyOpen request.
type EasyRequest ¶
type EasyRequest struct { Payload []byte `json:"payload"` Nonce []byte `json:"nonce"` TheirPub []byte `json:"their_pub"` }
EasyRequest is a request to seal payload with a provided nonce.
type EasyResponse ¶
type EasyResponse struct {
Ciphertext []byte `json:"ciphertext"`
}
EasyResponse is a response for Easy request.
type EncryptRequest ¶
type EncryptRequest struct { Message []byte `json:"message"` AssociatedData []byte `json:"associated_data,omitempty"` }
EncryptRequest is a request to encrypt a message with associated data.
type EncryptResponse ¶
EncryptResponse is a response for Encrypt request.
type ExportKeyResponse ¶
type ExportKeyResponse struct { PublicKey []byte `json:"public_key"` KeyType string `json:"key_type"` }
ExportKeyResponse is a response for ExportKey request.
type Handler ¶
type Handler interface { // Method returns a name of the command. Method() string // Handle executes function of the command. Handle() Exec }
Handler for each controller command.
type ImportKeyRequest ¶
type ImportKeyRequest struct { Key []byte `json:"key"` KeyType kms.KeyType `json:"key_type"` KeyID string `json:"key_id,omitempty"` }
ImportKeyRequest is a request to import a key.
type ImportKeyResponse ¶
type ImportKeyResponse struct {
KeyURL string `json:"key_url"`
}
ImportKeyResponse is a response for ImportKey request.
type RotateKeyRequest ¶
RotateKeyRequest is a request to rotate a key.
type RotateKeyResponse ¶
type RotateKeyResponse struct {
KeyURL string `json:"key_url"`
}
RotateKeyResponse is a response for RotateKeyRequest request.
type SealOpenRequest ¶
SealOpenRequest is a request to decrypt a ciphertext encrypted with Seal.
type SealOpenResponse ¶
type SealOpenResponse struct {
Plaintext []byte `json:"plaintext"`
}
SealOpenResponse is a response for SealOpen request.
type SignMultiRequest ¶
type SignMultiRequest struct {
Messages [][]byte `json:"messages"`
}
SignMultiRequest is a request to create a BBS+ signature of messages.
type SignMultiResponse ¶
type SignMultiResponse struct {
Signature []byte `json:"signature"`
}
SignMultiResponse is a response for SignMulti request.
type SignRequest ¶
type SignRequest struct {
Message []byte `json:"message"`
}
SignRequest is a request to sign a message.
type SignResponse ¶
type SignResponse struct {
Signature []byte `json:"signature"`
}
SignResponse is a response for Sign request.
type UnwrapKeyRequest ¶
type UnwrapKeyRequest struct { WrappedKey crypto.RecipientWrappedKey `json:"wrapped_key"` SenderPubKey *crypto.PublicKey `json:"sender_pub_key,omitempty"` Tag []byte `json:"tag,omitempty"` }
UnwrapKeyRequest is a request to unwrap a wrapped key.
type UnwrapKeyResponse ¶
type UnwrapKeyResponse struct {
Key []byte `json:"key"`
}
UnwrapKeyResponse is a response for UnwrapKey request.
type VerifyMACRequest ¶
VerifyMACRequest is a request to verify MAC for data.
type VerifyMultiRequest ¶
type VerifyMultiRequest struct { Signature []byte `json:"signature"` Messages [][]byte `json:"messages"` }
VerifyMultiRequest is a request to verify a signature of messages (BBS+).
type VerifyProofRequest ¶
type VerifyProofRequest struct { Proof []byte `json:"proof"` Messages [][]byte `json:"messages"` Nonce []byte `json:"nonce"` }
VerifyProofRequest is a request to verify a BBS+ signature proof for revealed messages.
type VerifyRequest ¶
VerifyRequest is a request to verify a signature.
type WrapKeyRequest ¶
type WrapKeyRequest struct { CEK []byte `json:"cek"` APU []byte `json:"apu"` APV []byte `json:"apv"` RecipientPubKey *crypto.PublicKey `json:"recipient_pub_key"` Tag []byte `json:"tag,omitempty"` }
WrapKeyRequest is a request to wrap CEK.
type WrapKeyResponse ¶
type WrapKeyResponse struct {
crypto.RecipientWrappedKey
}
WrapKeyResponse is a response for WrapKey request.