api

package
v0.0.0-...-7c1f19f Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 19 Imported by: 7

Documentation

Index

Constants

View Source
const UserLocaleENUK = "en-UK"

Variables

View Source
var (
	// API Error Codes
	ErrAPIResponseErrorStatusCode   = errors.New("Error API JSON Response Status")
	ErrAPIResponseUnknownStatusCode = errors.New("Unknown API JSON Response Status")
)

Functions

This section is empty.

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 ARO

type ARO struct {
	User
	Group
}

ARO is a User or a Group

type AuthenticationToken

type AuthenticationToken struct {
	Token string `json:"token,omitempty"`
}

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 {

	// used for solving MFA challenges. You can block this to for example wait for user input.
	// You shouden't run any unrelated API Calls while you are in this callback.
	// You need to Return the Cookie that Cipherguard expects to verify you MFA, usually it is called cipherguard_mfa
	MFACallback func(ctx context.Context, c *Client, res *APIResponse) (http.Cookie, error)

	// Enable Debug Logging
	Debug bool
	// contains filtered or unexported fields
}

Client is a Client struct for the Cipherguard api

func NewClient

func NewClient(httpClient *http.Client, UserAgent, BaseURL, UserPrivateKey, UserPassword string) (*Client, error)

NewClient Returns a new Cipherguard Client. if httpClient is nil http.DefaultClient will be used. if UserAgent is "" "goCipherguardClient/1.0" will be used. if UserPrivateKey is "" Key Setup is Skipped to Enable using the Client for User Registration, Most other function will be broken. After Registration a new Client Should be Created.

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 Cipherguard Comment

func (*Client) CreateFavorite

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

CreateFavorite Creates a new Cipherguard Favorite for the given Resource ID

func (*Client) CreateFolder

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

CreateFolder Creates a new Cipherguard Folder

func (*Client) CreateGroup

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

CreateGroup Creates a new Cipherguard Group

func (*Client) CreateResource

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

CreateResource Creates a new Cipherguard Resource

func (*Client) CreateUser

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

CreateUser Creates a new Cipherguard User

func (*Client) DecryptMessage

func (c *Client) DecryptMessage(message string) (string, error)

DecryptMessage decrypts a message using the users Private Key

func (*Client) DeleteComment

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

DeleteComment Deletes a Cipherguard Comment

func (*Client) DeleteFavorite

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

DeleteFavorite Deletes a Cipherguard Favorite

func (*Client) DeleteFolder

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

DeleteFolder Deletes a Cipherguard Folder

func (*Client) DeleteGroup

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

DeleteGroup Deletes a Cipherguard Group

func (*Client) DeleteResource

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

DeleteResource Deletes a Cipherguard Resource

func (*Client) DeleteUser

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

DeleteUser Deletes a Cipherguard User

func (*Client) DeleteUserDryrun

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

DeleteUserDryrun Check if a Cipherguard User is Deleteable

func (*Client) DoCustomRequest

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

DoCustomRequest Executes a Custom Request and returns a APIResponse

func (*Client) DoCustomRequestAndReturnRawResponse

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

DoCustomRequestAndReturnRawResponse Executes a Custom Request and returns a APIResponse and the Raw HTTP Response

func (*Client) EncryptMessage

func (c *Client) EncryptMessage(message string) (string, error)

EncryptMessage encrypts a message using the users public key and then signes the message using the users private key

func (*Client) EncryptMessageWithPublicKey

func (c *Client) EncryptMessageWithPublicKey(publickey, message string) (string, error)

EncryptMessageWithPublicKey encrypts a message using the provided public key and then signes the message using the users private key

func (*Client) GetComments

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

GetComments gets all Cipherguard Comments an The Specified Resource

func (*Client) GetFolder

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

GetFolder gets a Cipherguard Folder

func (*Client) GetFolders

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

GetFolders gets all Folders from the Cipherguardserver

func (*Client) GetGPGKey

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

GetGPGKey gets a Cipherguard GPGKey

func (*Client) GetGPGKeys

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

GetGPGKeys gets all Cipherguard GPGKeys

func (*Client) GetGroup

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

GetGroup gets a Cipherguard Group

func (*Client) GetGroups

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

GetGroups gets all Cipherguard 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 Cipherguard User

func (*Client) GetPublicKey

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

GetPublicKey gets the Public Key and Fingerprint of the Cipherguard instance

func (*Client) GetResource

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

GetResource gets a Cipherguard Resource

func (*Client) GetResourcePermissions

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

GetResourcePermissions gets a Resources Permissions

func (*Client) GetResourceType

func (c *Client) GetResourceType(ctx context.Context, typeID string) (*ResourceType, error)

GetResourceType gets a Cipherguard Type

func (*Client) GetResourceTypes

func (c *Client) GetResourceTypes(ctx context.Context, opts *GetResourceTypesOptions) ([]ResourceType, error)

GetResourceTypes gets all Cipherguard Resource Types

func (*Client) GetResources

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

GetResources gets all Cipherguard Resources

func (*Client) GetRoles

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

GetRoles gets all Cipherguard Roles

func (*Client) GetSecret

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

GetSecret gets a Cipherguard Secret

func (*Client) GetUser

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

GetUser gets a Cipherguard User

func (*Client) GetUserID

func (c *Client) GetUserID() string

GetUserID Gets the ID of the Current User

func (*Client) GetUsers

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

GetUsers gets all Cipherguard Users

func (*Client) Login

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

Login gets a Session and CSRF Token from Cipherguard 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 Cipherguard server

func (*Client) MoveFolder

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

MoveFolder Moves a Cipherguard Folder

func (*Client) MoveResource

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

MoveResource Moves a Cipherguard Resource

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 Cipherguard AROs

func (*Client) SetupComplete

func (c *Client) SetupComplete(ctx context.Context, userID string, request SetupCompleteRequest) error

SetupComplete Completes setup of a Cipherguard Account

func (*Client) SetupInstall

func (c *Client) SetupInstall(ctx context.Context, userID, token string) (*SetupInstallResponse, error)

SetupInstall validates the userid and token used for Account setup, gives back the User Information

func (*Client) SetupServerVerification

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

SetupServerVerification sets up Server Verification, Only works before login

func (*Client) ShareFolder

func (c *Client) ShareFolder(ctx context.Context, folderID string, permissions []Permission) error

ShareFolder Shares a Folder with AROs

func (*Client) ShareResource

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

ShareResource Shares a Resource with AROs

func (*Client) SimulateShareResource

func (c *Client) SimulateShareResource(ctx context.Context, resourceID string, shareRequest ResourceShareRequest) (*ResourceShareSimulationResult, 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 Cipherguard Comment

func (*Client) UpdateFolder

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

UpdateFolder Updates a existing Cipherguard Folder

func (*Client) UpdateGroup

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

UpdateGroup Updates a existing Cipherguard Group

func (*Client) UpdateGroupDryRun

func (c *Client) UpdateGroupDryRun(ctx context.Context, groupID string, update GroupUpdate) (*UpdateGroupDryRunResult, error)

UpdateGroupDryRun Checks that a Cipherguard Group update passes validation

func (*Client) UpdateResource

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

UpdateResource Updates a existing Cipherguard Resource

func (*Client) UpdateUser

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

UpdateUser Updates a existing Cipherguard User

func (*Client) VerifyServer

func (c *Client) VerifyServer(ctx context.Context, token, encToken string) error

VerifyServer verifys that the Server is still the same one as during the Setup, Only works before login

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"`
	ChildrenResources []Resource   `json:"children_resources,omitempty"`
	ChildrenFolders   []Folder     `json:"children_folders,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 GPGVerify

type GPGVerify struct {
	KeyID string `json:"keyid"`
	Token string `json:"server_verify_token,omitempty"`
}

GPGVerify is used for verification

type GPGVerifyContainer

type GPGVerifyContainer struct {
	Req GPGVerify `json:"gpg_auth"`
}

GPGVerifyContainer is used for verification

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 {
	ContainChildrenResources     bool `url:"contain[children_resources],omitempty"`
	ContainChildrenFolders       bool `url:"contain[children_folders],omitempty"`
	ContainCreator               bool `url:"contain[creator],omitempty"`
	ContainCreatorProfile        bool `url:"contain[creator.profile],omitempty"`
	ContainModifier              bool `url:"contain[modifier],omitempty"`
	ContainModiferProfile        bool `url:"contain[modifier.profile],omitempty"`
	ContainPermission            bool `url:"contain[permission],omitempty"`
	ContainPermissions           bool `url:"contain[permissions],omitempty"`
	ContainPermissionUserProfile bool `url:"contain[permissions.user.profile],omitempty"`
	ContainPermissionGroup       bool `url:"contain[permissions.group],omitempty"`
}

GetFolderOptions are all available query parameters

type GetFoldersOptions

type GetFoldersOptions struct {
	ContainChildrenResources     bool `url:"contain[children_resources],omitempty"`
	ContainChildrenFolders       bool `url:"contain[children_folders],omitempty"`
	ContainCreator               bool `url:"contain[creator],omitempty"`
	ContainCreatorProfile        bool `url:"contain[creator.profile],omitempty"`
	ContainModifier              bool `url:"contain[modifier],omitempty"`
	ContainModiferProfile        bool `url:"contain[modifier.profile],omitempty"`
	ContainPermission            bool `url:"contain[permission],omitempty"`
	ContainPermissions           bool `url:"contain[permissions],omitempty"`
	ContainPermissionUserProfile bool `url:"contain[permissions.user.profile],omitempty"`
	ContainPermissionGroup       bool `url:"contain[permissions.group],omitempty"`

	FilterHasID     []string `url:"filter[has-id][],omitempty"`
	FilterHasParent []string `url:"filter[has-parent][],omitempty"`
	FilterSearch    string   `url:"filter[search],omitempty"`
}

GetFoldersOptions are all available query parameters

type GetGPGKeysOptions

type GetGPGKeysOptions struct {
	// This is a Unix TimeStamp
	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"`
	ContainMyGroupUser            bool `url:"contain[my_group_user],omitempty"`
	ContainUsers                  bool `url:"contain[users],omitempty"`
	ContainGroupsUsers            bool `url:"contain[groups_users],omitempty"`
	ContainGroupsUsersUser        bool `url:"contain[groups_users.user],omitempty"`
	ContainGroupsUsersUserProfile bool `url:"contain[groups_users.user.profile],omitempty"`
	ContainGroupsUsersUserGPGKey  bool `url:"contain[groups_users.user.gpgkey],omitempty"`
}

GetGroupsOptions are all available query parameters

type GetResourceTypesOptions

type GetResourceTypesOptions struct {
}

GetResourceTypesOptions is a placeholder for future options

type GetResourcesOptions

type GetResourcesOptions struct {
	FilterIsFavorite        bool     `url:"filter[is-favorite],omitempty"`
	FilterIsSharedWithGroup string   `url:"filter[is-shared-with-group],omitempty"`
	FilterIsOwnedByMe       bool     `url:"filter[is-owned-by-me],omitempty"`
	FilterIsSharedWithMe    bool     `url:"filter[is-shared-with-me],omitempty"`
	FilterHasID             []string `url:"filter[has-id][],omitempty"`
	// Parent Folder id
	FilterHasParent []string `url:"filter[has-parent][],omitempty"`
	FilterHasTag    string   `url:"filter[has-tag],omitempty"`

	ContainCreator                bool `url:"contain[creator],omitempty"`
	ContainFavorites              bool `url:"contain[favorite],omitempty"`
	ContainModifier               bool `url:"contain[modifier],omitempty"`
	ContainSecret                 bool `url:"contain[secret],omitempty"`
	ContainResourceType           bool `url:"contain[resource-type],omitempty"`
	ContainPermissions            bool `url:"contain[permission],omitempty"`
	ContainPermissionsUserProfile bool `url:"contain[permissions.user.profile],omitempty"`
	ContainPermissionsGroup       bool `url:"contain[permissions.group],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"`
	// This does not Contain Profile for Users Anymore...
	GroupUsers []GroupMembership `json:"groups_users,omitempty"`
	// This is new and undocumented but as all the data
	Users []GroupUser `json:"users,omitempty"`
}

Group is a Group

type GroupJoinData

type GroupJoinData struct {
	ID      string `json:"id,omitempty"`
	GroupID string `json:"group_id,omitempty"`
	UserID  string `json:"user_id,omitempty"`
	IsAdmin bool   `json:"is_admin,omitempty"`
	Created *Time  `json:"created,omitempty"`
}

type GroupMembership

type GroupMembership struct {
	ID      string `json:"id,omitempty"`
	UserID  string `json:"user_id,omitempty"`
	GroupID string `json:"group_id,omitempty"`
	IsAdmin bool   `json:"is_admin,omitempty"`
	Delete  bool   `json:"delete,omitempty"`
	User    User   `json:"user,omitempty"`
	Created *Time  `json:"created,omitempty"`
}

type GroupSecret

type GroupSecret struct {
	Secret []Secret `json:"secret,omitempty"`
}

GroupSecret is a unnessesary container...

type GroupUpdate

type GroupUpdate struct {
	Name         string            `json:"name,omitempty"`
	GroupChanges []GroupMembership `json:"groups_users,omitempty"`
	Secrets      []Secret          `json:"secrets,omitempty"`
}

type GroupUser

type GroupUser struct {
	User
	JoinData GroupJoinData `json:"_join_data,omitempty"`
}

type Login

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

Login is used for login

type MFAChallenge

type MFAChallenge struct {
	Provider MFAProviders `json:"providers,omitempty"`
}

type MFAChallengeResponse

type MFAChallengeResponse struct {
	TOTP string `json:"totp,omitempty"`
}

type MFAProviders

type MFAProviders struct {
	TOTP string `json:"totp,omitempty"`
}

type Permission

type Permission struct {
	ID            string `json:"id,omitempty"`
	ACO           string `json:"aco,omitempty"`
	ARO           string `json:"aro,omitempty"`
	ACOForeignKey string `json:"aco_foreign_key,omitempty"`
	AROForeignKey string `json:"aro_foreign_key,omitempty"`
	Type          int    `json:"type,omitempty"`
	Delete        bool   `json:"delete,omitempty"`
	IsNew         bool   `json:"is_new,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"`
	ResourceTypeID string       `json:"resource_type_id,omitempty"`
	ResourceType   ResourceType `json:"resource_type,omitempty"`
	Secrets        []Secret     `json:"secrets,omitempty"`
	Tags           []Tag        `json:"tags,omitempty"`
}

Resource is a Resource. Warning: Since Cipherguard v3 some fields here may not be populated as they may be in the Secret depending on the ResourceType, for now the only Field like that is the Description.

type ResourceShareRequest

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

ResourceShareRequest is a ResourceShareRequest

type ResourceShareSimulationChange

type ResourceShareSimulationChange struct {
	User ResourceShareSimulationUser `json:"user,omitempty"`
}

ResourceShareSimulationChange is a single change

type ResourceShareSimulationChanges

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

ResourceShareSimulationChanges contains the Actual Changes

type ResourceShareSimulationResult

type ResourceShareSimulationResult struct {
	Changes ResourceShareSimulationChanges `json:"changes,omitempty"`
}

ResourceShareSimulationResult is the Result of a Sharing Simulation

type ResourceShareSimulationUser

type ResourceShareSimulationUser struct {
	ID string `json:"id,omitempty"`
}

ResourceShareSimulationUser contains the users id

type ResourceType

type ResourceType struct {
	ID          string          `json:"id,omitempty"`
	Slug        string          `json:"slug,omitempty"`
	Description string          `json:"description,omitempty"`
	Definition  json.RawMessage `json:"definition,omitempty"`
	Created     *Time           `json:"created,omitempty"`
	Modified    *Time           `json:"modified,omitempty"`
}

ResourceType is the Type of a Resource

type ResourceTypeSchema

type ResourceTypeSchema struct {
	Resource json.RawMessage `json:"resource"`
	Secret   json.RawMessage `json:"secret"`
}

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 SecretDataTOTP

type SecretDataTOTP struct {
	Algorithm string `json:"algorithm"`
	SecretKey string `json:"secret_key"`
	Digits    int    `json:"digits"`
	Period    int    `json:"period"`
}

type SecretDataTypePasswordAndDescription

type SecretDataTypePasswordAndDescription struct {
	Password    string `json:"password"`
	Description string `json:"description,omitempty"`
}

SecretDataTypePasswordAndDescription is the format a secret of resource type "password-and-description" is stored in

type SecretDataTypePasswordDescriptionTOTP

type SecretDataTypePasswordDescriptionTOTP struct {
	Password    string         `json:"password"`
	Description string         `json:"description,omitempty"`
	TOTP        SecretDataTOTP `json:"totp"`
}

SecretDataTypePasswordDescriptionTOTP is the format a secret of resource type "password-description-totp" is stored in

type SecretDataTypeTOTP

type SecretDataTypeTOTP struct {
	TOTP SecretDataTOTP `json:"totp"`
}

SecretDataTypeTOTP is the format a secret of resource type "totp" is stored in

type SetupCompleteRequest

type SetupCompleteRequest struct {
	AuthenticationToken AuthenticationToken `json:"authenticationtoken,omitempty"`
	GPGKey              GPGKey              `json:"gpgkey,omitempty"`
	User                User                `json:"user,omitempty"`
}

type SetupInstallResponse

type SetupInstallResponse struct {
	User `json:"user,omitempty"`
}

type Tag

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

Tag is a Cipherguard 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 Cipherguard *Time

func (*Time) UnmarshalJSON

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

UnmarshalJSON Parses Cipherguard *Time

type URL

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

URL is a Cipherguard URL

type UpdateGroupDryRun

type UpdateGroupDryRun struct {
	// for which users the secrets need to be reencrypted
	SecretsNeeded []UpdateGroupSecretsNeededContainer `json:"SecretsNeeded,omitempty"`
	// secrets needed to be reencrypted
	Secrets []GroupSecret `json:"Secrets,omitempty"`
}

UpdateGroupDryRun contains the Actual Secrets Needed to update the group

type UpdateGroupDryRunResult

type UpdateGroupDryRunResult struct {
	DryRun UpdateGroupDryRun `json:"dry-run,omitempty"`
}

UpdateGroupDryRunResult is the Result of a Update Group DryRun

type UpdateGroupDryRunSecretsNeeded

type UpdateGroupDryRunSecretsNeeded struct {
	ResourceID string `json:"resource_id,omitempty"`
	UserID     string `json:"user_id,omitempty"`
}

UpdateGroupDryRunSecretsNeeded a secret that needs to be reencrypted for a specific user

type UpdateGroupSecretsNeededContainer

type UpdateGroupSecretsNeededContainer struct {
	Secret UpdateGroupDryRunSecretsNeeded `json:"Secret,omitempty"`
}

UpdateGroupSecretsNeededContainer is a unnessesary container...

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"`
	Locale       string    `json:"locale,omitempty"`
}

User contains information about a cipherguard User

Jump to

Keyboard shortcuts

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