encryption

package
v0.112.1-nightly Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveIdentity

func SaveIdentity(identity *IdentityInfo, path string) error

Types

type IdentityInfo

type IdentityInfo struct {
	PrivateKey crypto.PrivKey
	PublicKey  crypto.PubKey
	PeerID     peer.ID
}

func GenerateIdentity

func GenerateIdentity() (*IdentityInfo, error)

func LoadIdentity

func LoadIdentity(path string) (*IdentityInfo, error)

type NodeKeys

type NodeKeys struct {
	LibP2PPrivateKey  ed25519.PrivateKey // Ed25519 for LibP2P identity
	LibP2PPublicKey   ed25519.PublicKey
	WireGuardKey      [32]byte // Curve25519 private key (clamped)
	WireGuardPubKey   [32]byte // Curve25519 public key
	IPFSPrivateKey    ed25519.PrivateKey
	IPFSPublicKey     ed25519.PublicKey
	ClusterPrivateKey ed25519.PrivateKey // IPFS Cluster identity
	ClusterPublicKey  ed25519.PublicKey
	JWTPrivateKey     ed25519.PrivateKey // EdDSA JWT signing key
	JWTPublicKey      ed25519.PublicKey
}

NodeKeys holds all cryptographic keys derived from a wallet's master key.

func DeriveNodeKeysFromWallet

func DeriveNodeKeysFromWallet(vpsIP string) (*NodeKeys, error)

DeriveNodeKeysFromWallet calls `rw derive` to get a master key from the user's Root Wallet, then expands it into all node keys. The wallet's private key never leaves the `rw` process.

vpsIP is used as the HKDF info parameter, so each VPS gets unique keys from the same wallet. Stdin is passed through so rw can prompt for the wallet password.

func ExpandNodeKeys

func ExpandNodeKeys(masterKey []byte) (*NodeKeys, error)

ExpandNodeKeys expands a 32-byte master key into all node keys using HKDF-SHA256. The master key should come from `rw derive --salt "orama-node" --info "<IP>"`.

Each key type uses a different HKDF info string under the salt "orama-expand", ensuring cryptographic independence between key types.

Jump to

Keyboard shortcuts

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