x25519

package
v0.0.0-...-604f8df Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package x25519 provides X25519 key pair helpers for v3 onion service client authorization. The generated keys are used by the "ONION_CLIENT_AUTH_*" controller commands (client side, base64-encoded private key) and the ADD_ONION "ClientAuthV3" flag / "descriptor:x25519:" auth files (service side, base32-encoded public key).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyPair

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

KeyPair is an X25519 key pair used for v3 onion service client authorization.

func FromPrivateKey

func FromPrivateKey(privateKey []byte) (*KeyPair, error)

FromPrivateKey builds a KeyPair from a raw 32-byte X25519 private key.

func FromPrivateKeyBase64

func FromPrivateKeyBase64(blob string) (*KeyPair, error)

FromPrivateKeyBase64 builds a KeyPair from a base64-encoded raw X25519 private key, the form used by the ONION_CLIENT_AUTH_ADD command.

func Generate

func Generate(rng io.Reader) (*KeyPair, error)

Generate creates a new random X25519 key pair. If rng is nil, crypto/rand.Reader is used.

func (*KeyPair) PrivateKey

func (k *KeyPair) PrivateKey() []byte

PrivateKey returns the raw 32-byte X25519 private key.

func (*KeyPair) PrivateKeyBase64

func (k *KeyPair) PrivateKeyBase64() string

PrivateKeyBase64 returns the base64-encoded private key, the form expected by the ONION_CLIENT_AUTH_ADD controller command (client side).

func (*KeyPair) PublicKey

func (k *KeyPair) PublicKey() []byte

PublicKey returns the raw 32-byte X25519 public key.

func (*KeyPair) PublicKeyBase32

func (k *KeyPair) PublicKeyBase32() string

PublicKeyBase32 returns the base32-encoded public key, the form expected by the ADD_ONION "ClientAuthV3" flag and "descriptor:x25519:" client auth files (service side).

Jump to

Keyboard shortcuts

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