vault

package
v0.0.0-...-7b7c10a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2022 License: Apache-2.0 Imports: 15 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client for vault.

func New

func New(baseURL string, opts ...Option) *Client

New return new instance of vault client.

func (*Client) CreateAuthorization

func (c *Client) CreateAuthorization(vaultID, requestingParty string, scope *vault.AuthorizationsScope,
) (*vault.CreatedAuthorization, error)

CreateAuthorization creates an authorization.

func (*Client) CreateVault

func (c *Client) CreateVault() (*vault.CreatedVault, error)

CreateVault creates a new vault.

func (*Client) GetAuthorization

func (c *Client) GetAuthorization(vaultID, id string) (*vault.CreatedAuthorization, error)

GetAuthorization returns an authorization.

func (*Client) GetDocMetaData

func (c *Client) GetDocMetaData(vaultID, docID string) (*vault.DocumentMetadata, error)

GetDocMetaData get doc metadata.

func (*Client) SaveDoc

func (c *Client) SaveDoc(vaultID, id string, content interface{}) (*vault.DocumentMetadata, error)

SaveDoc saves a document.

type ConfidentialStorageDocReader

type ConfidentialStorageDocReader interface {
	ReadDocument(vaultID, docID string, opts ...edv.ReqOption) (*models.EncryptedDocument, error)
}

ConfidentialStorageDocReader reads encrypted documents from Confidential Storages.

type DocumentReader

type DocumentReader struct {
	// contains filtered or unexported fields
}

DocumentReader is an io.Reader encapsulating the contents of a Confidential Storage document.

func NewDocumentReader

func NewDocumentReader(vaultID, docID string, client ConfidentialStorageDocReader, options ...ReaderOption,
) *DocumentReader

NewDocumentReader returns a non thread-safe Reader for the Confidential Storage document.

If the Confidential Storage document is encrypted then use the WithDocumentDecrypter ReaderOption to decrypt the contents.

func (*DocumentReader) Read

func (r *DocumentReader) Read(p []byte) (n int, err error)

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient interface for the http client.

type Option

type Option func(opts *Client)

Option is a vault client instance option.

func WithHTTPClient

func WithHTTPClient(c HTTPClient) Option

WithHTTPClient allows providing HTTP client.

type ReaderOption

type ReaderOption func(*DocumentReader)

ReaderOption configures the DocumentReader.

func WithDocumentDecrypter

func WithDocumentDecrypter(jd jose.Decrypter) ReaderOption

WithDocumentDecrypter must be used when the Confidential Storage document has been encrypted.

type Vault

type Vault interface {
	CreateVault() (*vault.CreatedVault, error)
	SaveDoc(vaultID, id string, content interface{}) (*vault.DocumentMetadata, error)
	GetDocMetaData(vaultID, docID string) (*vault.DocumentMetadata, error)
	CreateAuthorization(vaultID, requestingParty string,
		scope *vault.AuthorizationsScope) (*vault.CreatedAuthorization, error)
	GetAuthorization(vaultID, id string) (*vault.CreatedAuthorization, error)
}

Vault defines vault client interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL