Back to godoc.org
git.lastassault.de/sup/passbolt

Package passbolt

v0.0.0-...-ee3c92b
Latest Go to latest

The latest major version is .

Published: Aug 21, 2020 | License: MIT | Module: git.lastassault.de/sup/passbolt

Index

func DecryptMessage

func DecryptMessage(userPrivateKey, userPassword, message []byte) ([]byte, error)

DecryptMessage decrypts a message

func EncryptMessage

func EncryptMessage(publicKey, privateKey, privateKeyPassword, message string) (string, error)

EncryptMessage encrypt a message using the public key and then signes the message using the private key

func GetPrivateKeyPacket

func GetPrivateKeyPacket(privateKey []byte) (*packet.PrivateKey, error)

GetPrivateKeyPacket converts string into package

func GetPublicKeyPacket

func GetPublicKeyPacket(publicKey []byte) (*packet.PublicKey, error)

GetPublicKeyPacket converts string into package

type APIHeader

type APIHeader struct {
	ID         string `json:"id"`
	Status     string `json:"status"`
	Servertime int    `json:"servertime"`
	Action     string `json:"action"`
	Message    string `json:"message"`
	URL        string `json:"url"`
	Code       int    `json:"code"`
}

APIHeader is the Struct representation of the Header of a APIResponse

type APIResponse

type APIResponse struct {
	Header APIHeader       `json:"header"`
	Body   json.RawMessage `json:"body"`
}

APIResponse is the Struct representation of a Json Response

type ARO

type ARO struct {
	User
	Group
}

ARO is a User or a Group

type Avatar

type Avatar struct {
	ID         string `json:"id,omitempty"`
	UserID     string `json:"user_id,omitempty"`
	ForeignKey string `json:"foreign_key,omitempty"`
	Model      string `json:"model,omitempty"`
	Filename   string `json:"filename,omitempty"`
	Filesize   int    `json:"filesize,omitempty"`
	MimeType   string `json:"mime_type,omitempty"`
	Extension  string `json:"extension,omitempty"`
	Hash       string `json:"hash,omitempty"`
	Path       string `json:"path,omitempty"`
	Adapter    string `json:"adapter,omitempty"`
	Created    *Time  `json:"created,omitempty"`
	Modified   *Time  `json:"modified,omitempty"`
	URL        *URL   `json:"url,omitempty"`
}

Avatar is a Users Avatar

type Client

type Client struct {
	BaseURL   *url.URL
	UserAgent string

	SessionToken http.Cookie
	CSRFToken    http.Cookie
	// contains filtered or unexported fields
}

Client is a Client struct for the Passbolt api

func NewClient

func NewClient(BaseURL *url.URL, UserAgent string, httpClient *http.Client) *Client

NewClient Returns a new Passbolt Client

func (*Client) CheckSession

func (c *Client) CheckSession(ctx context.Context) bool

CheckSession Check to see if you have a Valid Session

func (*Client) CreateComment

func (c *Client) CreateComment(ctx context.Context, resourceID string, comment Comment) (*Comment, error)

CreateComment Creates a new Passbolt Comment

func (*Client) CreateFavorite

func (c *Client) CreateFavorite(ctx context.Context, resourceID string) (*Favorite, error)

CreateFavorite Creates a new Passbolt Favorite for the given Resource ID

func (*Client) CreateFolder

func (c *Client) CreateFolder(ctx context.Context, folder Folder) (*Folder, error)

CreateFolder Creates a new Passbolt Folder

func (*Client) CreateGroup

func (c *Client) CreateGroup(ctx context.Context, group Group) (*Group, error)

CreateGroup Creates a new Passbolt Group

func (*Client) CreateResource

func (c *Client) CreateResource(ctx context.Context, resource Resource) (*Resource, error)

CreateResource Creates a new Passbolt Resource

func (*Client) CreateUser

func (c *Client) CreateUser(ctx context.Context, user User) (*User, error)

CreateUser Creates a new Passbolt User

func (*Client) DeleteComment

func (c *Client) DeleteComment(ctx context.Context, commentID string) error

DeleteComment Deletes a Passbolt Comment

func (*Client) DeleteFavorite

func (c *Client) DeleteFavorite(ctx context.Context, favoriteID string) error

DeleteFavorite Deletes a Passbolt Favorite

func (*Client) DeleteFolder

func (c *Client) DeleteFolder(ctx context.Context, folderID string) error

DeleteFolder Deletes a Passbolt Folder

func (*Client) DeleteGroup

func (c *Client) DeleteGroup(ctx context.Context, groupID string) error

DeleteGroup Deletes a Passbolt Group

func (*Client) DeleteResource

func (c *Client) DeleteResource(ctx context.Context, resourceID string) error

DeleteResource Deletes a Passbolt Resource

func (*Client) DeleteUser

func (c *Client) DeleteUser(ctx context.Context, userID string) error

DeleteUser Deletes a Passbolt User

func (*Client) DeleteUserDryrun

func (c *Client) DeleteUserDryrun(ctx context.Context, userID string) error

DeleteUserDryrun Check if a Passbolt User is Deleteable

func (*Client) DoCustomRequest

func (c *Client) DoCustomRequest(ctx context.Context, method, path string, body interface{}, opts interface{}) (*http.Response, *APIResponse, error)

DoCustomRequest Executes a Custom Request and return the raw Json Body

func (*Client) GetComments

func (c *Client) GetComments(ctx context.Context, resourceID string, opts *GetCommentsOptions) ([]Comment, error)

GetComments gets all Passbolt Comments an The Specified Resource

func (*Client) GetFolder

func (c *Client) GetFolder(ctx context.Context, folderID string) (*Folder, error)

GetFolder gets a Passbolt Folder

func (*Client) GetFolders

func (c *Client) GetFolders(ctx context.Context, opts *GetFolderOptions) ([]Folder, error)

GetFolders gets all Folders from the Passboltserver

func (*Client) GetGPGKey

func (c *Client) GetGPGKey(ctx context.Context, gpgkeyID string) (*GPGKey, error)

GetGPGKey gets a Passbolt GPGKey

func (*Client) GetGPGKeys

func (c *Client) GetGPGKeys(ctx context.Context, opts *GetGPGKeysOptions) ([]GPGKey, error)

GetGPGKeys gets all Passbolt GPGKeys

func (*Client) GetGroup

func (c *Client) GetGroup(ctx context.Context, groupID string) (*Group, error)

GetGroup gets a Passbolt Group

func (*Client) GetGroups

func (c *Client) GetGroups(ctx context.Context, opts *GetGroupsOptions) ([]Group, error)

GetGroups gets all Passbolt Groups

func (*Client) GetHealthCheckStatus

func (c *Client) GetHealthCheckStatus(ctx context.Context) (string, error)

GetHealthCheckStatus gets the Server Status

func (*Client) GetMe

func (c *Client) GetMe(ctx context.Context) (*User, error)

GetMe gets the currently logged in Passbolt User

func (*Client) GetPublicKey

func (c *Client) GetPublicKey(ctx context.Context) (string, string, error)

GetPublicKey gets the Public Key and Fingerprint of the Passbolt instance

func (*Client) GetResource

func (c *Client) GetResource(ctx context.Context, resourceID string) (*Resource, error)

GetResource gets a Passbolt Resource

func (*Client) GetResourcePermissions

func (c *Client) GetResourcePermissions(ctx context.Context, resourceID string) ([]Permission, error)

GetResourcePermissions gets a Resources Permissions

func (*Client) GetResources

func (c *Client) GetResources(ctx context.Context, opts *GetResourcesOptions) ([]Resource, error)

GetResources gets all Passbolt Resources

func (*Client) GetRoles

func (c *Client) GetRoles(ctx context.Context) ([]Role, error)

GetRoles gets all Passbolt Roles

func (*Client) GetSecret

func (c *Client) GetSecret(ctx context.Context, resourceID string) (*Secret, error)

GetSecret gets a Passbolt Secret

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, userID string) (*User, error)

GetUser gets a Passbolt User

func (*Client) GetUsers

func (c *Client) GetUsers(ctx context.Context, opts *GetUsersOptions) ([]User, error)

GetUsers gets all Passbolt Users

func (*Client) Login

func (c *Client) Login(ctx context.Context, userPrivateKey, userPassword, passboltPublicKey []byte) error

Login gets a Session and CSRF Token from Passbolt and Stores them in the Clients Cookie Jar

func (*Client) Logout

func (c *Client) Logout(ctx context.Context) error

Logout closes the current Session on the Passbolt server

func (*Client) PerformHealthCheck

func (c *Client) PerformHealthCheck(ctx context.Context) (json.RawMessage, error)

PerformHealthCheck performs a Health Check

func (*Client) SearchAROs

func (c *Client) SearchAROs(ctx context.Context, opts SearchAROsOptions) ([]ARO, error)

SearchAROs gets all Passbolt AROs

func (*Client) ShareResource

func (c *Client) ShareResource(ctx context.Context, resourceID string, shareRequest ShareRequest) error

ShareResource Shares a Resource with AROs

func (*Client) SimulateShareResource

func (c *Client) SimulateShareResource(ctx context.Context, resourceID string, shareRequest ShareRequest) (*ShareSimultaionResult, error)

SimulateShareResource Simulates Shareing a Resource with AROs

func (*Client) UpdateComment

func (c *Client) UpdateComment(ctx context.Context, commentID string, comment Comment) (*Comment, error)

UpdateComment Updates a existing Passbolt Comment

func (*Client) UpdateFolder

func (c *Client) UpdateFolder(ctx context.Context, folderID string, folder Folder) (*Folder, error)

UpdateFolder Updates a existing Passbolt Folder

func (*Client) UpdateGroup

func (c *Client) UpdateGroup(ctx context.Context, groupID string, group Group) (*Group, error)

UpdateGroup Updates a existing Passbolt Group

func (*Client) UpdateResource

func (c *Client) UpdateResource(ctx context.Context, resourceID string, resource Resource) (*Resource, error)

UpdateResource Updates a existing Passbolt Resource

func (*Client) UpdateUser

func (c *Client) UpdateUser(ctx context.Context, userID string, user User) (*User, error)

UpdateUser Updates a existing Passbolt User

type Comment

type Comment struct {
	ID           string    `json:"id,omitempty"`
	ParentID     string    `json:"parent_id,omitempty"`
	ForeignKey   string    `json:"foreign_key,omitempty"`
	Content      string    `json:"content,omitempty"`
	ForeignModel string    `json:"foreign_model,omitempty"`
	Created      *Time     `json:"created,omitempty"`
	CreatedBy    string    `json:"created_by,omitempty"`
	UserID       string    `json:"user_id,omitempty"`
	Description  string    `json:"description,omitempty"`
	Modified     *Time     `json:"modified,omitempty"`
	ModifiedBy   string    `json:"modified_by,omitempty"`
	Children     []Comment `json:"children,omitempty"`
}

Comment is a Comment

type Favorite

type Favorite struct {
	ID           string `json:"id,omitempty"`
	Created      *Time  `json:"created,omitempty"`
	ForeignKey   string `json:"foreign_key,omitempty"`
	ForeignModel string `json:"foreign_model,omitempty"`
	Modified     *Time  `json:"modified,omitempty"`
}

Favorite is a Favorite

type Folder

type Folder struct {
	ID             string       `json:"id,omitempty"`
	Created        *Time        `json:"created,omitempty"`
	CreatedBy      string       `json:"created_by,omitempty"`
	Modified       *Time        `json:"modified,omitempty"`
	ModifiedBy     string       `json:"modified_by,omitempty"`
	Name           string       `json:"name,omitempty"`
	Permissions    []Permission `json:"permissions,omitempty"`
	FolderParentID string       `json:"folder_parent_id,omitempty"`
	Personal       bool         `json:"personal,omitempty"`
}

Folder is a Folder

type GPGAuth

type GPGAuth struct {
	KeyID string `json:"keyid"`
	Token string `json:"user_token_result,omitempty"`
}

GPGAuth is used for login

type GPGKey

type GPGKey struct {
	ID          string `json:"id,omitempty"`
	ArmoredKey  string `json:"armored_key,omitempty"`
	Created     *Time  `json:"created,omitempty"`
	KeyCreated  *Time  `json:"key_created,omitempty"`
	Bits        int    `json:"bits,omitempty"`
	Deleted     bool   `json:"deleted,omitempty"`
	Modified    *Time  `json:"modified,omitempty"`
	KeyID       string `json:"key_id,omitempty"`
	Fingerprint string `json:"fingerprint,omitempty"`
	Type        string `json:"type,omitempty"`
	Expires     *Time  `json:"expires,omitempty"`
}

GPGKey is a GPGKey

type GetCommentsOptions

type GetCommentsOptions struct {
	ContainCreator  bool `url:"contain[creator],omitempty"`
	ContainModifier bool `url:"contain[modifier],omitempty"`
}

GetCommentsOptions are all available query parameters

type GetFolderOptions

type GetFolderOptions struct {
	ContainPermissionUserProfile bool `url:"contain[permissions.user.profile]"`
	ContainPermissionGroup       bool `url:"contain[permissions.group]"`
}

GetFolderOptions are all available query parameters

type GetGPGKeysOptions

type GetGPGKeysOptions struct {
	// This is a Unix TimeStamp for Whatever Reason
	FilterModifiedAfter int `url:"filter[modified-after],omitempty"`
}

GetGPGKeysOptions are all available query parameters

type GetGroupsOptions

type GetGroupsOptions struct {
	FilterHasUsers    []string `url:"filter[has_users],omitempty"`
	FilterHasManagers []string `url:"filter[has-managers],omitempty"`

	ContainModifier        bool `url:"contain[modifier],omitempty"`
	ContainModifierProfile bool `url:"contain[modifier.profile],omitempty"`
	ContainUser            bool `url:"contain[user],omitempty"`
	ContainGroupUser       bool `url:"contain[group_user],omitempty"`
	ContainMyGroupUser     bool `url:"contain[my_group_user],omitempty"`
}

GetGroupsOptions are all available query parameters

type GetResourcesOptions

type GetResourcesOptions struct {
	FilterIsFavorite        bool   `url:"filter[is-favorite],omitempty"`
	FilterIsSharedWithMe    bool   `url:"filter[is-shared-with-me],omitempty"`
	FilterIsSharedWithGroup string `url:"filter[is-shared-with-group],omitempty"`
	FilterHasID             string `url:"filter[has-id],omitempty"`

	ContainCreator                bool `url:"contain[creator],omitempty"`
	ContainFavorites              bool `url:"contain[favorite],omitempty"`
	ContainModifier               bool `url:"contain[modifier],omitempty"`
	ContainPermissions            bool `url:"contain[permission],omitempty"`
	ContainPermissionsUserProfile bool `url:"contain[permissions.user.profile],omitempty"`
	ContainPermissionsGroup       bool `url:"contain[permissions.group],omitempty"`
	ContainSecret                 bool `url:"contain[secret],omitempty"`
	ContainTags                   bool `url:"contain[tag],omitempty"`
}

GetResourcesOptions are all available query parameters

type GetUsersOptions

type GetUsersOptions struct {
	FilterSearch    string `url:"filter[search],omitempty"`
	FilterHasGroup  string `url:"filter[has-group],omitempty"`
	FilterHasAccess string `url:"filter[has-access],omitempty"`
	FilterIsAdmin   bool   `url:"filter[is-admin],omitempty"`

	ContainLastLoggedIn bool `url:"contain[LastLoggedIn],omitempty"`
}

GetUsersOptions are all available query parameters

type Group

type Group struct {
	ID         string `json:"id,omitempty"`
	Name       string `json:"name,omitempty"`
	Created    *Time  `json:"created,omitempty"`
	CreatedBy  string `json:"created_by,omitempty"`
	Deleted    bool   `json:"deleted,omitempty"`
	Modified   *Time  `json:"modified,omitempty"`
	ModifiedBy string `json:"modified_by,omitempty"`
	GroupUsers []User `json:"groups_users,omitempty"`
}

Group is a Group

type Login

type Login struct {
	Auth *GPGAuth `json:"gpg_auth"`
}

Login is used for login

type Permission

type Permission struct {
	ID            string `json:"id,omitempty"`
	ACO           string `json:"aco,omitempty"`
	ACOForeignKey string `json:"aco_foreign_key,omitempty"`
	ARO           string `json:"aro,omitempty"`
	AROForeignKey string `json:"aro_foreign_key,omitempty"`
	Type          int    `json:"type,omitempty"`
	Created       *Time  `json:"created,omitempty"`
	Modified      *Time  `json:"modified,omitempty"`
}

Permission is a Permission

type Profile

type Profile struct {
	ID        string `json:"id,omitempty"`
	UserID    string `json:"user_id,omitempty"`
	FirstName string `json:"first_name,omitempty"`
	LastName  string `json:"last_name,omitempty"`
	Created   *Time  `json:"created,omitempty"`
	Modified  *Time  `json:"modified,omitempty"`
}

Profile is a Profile

type PublicKeyReponse

type PublicKeyReponse struct {
	Fingerprint string `json:"fingerprint"`
	Keydata     string `json:"keydata"`
}

PublicKeyReponse the Body of a Public Key Api Request

type Resource

type Resource struct {
	ID             string      `json:"id,omitempty"`
	Created        *Time       `json:"created,omitempty"`
	CreatedBy      string      `json:"created_by,omitempty"`
	Creator        *User       `json:"creator,omitempty"`
	Deleted        bool        `json:"deleted,omitempty"`
	Description    string      `json:"description,omitempty"`
	Favorite       *Favorite   `json:"favorite,omitempty"`
	Modified       *Time       `json:"modified,omitempty"`
	ModifiedBy     string      `json:"modified_by,omitempty"`
	Modifier       *User       `json:"modifier,omitempty"`
	Name           string      `json:"name,omitempty"`
	Permission     *Permission `json:"permission,omitempty"`
	URI            string      `json:"uri,omitempty"`
	Username       string      `json:"username,omitempty"`
	FolderParentID string      `json:"folder_parent_id,omitempty"`
	Secrets        []Secret    `json:"secrets,omitempty"`
	Tags           []Tag       `json:"tags,omitempty"`
}

Resource is a Resource

type Role

type Role struct {
	ID          string `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
	Created     *Time  `json:"created,omitempty"`
	Description string `json:"description,omitempty"`
	Modified    *Time  `json:"modified,omitempty"`
	Avatar      Avatar `json:"avatar,omitempty"`
}

Role is a Role

type SearchAROsOptions

type SearchAROsOptions struct {
	FilterSearch string `url:"filter[search],omitempty"`
}

SearchAROsOptions are all available query parameters

type Secret

type Secret struct {
	ID         string `json:"id,omitempty"`
	UserID     string `json:"user_id,omitempty"`
	ResourceID string `json:"resource_id,omitempty"`
	Data       string `json:"data,omitempty"`
	Created    *Time  `json:"created,omitempty"`
	Modified   *Time  `json:"modified,omitempty"`
}

Secret is a Secret

type ShareRequest

type ShareRequest struct {
	Permissions []Permission `json:"permissions,omitempty"`
	Secrets     []Secret     `json:"secrets,omitempty"`
}

ShareRequest is a ShareRequest

type ShareSimultaionResult

type ShareSimultaionResult struct {
	Added   []string `json:"added,omitempty"`
	Removed []string `json:"removed,omitempty"`
}

ShareSimultaionResult is the Result of a Sharing Siumulation

type Tag

type Tag struct {
	ID       string `json:"id,omitempty"`
	Slug     string `json:"slug,omitempty"`
	IsShared bool   `json:"is_shared,omitempty"`
}

Tag is a Passbolt Password Tag

type Time

type Time struct {
	time.Time
}

Time is here to unmarshall time correctly

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON Marshals Passbolt *Time

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(buf []byte) error

UnmarshalJSON Parses Passbolt *Time

type URL

type URL struct {
	Medium string `json:"medium,omitempty"`
	Small  string `json:"small,omitempty"`
}

URL is a Passbolt URL

type User

type User struct {
	ID           string    `json:"id,omitempty"`
	Created      *Time     `json:"created,omitempty"`
	Active       bool      `json:"active,omitempty"`
	Deleted      bool      `json:"deleted,omitempty"`
	Description  string    `json:"description,omitempty"`
	Favorite     *Favorite `json:"favorite,omitempty"`
	Modified     *Time     `json:"modified,omitempty"`
	Username     string    `json:"username,omitempty"`
	RoleID       string    `json:"role_id,omitempty"`
	Profile      *Profile  `json:"profile,omitempty"`
	Role         *Role     `json:"role,omitempty"`
	GPGKey       *GPGKey   `json:"gpgKey,omitempty"`
	LastLoggedIn string    `json:"last_logged_in,omitempty"`
}

User contains information about a passbolt User

Package Files

  • api.go
  • auth.go
  • client.go
  • comments.go
  • decrypt.go
  • encrypt.go
  • favorites.go
  • folders.go
  • gpgkey.go
  • groups.go
  • healthcheck.go
  • key.go
  • permissions.go
  • resources.go
  • roles.go
  • secrets.go
  • share.go
  • time.go
  • users.go
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier