vault

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsymmetricAlgorithm

type AsymmetricAlgorithm string
const (
	AAed25519                 AsymmetricAlgorithm = "ED25519"
	AAes256                   AsymmetricAlgorithm = "ES256"
	AAes384                   AsymmetricAlgorithm = "ES384"
	AAes512                   AsymmetricAlgorithm = "ES512"
	AArsa2048_pkcs1v15_sha256 AsymmetricAlgorithm = "RSA-PKCS1V15-2048-SHA256"
	AArsa2048_oaep_sha256     AsymmetricAlgorithm = "RSA-OAEP-2048-SHA256"
	AAes256K                  AsymmetricAlgorithm = "ES256K"
	AArsa2048_oaep_sha1       AsymmetricAlgorithm = "RSA-OAEP-2048-SHA1"
	AArsa2048_oaep_sha512     AsymmetricAlgorithm = "RSA-OAEP-2048-SHA512"
	AArsa3072_oaep_sha1       AsymmetricAlgorithm = "RSA-OAEP-3072-SHA1"
	AArsa3072_oaep_sha256     AsymmetricAlgorithm = "RSA-OAEP-3072-SHA256"
	AArsa3072_oaep_sha512     AsymmetricAlgorithm = "RSA-OAEP-3072-SHA512"
	AArsa4096_oaep_sha1       AsymmetricAlgorithm = "RSA-OAEP-4096-SHA1"
	AArsa4096_oaep_sha256     AsymmetricAlgorithm = "RSA-OAEP-4096-SHA256"
	AArsa4096_oaep_sha512     AsymmetricAlgorithm = "RSA-OAEP-4096-SHA512"
	AArsa2048_pss_sha256      AsymmetricAlgorithm = "RSA-PSS-2048-SHA256"
	AArsa3072_pss_sha256      AsymmetricAlgorithm = "RSA-PSS-3072-SHA256"
	AA4096_pss_sha256         AsymmetricAlgorithm = "RSA-PSS-4096-SHA256"
	AArsa4096_pss_sha512      AsymmetricAlgorithm = "RSA-PSS-4096-SHA512"
	AArsa                     AsymmetricAlgorithm = "RSA-PKCS1V15-2048-SHA256" // deprecated, use AArsa2048_pkcs1v15_sha256 instead
)

type AsymmetricGenerateRequest

type AsymmetricGenerateRequest struct {
	CommonGenerateRequest
	Algorithm AsymmetricAlgorithm `json:"algorithm,omitempty"`
	Purpose   KeyPurpose          `json:"purpose,omitempty"`
}

type AsymmetricGenerateResult

type AsymmetricGenerateResult struct {
	CommonGenerateResult
	PublicKey EncodedPublicKey `json:"public_key"`
	Algorithm string           `json:"algorithm"`
	Purpose   string           `json:"purpose"`
}

type AsymmetricStoreRequest

type AsymmetricStoreRequest struct {
	CommonStoreRequest
	Algorithm  AsymmetricAlgorithm `json:"algorithm"`
	PublicKey  EncodedPublicKey    `json:"public_key"`
	PrivateKey EncodedPrivateKey   `json:"private_key"`
	Purpose    KeyPurpose          `json:"purpose,omitempty"`
}

type AsymmetricStoreResult

type AsymmetricStoreResult struct {
	CommonStoreResult
	PublicKey EncodedPublicKey `json:"public_key"`
	Algorithm string           `json:"algorithm"`
	Purpose   string           `json:"purpose"`
}

type Client

type Client interface {
	StateChange(ctx context.Context, req *StateChangeRequest) (*pangea.PangeaResponse[StateChangeResult], error)
	Delete(ctx context.Context, req *DeleteRequest) (*pangea.PangeaResponse[DeleteResult], error)
	Get(ctx context.Context, req *GetRequest) (*pangea.PangeaResponse[GetResult], error)
	JWKGet(ctx context.Context, req *JWKGetRequest) (*pangea.PangeaResponse[JWKGetResult], error)
	List(ctx context.Context, req *ListRequest) (*pangea.PangeaResponse[ListResult], error)
	Update(ctx context.Context, req *UpdateRequest) (*pangea.PangeaResponse[UpdateResult], error)
	SecretStore(ctx context.Context, req *SecretStoreRequest) (*pangea.PangeaResponse[SecretStoreResult], error)
	PangeaTokenStore(ctx context.Context, req *PangeaTokenStoreRequest) (*pangea.PangeaResponse[SecretStoreResult], error)
	SecretRotate(ctx context.Context, req *SecretRotateRequest) (*pangea.PangeaResponse[SecretRotateResult], error)
	PangeaTokenRotate(ctx context.Context, req *PangeaTokenRotateRequest) (*pangea.PangeaResponse[SecretRotateResult], error)
	SymmetricGenerate(ctx context.Context, req *SymmetricGenerateRequest) (*pangea.PangeaResponse[SymmetricGenerateResult], error)
	AsymmetricGenerate(ctx context.Context, req *AsymmetricGenerateRequest) (*pangea.PangeaResponse[AsymmetricGenerateResult], error)
	SymmetricStore(ctx context.Context, req *SymmetricStoreRequest) (*pangea.PangeaResponse[SymmetricStoreResult], error)
	AsymmetricStore(ctx context.Context, req *AsymmetricStoreRequest) (*pangea.PangeaResponse[AsymmetricStoreResult], error)
	KeyRotate(ctx context.Context, req *KeyRotateRequest) (*pangea.PangeaResponse[KeyRotateResult], error)
	Encrypt(ctx context.Context, req *EncryptRequest) (*pangea.PangeaResponse[EncryptResult], error)
	Decrypt(ctx context.Context, req *DecryptRequest) (*pangea.PangeaResponse[DecryptResult], error)
	Sign(ctx context.Context, req *SignRequest) (*pangea.PangeaResponse[SignResult], error)
	Verify(ctx context.Context, req *VerifyRequest) (*pangea.PangeaResponse[VerifyResult], error)
	JWTSign(ctx context.Context, req *JWTSignRequest) (*pangea.PangeaResponse[JWTSignResult], error)
	JWTVerify(ctx context.Context, req *JWTVerifyRequest) (*pangea.PangeaResponse[JWTVerifyResult], error)
	FolderCreate(ctx context.Context, req *FolderCreateRequest) (*pangea.PangeaResponse[FolderCreateResult], error)

	// Base service methods
	pangea.BaseServicer
}

func New

func New(cfg *pangea.Config) Client

type CommonGenerateRequest

type CommonGenerateRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	Type              ItemType         `json:"type"`
	Name              string           `json:"name,omitempty"`
	Folder            string           `json:"folder,omitempty"`
	Metadata          Metadata         `json:"metadata,omitempty"`
	Tags              Tags             `json:"tags,omitempty"`
	RotationFrequency string           `json:"rotation_frequency,omitempty"`
	RotationState     ItemVersionState `json:"rotation_state,omitempty"`
	Expiration        string           `json:"expiration,omitempty"`
}

type CommonGenerateResult

type CommonGenerateResult struct {
	ID      string `json:"id"`
	Type    string `json:"type"`
	Version int    `json:"version"`
}

type CommonRotateRequest

type CommonRotateRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	ID            string           `json:"id"`
	RotationState ItemVersionState `json:"rotation_state,omitempty"`
}

type CommonRotateResult

type CommonRotateResult struct {
	ID      string `json:"id"`
	Version int    `json:"version"`
	Type    string `json:"type"`
}

type CommonStoreRequest

type CommonStoreRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	Type              ItemType         `json:"type"`
	Name              string           `json:"name,omitempty"`
	Folder            string           `json:"folder,omitempty"`
	Metadata          Metadata         `json:"metadata,omitempty"`
	Tags              Tags             `json:"tags,omitempty"`
	RotationFrequency string           `json:"rotation_frequency,omitempty"`
	RotationState     ItemVersionState `json:"rotation_state,omitempty"`
	Expiration        string           `json:"expiration,omitempty"`
}

type CommonStoreResult

type CommonStoreResult struct {
	ID      string `json:"id"`
	Type    string `json:"type"`
	Version int    `json:"version"`
}

type DecryptRequest

type DecryptRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	ID             string  `json:"id"`
	CipherText     string  `json:"cipher_text"`
	Version        *int    `json:"version,omitempty"`
	AdditionalData *string `json:"additional_data,omitempty"`
}

type DecryptResult

type DecryptResult struct {
	ID        string `json:"id"`
	Version   int    `json:"version"`
	Algorithm string `json:"algorithm"`
	PlainText string `json:"plain_text"`
}

type DeleteRequest

type DeleteRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	ID string `json:"id"`
}

type DeleteResult

type DeleteResult struct {
	ID string `json:"id"`
}

type EncodedPrivateKey

type EncodedPrivateKey string

EncodedPrivateKey is a PEM private key, with no further encoding (i.e. no base64). It may be used for example in openssh with no further processing

type EncodedPublicKey

type EncodedPublicKey string

EncodedPublicKey is a PEM public key, with no further encoding (i.e. no base64) It may be used for example in openssh with no further processing

type EncodedSymmetricKey

type EncodedSymmetricKey string

EncodedSymmetricKey is a base64 encoded key

type EncryptRequest

type EncryptRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	ID             string  `json:"id"`
	PlainText      string  `json:"plain_text"`
	Version        *int    `json:"version,omitempty"`
	AdditionalData *string `json:"additional_data,omitempty"`
}

type EncryptResult

type EncryptResult struct {
	ID         string `json:"id"`
	Version    int    `json:"version"`
	Algorithm  string `json:"algorithm"`
	CipherText string `json:"cipher_text"`
}

type FolderCreateRequest added in v2.1.0

type FolderCreateRequest struct {
	pangea.BaseRequest

	Name     string   `json:"name"`
	Folder   string   `json:"folder"`
	Metadata Metadata `json:"metadata,omitempty"`
	Tags     Tags     `json:"tags,omitempty"`
}

type FolderCreateResult added in v2.1.0

type FolderCreateResult struct {
	ID string `json:"id"`
}

type GetRequest

type GetRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	ID           string            `json:"id"`
	Version      string            `json:"version,omitempty"`
	Verbose      *bool             `json:"verbose,omitempty"`
	VersionState *ItemVersionState `json:"version_state,omitempty"`
}

type GetResult

type GetResult struct {
	ItemData
	Versions            []ItemVersionData `json:"versions"`
	RotationGracePeriod string            `json:"rotation_grace_period,omitempty"`
}

type ItemData

type ItemData struct {
	ID                string          `json:"id"`
	Type              string          `json:"type"`
	ItemState         string          `json:"item_state"`
	CurrentVersion    ItemVersionData `json:"current_version"`
	Name              string          `json:"name,omitempty"`
	Folder            string          `json:"folder,omitempty"`
	Metadata          Metadata        `json:"metadata,omitempty"`
	Tags              Tags            `json:"tags,omitempty"`
	RotationFrequency string          `json:"rotation_frequency,omitempty"`
	RotationState     string          `json:"rotation_state,omitempty"`
	LastRotated       string          `json:"last_rotated,omitempty"`
	NextRotation      string          `json:"next_rotation,omitempty"`
	Expiration        string          `json:"expiration,omitempty"`
	CreatedAt         string          `json:"created_at"`
	Algorithm         string          `json:"algorithm,omitempty"`
	Purpose           string          `json:"purpose,omitempty"`
}

type ItemOrder

type ItemOrder string
const (
	IOasc ItemOrder = "asc"
	IOdes ItemOrder = "desc"
)

type ItemOrderBy

type ItemOrderBy string
const (
	IOBtype         ItemOrderBy = "type"
	IOBcreateAt     ItemOrderBy = "create_at"
	IOBdestroyedAt  ItemOrderBy = "destroyed_at"
	IOBidentity     ItemOrderBy = "identity"
	IOBmanaged      ItemOrderBy = "managed"
	IOBpurpose      ItemOrderBy = "purpose"
	IOBexpiration   ItemOrderBy = "expiration"
	IOBlastRotated  ItemOrderBy = "last_rotated"
	IOBnextRotation ItemOrderBy = "next_rotation"
	IOBname         ItemOrderBy = "name"
	IOBfolder       ItemOrderBy = "folder"
	IOBversion      ItemOrderBy = "version"
)

type ItemState

type ItemState string
const (
	ISenabled  ItemState = "enabled"
	ISdisabled ItemState = "disabled"
)

type ItemType

type ItemType string
const (
	ITasymmetricKey ItemType = "asymmetric_key"
	ITsymmetricKey  ItemType = "symmetric_key"
	ITsecret        ItemType = "secret"
	ITpangeaToken   ItemType = "pangea_token"
)

type ItemVersionData

type ItemVersionData struct {
	Version   int               `json:"version"`
	State     string            `json:"state"`
	CreatedAt string            `json:"created_at"`
	DestroyAt *string           `json:"destroy_at,omitempty"`
	PublicKey *EncodedPublicKey `json:"public_key,omitempty"`
	Secret    *string           `json:"secret,omitempty"`
}

type ItemVersionState

type ItemVersionState string
const (
	IVSactive      ItemVersionState = "active"
	IVSdeactivated ItemVersionState = "deactivated"
	IVSsuspended   ItemVersionState = "suspended"
	IVScompromised ItemVersionState = "compromised"
	IVSdestroyed   ItemVersionState = "destroyed"
)

type JWKGetRequest

type JWKGetRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	ID      string  `json:"id"`
	Version *string `json:"version,omitempty"`
}

type JWKGetResult

type JWKGetResult struct {
	Keys []JWT `json:"keys"`
}

type JWT

type JWT struct {
	Alg string  `json:"alg"`
	Kid *string `json:"kid,omitempty"`
	Kty string  `json:"kty"`
	Use *string `json:"use,omitemtpy"`
	Crv *string `json:"crv,omitemtpy"`
	D   *string `json:"d,omitemtpy"`
	X   *string `json:"x,omitemtpy"`
	Y   *string `json:"y,omitemtpy"`
	N   *string `json:"n,omitemtpy"`
	E   *string `json:"e,omitemtpy"`
}

type JWTSignRequest

type JWTSignRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	ID      string `json:"id"`
	Payload string `json:"payload"`
}

type JWTSignResult

type JWTSignResult struct {
	JWS string `json:"jws"`
}

type JWTVerifyRequest

type JWTVerifyRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	JWS string `json:"jws"`
}

type JWTVerifyResult

type JWTVerifyResult struct {
	ValidSignature bool `json:"valid_signature"`
}

type KeyPurpose

type KeyPurpose string
const (
	KPsigning    KeyPurpose = "signing"
	KPencryption KeyPurpose = "encryption"
	KPjwt        KeyPurpose = "jwt"
)

type KeyRotateRequest

type KeyRotateRequest struct {
	CommonRotateRequest
	PublicKey  *EncodedPublicKey    `json:"public_key,omitempty"`
	PrivateKey *EncodedPrivateKey   `json:"private_key,omitempty"`
	Key        *EncodedSymmetricKey `json:"key,omitempty"`
}

type KeyRotateResult

type KeyRotateResult struct {
	CommonRotateResult
	PublicKey *EncodedPublicKey `json:"public_key,omitempty"`
	Algorithm string            `json:"algorithm"`
	Purpose   string            `json:"purpose"`
}

type ListItemData

type ListItemData struct {
	ItemData
	CompromisedVersions []ItemVersionData `json:"compromised_versions"`
}

type ListRequest

type ListRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	Filter  map[string]string `json:"filter,omitempty"`
	Last    string            `json:"last,omitempty"`
	Size    int               `json:"size,omitempty"`
	Order   ItemOrder         `json:"order,omitempty"`
	OrderBy ItemOrderBy       `json:"order_by,omitempty"`
}

type ListResult

type ListResult struct {
	Items []ListItemData `json:"items"`
	Count int            `json:"count"`
	Last  string         `json:"last,omitempty"`
}

type Metadata

type Metadata map[string]string

type PangeaTokenRotateRequest

type PangeaTokenRotateRequest struct {
	CommonRotateRequest
	RotationGracePeriod string `json:"rotation_grace_period"`
}

type PangeaTokenStoreRequest

type PangeaTokenStoreRequest struct {
	CommonStoreRequest
	Token string `json:"secret"`
}

type SecretRotateRequest

type SecretRotateRequest struct {
	CommonRotateRequest
	Secret string `json:"secret"`
}

type SecretRotateResult

type SecretRotateResult struct {
	CommonRotateResult
	Secret string `json:"secret"`
}

type SecretStoreRequest

type SecretStoreRequest struct {
	CommonStoreRequest
	Secret string `json:"secret"`
}

type SecretStoreResult

type SecretStoreResult struct {
	CommonStoreResult
	Secret string `json:"secret"`
}

type SignRequest

type SignRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	ID      string `json:"id"`
	Message string `json:"message"`
	Version *int   `json:"version,omitempty"`
}

type SignResult

type SignResult struct {
	ID        string            `json:"id"`
	Version   int               `json:"version"`
	Signature string            `json:"signature"`
	Algorithm string            `json:"algorithm"`
	PublicKey *EncodedPublicKey `json:"public_key,omitempty"`
}

type StateChangeRequest

type StateChangeRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	ID            string           `json:"id"`
	State         ItemVersionState `json:"state"`
	Version       *int             `json:"version,omitempty"`
	DestroyPeriod string           `json:"destroy_period,omitempty"`
}

type StateChangeResult

type StateChangeResult struct {
	ID        string  `json:"id"`
	Version   int     `json:"version"`
	State     string  `json:"state"`
	DestroyAt *string `json:"destroy_at,omitempty"`
}

type SymmetricAlgorithm

type SymmetricAlgorithm string
const (
	SYAhs256      SymmetricAlgorithm = "HS256"
	SYAhs384      SymmetricAlgorithm = "HS384"
	SYAhs512      SymmetricAlgorithm = "HS512"
	SYAaes128_cfb SymmetricAlgorithm = "AES-CFB-128"
	SYAaes256_cfb SymmetricAlgorithm = "AES-CFB-256"
	SYAaes256_gcm SymmetricAlgorithm = "AES-GCM-256"
	SYAaes        SymmetricAlgorithm = "AES-CFB-128" // deprecated, use SYAaes128_cfb instead
)

type SymmetricGenerateRequest

type SymmetricGenerateRequest struct {
	CommonGenerateRequest
	Algorithm SymmetricAlgorithm `json:"algorithm"`
	Purpose   KeyPurpose         `json:"purpose"`
}

type SymmetricGenerateResult

type SymmetricGenerateResult struct {
	CommonGenerateResult
	Algorithm string `json:"algorithm"`
	Purpose   string `json:"purpose"`
}

type SymmetricStoreRequest

type SymmetricStoreRequest struct {
	CommonStoreRequest
	Key       EncodedSymmetricKey `json:"key"`
	Algorithm SymmetricAlgorithm  `json:"algorithm"`
	Purpose   KeyPurpose          `json:"purpose,omitempty"`
}

type SymmetricStoreResult

type SymmetricStoreResult struct {
	CommonStoreResult
	Algorithm string `json:"algorithm"`
	Purpose   string `json:"purpose"`
}

type Tags

type Tags []string

type UpdateRequest

type UpdateRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	ID                  string           `json:"id"`
	Name                string           `json:"name,omitempty"`
	Folder              string           `json:"folder,omitempty"`
	Metadata            Metadata         `json:"metadata,omitempty"`
	Tags                Tags             `json:"tags,omitempty"`
	RotationFrequency   string           `json:"rotation_frequency,omitempty"`
	RotationState       ItemVersionState `json:"rotation_state,omitempty"`
	RotationGracePeriod string           `json:"rotation_grace_period,omitempty"`
	Expiration          string           `json:"expiration,omitempty"`
	ItemState           ItemState        `json:"item_state,omitempty"`
}

type UpdateResult

type UpdateResult struct {
	ID string `json:"id"`
}

type VerifyRequest

type VerifyRequest struct {
	// Base request has ConfigID for multi-config projects
	pangea.BaseRequest

	ID        string `json:"id"`
	Version   *int   `json:"version,omitempty"`
	Message   string `json:"message"`
	Signature string `json:"signature"`
}

type VerifyResult

type VerifyResult struct {
	ID             string `json:"id"`
	Version        int    `json:"version"`
	Algorithm      string `json:"algorithm"`
	ValidSignature bool   `json:"valid_signature"`
}

Jump to

Keyboard shortcuts

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