apiclient

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPublicKeyNotFound means the response was OK, but no key was found
	ErrPublicKeyNotFound = fmt.Errorf("Public key not found")

	// ErrTeamNotFound means the response was OK, but no team was found
	ErrTeamNotFound = fmt.Errorf("Team not found")

	// ErrForbidden means the given user doesn't have access to the given resource, for example
	// the requester key isn't a member of a requested team.
	ErrForbidden = fmt.Errorf("Forbidden")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL   *url.URL // Base URL for API requests
	UserAgent string   // User agent used when communicating with the  API.
	// contains filtered or unexported fields
}

A Client manages communication with the Fluidkeys Server API.

func New

func New(fluidkeysVersion string) *Client

New returns a new Fluidkeys Server API client.

func (*Client) CreateSecret

func (c *Client) CreateSecret(recipientFingerprint fpr.Fingerprint, armoredEncryptedSecret string) error

CreateSecret creates a secret for the given recipient

func (*Client) DeleteRequestToJoinTeam

func (c *Client) DeleteRequestToJoinTeam(teamUUID uuid.UUID, requestUUID uuid.UUID) error

DeleteRequestToJoinTeam deletes a request to join a team

func (*Client) DeleteSecret

func (c *Client) DeleteSecret(fingerprint fpr.Fingerprint, uuid string) error

DeleteSecret deletes a secret

func (*Client) GetPublicKey

func (c *Client) GetPublicKey(email string) (string, error)

GetPublicKey attempts to get a single armored public key.

func (*Client) GetPublicKeyByFingerprint

func (c *Client) GetPublicKeyByFingerprint(fingerprint fpr.Fingerprint) (*pgpkey.PgpKey, error)

GetPublicKeyByFingerprint attempts to get a single armored public key.

func (*Client) GetTeamName

func (c *Client) GetTeamName(teamUUID uuid.UUID) (string, error)

GetTeamName attempts to get the team name

func (*Client) GetTeamRoster

func (c *Client) GetTeamRoster(teamUUID uuid.UUID, me fpr.Fingerprint) (
	roster string, signature string, err error)

GetTeamRoster attempts to get the team roster and signature for the given UUID. The API responds with encrypted JSON, so it tries to decrypt this using the requestingKey.

func (*Client) ListRequestsToJoinTeam

func (c *Client) ListRequestsToJoinTeam(teamUUID uuid.UUID, fingerprint fpr.Fingerprint) (
	requestsToJoinTeam []team.RequestToJoinTeam, err error)

ListRequestsToJoinTeam for the team with the given UUID.

func (*Client) ListSecrets

func (c *Client) ListSecrets(fingerprint fpr.Fingerprint) ([]v1structs.Secret, error)

ListSecrets for a particular fingerprint.

func (*Client) Log

func (c *Client) Log(event Event) error

Log sends an event to the API. The event is sent in a goroutine so it doesn't block the main thread.

func (*Client) RequestToJoinTeam

func (c *Client) RequestToJoinTeam(
	teamUUID uuid.UUID, fingerprint fpr.Fingerprint, email string) (err error)

RequestToJoinTeam posts a request to join the team identified by the UUID with the given fingerprint and email

func (*Client) UpsertPublicKey

func (c *Client) UpsertPublicKey(armoredPublicKey string, privateKey *pgpkey.PgpKey) error

UpsertPublicKey creates or updates a public key in the Fluidkeys Directory. It requires privateKey to ensure that only the owner of the public key can upload it.

func (*Client) UpsertTeam

func (c *Client) UpsertTeam(roster string, rosterSignature string,
	signerFingerprint fpr.Fingerprint) error

UpsertTeam takes a roster, signature and fingerprint to sign the request and attempts to create a secret for the given recipient

type Event

type Event struct {
	Name string

	// Fingerprint is the key that this event relates to, if any.
	Fingerprint *fp.Fingerprint

	// TeamUUID is the team that this event relates to, if any.
	TeamUUID *uuid.UUID

	// Error is the error associated with this event, or nil if no error.
	Error error
}

Event contains data to be uploaded and stored in the API

Jump to

Keyboard shortcuts

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