client

package
v0.0.0-...-3301e3d Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Padl

type Padl struct {
	HostURL    string
	AuthToken  string
	HTTPClient *http.Client
}

Padl represents a padl API client

func NewPadlClient

func NewPadlClient(hostURL, token string, httpClient *http.Client) (*Padl, error)

NewPadlClient is the constructor for the Client object

func (*Padl) AddUserToProject

func (p *Padl) AddUserToProject(projectName string, email string, privilegeLvl int) error

AddUserToProject adds another user to a project with given privilege permission

func (*Padl) CreateProject

func (p *Padl) CreateProject(name, description string, bits int) (*padlfile.File, error)

CreateProject creates a new project and returns a signed padlfile

func (*Padl) CreateServiceAccount

func (p *Padl) CreateServiceAccount(projectName, accountName, pubKeyPEM string) (*payloads.CreateServiceAccountResponse, error)

CreateServiceAccount Creates a new service account

func (*Padl) DecryptSecret

func (p *Padl) DecryptSecret(secret, kid string) (string, error)

DecryptSecret decrypts and returns a secret in plaintext

func (*Padl) DeleteProject

func (p *Padl) DeleteProject(projectName string) error

DeleteProject deletes a project from the padl server falis if the user does not have owner privileges

func (*Padl) GetProject

func (p *Padl) GetProject(name string) (*project.Project, error)

GetProject gets a project by name if the requesting user has access to it

func (*Padl) GetProjectKeys

func (p *Padl) GetProjectKeys(name string) (*payloads.GetProjectKeysReponse, error)

GetProjectKeys gets a project's list of keys by project name, the request will fail if the authorization token in the client is not for a user in the project

func (*Padl) GetPublicKey

func (p *Padl) GetPublicKey(kid string) (*kms.PublicKey, error)

GetPublicKey gets a padl-managed public key from the server

func (*Padl) ListProjects

func (p *Padl) ListProjects() (*payloads.ListProjectsResponse, error)

ListProjects lists the users padl projects

func (*Padl) Login

func (p *Padl) Login(email, password string) (string, error)

Login logs an existing user into a padl server

func (*Padl) Register

func (p *Padl) Register(email, password, pubKey string) error

Register registers a new user with email and a public PGP key

func (*Padl) RemoveServiceAccount

func (p *Padl) RemoveServiceAccount(projectName string, keyName string) error

RemoveServiceAccount Removes service account

func (*Padl) RemoveUserFromProject

func (p *Padl) RemoveUserFromProject(projectName string, email string) error

RemoveUserFromProject removes another user from the project fails if the current user does not have owner privilege or if an owner tries to remove themselves

func (*Padl) RotateUserKey

func (p *Padl) RotateUserKey(pubPEM string) error

RotateUserKey rotates the key for a given user

func (*Padl) Valid

func (p *Padl) Valid() (*auth.CustomClaims, error)

Valid checks whether a client has a valid token or not and returns the claims represented by the token body

Jump to

Keyboard shortcuts

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