omcrypto

package
v3.0.0-beta13 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package omcrypto is responsible for Message Encrypt, Decrypt, DecryptWithNode

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptDecrypter

type EncryptDecrypter interface {
	DecryptWithNode(data []byte) ([]byte, string, error)
	Decrypt(data []byte) ([]byte, error)
	Encrypt(data []byte) ([]byte, error)
}

EncryptDecrypter defines an interface for encryption and decryption operations with optional node identification support. DecryptWithNode decrypts the data, also returning the node name associated with the encryption process. Decrypt decrypts the data using the current encryption configuration and returns the result. Encrypt encrypts the data and outputs it in a secure format with metadata about the encryption.

type Keyer

type Keyer interface {
	MainSecret() string
	MainVersion() uint64
	AltSecret() string
	AltSecretVersion() uint64
}

type T

type T struct {
	NodeName    string
	ClusterName string

	// Key is the current key used to encrypt data.
	Key string

	// Version indicates the generation number of the current encryption key.
	Version uint64

	// AltKey is an alternate encryption key that can be used to decrypt messages.
	// It is the previous or future key.
	AltKey string

	// AltVersion indicates the generation number of the next encryption key.
	AltVersion uint64
}

func New

func New(nodename, clusterName string, sec Keyer) *T

func (*T) Decrypt

func (m *T) Decrypt(data []byte) ([]byte, error)

Decrypt decrypts the message, if the nodename found in the message is a cluster node.

func (*T) DecryptWithNode

func (m *T) DecryptWithNode(data []byte) ([]byte, string, error)

DecryptWithNode Decrypt the message

returns decodedMsg []byte, encryptorNodename string, error

func (*T) Encrypt

func (m *T) Encrypt(data []byte) ([]byte, error)

Encrypt encrypts the message and returns a json with head keys describing the sender, and embedding the AES-encypted + Base64-encoded data.

Jump to

Keyboard shortcuts

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