Help us shape the future of Go! Take the 2026 Go Developer Survey

runtimeutil

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CredentialAlgorithm  = "aes-256-gcm"
	CredentialKeyBytes   = 32
	CredentialNonceBytes = 12
)
View Source
const Redacted = "[REDACTED]"

Variables

View Source
var (
	ErrMissingEncryptionKey      = errors.New("APERIO_ENCRYPTION_KEY is required")
	ErrInvalidEncryptionKey      = errors.New("APERIO_ENCRYPTION_KEY must resolve to exactly 32 bytes")
	ErrProductionEncoding        = errors.New("APERIO_ENCRYPTION_KEY must use base64:, base64url:, or hex: encoding in production")
	ErrEmptyCredentialPlaintext  = errors.New("Cannot encrypt an empty string")
	ErrMalformedCredential       = errors.New("Encrypted value is malformed")
	ErrUnsupportedCredential     = errors.New("Unsupported encrypted value version or algorithm")
	ErrCredentialAuthentication  = errors.New("Encrypted value authentication failed")
	ErrInvalidCredentialNonceLen = errors.New("invalid encryption nonce length")
)

Functions

func DecryptGoogleMailboxPrivateKey

func DecryptGoogleMailboxPrivateKey(encryptedValue string, organizationID string, integrationID string, externalAccountID string) (string, error)

func DecryptIntegrationSecret

func DecryptIntegrationSecret(encryptedValue string, organizationID string, integrationID string, provider string, externalAccountID string, suffix string) (string, error)

func DecryptString

func DecryptString(encryptedValue string, additionalAuthenticatedData string) (string, error)

func EncryptString

func EncryptString(plaintext string, additionalAuthenticatedData string) (string, error)

func EncryptStringWithNonce

func EncryptStringWithNonce(plaintext string, additionalAuthenticatedData string, nonce []byte) (string, error)

func IntegrationSecretAAD

func IntegrationSecretAAD(organizationID string, provider string, externalAccountID string, suffix string) string

func LegacyIntegrationSecretAAD

func LegacyIntegrationSecretAAD(organizationID string, integrationID string, suffix string) string

func LoadEnvFile

func LoadEnvFile(path string, overwrite bool) (bool, error)

func LoadLocalEnv

func LoadLocalEnv(overwrite bool) (bool, error)

func PGXSafeDatabaseURL

func PGXSafeDatabaseURL(raw string) (string, error)

func RedactDSN

func RedactDSN(raw string) string

func RedactError

func RedactError(err error, secrets ...string) string

func RedactSecret

func RedactSecret(value string) string

func RedactText

func RedactText(input string, secrets ...string) string

func ResolveEncryptionKey

func ResolveEncryptionKey(rawKey string, production bool) ([]byte, error)

func ResolveEncryptionKeyFromEnv

func ResolveEncryptionKeyFromEnv() ([]byte, error)

func SIEMDestinationTokenAAD

func SIEMDestinationTokenAAD(organizationID string, destinationID string) string

Types

type EncryptedEnvelope

type EncryptedEnvelope struct {
	Version    int    `json:"version"`
	Algorithm  string `json:"algorithm"`
	IV         string `json:"iv"`
	Tag        string `json:"tag"`
	Ciphertext string `json:"ciphertext"`
}

Jump to

Keyboard shortcuts

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