crypto

package
v0.78.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: AGPL-3.0 Imports: 6 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

Overview

Package crypto seals repo-scoped forge tokens for storage at rest and generates the random ids used for webhook secrets, ceremony ids, and session ids.

Index

Constants

This section is empty.

Variables

View Source
var ErrCiphertextTooShort = errors.New("ciphertext shorter than nonce")

ErrCiphertextTooShort is returned when a blob passed to Decrypt is too short to contain a nonce.

View Source
var ErrInvalidKeySize = errors.New("encryption key must be 32 bytes")

ErrInvalidKeySize is returned when the supplied key isn't a valid AES-256 key.

Functions

func Decrypt

func Decrypt(key, data []byte) ([]byte, error)

Decrypt opens a blob produced by Encrypt under the same key.

func Encrypt

func Encrypt(key, plaintext []byte) ([]byte, error)

Encrypt seals plaintext with AES-256-GCM under key, returning a self-contained nonce||ciphertext blob.

func RandomHex added in v0.3.0

func RandomHex(n int) (string, error)

RandomHex returns n random bytes, hex-encoded.

Types

This section is empty.

Jump to

Keyboard shortcuts

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