crypto

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecryptParams

type DecryptParams struct {
	Ciphertext string `json:"ciphertext"`
	KeyID      string `json:"keyId,omitempty"`
}

DecryptParams are the parameters for the decrypt operation.

type EncryptParams

type EncryptParams struct {
	Data  string `json:"data"`
	KeyID string `json:"keyId,omitempty"`
}

EncryptParams are the parameters for the encrypt operation.

type HashParams

type HashParams struct {
	Data      string `json:"data"`
	Algorithm string `json:"algorithm,omitempty"` // sha256, sha512
}

HashParams are the parameters for the hash operation.

type KeyEntry

type KeyEntry struct {
	ID         string  `json:"id"`
	Name       string  `json:"name"`
	Type       string  `json:"type"`
	CreatedAt  string  `json:"createdAt"`
	LastUsedAt *string `json:"lastUsedAt,omitempty"`
}

KeyEntry represents a key in the list response.

type SignParams

type SignParams struct {
	Data  string `json:"data"`
	KeyID string `json:"keyId,omitempty"`
}

SignParams are the parameters for the sign operation.

type Tool

type Tool struct {
	// contains filtered or unexported fields
}

Tool provides cryptographic operations for AI agents. Decrypted values are returned as opaque reference tokens; the plaintext never enters the agent context.

func New

func New(crypto security.CryptoProvider, registry *security.KeyRegistry, refs *security.RefStore, scanner *agent.SecretScanner) *Tool

New creates a new crypto tool. If scanner is non-nil, decrypted values are registered for output scanning.

func (*Tool) Decrypt

func (t *Tool) Decrypt(ctx context.Context, params map[string]interface{}) (interface{}, error)

Decrypt decrypts data and returns an opaque reference token. The plaintext is stored in the RefStore and resolved at execution time.

func (*Tool) Encrypt

func (t *Tool) Encrypt(ctx context.Context, params map[string]interface{}) (interface{}, error)

Encrypt encrypts data using the specified key.

func (*Tool) Hash

func (t *Tool) Hash(ctx context.Context, params map[string]interface{}) (interface{}, error)

Hash computes a hash of the data.

func (*Tool) Keys

func (t *Tool) Keys(ctx context.Context, params map[string]interface{}) (interface{}, error)

Keys lists available keys.

func (*Tool) Sign

func (t *Tool) Sign(ctx context.Context, params map[string]interface{}) (interface{}, error)

Sign generates a signature for the data.

Jump to

Keyboard shortcuts

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