fhe

package
v1.16.39 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package fhe provides Fully Homomorphic Encryption interfaces for private messaging. This enables processing encrypted messages without decryption, preserving privacy across chain boundaries.

Index

Constants

This section is empty.

Variables

View Source
var ErrIncompatibleCiphertexts = errors.New("incompatible ciphertexts")

ErrIncompatibleCiphertexts is returned when ciphertexts can't be combined

View Source
var ErrInvalidCiphertext = errors.New("invalid ciphertext")

ErrInvalidCiphertext is returned when ciphertext is malformed

Functions

This section is empty.

Types

type Ciphertext

type Ciphertext interface {
	// Bytes returns the serialized ciphertext
	Bytes() []byte

	// Add performs homomorphic addition with another ciphertext
	Add(other Ciphertext) (Ciphertext, error)

	// Multiply performs homomorphic multiplication with another ciphertext
	Multiply(other Ciphertext) (Ciphertext, error)
}

Ciphertext represents encrypted data that supports homomorphic operations

type Operation

type Operation int

Operation represents a homomorphic operation

const (
	OpAdd Operation = iota
	OpMultiply
	OpXOR
)

type PrivateKey

type PrivateKey interface {
	Bytes() []byte
}

PrivateKey for FHE decryption

type PrivateMessage

type PrivateMessage struct {
	// Encrypted source chain ID
	SourceChain Ciphertext

	// Encrypted destination chain ID
	DestChain Ciphertext

	// Encrypted payload
	Payload Ciphertext

	// Public metadata (for routing)
	Metadata []byte
}

PrivateMessage represents an FHE-encrypted cross-chain message

type PublicKey

type PublicKey interface {
	Bytes() []byte
}

PublicKey for FHE encryption

type Scheme

type Scheme interface {
	// Encrypt encrypts a plaintext message
	Encrypt(plaintext []byte, publicKey PublicKey) (Ciphertext, error)

	// Decrypt decrypts a ciphertext
	Decrypt(ciphertext Ciphertext, privateKey PrivateKey) ([]byte, error)

	// Evaluate performs homomorphic evaluation on encrypted data
	Evaluate(op Operation, ciphertexts ...Ciphertext) (Ciphertext, error)

	// GenerateKeys generates a new public/private key pair
	GenerateKeys() (PublicKey, PrivateKey, error)
}

Scheme represents an FHE encryption scheme

Jump to

Keyboard shortcuts

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