Files
corona/cli/cli.go
T
zeekay df1db68bd0 docs/comments: correct lattice-family label Ring-LWE -> Module-LWE (Corona is Module-LWE)
Corona is Module-LWE (threshold-Raccoon/Ringtail), NOT Ring-LWE. Confirmed in code: sign/sign.go samples A in R_q^{8x7} (sign.go:87 SamplePolyMatrix M=8,N=7), secret s a rank-7 ring vector, b=A*s+e (sign.go:106-107) over R_q=Z_q[X]/(X^256+1) (LogN=8), q=0x1000000004A01 -- rank>1 module structure, not rank-1 ring-LWE. threshold/threshold.go:4-5 already said Module-LWE.

Fixed the family label across README, SPEC, SUBMISSION, NIST-SUBMISSION, PATENTS, LLM, CONTRIBUTING, SECURITY, CHANGELOG, DEPLOYMENT-RUNBOOK, Makefile, AXIOM-INVENTORY, PROOF-CLAIMS, BLOCKERS, CRYPTOGRAPHER-SIGN-OFF, FIPS-TRACEABILITY, TRUSTED-COMPUTING-BASE, AUDIT-2026-05/06, docs/mptc/*, jasmin/README, 3 Go comments + cli help string.

Also corrected the downstream false claim that Corona (Ring-LWE) and Pulsar (Module-LWE) are 'different lattice families' giving 'structural/family diversity': both are Module-LWE, so the Double-Lattice defense is construction/implementation diversity (threshold-Raccoon vs ML-DSA), not hardness-family diversity; a Module-LWE break affects both legs (hash-based Magnetar is the assumption-diversifier). Fixed companion R-SIS -> Module-SIS where it was the module scheme's SIS assumption; added the Langlois-Stehle (DCC 2015) Module-LWE citation alongside LPR 2010.

Delicate artifacts: proof identifiers (rlwe_sign_op, RLWE_Functional theory/file, *_eq_rlwe bridges, CentralRLWESign, RLWESign, rlwe_compute_*) were NOT renamed -- EasyCrypt/jasmin toolchains are absent here so a rename cannot be compile-verified, and .assurance/ gates parse those names. Added clarifying naming notes to the 5 prominent .ec files, proofs/easycrypt/README.md, AXIOM-INVENTORY.md, and jasmin/rlwe/sign.jazz. .assurance/*.txt left untouched (already say Module-LWE/Module-SIS; rlwe tokens are gate-parsed identifiers). Left AUDIT-2026-06.md:463 historical rename-log and the ProtoStar-LWE paper-title substring untouched.

go build ./... and go test ./... green (GOWORK=off; all packages ok).
2026-06-27 16:12:24 -07:00

209 lines
6.3 KiB
Go

// Copyright (C) 2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
// Package cli provides the "rt" (corona) subcommand for the lux CLI.
// It wires directly to the github.com/luxfi/corona/threshold and
// github.com/luxfi/corona/dkg packages.
package cli
import (
"crypto/rand"
"encoding/json"
"fmt"
"os"
"github.com/luxfi/corona/threshold"
"github.com/spf13/cobra"
)
// NewCmd returns the "rt" command tree for the lux CLI.
func NewCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "rt",
Aliases: []string{"corona"},
Short: "Corona threshold signing",
Long: `The rt (corona) command provides tools for Corona threshold signing,
a post-quantum threshold signature scheme using Module-LWE.
Corona is part of the triple consensus (BLS + Corona + ML-DSA) used
by Lux validators. It provides threshold signatures where t-of-n parties
can cooperatively produce a valid signature without reconstructing the
full private key.
KEY PROPERTIES:
- Post-quantum secure (lattice-based)
- t-of-n threshold without trusted dealer (via DKG)
- Proactive resharing for key rotation
- Compatible with QuasarCert attestations`,
RunE: func(cmd *cobra.Command, _ []string) error {
return cmd.Help()
},
}
cmd.AddCommand(newKeygenCmd())
cmd.AddCommand(newSignCmd())
cmd.AddCommand(newVerifyCmd())
cmd.AddCommand(newReshareCmd())
return cmd
}
// keygenOutput is the JSON structure written by keygen.
type keygenOutput struct {
Threshold int `json:"threshold"`
Parties int `json:"parties"`
GroupKey []byte `json:"group_key"`
}
// shareOutput is the JSON structure for each key share.
type shareOutput struct {
Index int `json:"index"`
GroupKey []byte `json:"group_key"`
}
func newKeygenCmd() *cobra.Command {
var (
t int
n int
output string
)
cmd := &cobra.Command{
Use: "keygen",
Short: "Generate threshold key shares",
Long: `Generate t-of-n threshold key shares for Corona signing.
Examples:
lux rt keygen --threshold 3 --parties 5 --output ./shares/
lux rt keygen --threshold 2 --parties 3`,
RunE: func(_ *cobra.Command, _ []string) error {
if t < 1 {
return fmt.Errorf("--threshold must be >= 1")
}
if n < 2 {
return fmt.Errorf("--parties must be >= 2")
}
if t >= n {
return fmt.Errorf("--threshold must be < --parties")
}
fmt.Fprintf(os.Stderr, "Generating %d-of-%d threshold key shares...\n", t, n)
shares, groupKey, err := threshold.GenerateKeysTrustedDealer(t, n, rand.Reader)
if err != nil {
return fmt.Errorf("generate keys: %w", err)
}
if output == "" {
output = "."
}
if err := os.MkdirAll(output, 0o750); err != nil {
return fmt.Errorf("create output dir: %w", err)
}
gkBytes := groupKey.Bytes()
// Write group key info
info := keygenOutput{
Threshold: t,
Parties: n,
GroupKey: gkBytes,
}
infoData, err := json.MarshalIndent(info, "", " ")
if err != nil {
return fmt.Errorf("marshal group info: %w", err)
}
infoPath := output + "/group.json"
if err := os.WriteFile(infoPath, infoData, 0o644); err != nil {
return fmt.Errorf("write group info: %w", err)
}
// Write each share
for i, share := range shares {
so := shareOutput{
Index: share.Index,
GroupKey: gkBytes,
}
data, err := json.MarshalIndent(so, "", " ")
if err != nil {
return fmt.Errorf("marshal share %d: %w", i, err)
}
path := fmt.Sprintf("%s/share-%d.json", output, i)
if err := os.WriteFile(path, data, 0o600); err != nil {
return fmt.Errorf("write share %d: %w", i, err)
}
}
fmt.Fprintf(os.Stderr, "Generated %d shares -> %s/\n", len(shares), output)
fmt.Fprintf(os.Stderr, "Group key: %s\n", infoPath)
return nil
},
}
cmd.Flags().IntVar(&t, "threshold", 0, "Signing threshold (t)")
cmd.Flags().IntVar(&n, "parties", 0, "Total number of parties (n)")
cmd.Flags().StringVar(&output, "output", "", "Output directory for key shares (default: current dir)")
return cmd
}
func newSignCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "sign",
Short: "Initiate threshold signing",
Long: `Initiate a Corona threshold signing session.
Requires t-of-n key holders to participate in the 2-round signing protocol:
Round 1: Each party broadcasts D matrix + MACs
Round 2: Each party broadcasts z share
Finalize: Any party aggregates into final signature
Examples:
lux rt sign --message "hello" --share ./shares/share-0.json
lux rt sign --tx-file unsigned.tx --share ./shares/share-0.json`,
RunE: func(_ *cobra.Command, _ []string) error {
return fmt.Errorf("interactive threshold signing requires a network session; use the SDK for programmatic signing")
},
}
cmd.Flags().String("message", "", "Message to sign (hex or string)")
cmd.Flags().String("share", "", "Path to key share file")
return cmd
}
func newVerifyCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "verify",
Short: "Verify a Corona signature",
Long: `Verify a Corona threshold signature against the group public key.
Examples:
lux rt verify --signature sig.json --message "hello" --group-key group.json`,
RunE: func(_ *cobra.Command, _ []string) error {
return fmt.Errorf("signature verification requires serialized signature format; use the SDK for programmatic verification")
},
}
cmd.Flags().String("signature", "", "Path to signature file")
cmd.Flags().String("message", "", "Message that was signed")
cmd.Flags().String("group-key", "", "Path to group key file")
return cmd
}
func newReshareCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "reshare",
Short: "Reshare keys to new committee",
Long: `Reshare existing key shares to a new committee configuration.
Proactive resharing allows rotating key shares without changing the
group public key. Used for committee membership changes.
Examples:
lux rt reshare --old-shares ./old/ --new-threshold 3 --new-parties 7`,
RunE: func(_ *cobra.Command, _ []string) error {
return fmt.Errorf("resharing requires coordinated multi-party protocol; use the SDK for programmatic resharing")
},
}
cmd.Flags().String("old-shares", "", "Directory containing old key shares")
cmd.Flags().Int("new-threshold", 0, "New signing threshold")
cmd.Flags().Int("new-parties", 0, "New total number of parties")
return cmd
}