Documentation ¶
Index ¶
- type Authorization
- type AuthorizationsScope
- type Caveat
- type Client
- func (c *Client) CreateAuthorization(vaultID, requestingParty string, scope *AuthorizationsScope) (*CreatedAuthorization, error)
- func (c *Client) CreateVault() (*CreatedVault, error)
- func (c *Client) GetAuthorization(vaultID, id string) (*CreatedAuthorization, error)
- func (c *Client) GetDocMetadata(vaultID, docID string) (*DocumentMetadata, error)
- func (c *Client) SaveDoc(vaultID, id string, content []byte) (*DocumentMetadata, error)
- type CreatedAuthorization
- type CreatedVault
- type DocumentMetadata
- type HTTPClient
- type KeyManager
- type Location
- type Opt
- type Tokens
- type Vault
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authorization ¶
Authorization consists of info needed for the authorization.
type AuthorizationsScope ¶
type AuthorizationsScope struct { Target string `json:"target,omitempty"` TargetAttr string `json:"targetAttr,omitempty"` Actions []string `json:"actions,omitempty"` Caveats []Caveat `json:"caveats,omitempty"` }
AuthorizationsScope represents authorization request.
type Caveat ¶
type Caveat struct { Type string `json:"type,omitempty"` Duration uint64 `json:"duration,omitempty"` }
Caveat for the AuthorizationsScope request.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client vault`s client.
func NewClient ¶
func NewClient(kmsURL, edvURL string, kmsClient kms.KeyManager, db storage.Provider, loader ld.DocumentLoader, opts ...Opt, ) (*Client, error)
NewClient creates a new vault client.
func (*Client) CreateAuthorization ¶
func (c *Client) CreateAuthorization(vaultID, requestingParty string, scope *AuthorizationsScope, ) (*CreatedAuthorization, error)
CreateAuthorization creates a new authorization. nolint: funlen
func (*Client) CreateVault ¶
func (c *Client) CreateVault() (*CreatedVault, error)
CreateVault creates a new vault and KMS store bases on generated DIDKey.
func (*Client) GetAuthorization ¶
func (c *Client) GetAuthorization(vaultID, id string) (*CreatedAuthorization, error)
GetAuthorization returns an authorization by given id.
func (*Client) GetDocMetadata ¶
func (c *Client) GetDocMetadata(vaultID, docID string) (*DocumentMetadata, error)
GetDocMetadata returns document`s metadata.
type CreatedAuthorization ¶
type CreatedAuthorization struct { ID string `json:"id"` Scope *AuthorizationsScope `json:"scope"` RequestingParty string `json:"requestingParty"` Tokens *Tokens `json:"authTokens"` }
CreatedAuthorization represents success response of CreateAuthorization function.
type CreatedVault ¶
type CreatedVault struct { ID string `json:"id"` *Authorization }
CreatedVault represents success response of CreateVault function.
type DocumentMetadata ¶
type DocumentMetadata struct { ID string `json:"docID"` URI string `json:"edvDocURI"` EncKeyURI string `json:"encKeyURI"` }
DocumentMetadata represents document`s metadata.
type HTTPClient ¶
HTTPClient interface for the http client.
type Opt ¶
type Opt func(*Client)
Opt represents Client`s option.
func WithDidAnchorOrigin ¶
WithDidAnchorOrigin allows providing did anchor origin.
func WithDidDomain ¶
WithDidDomain allows providing did domain.
func WithDidMethod ¶
WithDidMethod allows providing did method.
func WithHTTPClient ¶
func WithHTTPClient(client HTTPClient) Opt
WithHTTPClient allows providing HTTP client.
func WithRegistry ¶
WithRegistry allows providing registry.
type Vault ¶
type Vault interface { CreateVault() (*CreatedVault, error) SaveDoc(vaultID, id string, content []byte) (*DocumentMetadata, error) GetDocMetadata(vaultID, docID string) (*DocumentMetadata, error) CreateAuthorization(vaultID, requestingParty string, scope *AuthorizationsScope) (*CreatedAuthorization, error) GetAuthorization(vaultID, id string) (*CreatedAuthorization, error) }
Vault defines vault client interface.