Help us shape the future of Go! Take the 2026 Go Developer Survey

protocolkey

package
v1.21.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package protocolkey preserves the key and short-identifier encodings used by external protocols. These compatibility transforms are not token issuers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Curve25519Genkey

func Curve25519Genkey(stdEncoding bool, inputBase64 string) (public, private string, err error)

Curve25519Genkey returns an X25519 key pair for REALITY, base64-encoded (standard or raw URL encoding): the pair of the private key inputBase64 when given, or of a new random one.

func FixedUniqueString

func FixedUniqueString(s string, length int, alphabet string) (string, error)

FixedUniqueString derives from s a string of length distinct characters of alphabet (letters and digits when empty), the same for the same s. The short code of a subscription, the first label of its host name in pan-domain mode, is derived from the subscription token this way, so the output must not change.

func GenerateCipher

func GenerateCipher(serverKey string, length int) string

GenerateCipher derives a fixed-length key from serverKey: the first length hex digits (at most 64) of the HMAC-SHA256 of an empty message keyed with serverKey. The same serverKey always gives the same key.

func GenerateShortID

func GenerateShortID(privateKey string) string

GenerateShortID derives a REALITY short ID from the private key: the first eight hex digits of its SHA-1, so the same key keeps the same short ID.

func Md5Encode

func Md5Encode(value string, upper bool) string

Md5Encode is retained for providers whose signing protocol requires MD5.

Types

This section is empty.

Jump to

Keyboard shortcuts

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