Documentation
¶
Overview ¶
Package protocolkey preserves the key and short-identifier encodings used by external protocols. These compatibility transforms are not token issuers.
Index ¶
- func Curve25519Genkey(stdEncoding bool, inputBase64 string) (public, private string, err error)
- func FixedUniqueString(s string, length int, alphabet string) (string, error)
- func GenerateCipher(serverKey string, length int) string
- func GenerateShortID(privateKey string) string
- func Md5Encode(value string, upper bool) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Curve25519Genkey ¶
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 ¶
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 ¶
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 ¶
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.
Types ¶
This section is empty.