Documentation
¶
Index ¶
- func DecryptMessage(userPrivateKey, userPassword, message []byte) ([]byte, error)
- func EncryptMessage(publicKey, privateKey, privateKeyPassword, message string) (string, error)
- func GetPrivateKeyPacket(privateKey []byte) (*packet.PrivateKey, error)
- func GetPublicKeyPacket(publicKey []byte) (*packet.PublicKey, error)
- type APIHeader
- type APIResponse
- type ARO
- type Avatar
- type Client
- func (c *Client) CheckSession(ctx context.Context) bool
- func (c *Client) CreateComment(ctx context.Context, resourceID string, comment Comment) (*Comment, error)
- func (c *Client) CreateFavorite(ctx context.Context, resourceID string) (*Favorite, error)
- func (c *Client) CreateFolder(ctx context.Context, folder Folder) (*Folder, error)
- func (c *Client) CreateGroup(ctx context.Context, group Group) (*Group, error)
- func (c *Client) CreateResource(ctx context.Context, resource Resource) (*Resource, error)
- func (c *Client) CreateUser(ctx context.Context, user User) (*User, error)
- func (c *Client) DeleteComment(ctx context.Context, commentID string) error
- func (c *Client) DeleteFavorite(ctx context.Context, favoriteID string) error
- func (c *Client) DeleteFolder(ctx context.Context, folderID string) error
- func (c *Client) DeleteGroup(ctx context.Context, groupID string) error
- func (c *Client) DeleteResource(ctx context.Context, resourceID string) error
- func (c *Client) DeleteUser(ctx context.Context, userID string) error
- func (c *Client) DeleteUserDryrun(ctx context.Context, userID string) error
- func (c *Client) DoCustomRequest(ctx context.Context, method, path string, body interface{}, opts interface{}) (*http.Response, *APIResponse, error)
- func (c *Client) GetComments(ctx context.Context, resourceID string, opts *GetCommentsOptions) ([]Comment, error)
- func (c *Client) GetFolder(ctx context.Context, folderID string) (*Folder, error)
- func (c *Client) GetFolders(ctx context.Context, opts *GetFolderOptions) ([]Folder, error)
- func (c *Client) GetGPGKey(ctx context.Context, gpgkeyID string) (*GPGKey, error)
- func (c *Client) GetGPGKeys(ctx context.Context, opts *GetGPGKeysOptions) ([]GPGKey, error)
- func (c *Client) GetGroup(ctx context.Context, groupID string) (*Group, error)
- func (c *Client) GetGroups(ctx context.Context, opts *GetGroupsOptions) ([]Group, error)
- func (c *Client) GetHealthCheckStatus(ctx context.Context) (string, error)
- func (c *Client) GetMe(ctx context.Context) (*User, error)
- func (c *Client) GetPublicKey(ctx context.Context) (string, string, error)
- func (c *Client) GetResource(ctx context.Context, resourceID string) (*Resource, error)
- func (c *Client) GetResourcePermissions(ctx context.Context, resourceID string) ([]Permission, error)
- func (c *Client) GetResources(ctx context.Context, opts *GetResourcesOptions) ([]Resource, error)
- func (c *Client) GetRoles(ctx context.Context) ([]Role, error)
- func (c *Client) GetSecret(ctx context.Context, resourceID string) (*Secret, error)
- func (c *Client) GetUser(ctx context.Context, userID string) (*User, error)
- func (c *Client) GetUsers(ctx context.Context, opts *GetUsersOptions) ([]User, error)
- func (c *Client) Login(ctx context.Context, userPrivateKey, userPassword, passboltPublicKey []byte) error
- func (c *Client) Logout(ctx context.Context) error
- func (c *Client) PerformHealthCheck(ctx context.Context) (json.RawMessage, error)
- func (c *Client) SearchAROs(ctx context.Context, opts SearchAROsOptions) ([]ARO, error)
- func (c *Client) ShareResource(ctx context.Context, resourceID string, shareRequest ShareRequest) error
- func (c *Client) SimulateShareResource(ctx context.Context, resourceID string, shareRequest ShareRequest) (*ShareSimultaionResult, error)
- func (c *Client) UpdateComment(ctx context.Context, commentID string, comment Comment) (*Comment, error)
- func (c *Client) UpdateFolder(ctx context.Context, folderID string, folder Folder) (*Folder, error)
- func (c *Client) UpdateGroup(ctx context.Context, groupID string, group Group) (*Group, error)
- func (c *Client) UpdateResource(ctx context.Context, resourceID string, resource Resource) (*Resource, error)
- func (c *Client) UpdateUser(ctx context.Context, userID string, user User) (*User, error)
- type Comment
- type Favorite
- type Folder
- type GPGAuth
- type GPGKey
- type GetCommentsOptions
- type GetFolderOptions
- type GetGPGKeysOptions
- type GetGroupsOptions
- type GetResourcesOptions
- type GetUsersOptions
- type Group
- type Login
- type Permission
- type Profile
- type PublicKeyReponse
- type Resource
- type Role
- type SearchAROsOptions
- type Secret
- type ShareRequest
- type ShareSimultaionResult
- type Tag
- type Time
- type URL
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptMessage ¶
DecryptMessage decrypts a message
func EncryptMessage ¶
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
Types ¶
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 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 (*Client) CheckSession ¶
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 ¶
CreateFavorite Creates a new Passbolt Favorite for the given Resource ID
func (*Client) CreateFolder ¶
CreateFolder Creates a new Passbolt Folder
func (*Client) CreateGroup ¶
CreateGroup Creates a new Passbolt Group
func (*Client) CreateResource ¶
CreateResource Creates a new Passbolt Resource
func (*Client) CreateUser ¶
CreateUser Creates a new Passbolt User
func (*Client) DeleteComment ¶
DeleteComment Deletes a Passbolt Comment
func (*Client) DeleteFavorite ¶
DeleteFavorite Deletes a Passbolt Favorite
func (*Client) DeleteFolder ¶
DeleteFolder Deletes a Passbolt Folder
func (*Client) DeleteGroup ¶
DeleteGroup Deletes a Passbolt Group
func (*Client) DeleteResource ¶
DeleteResource Deletes a Passbolt Resource
func (*Client) DeleteUser ¶
DeleteUser Deletes a Passbolt User
func (*Client) DeleteUserDryrun ¶
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) GetFolders ¶
GetFolders gets all Folders from the Passboltserver
func (*Client) GetGPGKeys ¶
GetGPGKeys gets all Passbolt GPGKeys
func (*Client) GetHealthCheckStatus ¶
GetHealthCheckStatus gets the Server Status
func (*Client) GetPublicKey ¶
GetPublicKey gets the Public Key and Fingerprint of the Passbolt instance
func (*Client) GetResource ¶
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 ¶
GetResources gets all Passbolt Resources
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) PerformHealthCheck ¶
PerformHealthCheck performs a Health Check
func (*Client) SearchAROs ¶
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 ¶
UpdateFolder Updates a existing Passbolt Folder
func (*Client) UpdateGroup ¶
UpdateGroup Updates a existing Passbolt Group
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"`
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 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 ShareSimultaionResult ¶
type ShareSimultaionResult struct {
}
ShareSimultaionResult is the Result of a Sharing Siumulation
type Time ¶
Time is here to unmarshall time correctly
func (Time) MarshalJSON ¶
MarshalJSON Marshals Passbolt *Time
func (*Time) UnmarshalJSON ¶
UnmarshalJSON Parses Passbolt *Time
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