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

keypair

package
v1.3.104 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package keypair pkg/skywireconfig/keypair/keypair.go c3-vis-core pkg/cipher.GenerateKeyPair. It exists so external consumers (TinyGo WASM, doc generators) that need to spin up a fresh visor identity don't have to import the full cipher package surface or understand its hex-formatting conventions.

Security note: client-side keygen in a browser WASM is safe ONLY when the secret key never leaves the page. The render layer must not exfiltrate the SK over the network or place it in a clipboard the user might paste publicly. The Generate function returns the SK as a plain string — protecting it is the caller's job.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromSecretKey

func FromSecretKey(skHex string) (pkHex string, err error)

FromSecretKey derives the public key for an existing hex secret key. Returns "" + a non-nil error when skHex is malformed (wrong length, non-hex characters, or invalid scalar). Used by config flows where the operator pastes an existing SK and the form needs to display the corresponding PK as a sanity check.

func Generate

func Generate() (pkHex, skHex string)

Generate creates a fresh skywire-format keypair and returns (pkHex, skHex) — the same lowercase-hex format every other skywire surface accepts. PK is 66 chars (33-byte compressed secp256k1 point); SK is 64 chars (32-byte scalar).

Entropy comes from crypto/rand on standard Go targets and from crypto.getRandomValues via the WASM runtime on js/wasm — both suitable for production identities.

Types

This section is empty.

Jump to

Keyboard shortcuts

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