webapi

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeviceInformation added in v0.10.0

func DeviceInformation(deviceId, providerVersion string) deviceInfoWithOfficialFallback

Types

type AccessPoliciesRequests added in v0.10.0

type AccessPoliciesRequests struct {
	UserAccessPolicyRequests           []interface{} `json:"userAccessPolicyRequests"`
	GroupAccessPolicyRequests          []interface{} `json:"groupAccessPolicyRequests"`
	ServiceAccountAccessPolicyRequests []interface{} `json:"serviceAccountAccessPolicyRequests"`
}

type ApiKey added in v0.9.4

type ApiKey struct {
	ApiKey       string            `json:"apiKey"`
	Object       models.ObjectType `json:"object"`
	RevisionDate *time.Time        `json:"revisionDate"`
}

type AttachmentRequestData added in v0.9.0

type AttachmentRequestData struct {
	Key      string `json:"key"`
	FileName string `json:"fileName"`
	FileSize int    `json:"fileSize"`
}

type Client

type Client interface {
	ClearSession()
	ConfirmOrganizationUser(ctx context.Context, orgID, orgUserID, key string) error
	CreateFolder(ctx context.Context, obj models.Folder) (*models.Folder, error)
	CreateItem(context.Context, models.Item) (*models.Item, error)
	CreateObjectAttachment(ctx context.Context, itemId string, data []byte, req AttachmentRequestData) (*CreateObjectAttachmentResponse, error)
	CreateObjectAttachmentData(ctx context.Context, itemId, attachmentId string, data []byte) error
	CreateOrganization(ctx context.Context, req CreateOrganizationRequest) (*CreateOrganizationResponse, error)
	CreateOrganizationCollection(ctx context.Context, orgId string, req Collection) (*Collection, error)
	CreateProject(ctx context.Context, project models.Project) (*models.Project, error)
	CreateSecret(ctx context.Context, secret models.Secret) (*Secret, error)
	DeleteFolder(ctx context.Context, objID string) error
	DeleteObject(ctx context.Context, objID string) error
	DeleteObjectAttachment(ctx context.Context, itemId, attachmentId string) error
	DeleteOrganizationCollection(ctx context.Context, orgID, collectionID string) error
	DeleteProject(ctx context.Context, projectId string) error
	DeleteSecret(ctx context.Context, secretId string) error
	EditFolder(ctx context.Context, obj models.Folder) (*models.Folder, error)
	EditItem(context.Context, models.Item) (*models.Item, error)
	EditItemCollections(ctx context.Context, objId string, collectionIds []string) (*models.Item, error)
	EditOrganizationCollection(ctx context.Context, orgId, objId string, obj Collection) (*Collection, error)
	EditProject(context.Context, models.Project) (*models.Project, error)
	EditSecret(ctx context.Context, secret models.Secret) (*Secret, error)
	GetAPIKey(ctx context.Context, username, password string, kdfConfig models.KdfConfiguration) (*ApiKey, error)
	GetOrganizationCollections(ctx context.Context, orgID string) ([]Collection, error)
	GetContentFromURL(ctx context.Context, url string) ([]byte, error)
	GetCipherAttachment(ctx context.Context, itemId, attachmentId string) (*models.Attachment, error)
	GetOrganizationUsers(ctx context.Context, orgId string) ([]OrganizationUserDetails, error)
	GetProfile(context.Context) (*Profile, error)
	GetProject(ctx context.Context, projectId string) (*models.Project, error)
	GetProjects(ctx context.Context, orgId string) ([]models.Project, error)
	GetSecret(ctx context.Context, secretId string) (*Secret, error)
	GetSecrets(ctx context.Context, orgId string) ([]SecretSummary, error)
	GetUserPublicKey(ctx context.Context, userId string) ([]byte, error)
	InviteUser(ctx context.Context, orgId string, user InviteUserRequest) error
	LoginWithAccessToken(ctx context.Context, clientId, clientSecret string) (*MachineTokenResponse, error)
	LoginWithAPIKey(ctx context.Context, clientId, clientSecret string) (*TokenResponse, error)
	LoginWithPassword(ctx context.Context, username, password string, kdfConfig models.KdfConfiguration) (*TokenResponse, error)
	PreLogin(context.Context, string) (*PreloginResponse, error)
	RegisterUser(ctx context.Context, req SignupRequest) error
	Sync(ctx context.Context) (*SyncResponse, error)
}

func NewClient

func NewClient(serverURL, deviceIdentifier, providerVersion string, opts ...Options) Client

type Collection

type Collection struct {
	Assigned       bool              `json:"assigned"`
	ExternalId     string            `json:"externalId"`
	Groups         []string          `json:"groups"`
	HidePasswords  bool              `json:"hidePasswords"` // Missing in get collections
	Id             string            `json:"id"`
	Manage         bool              `json:"manage"`
	Name           string            `json:"name"`
	Object         models.ObjectType `json:"object"`
	OrganizationId string            `json:"organizationId"`
	ReadOnly       bool              `json:"readOnly"` // Missing in get collections
	Unmanaged      bool              `json:"unmanaged"`
	Users          []CollectionUser  `json:"users"`
}

type CollectionAccessResponse added in v0.13.0

type CollectionAccessResponse struct {
	ContinuationToken string            `json:"continuationToken"`
	Data              []Collection      `json:"data"`
	Object            models.ObjectType `json:"object"`
}

type CollectionResponse

type CollectionResponse struct {
	Data   []CollectionResponseItem `json:"data"`
	Object models.ObjectType        `json:"object"`
}

type CollectionResponseItem added in v0.9.0

type CollectionResponseItem struct {
	Id             string            `json:"id"`
	Name           string            `json:"name"`
	OrganizationId int               `json:"organization_id"`
	Object         models.ObjectType `json:"object"`
	ExternalId     string            `json:"external_id"`
}

type CollectionUser added in v0.13.0

type CollectionUser struct {
	HidePasswords bool   `json:"hidePasswords"`
	Id            string `json:"id"`
	ReadOnly      bool   `json:"readOnly"`
}

type ConfirmUserRequest added in v0.13.0

type ConfirmUserRequest struct {
	Key string `json:"key"`
}

type CreateCipherRequest added in v0.9.0

type CreateCipherRequest struct {
	Cipher        models.Item `json:"cipher"`
	CollectionIds []string    `json:"collectionIds"`
}

type CreateObjectAttachmentResponse added in v0.9.0

type CreateObjectAttachmentResponse struct {
	AttachmentId   string            `json:"attachmentId"`
	CipherResponse models.Item       `json:"cipherResponse"`
	FileUploadType int               `json:"fileUploadType"`
	Object         models.ObjectType `json:"object"`
	Url            string            `json:"url"`
}

type CreateOrganizationRequest

type CreateOrganizationRequest struct {
	Name           string  `json:"name"`
	BillingEmail   string  `json:"billingEmail"`
	PlanType       int     `json:"planType"`
	CollectionName string  `json:"collectionName"`
	Key            string  `json:"key"`
	Keys           KeyPair `json:"keys"`
}

type CreateOrganizationResponse

type CreateOrganizationResponse struct {
	Id string `json:"id"`
}

type CreateProjectRequest added in v0.11.0

type CreateProjectRequest struct {
	Name string `json:"name"`
}

type CreateSecretRequest added in v0.10.0

type CreateSecretRequest struct {
	Key                    string                  `json:"key"`
	Value                  string                  `json:"value"`
	Note                   string                  `json:"note"`
	ProjectIDs             []string                `json:"projectIds"`
	AccessPoliciesRequests *AccessPoliciesRequests `json:"accessPoliciesRequests,omitempty"`
}

type InviteUserRequest added in v0.13.0

type InviteUserRequest struct {
	Emails      []string `json:"emails"`
	Collections []string `json:"collections"`
	AccessAll   bool     `json:"accessAll"`
	Permissions struct {
		Response interface{} `json:"response"`
	} `json:"permissions"`
	Type                 models.OrgMemberRoleType `json:"type"`
	Groups               []string                 `json:"groups"`
	AccessSecretsManager bool                     `json:"accessSecretsManager"`
}

type KeyPair

type KeyPair struct {
	PublicKey           string `json:"publicKey"`
	EncryptedPrivateKey string `json:"encryptedPrivateKey"`
}

type MachineTokenEncryptedPayload added in v0.10.0

type MachineTokenEncryptedPayload struct {
	EncryptionKey string `json:"encryptionKey"`
}

type MachineTokenResponse added in v0.10.0

type MachineTokenResponse struct {
	AccessToken      string `json:"access_token"`
	ExpireIn         int    `json:"expires_in"`
	RefreshToken     string `json:"refresh_token,omitempty"`
	Scope            string `json:"scope"`
	TokenType        string `json:"token_type"`
	EncryptedPayload string `json:"encrypted_payload"`

	// To load profile ? Not present with access login
	PrivateKey string `json:"private_key,omitempty"`
	Key        string `json:"key,omitempty"`
}

type Options added in v0.9.0

type Options func(c Client)

func DisableRetries added in v0.9.0

func DisableRetries() Options

func WithCustomClient added in v0.9.0

func WithCustomClient(httpClient http.Client) Options

type Organization added in v0.9.0

type Organization struct {
	Id   string `json:"id"`
	Key  string `json:"key"`
	Name string `json:"name"`
}

type OrganizationUserDetails added in v0.13.0

type OrganizationUserDetails struct {
	AccessAll            bool              `json:"accessAll"`
	AccessSecretsManager bool              `json:"accessSecretsManager"`
	AvatarColor          string            `json:"avatarColor"`
	Collections          []Collection      `json:"collections"`
	Email                string            `json:"email"`
	ExternalId           string            `json:"externalId"`
	Groups               []string          `json:"groups"`
	HasMasterPassword    bool              `json:"hasMasterPassword"`
	Id                   string            `json:"id"`
	Name                 string            `json:"name"`
	Object               models.ObjectType `json:"object"`
	Permissions          struct {
		AccessEventLogs           bool `json:"accessEventLogs"`
		AccessImportExport        bool `json:"accessImportExport"`
		AccessReports             bool `json:"accessReports"`
		CreateNewCollections      bool `json:"createNewCollections"`
		DeleteAnyCollection       bool `json:"deleteAnyCollection"`
		DeleteAssignedCollections bool `json:"deleteAssignedCollections"`
		EditAnyCollection         bool `json:"editAnyCollection"`
		EditAssignedCollections   bool `json:"editAssignedCollections"`
		ManageGroups              bool `json:"manageGroups"`
		ManagePolicies            bool `json:"managePolicies"`
		ManageResetPassword       bool `json:"manageResetPassword"`
		ManageScim                bool `json:"manageScim"`
		ManageSso                 bool `json:"manageSso"`
		ManageUsers               bool `json:"manageUsers"`
	} `json:"permissions"`
	ResetPasswordEnrolled bool   `json:"resetPasswordEnrolled"`
	SsoBound              bool   `json:"ssoBound"`
	Status                int    `json:"status"`
	TwoFactorEnabled      bool   `json:"twoFactorEnabled"`
	Type                  int    `json:"type"`
	UserId                string `json:"userId"`
	UsesKeyConnector      bool   `json:"usesKeyConnector"`
}

type OrganizationUserList added in v0.13.0

type OrganizationUserList struct {
	Data   []OrganizationUserDetails `json:"data"`
	Object models.ObjectType         `json:"object"`
}

type PreloginRequest added in v0.9.0

type PreloginRequest struct {
	Email string `json:"email"`
}

type PreloginResponse added in v0.9.0

type PreloginResponse struct {
	Kdf            models.KdfType `json:"kdf"`
	KdfIterations  int            `json:"kdfIterations"`
	KdfMemory      int            `json:"kdfMemory"`
	KdfParallelism int            `json:"kdfParallelism"`
}

type Profile added in v0.9.0

type Profile struct {
	Email         string            `json:"email"`
	Id            string            `json:"id"`
	Key           string            `json:"key"`
	Name          string            `json:"name"`
	Object        models.ObjectType `json:"object"`
	Organizations []Organization    `json:"organizations"`
	PrivateKey    string            `json:"privateKey"`
}

type Projects added in v0.10.0

type Projects struct {
	Data              []models.Project `json:"data"`
	ContinuationToken *string          `json:"continuationToken"`
	Object            string           `json:"object"`
}

type RegistrationResponse added in v0.9.0

type RegistrationResponse struct {
	CaptchaBypassToken string            `json:"captchaBypassToken"`
	Object             models.ObjectType `json:"object"`
}

type RetryRoundTripper added in v0.11.0

type RetryRoundTripper struct {
	DisableRetries bool
	Transport      http.RoundTripper
	// contains filtered or unexported fields
}

func NewRetryRoundTripper added in v0.11.0

func NewRetryRoundTripper(maxConcurrentRequests int, maxLowLevelRetries int, requestTimeout time.Duration) *RetryRoundTripper

maxLowLevelRetries is the maximum number of retries for low-level errors (e.g. timeouts). A value of 0 means no retries.

func (*RetryRoundTripper) RoundTrip added in v0.11.0

func (rrt *RetryRoundTripper) RoundTrip(httpReq *http.Request) (*http.Response, error)

type Secret added in v0.10.0

type Secret struct {
	SecretSummary
	Value  string `json:"value"`
	Note   string `json:"note"`
	Object string `json:"object"`
}

type SecretSummary added in v0.10.0

type SecretSummary struct {
	ID             string           `json:"id"`
	OrganizationID string           `json:"organizationId"`
	Key            string           `json:"key"`
	CreationDate   time.Time        `json:"creationDate"`
	RevisionDate   time.Time        `json:"revisionDate"`
	Projects       []models.Project `json:"projects"`
	Read           bool             `json:"read"`
	Write          bool             `json:"write"`
}

type SecretsWithProjectsList added in v0.10.0

type SecretsWithProjectsList struct {
	Secrets  []SecretSummary  `json:"secrets"`
	Projects []models.Project `json:"projects"`
	Object   string           `json:"object"`
}

type SignupRequest

type SignupRequest struct {
	Email              string         `json:"email"`
	Name               string         `json:"name"`
	MasterPasswordHash string         `json:"masterPasswordHash"`
	Key                string         `json:"key"`
	Kdf                models.KdfType `json:"kdf"`
	KdfIterations      int            `json:"kdfIterations"`
	KdfMemory          int            `json:"kdfMemory"`
	KdfParallelism     int            `json:"kdfParallelism"`
	Keys               KeyPair        `json:"keys"`
}

type SyncResponse added in v0.9.0

type SyncResponse struct {
	Ciphers     []models.Item     `json:"ciphers"`
	Collections []Collection      `json:"collections"`
	Folders     []models.Folder   `json:"folders"`
	Object      models.ObjectType `json:"object"`
	Profile     Profile           `json:"profile"`
}

type TokenResponse

type TokenResponse struct {
	Kdf                 models.KdfType `json:"Kdf"`
	KdfIterations       int            `json:"KdfIterations"`
	KdfMemory           int            `json:"kdfMemory"`
	KdfParallelism      int            `json:"kdfParallelism"`
	Key                 string         `json:"Key"`
	PrivateKey          string         `json:"PrivateKey"`
	ResetMasterPassword bool           `json:"ResetMasterPassword"`
	AccessToken         string         `json:"access_token"`
	ExpireIn            int            `json:"expires_in"`
	RefreshToken        string         `json:"refresh_token"`
	Scope               string         `json:"scope"`
	TokenType           string         `json:"token_type"`
	UnofficialServer    bool           `json:"unofficialServer"`
	RSAPrivateKey       *rsa.PrivateKey
}

type UserPublicKeyResponse added in v0.13.0

type UserPublicKeyResponse struct {
	Object    models.ObjectType `json:"object"`
	PublicKey string            `json:"publicKey"`
	UserId    string            `json:"userId"`
}

Jump to

Keyboard shortcuts

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