crypto

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 13 Imported by: 0 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptCredentials

func DecryptCredentials(encrypted string) (accessKey, secretKey string, err error)

DecryptCredentials reverses EncryptCredentials.

func DecryptString added in v0.2.0

func DecryptString(encoded string) (string, error)

DecryptString reverses EncryptString. It fails if the ciphertext is corrupted, truncated, or was not produced on this device (the device key differs).

func EncryptCredentials

func EncryptCredentials(accessKey, secretKey string) (string, error)

EncryptCredentials encrypts AWS credentials using the device-specific key. The access and secret keys are combined with a ":" separator.

func EncryptString added in v0.2.0

func EncryptString(plaintext string) (string, error)

EncryptString encrypts an arbitrary string using the device-specific key (AES-256-GCM, random nonce, base64-encoded result). The output includes the nonce as a prefix to the ciphertext.

func GetDeviceKey

func GetDeviceKey() ([]byte, error)

GetDeviceKey derives a unique encryption key from device-specific data. It dispatches to a platform-specific collector, falling back to a hostname-based identity when none is available, then SHA-256s the result together with a project-wide salt.

Types

This section is empty.

Jump to

Keyboard shortcuts

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