ocivault

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 54 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

OCI Vault

Parity grade: B · SDK github.com/oracle/oci-go-sdk/v65@v65.126.2 · last audited 2026-10-25 (8533cce14)

Coverage

Metric Value
PARITY entries audited 62 (31 ok, 31 partial)
Feature families 9 (8 ok, 1 partial)
Known gaps 2
Deferred items 0
Resource leaks unknown
Known gaps
  • HSM clusters (the 14 KmsHsmCluster operations), external vaults and external keys (CreateVault EXTERNAL with externalKeyManagerMetadata, CreateKey externalKeyReferenceDetails: every crypto operation would call the customer external key manager) and UpdateRegisteredVaultForMtls (the mtlsCryptoDns format is not published) are not implemented; vaults.go validates vaultType DEFAULT or VIRTUAL_PRIVATE only.
  • IAM policy checks, resource principals and instance principals are not applied; only API-key signatures are verified (pkgs/ociauth/ociauth.go Verify). Blocker: services/ociidentity stores and parses policy statements (grammar.go) but no OCI service has a policy evaluator, group or dynamic-group resolution, or token issuer to call.

More

Documentation

Index

Constants

View Source
const DefaultPort = 8151

DefaultPort is the dedicated listener's default TCP port.

View Source
const (
	// Region is the fixed region baked into emulated OCIDs.
	Region = "us-ashburn-1"
)
View Source
const TransitionDelay = 2 * time.Second

TransitionDelay is how long a resource stays in a transitional state (CREATING, ENABLING, ...) by default.

Variables

View Source
var ErrFunctionFailed = errors.New("ocivault: rotation function failed")

ErrFunctionFailed marks a rotation function call that did not succeed.

View Source
var ErrNilAppContext = errors.New("ocivault: nil app context")

ErrNilAppContext is returned when Init is called with a nil AppContext.

View Source
var ErrSnapshotNull = errors.New("ocivault: null entry in snapshot")

ErrSnapshotNull is returned when a snapshot contains a null entry.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Code    string
	Message string
	Status  int
}

APIError is an OCI error response: HTTP status plus the `code` and `message` body fields.

func (*APIError) Error

func (e *APIError) Error() string

type AdbTarget

type AdbTarget interface {
	VerifyAdb(ctx context.Context, adbID string) error
	SetAdbAdminPassword(ctx context.Context, adbID, password string) error
}

AdbTarget reaches Autonomous Databases for ADB rotation targets.

type BackupIn

type BackupIn struct {
	BackupLocation *BackupLocation `json:"backupLocation"`
}

BackupIn is the BackupVault, BackupKey, RestoreVaultFromObjectStore and RestoreKeyFromObjectStore body.

type BackupLocation

type BackupLocation struct {
	Destination string `json:"destination"`
	Namespace   string `json:"namespace"`
	BucketName  string `json:"bucketName"`
	ObjectName  string `json:"objectName"`
	URI         string `json:"uri"`
}

BackupLocation is the polymorphic backupLocation body (BUCKET or PRE_AUTHENTICATED_REQUEST_URI).

type BlobStore

type BlobStore interface {
	PutBlob(ns, bucket, object string, data []byte) error
	GetBlob(ns, bucket, object string) ([]byte, error)
	PutBlobPAR(uri string, data []byte) error
	GetBlobPAR(uri string) ([]byte, error)
}

BlobStore is the Object Storage surface backups are written to and read from.

type BundleSelector

type BundleSelector struct {
	VersionNumber *int64
	VersionName   string
	Stage         string
}

BundleSelector picks the secret version GetSecretBundle returns.

type ConfigProvider

type ConfigProvider interface {
	GetOCIVaultSettings() Settings
}

ConfigProvider extracts OCI Vault configuration from the AppContext Config.

type CreateEkmsIn

type CreateEkmsIn struct {
	FreeformTags  map[string]string         `json:"freeformTags"`
	DefinedTags   map[string]map[string]any `json:"definedTags"`
	Port          *int                      `json:"port"`
	SubnetID      string                    `json:"subnetId"`
	CompartmentID string                    `json:"compartmentId"`
	DisplayName   string                    `json:"displayName"`
	ExternalIP    string                    `json:"externalKeyManagerIp"`
	CABundle      string                    `json:"caBundle"`
}

CreateEkmsIn is the CreateEkmsPrivateEndpoint request body.

type CreateKeyIn

type CreateKeyIn struct {
	RetryToken             string                    `json:"-"`
	FreeformTags           map[string]string         `json:"freeformTags"`
	DefinedTags            map[string]map[string]any `json:"definedTags"`
	AutoKeyRotationDetails *RotationDetails          `json:"autoKeyRotationDetails"`
	CompartmentID          string                    `json:"compartmentId"`
	DisplayName            string                    `json:"displayName"`
	ProtectionMode         string                    `json:"protectionMode"`
	KeyShape               KeyShape                  `json:"keyShape"`
	IsAutoRotationEnabled  bool                      `json:"isAutoRotationEnabled"`
}

CreateKeyIn is the CreateKey request body.

type CreateReplicaIn

type CreateReplicaIn struct {
	ReplicaRegion string `json:"replicaRegion"`
}

CreateReplicaIn is the CreateVaultReplica body.

type CreateSecretIn

type CreateSecretIn struct {
	RetryToken              string                    `json:"-"`
	FreeformTags            map[string]string         `json:"freeformTags"`
	DefinedTags             map[string]map[string]any `json:"definedTags"`
	Metadata                map[string]any            `json:"metadata"`
	SecretContent           *SecretContent            `json:"secretContent"`
	ReplicationConfig       jsontext.Value            `json:"replicationConfig"`
	RotationConfig          jsontext.Value            `json:"rotationConfig"`
	SecretGenerationContext jsontext.Value            `json:"secretGenerationContext"`
	EnableAutoGeneration    *bool                     `json:"enableAutoGeneration"`
	CompartmentID           string                    `json:"compartmentId"`
	KeyID                   string                    `json:"keyId"`
	SecretName              string                    `json:"secretName"`
	VaultID                 string                    `json:"vaultId"`
	Description             string                    `json:"description"`
	SecretRules             []jsontext.Value          `json:"secretRules"`
}

CreateSecretIn is the CreateSecret request body.

type CreateVaultIn

type CreateVaultIn struct {
	RetryToken    string                    `json:"-"`
	FreeformTags  map[string]string         `json:"freeformTags"`
	DefinedTags   map[string]map[string]any `json:"definedTags"`
	CompartmentID string                    `json:"compartmentId"`
	DisplayName   string                    `json:"displayName"`
	VaultType     string                    `json:"vaultType"`
}

CreateVaultIn is the CreateVault request body.

type DecryptIn

type DecryptIn struct {
	AssociatedData map[string]string `json:"associatedData"`
	KeyID          string            `json:"keyId"`
	Ciphertext     string            `json:"ciphertext"`
	KeyVersionID   string            `json:"keyVersionId"`
	Algorithm      string            `json:"encryptionAlgorithm"`
}

DecryptIn is the Decrypt request body.

type DeleteReplicaIn

type DeleteReplicaIn struct {
	ReplicaRegion string `json:"replicaRegion"`
}

DeleteReplicaIn is the DeleteVaultReplica body.

type EkmsEndpoint

type EkmsEndpoint struct {
	TimeCreated   time.Time                 `json:"timeCreated"`
	TimeUpdated   *time.Time                `json:"timeUpdated,omitempty"`
	FreeformTags  map[string]string         `json:"freeformTags,omitempty"`
	DefinedTags   map[string]map[string]any `json:"definedTags,omitempty"`
	ID            string                    `json:"id"`
	CompartmentID string                    `json:"compartmentId"`
	SubnetID      string                    `json:"subnetId"`
	DisplayName   string                    `json:"displayName"`
	State         string                    `json:"state"`
	ExternalIP    string                    `json:"externalKeyManagerIp"`
	CABundle      string                    `json:"caBundle"`
	PrivateIP     string                    `json:"privateEndpointIp,omitempty"`
	Etag          string                    `json:"etag"`
	Port          int                       `json:"port"`
	Seq           int64                     `json:"seq"`
	// contains filtered or unexported fields
}

EkmsEndpoint is an EKMS private endpoint.

type EkmsEndpointWire

type EkmsEndpointWire struct {
	TimeCreated   time.Time                 `json:"timeCreated"`
	TimeUpdated   *time.Time                `json:"timeUpdated,omitempty"`
	FreeformTags  map[string]string         `json:"freeformTags,omitempty"`
	DefinedTags   map[string]map[string]any `json:"definedTags,omitempty"`
	ID            string                    `json:"id"`
	CompartmentID string                    `json:"compartmentId"`
	SubnetID      string                    `json:"subnetId"`
	DisplayName   string                    `json:"displayName"`
	State         string                    `json:"lifecycleState"`
	ExternalIP    string                    `json:"externalKeyManagerIp"`
	CABundle      string                    `json:"caBundle,omitempty"`
	PrivateIP     string                    `json:"privateEndpointIp,omitempty"`
	Port          int                       `json:"port"`
}

EkmsEndpointWire is the EkmsPrivateEndpoint body.

type EncryptIn

type EncryptIn struct {
	AssociatedData map[string]string `json:"associatedData"`
	KeyID          string            `json:"keyId"`
	Plaintext      string            `json:"plaintext"`
	KeyVersionID   string            `json:"keyVersionId"`
	Algorithm      string            `json:"encryptionAlgorithm"`
}

EncryptIn is the Encrypt request body.

type ExportIn

type ExportIn struct {
	KeyID        string `json:"keyId"`
	Algorithm    string `json:"algorithm"`
	PublicKey    string `json:"publicKey"`
	KeyVersionID string `json:"keyVersionId"`
}

ExportIn is the ExportKey request body.

type FunctionInvoker

type FunctionInvoker func(ctx context.Context, functionID string, body []byte) error

FunctionInvoker calls an OCI function in-process with the given request body.

type GenerateDEKIn

type GenerateDEKIn struct {
	AssociatedData      map[string]string `json:"associatedData"`
	KeyID               string            `json:"keyId"`
	KeyShape            KeyShape          `json:"keyShape"`
	IncludePlaintextKey bool              `json:"includePlaintextKey"`
}

GenerateDEKIn is the GenerateDataEncryptionKey request body.

type GenerationContext

type GenerationContext struct {
	SecretTemplate     string `json:"secretTemplate,omitempty"`
	GenerationType     string `json:"generationType"`
	GenerationTemplate string `json:"generationTemplate"`
	PassphraseLength   int    `json:"passphraseLength,omitempty"`
}

GenerationContext is the polymorphic secretGenerationContext body.

type Handler

type Handler struct {
	Backend *InMemoryBackend

	Port        int
	EnforceAuth bool
	// contains filtered or unexported fields
}

Handler serves OCI Vault: KMS vaults, keys and crypto, vault secrets and secret retrieval.

func NewHandler

func NewHandler(backend *InMemoryBackend) *Handler

NewHandler creates a Handler; callers override Port and EnforceAuth from Settings.

func (*Handler) ExtractOperation

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation returns the operation name for metrics.

func (*Handler) ExtractResource

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource returns the addressed resource id for metrics.

func (*Handler) GetSupportedOperations

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations lists the supported operations.

func (*Handler) Handler

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler for all OCI Vault requests.

func (*Handler) MatchPriority

func (h *Handler) MatchPriority() int

MatchPriority is irrelevant because RouteMatcher never matches.

func (*Handler) Name

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset

func (h *Handler) Reset()

Reset clears all in-memory state.

func (*Handler) Restore

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*Handler) RouteMatcher

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher never matches: OCI Vault runs on its own listener.

func (*Handler) Shutdown

func (h *Handler) Shutdown(ctx context.Context)

Shutdown stops the listener and the sweeper.

func (*Handler) Snapshot

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

func (*Handler) StartWorker

func (h *Handler) StartWorker(ctx context.Context) error

StartWorker binds the dedicated listener synchronously so a port conflict is returned to the caller.

type ImportKeyIn

type ImportKeyIn struct {
	WrappedImportKey WrappedImportKey `json:"wrappedImportKey"`
	CreateKeyIn
}

ImportKeyIn is the ImportKey request body.

type ImportKeyVersionIn

type ImportKeyVersionIn struct {
	WrappedImportKey WrappedImportKey `json:"wrappedImportKey"`
}

ImportKeyVersionIn is the ImportKeyVersion request body.

type InMemoryBackend

type InMemoryBackend struct {
	Auth *ociauth.Registry
	// contains filtered or unexported fields
}

InMemoryBackend holds every vault, key and secret under one lock.

func NewInMemoryBackend

func NewInMemoryBackend() *InMemoryBackend

NewInMemoryBackend creates an empty backend.

func (*InMemoryBackend) BackupKey

func (b *InMemoryBackend) BackupKey(vaultID, keyID, ifMatch string, in BackupIn) (KeyWire, string, error)

BackupKey writes an encrypted copy of the key, all its versions and its vault metadata.

func (*InMemoryBackend) BackupVault

func (b *InMemoryBackend) BackupVault(id, ifMatch, hostPort string, in BackupIn) (VaultWire, string, error)

BackupVault writes an encrypted copy of the vault metadata to the backup location.

func (*InMemoryBackend) CancelKeyDeletion

func (b *InMemoryBackend) CancelKeyDeletion(vaultID, keyID, ifMatch, token string) (KeyWire, string, error)

CancelKeyDeletion restores the state a key had before deletion was scheduled.

func (*InMemoryBackend) CancelKeyVersionDeletion

func (b *InMemoryBackend) CancelKeyVersionDeletion(
	vaultID, keyID, versionID, token string,
) (keyVersionWire, string, error)

CancelKeyVersionDeletion returns a PENDING_DELETION version to ENABLED.

func (*InMemoryBackend) CancelSecretDeletion

func (b *InMemoryBackend) CancelSecretDeletion(id, ifMatch string) error

CancelSecretDeletion returns a PENDING_DELETION secret to ACTIVE.

func (*InMemoryBackend) CancelSecretRotation

func (b *InMemoryBackend) CancelSecretRotation(id, ifMatch string) error

CancelSecretRotation disables scheduled rotation for the secret.

func (*InMemoryBackend) CancelSecretVersionDeletion

func (b *InMemoryBackend) CancelSecretVersionDeletion(id string, n int64, ifMatch string) error

CancelSecretVersionDeletion cancels a scheduled version deletion.

func (*InMemoryBackend) CancelVaultDeletion

func (b *InMemoryBackend) CancelVaultDeletion(id, ifMatch, hostPort, token string) (VaultWire, string, error)

CancelVaultDeletion returns a PENDING_DELETION vault to ACTIVE.

func (*InMemoryBackend) ChangeKeyCompartment

func (b *InMemoryBackend) ChangeKeyCompartment(vaultID, keyID, ifMatch, compartment, token string) error

ChangeKeyCompartment moves a key.

func (*InMemoryBackend) ChangeSecretCompartment

func (b *InMemoryBackend) ChangeSecretCompartment(id, ifMatch, compartment, token string) error

ChangeSecretCompartment moves a secret.

func (*InMemoryBackend) ChangeVaultCompartment

func (b *InMemoryBackend) ChangeVaultCompartment(id, ifMatch, compartment, token string) error

ChangeVaultCompartment moves a vault; its keys and secrets follow.

func (*InMemoryBackend) Compartments

func (b *InMemoryBackend) Compartments() []string

Compartments lists the distinct compartments that hold vaults, keys or secrets.

func (*InMemoryBackend) CreateEkmsPrivateEndpoint

func (b *InMemoryBackend) CreateEkmsPrivateEndpoint(in CreateEkmsIn) (EkmsEndpointWire, string, error)

CreateEkmsPrivateEndpoint creates a private endpoint to an external key manager; it is CREATING until the transition delay elapses.

func (*InMemoryBackend) CreateKey

func (b *InMemoryBackend) CreateKey(vaultID string, in CreateKeyIn) (KeyWire, string, error)

CreateKey creates a key with its first version; it is ENABLING until the transition delay elapses.

func (*InMemoryBackend) CreateKeyVersion

func (b *InMemoryBackend) CreateKeyVersion(vaultID, keyID, token string) (keyVersionWire, string, error)

CreateKeyVersion rotates the key: new material becomes the current version.

func (*InMemoryBackend) CreateSecret

func (b *InMemoryBackend) CreateSecret(in CreateSecretIn) (secretWire, string, error)

CreateSecret creates a secret and, when content is given, version 1.

func (*InMemoryBackend) CreateVault

func (b *InMemoryBackend) CreateVault(in CreateVaultIn, hostPort string) (VaultWire, string, error)

CreateVault creates a vault that is CREATING until the transition delay elapses.

func (*InMemoryBackend) CreateVaultReplica

func (b *InMemoryBackend) CreateVaultReplica(id, ifMatch, token string, in CreateReplicaIn) error

CreateVaultReplica adds a replica of a virtual private vault in another region.

func (*InMemoryBackend) Decrypt

func (b *InMemoryBackend) Decrypt(vaultID string, in DecryptIn) (decryptedWire, error)

Decrypt reverses Encrypt; rotated key versions keep decrypting their own ciphertext.

func (*InMemoryBackend) DeleteEkmsPrivateEndpoint

func (b *InMemoryBackend) DeleteEkmsPrivateEndpoint(id, ifMatch string) error

DeleteEkmsPrivateEndpoint deletes a private endpoint that no external vault uses.

func (*InMemoryBackend) DeleteVaultReplica

func (b *InMemoryBackend) DeleteVaultReplica(id, ifMatch, token string, in DeleteReplicaIn) error

DeleteVaultReplica removes the replica in the given region.

func (*InMemoryBackend) DisableKey

func (b *InMemoryBackend) DisableKey(vaultID, keyID, ifMatch, token string) (KeyWire, string, error)

DisableKey moves an ENABLED key to DISABLED.

func (*InMemoryBackend) EnableKey

func (b *InMemoryBackend) EnableKey(vaultID, keyID, ifMatch, token string) (KeyWire, string, error)

EnableKey moves a DISABLED key to ENABLED.

func (*InMemoryBackend) Encrypt

func (b *InMemoryBackend) Encrypt(vaultID string, in EncryptIn) (encryptedWire, error)

Encrypt encrypts base64 plaintext with an AES or RSA key.

func (*InMemoryBackend) ExportKey

func (b *InMemoryBackend) ExportKey(vaultID string, in ExportIn) (exportedWire, error)

ExportKey wraps a SOFTWARE key version's material with the caller's RSA public key.

func (*InMemoryBackend) GenerateDataEncryptionKey

func (b *InMemoryBackend) GenerateDataEncryptionKey(vaultID string, in GenerateDEKIn) (generatedWire, error)

GenerateDataEncryptionKey returns a fresh data key wrapped by the master key.

func (*InMemoryBackend) GetEkmsPrivateEndpoint

func (b *InMemoryBackend) GetEkmsPrivateEndpoint(id string) (EkmsEndpointWire, string, error)

GetEkmsPrivateEndpoint returns one private endpoint; DELETED endpoints stay readable.

func (*InMemoryBackend) GetKey

func (b *InMemoryBackend) GetKey(vaultID, keyID string) (KeyWire, string, error)

GetKey returns one key.

func (*InMemoryBackend) GetKeyVersion

func (b *InMemoryBackend) GetKeyVersion(vaultID, keyID, versionID string) (keyVersionWire, string, error)

GetKeyVersion returns one key version including its public key.

func (*InMemoryBackend) GetReplicationStatus

func (b *InMemoryBackend) GetReplicationStatus(replicationID string) (ReplicationStatusWire, error)

GetReplicationStatus reports whether a replicated operation has been applied in every replica region.

func (*InMemoryBackend) GetSecret

func (b *InMemoryBackend) GetSecret(id string) (secretWire, string, error)

GetSecret returns secret metadata.

func (*InMemoryBackend) GetSecretBundle

func (b *InMemoryBackend) GetSecretBundle(id string, sel BundleSelector) (secretBundleWire, string, error)

GetSecretBundle returns decrypted secret content by id.

func (*InMemoryBackend) GetSecretBundleByName

func (b *InMemoryBackend) GetSecretBundleByName(vaultID, name string, sel BundleSelector) (secretBundleWire, error)

GetSecretBundleByName returns decrypted secret content by name within a vault.

func (*InMemoryBackend) GetSecretVersion

func (b *InMemoryBackend) GetSecretVersion(id string, n int64) (secretVersionWire, string, error)

GetSecretVersion returns one version's metadata.

func (*InMemoryBackend) GetVault

func (b *InMemoryBackend) GetVault(id, hostPort string) (VaultWire, string, error)

GetVault returns one vault.

func (*InMemoryBackend) GetVaultUsage

func (b *InMemoryBackend) GetVaultUsage(id string) (vaultUsageWire, error)

GetVaultUsage counts the keys and key versions of a vault.

func (*InMemoryBackend) GetWrappingKey

func (b *InMemoryBackend) GetWrappingKey(vaultID string) (wrappingKeyWire, error)

GetWrappingKey returns the vault's public RSA wrapping key.

func (*InMemoryBackend) ImportKey

func (b *InMemoryBackend) ImportKey(vaultID, token string, in ImportKeyIn) (KeyWire, string, error)

ImportKey creates a key from wrapped external key material.

func (*InMemoryBackend) ImportKeyVersion

func (b *InMemoryBackend) ImportKeyVersion(
	vaultID, keyID, token string,
	in ImportKeyVersionIn,
) (keyVersionWire, string, error)

ImportKeyVersion adds wrapped external key material as a new current version.

func (*InMemoryBackend) KeyState

func (b *InMemoryBackend) KeyState(keyID string) (string, bool)

KeyState reports the lifecycle state of a key by OCID, for services that reference Vault keys.

func (*InMemoryBackend) KeyVisibleOnReplica

func (b *InMemoryBackend) KeyVisibleOnReplica(keyID string) bool

KeyVisibleOnReplica reports whether the key exists in the replica region yet.

func (*InMemoryBackend) ListEkmsPrivateEndpoints

func (b *InMemoryBackend) ListEkmsPrivateEndpoints(compartment string, o ListOpts) (page.Page[ekmsSummaryWire], error)

ListEkmsPrivateEndpoints lists the private endpoints of a compartment.

func (*InMemoryBackend) ListKeyVersions

func (b *InMemoryBackend) ListKeyVersions(vaultID, keyID string, o ListOpts) (page.Page[keyVersionSummaryWire], error)

ListKeyVersions lists a key's versions.

func (*InMemoryBackend) ListKeys

func (b *InMemoryBackend) ListKeys(
	vaultID, compartment string,
	f KeyFilter,
	o ListOpts,
) (page.Page[keySummaryWire], error)

ListKeys lists a vault's keys in a compartment.

func (*InMemoryBackend) ListSecretBundleVersions

func (b *InMemoryBackend) ListSecretBundleVersions(id string, o ListOpts) (page.Page[bundleVersionSummaryWire], error)

ListSecretBundleVersions lists version summaries without content.

func (*InMemoryBackend) ListSecretVersions

func (b *InMemoryBackend) ListSecretVersions(id string, o ListOpts) (page.Page[secretVersionSummaryWire], error)

ListSecretVersions lists a secret's versions (oldest first unless DESC).

func (*InMemoryBackend) ListSecrets

func (b *InMemoryBackend) ListSecrets(f SecretFilter, o ListOpts) (page.Page[secretSummaryWire], error)

ListSecrets lists secrets in a compartment.

func (*InMemoryBackend) ListVaultReplicas

func (b *InMemoryBackend) ListVaultReplicas(id, hostPort string, o ListOpts) (page.Page[ReplicaSummaryWire], error)

ListVaultReplicas lists the replicas of a vault.

func (*InMemoryBackend) ListVaults

func (b *InMemoryBackend) ListVaults(compartment, hostPort string, o ListOpts) (page.Page[vaultSummaryWire], error)

ListVaults lists the vaults of a compartment.

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all state.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads backend state from a snapshot.

func (*InMemoryBackend) RestoreKey

func (b *InMemoryBackend) RestoreKey(vaultScope string, blob []byte) (KeyWire, string, error)

RestoreKey recreates a key and its versions in its original vault from a backup file.

func (*InMemoryBackend) RestoreVault

func (b *InMemoryBackend) RestoreVault(compartment, hostPort string, blob []byte) (VaultWire, string, error)

RestoreVault recreates a vault from a backup file; it keeps its OCID and must land in its original compartment.

func (*InMemoryBackend) RotateSecret

func (b *InMemoryBackend) RotateSecret(id, ifMatch, token string) error

RotateSecret forces a rotation now; the version stages move PENDING to CURRENT when it succeeds.

func (*InMemoryBackend) ScheduleKeyDeletion

func (b *InMemoryBackend) ScheduleKeyDeletion(
	vaultID, keyID, ifMatch, token string, at *time.Time,
) (KeyWire, string, error)

ScheduleKeyDeletion moves an ENABLED or DISABLED key to PENDING_DELETION.

func (*InMemoryBackend) ScheduleKeyVersionDeletion

func (b *InMemoryBackend) ScheduleKeyVersionDeletion(
	vaultID, keyID, versionID, token string,
	at *time.Time,
) (keyVersionWire, string, error)

ScheduleKeyVersionDeletion schedules deletion of a non-current key version.

func (*InMemoryBackend) ScheduleSecretDeletion

func (b *InMemoryBackend) ScheduleSecretDeletion(id, ifMatch string, at *time.Time) error

ScheduleSecretDeletion moves an ACTIVE secret to PENDING_DELETION.

func (*InMemoryBackend) ScheduleSecretVersionDeletion

func (b *InMemoryBackend) ScheduleSecretVersionDeletion(id string, n int64, ifMatch string, at *time.Time) error

ScheduleSecretVersionDeletion schedules deletion of a version that is not current.

func (*InMemoryBackend) ScheduleVaultDeletion

func (b *InMemoryBackend) ScheduleVaultDeletion(
	id, ifMatch, hostPort, token string,
	at *time.Time,
) (VaultWire, string, error)

ScheduleVaultDeletion moves an ACTIVE vault to PENDING_DELETION.

func (*InMemoryBackend) SecretContent

func (b *InMemoryBackend) SecretContent(id string) (string, error)

SecretContent returns the decoded content of the latest version of a secret (Container Instances always uses the latest version: docs vault-secrets-image-authorization.htm).

func (*InMemoryBackend) SetAdbTarget

func (b *InMemoryBackend) SetAdbTarget(t AdbTarget)

SetAdbTarget wires Autonomous Database for ADB rotation targets.

func (*InMemoryBackend) SetBlobStore

func (b *InMemoryBackend) SetBlobStore(s BlobStore)

SetBlobStore wires the Object Storage backend that BackupVault and BackupKey write to.

func (*InMemoryBackend) SetClock

func (b *InMemoryBackend) SetClock(now func() time.Time)

SetClock injects the time source used for deletion schedules and rotation.

func (*InMemoryBackend) SetFunctionInvoker

func (b *InMemoryBackend) SetFunctionInvoker(fn FunctionInvoker)

SetFunctionInvoker wires OCI Functions for FUNCTION rotation targets.

func (*InMemoryBackend) SetSubnetResolver

func (b *InMemoryBackend) SetSubnetResolver(fn SubnetResolver)

SetSubnetResolver wires subnet validation for EKMS private endpoints; nil only shape-checks subnet OCIDs.

func (*InMemoryBackend) SetTagLookup

func (b *InMemoryBackend) SetTagLookup(fn ocitags.Lookup)

SetTagLookup wires defined-tag validation against a tag namespace source (OCI Identity); nil accepts any namespace.

func (*InMemoryBackend) SetTransitionDelay

func (b *InMemoryBackend) SetTransitionDelay(d time.Duration)

SetTransitionDelay overrides how long transitional states last; zero makes every transition instant.

func (*InMemoryBackend) Sign

func (b *InMemoryBackend) Sign(vaultID string, in SignIn) (signedWire, error)

Sign signs a message or digest with an RSA or ECDSA key version.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state, including registered API keys.

func (*InMemoryBackend) Sweep

func (b *InMemoryBackend) Sweep()

Sweep applies elapsed deletion schedules and due key auto-rotations against the backend clock.

func (*InMemoryBackend) UpdateEkmsPrivateEndpoint

func (b *InMemoryBackend) UpdateEkmsPrivateEndpoint(
	id, ifMatch string,
	in UpdateEkmsIn,
) (EkmsEndpointWire, string, error)

UpdateEkmsPrivateEndpoint changes the display name and tags.

func (*InMemoryBackend) UpdateKey

func (b *InMemoryBackend) UpdateKey(vaultID, keyID, ifMatch string, in UpdateKeyIn) (KeyWire, string, error)

UpdateKey changes display name, tags and the auto-rotation schedule.

func (*InMemoryBackend) UpdateSecret

func (b *InMemoryBackend) UpdateSecret(id, ifMatch string, in UpdateSecretIn) (secretWire, string, error)

UpdateSecret edits metadata, adds a version on content change, or promotes a version.

func (*InMemoryBackend) UpdateVault

func (b *InMemoryBackend) UpdateVault(id, ifMatch, hostPort string, in UpdateVaultIn) (VaultWire, string, error)

UpdateVault changes display name and tags.

func (*InMemoryBackend) VaultIDForHost

func (b *InMemoryBackend) VaultIDForHost(hint string) (string, *APIError)

VaultIDForHost resolves a per-vault endpoint label ("<prefix>") or OCID to a vault id; with no hint a lone non-deleted vault is used.

func (*InMemoryBackend) Verify

func (b *InMemoryBackend) Verify(vaultID string, in VerifyIn) (verifiedWire, error)

Verify checks a signature made by Sign.

type Key

type Key struct {
	TimeCreated    time.Time                 `json:"timeCreated"`
	TimeOfDeletion *time.Time                `json:"timeOfDeletion,omitempty"`
	Rotation       *RotationDetails          `json:"rotation,omitempty"`
	FreeformTags   map[string]string         `json:"freeformTags,omitempty"`
	DefinedTags    map[string]map[string]any `json:"definedTags,omitempty"`
	ID             string                    `json:"id"`
	VaultID        string                    `json:"vaultId"`
	CompartmentID  string                    `json:"compartmentId"`
	DisplayName    string                    `json:"displayName"`
	State          string                    `json:"state"`
	ProtectionMode string                    `json:"protectionMode"`
	CurrentVersion string                    `json:"currentVersion"`
	PrevState      string                    `json:"prevState,omitempty"`
	RestoredFrom   string                    `json:"restoredFrom,omitempty"`
	ReplicationID  string                    `json:"replicationId,omitempty"`
	CreatedRepl    string                    `json:"createdRepl,omitempty"`
	Etag           string                    `json:"etag"`
	Shape          KeyShape                  `json:"shape"`
	Versions       []*KeyVersion             `json:"versions"`
	Seq            int64                     `json:"seq"`
	AutoRotation   bool                      `json:"autoRotation"`
	// contains filtered or unexported fields
}

Key is a master encryption key.

type KeyFilter

type KeyFilter struct {
	ProtectionMode string
	Algorithm      string
	CurveID        string
	Length         int
	Replica        bool
}

KeyFilter narrows ListKeys.

type KeyShape

type KeyShape struct {
	Algorithm string `json:"algorithm"`
	CurveID   string `json:"curveId,omitempty"`
	Length    int    `json:"length"`
}

KeyShape is the algorithm/length/curve triple of a key.

type KeyVersion

type KeyVersion struct {
	TimeCreated    time.Time  `json:"timeCreated"`
	TimeOfDeletion *time.Time `json:"timeOfDeletion,omitempty"`
	ID             string     `json:"id"`
	State          string     `json:"state"`
	Origin         string     `json:"origin"`
	Material       []byte     `json:"material"`
	AutoRotated    bool       `json:"autoRotated,omitempty"`
	Promote        bool       `json:"promote,omitempty"`
	// contains filtered or unexported fields
}

KeyVersion is one version of a key's material.

type KeyWire

type KeyWire struct {
	TimeCreated            time.Time                 `json:"timeCreated"`
	TimeOfDeletion         *time.Time                `json:"timeOfDeletion,omitempty"`
	AutoKeyRotationDetails *RotationDetails          `json:"autoKeyRotationDetails,omitempty"`
	FreeformTags           map[string]string         `json:"freeformTags,omitempty"`
	DefinedTags            map[string]map[string]any `json:"definedTags,omitempty"`
	CompartmentID          string                    `json:"compartmentId"`
	CurrentKeyVersion      string                    `json:"currentKeyVersion"`
	DisplayName            string                    `json:"displayName"`
	ID                     string                    `json:"id"`
	LifecycleState         string                    `json:"lifecycleState"`
	ProtectionMode         string                    `json:"protectionMode"`
	RestoredFromKey        string                    `json:"restoredFromKeyId,omitempty"`
	ReplicaDetails         *replicationRef           `json:"replicaDetails,omitempty"`
	VaultID                string                    `json:"vaultId"`
	KeyShape               KeyShape                  `json:"keyShape"`
	IsPrimary              bool                      `json:"isPrimary"`
	IsAutoRotationEnabled  bool                      `json:"isAutoRotationEnabled"`
}

KeyWire is the key wire shape.

type ListOpts

type ListOpts struct {
	SortBy string
	Order  string
	Page   string
	Limit  int
}

ListOpts carries the shared list query parameters.

type Provider

type Provider struct{}

Provider implements service.Provider for OCI Vault. It runs on its own listener (see Handler.StartWorker) and never matches on the shared AWS router.

func (*Provider) Init

Init creates the backend and handler; the port is bound in StartWorker.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the service provider name.

type ReplicaSummaryWire

type ReplicaSummaryWire struct {
	CryptoEndpoint     string `json:"cryptoEndpoint"`
	ManagementEndpoint string `json:"managementEndpoint"`
	Region             string `json:"region"`
	Status             string `json:"status"`
}

ReplicaSummaryWire is the replica summary wire shape.

type ReplicationStatusWire

type ReplicationStatusWire struct {
	ReplicaDetails []replicaDetailWire `json:"replicaDetails"`
}

ReplicationStatusWire is the replication status wire shape.

type ReplicationTarget

type ReplicationTarget struct {
	KeyID   string `json:"targetKeyId"`
	Region  string `json:"targetRegion"`
	VaultID string `json:"targetVaultId"`
}

ReplicationTarget is one entry of a secret's replicationConfig.

type RotationConfig

type RotationConfig struct {
	TargetSystemDetails        TargetSystemDetails `json:"targetSystemDetails"`
	RotationInterval           string              `json:"rotationInterval,omitempty"`
	IsScheduledRotationEnabled bool                `json:"isScheduledRotationEnabled"`
}

RotationConfig is the secret rotationConfig body.

type RotationDetails

type RotationDetails struct {
	ScheduleStart *time.Time `json:"timeOfScheduleStart,omitempty"`
	NextRotation  *time.Time `json:"timeOfNextRotation,omitempty"`
	LastRotation  *time.Time `json:"timeOfLastRotation,omitempty"`
	LastStatus    string     `json:"lastRotationStatus,omitempty"`
	LastMessage   string     `json:"lastRotationMessage,omitempty"`
	IntervalDays  int        `json:"rotationIntervalInDays,omitempty"`
}

RotationDetails is a key's auto-rotation schedule.

type Secret

type Secret struct {
	TimeCreated    time.Time                 `json:"timeCreated"`
	TimeOfDeletion *time.Time                `json:"timeOfDeletion,omitempty"`
	FreeformTags   map[string]string         `json:"freeformTags,omitempty"`
	DefinedTags    map[string]map[string]any `json:"definedTags,omitempty"`
	Metadata       map[string]any            `json:"metadata,omitempty"`
	GenContext     *GenerationContext        `json:"genContext,omitempty"`
	Rotation       *SecretRotation           `json:"rotation,omitempty"`
	Replication    *SecretReplication        `json:"replication,omitempty"`

	SourceID      string           `json:"sourceId,omitempty"`
	SyncedEtag    string           `json:"syncedEtag,omitempty"`
	SourceVault   string           `json:"sourceVault,omitempty"`
	SourceKey     string           `json:"sourceKey,omitempty"`
	KeyID         string           `json:"keyId"`
	VaultID       string           `json:"vaultId"`
	CompartmentID string           `json:"compartmentId"`
	Description   string           `json:"description,omitempty"`
	State         string           `json:"state"`
	Etag          string           `json:"etag"`
	ID            string           `json:"id"`
	Name          string           `json:"name"`
	Versions      []*SecretVersion `json:"versions"`
	Rules         []jsontext.Value `json:"rules,omitempty"`
	Current       int64            `json:"current"`
	Previous      int64            `json:"previous"`
	Pending       int64            `json:"pending"`
	Seq           int64            `json:"seq"`
	AutoGen       bool             `json:"autoGen,omitempty"`
	// contains filtered or unexported fields
}

Secret is a vault secret.

type SecretContent

type SecretContent struct {
	ContentType string `json:"contentType"`
	Name        string `json:"name"`
	Content     string `json:"content"`
	Stage       string `json:"stage"`
}

SecretContent is the polymorphic secretContent body (only BASE64 exists).

type SecretFilter

type SecretFilter struct {
	Compartment string
	Name        string
	VaultID     string
	State       string
}

SecretFilter narrows ListSecrets.

type SecretReplication

type SecretReplication struct {
	WriteForward *bool               `json:"isWriteForwardEnabled,omitempty"`
	Targets      []ReplicationTarget `json:"replicationTargets"`
}

SecretReplication is a secret's replicationConfig.

type SecretRotation

type SecretRotation struct {
	LastRotation *time.Time `json:"lastRotation,omitempty"`
	NextRotation *time.Time `json:"nextRotation,omitempty"`

	Status string         `json:"status"`
	Config RotationConfig `json:"config"`
	// contains filtered or unexported fields
}

SecretRotation is a secret's stored rotation state.

type SecretVersion

type SecretVersion struct {
	TimeCreated    time.Time  `json:"timeCreated"`
	TimeOfDeletion *time.Time `json:"timeOfDeletion,omitempty"`
	TimeOfExpiry   *time.Time `json:"timeOfExpiry,omitempty"`
	Name           string     `json:"name,omitempty"`
	Ciphertext     string     `json:"ciphertext"`
	Number         int64      `json:"number"`
}

SecretVersion is one stored (KMS-encrypted) version of a secret.

type Settings

type Settings struct {
	Port int `` //nolint:lll // config struct tags are intentionally verbose
	/* 217-byte string literal not displayed */
	EnforceAuth bool `` //nolint:lll // config struct tags are intentionally verbose
	/* 221-byte string literal not displayed */
}

Settings holds service-level configuration, embedded in the root CLI command as CLI.OCIVault.

func DefaultSettings

func DefaultSettings() Settings

DefaultSettings returns the settings used when no ConfigProvider is available.

type SignIn

type SignIn struct {
	KeyID        string `json:"keyId"`
	Message      string `json:"message"`
	Algorithm    string `json:"signingAlgorithm"`
	KeyVersionID string `json:"keyVersionId"`
	MessageType  string `json:"messageType"`
}

SignIn is the Sign request body.

type SubnetResolver

type SubnetResolver func(id string) (cidr string, found bool)

SubnetResolver reports the CIDR of a live subnet in OCI Core.

type TargetSystemDetails

type TargetSystemDetails struct {
	TargetSystemType string `json:"targetSystemType"`
	AdbID            string `json:"adbId,omitempty"`
	FunctionID       string `json:"functionId,omitempty"`
}

TargetSystemDetails is the polymorphic targetSystemDetails body.

type UpdateEkmsIn

type UpdateEkmsIn struct {
	FreeformTags map[string]string         `json:"freeformTags"`
	DefinedTags  map[string]map[string]any `json:"definedTags"`
	DisplayName  *string                   `json:"displayName"`
}

UpdateEkmsIn is the UpdateEkmsPrivateEndpoint request body.

type UpdateKeyIn

type UpdateKeyIn struct {
	DisplayName            *string                   `json:"displayName"`
	IsAutoRotationEnabled  *bool                     `json:"isAutoRotationEnabled"`
	AutoKeyRotationDetails *RotationDetails          `json:"autoKeyRotationDetails"`
	FreeformTags           map[string]string         `json:"freeformTags"`
	DefinedTags            map[string]map[string]any `json:"definedTags"`
}

UpdateKeyIn is the UpdateKey request body.

type UpdateSecretIn

type UpdateSecretIn struct {
	CurrentVersionNumber    *int64                    `json:"currentVersionNumber"`
	Description             *string                   `json:"description"`
	FreeformTags            map[string]string         `json:"freeformTags"`
	DefinedTags             map[string]map[string]any `json:"definedTags"`
	Metadata                map[string]any            `json:"metadata"`
	SecretContent           *SecretContent            `json:"secretContent"`
	ReplicationConfig       jsontext.Value            `json:"replicationConfig"`
	RotationConfig          jsontext.Value            `json:"rotationConfig"`
	SecretGenerationContext jsontext.Value            `json:"secretGenerationContext"`
	EnableAutoGeneration    *bool                     `json:"enableAutoGeneration"`
	SecretRules             []jsontext.Value          `json:"secretRules"`
}

UpdateSecretIn is the UpdateSecret request body.

type UpdateVaultIn

type UpdateVaultIn struct {
	DisplayName  *string                   `json:"displayName"`
	FreeformTags map[string]string         `json:"freeformTags"`
	DefinedTags  map[string]map[string]any `json:"definedTags"`
}

UpdateVaultIn is the UpdateVault request body.

type Vault

type Vault struct {
	TimeCreated        time.Time                 `json:"timeCreated"`
	TimeOfDeletion     *time.Time                `json:"timeOfDeletion,omitempty"`
	WrappingKeyCreated *time.Time                `json:"wrappingKeyCreated,omitempty"`
	FreeformTags       map[string]string         `json:"freeformTags,omitempty"`
	DefinedTags        map[string]map[string]any `json:"definedTags,omitempty"`
	ID                 string                    `json:"id"`
	Prefix             string                    `json:"prefix"`
	CompartmentID      string                    `json:"compartmentId"`
	DisplayName        string                    `json:"displayName"`
	VaultType          string                    `json:"vaultType"`
	State              string                    `json:"state"`
	WrappingKeyID      string                    `json:"wrappingKeyId"`
	RestoredFrom       string                    `json:"restoredFrom,omitempty"`
	ReplicationID      string                    `json:"replicationId,omitempty"`
	Replicas           []*VaultReplica           `json:"replicas,omitempty"`
	Etag               string                    `json:"etag"`
	WrappingKeyDER     []byte                    `json:"wrappingKeyDer,omitempty"`
	Seq                int64                     `json:"seq"`
	// contains filtered or unexported fields
}

Vault is a KMS vault.

type VaultReplica

type VaultReplica struct {
	TimeCreated   time.Time `json:"timeCreated"`
	Region        string    `json:"region"`
	Status        string    `json:"status"`
	ReplicationID string    `json:"replicationId"`
	// contains filtered or unexported fields
}

VaultReplica is a vault's copy in another region.

type VaultWire

type VaultWire struct {
	TimeCreated        time.Time                 `json:"timeCreated"`
	TimeOfDeletion     *time.Time                `json:"timeOfDeletion,omitempty"`
	FreeformTags       map[string]string         `json:"freeformTags,omitempty"`
	DefinedTags        map[string]map[string]any `json:"definedTags,omitempty"`
	ReplicaDetails     *replicationRef           `json:"replicaDetails,omitempty"`
	LifecycleState     string                    `json:"lifecycleState"`
	DisplayName        string                    `json:"displayName"`
	ID                 string                    `json:"id"`
	CryptoEndpoint     string                    `json:"cryptoEndpoint"`
	ManagementEndpoint string                    `json:"managementEndpoint"`
	VaultType          string                    `json:"vaultType"`
	WrappingKeyID      string                    `json:"wrappingkeyId"`
	RestoredFromVault  string                    `json:"restoredFromVaultId,omitempty"`
	CompartmentID      string                    `json:"compartmentId"`
	IsVaultReplicable  bool                      `json:"isVaultReplicable"`
	IsPrimary          bool                      `json:"isPrimary"`
}

VaultWire is the vault wire shape.

type VerifyIn

type VerifyIn struct {
	KeyID        string `json:"keyId"`
	KeyVersionID string `json:"keyVersionId"`
	Signature    string `json:"signature"`
	Message      string `json:"message"`
	Algorithm    string `json:"signingAlgorithm"`
	MessageType  string `json:"messageType"`
}

VerifyIn is the Verify request body.

type WrappedImportKey

type WrappedImportKey struct {
	KeyMaterial       string `json:"keyMaterial"`
	WrappingAlgorithm string `json:"wrappingAlgorithm"`
}

WrappedImportKey is the wrapped key material of an import request.

Jump to

Keyboard shortcuts

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