Documentation
¶
Overview ¶
Package remote is the client of a registry's knowledge routes: wrap and unwrap a pack's data key, create a pack, upload and download its sealed tree, list and delete, for the account a session token or a personal access token with knowledge:read and knowledge:write speaks for. It implements store.Registry for the CLI and the desktop alike, and, through Shared, store.Shared for an organization's shared packs (the core's /orgs/{org}/knowledge/).
Index ¶
- type Client
- func (c *Client) Create(ctx context.Context, name string, wk store.WrappedKey) (store.Remote, error)
- func (c *Client) Delete(ctx context.Context, id string) error
- func (c *Client) GetTree(ctx context.Context, id string) ([]byte, string, error)
- func (c *Client) List(ctx context.Context) ([]store.Remote, error)
- func (c *Client) PutTree(ctx context.Context, id string, sealed []byte) (store.Remote, error)
- func (c *Client) Shared(org string) *OrgClient
- func (c *Client) URL() string
- func (c *Client) Unwrap(ctx context.Context, wk store.WrappedKey) ([]byte, error)
- func (c *Client) Wrap(ctx context.Context, dataKey []byte) (store.WrappedKey, error)
- type OrgClient
- func (o *OrgClient) Export(ctx context.Context, id string) ([]byte, string, error)
- func (o *OrgClient) GetTree(ctx context.Context, id string) ([]byte, string, error)
- func (o *OrgClient) List(ctx context.Context) ([]store.Remote, error)
- func (o *OrgClient) Org() string
- func (o *OrgClient) URL() string
- func (o *OrgClient) Unwrap(ctx context.Context, wk store.WrappedKey) ([]byte, error)
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 is one registry, as one account.
func New ¶
New is the client of the registry at regURL (no trailing slash) with token as its bearer credential. hc is the HTTP client every request goes through (nil: http.DefaultClient, which has no timeout; callers pass their own).
func (*Client) Create ¶
func (c *Client) Create(ctx context.Context, name string, wk store.WrappedKey) (store.Remote, error)
Create implements store.Registry: POST /knowledge/packs.
func (*Client) GetTree ¶
GetTree implements store.Registry: GET /knowledge/packs/{id}/tree. The body is read no further than a sealed pack at the size cap can be, so a registry cannot make the client hold more than that.
type OrgClient ¶
type OrgClient struct {
// contains filtered or unexported fields
}
OrgClient is one organization's shared packs at a registry, as the account a Client speaks for: the registry answers it only while that account is an active member, and 404 to anyone else.
func (*OrgClient) Export ¶
Export implements store.Shared: GET /orgs/{org}/knowledge/packs/{id}/export, the tree the registry decrypts: an admin's, or a member's of a pack marked exportable (store.ErrNotExportable otherwise).
func (*OrgClient) GetTree ¶
GetTree implements store.Shared: GET /orgs/{org}/knowledge/packs/{id}/tree, read no further than a sealed pack at the size cap can be.