From 89b45d09c5e6ee548ae272480dcfe1a0fe586380 Mon Sep 17 00:00:00 2001 From: Soatok Dreamseeker Date: Tue, 2 Sep 2025 00:59:55 -0400 Subject: [PATCH] fix(legal): avoid accidental trademark infringement --- README.md | 61 ++++++++++---------- client/go.mod | 3 +- client/go.sum | 2 + client/internal/crypto_test.go | 2 +- client/internal/duct_test.go | 4 +- client/internal/openssh_test.go | 4 +- client/internal/persistence.go | 24 ++++---- client/internal/persistence_test.go | 4 +- client/internal/types.go | 6 +- client/internal/util_test.go | 6 +- client/main.go | 50 ++++++++-------- client/usage.go | 82 +++++++++++++-------------- coordinator/go.mod | 3 +- coordinator/go.sum | 5 ++ coordinator/internal/config.go | 2 +- coordinator/internal/config_test.go | 4 +- coordinator/internal/database.go | 72 +++++++++++------------ coordinator/internal/database_test.go | 20 +++---- coordinator/internal/keygen.go | 30 +++++----- coordinator/internal/keygen_test.go | 2 +- coordinator/internal/sign.go | 14 ++--- coordinator/internal/sign_test.go | 2 +- coordinator/internal/types.go | 14 ++--- coordinator/internal/util_test.go | 2 +- coordinator/requesttypes.go | 4 +- coordinator/server.go | 4 +- coordinator/tests/integration_test.go | 12 ++-- go.mod | 2 +- 28 files changed, 224 insertions(+), 216 deletions(-) diff --git a/README.md b/README.md index b9d3be2..041cba1 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,24 @@ -# FREON +# FREEON -> FOSS Resists Executive Overreaching Nations +> FOSS Resists Extralegal Executive Overreaching Nations -[![Build Status](https://github.com/soatok/freon/actions/workflows/ci.yml/badge.svg)](https://github.com/soatok/freon/actions/workflows/ci.yml) +[![Build Status](https://github.com/soatok/freeon/actions/workflows/ci.yml/badge.svg)](https://github.com/soatok/freeon/actions/workflows/ci.yml) -FREON implements FROST ([RFC 9591](https://www.rfc-editor.org/rfc/rfc9591.html)) to allow geographically distributed teams produce digital signatures. +FREEON implements FROST ([RFC 9591](https://www.rfc-editor.org/rfc/rfc9591.html)) to allow geographically distributed teams produce digital signatures. Each share of the signing key is encrypted locally using [age](https://github.com/FiloSottile/age). > [!WARNING] > This software is a minimum viable product (MVP) and is only in the **alpha** stage of development. It has not been audited. Do not use this in production yet! -## Installation +> This project is not affiliated with [the Chemours Company](https://en.wikipedia.org/wiki/Freon). -### Freon Clients +## Installation -> [!WARNING] -> This command currently does not work. See [below](#temporary-workaround-for-replace-directive-error). +### Freeon Clients ```terminal -go install github.com/soatok/freon/client@latest +go install github.com/soatok/freeon/client@latest ``` #### For Developers @@ -27,12 +26,12 @@ go install github.com/soatok/freon/client@latest You can also clone the repository to install the client locally: ```terminal -git clone https://github.com/soatok/freon.git -cd freon/client +git clone https://github.com/soatok/freeon.git +cd freeon/client go install ``` -### Freon Coordinators +### Freeon Coordinators > [!WARNING] > The coordinator is expected to run on a private network, such as [Tailscale](https://tailscale.com), @@ -42,8 +41,8 @@ go install > Internet, but this was cut from the alpha release due to time constraints. ```terminal -git clone https://github.com/soatok/freon.git -cd freon +git clone https://github.com/soatok/freeon.git +cd freeon go build -o coordinator ./coordinator ./coordinator ``` @@ -54,7 +53,7 @@ The order of operations is as followed: 1. Perform the **Distributed Key Generation** ceremony once, for each Ed25519 keypair. 1. One client tell the coordinator to initiate a new DKG. The number of parties and threshold are required at this step. - 2. The coordinator sets up a session that other clients can connect to, and gives the DKG Group ID to the client. This is to be shared with other users. The Group ID is not sensitive; it only serves to allow multiple keys be managed by one Freon coordinator. + 2. The coordinator sets up a session that other clients can connect to, and gives the DKG Group ID to the client. This is to be shared with other users. The Group ID is not sensitive; it only serves to allow multiple keys be managed by one Freeon coordinator. 3. Once every participating user enrolls in the DKG ceremony, the final public key is calculated and shared with each participant. 4. Each client encrypts their Shamir Share, along with their Party ID and the group identifier, locally. 2. For each message to be signed: @@ -71,20 +70,20 @@ To initiate a new DKG group, one of the clients with access to the coordinator w the number of participants and threshold needed to perform a signature operation, respectively): ```terminal -freon keygen create -h hostname:port -n 7 -t 3 +freeon keygen create -h hostname:port -n 7 -t 3 ``` Upon success, a Group ID will be returned. This is to be shared with the other participants, who will pass it as an extra argument: ```terminal -freon keygen join -h hostname:port -g [group-id-goes-here] +freeon keygen join -h hostname:port -g [group-id-goes-here] ``` This will maintain a connection with the coordinator until all `n` participants have connected. Afterwards, a copy of the public key will be returned to each client. #### Optional Arguments -If you provide a public key (`-r [RECIPIENT]`) as an optional argument, the Freon client will use [age](https://age-encryption.org) to encrypt the share locally. This public key can be an age public key or an OpenSSH public key. +If you provide a public key (`-r [RECIPIENT]`) as an optional argument, the Freeon client will use [age](https://age-encryption.org) to encrypt the share locally. This public key can be an age public key or an OpenSSH public key. ### Signature Generation @@ -98,8 +97,8 @@ To initiate a key ceremony, the following information is needed: The message can be passed as a file name or via `STDIN`, like so: ```terminal -freon sign create -g [group-id-goes-here] file-with-message.txt -echo -n "MESSAGE TO BE SIGNED" | freon sign create -g [group-id-goes-here] +freeon sign create -g [group-id-goes-here] file-with-message.txt +echo -n "MESSAGE TO BE SIGNED" | freeon sign create -g [group-id-goes-here] ``` This will initialize a signature in progress and return a Ceremony ID. @@ -114,8 +113,8 @@ By default, the final signature will be returned as a 128-character hex-encoded You can pass an optional `--openssh` flag to return an OpenSSH-compatible signature. ```terminal -freon sign create --openssh -g [group-id-goes-here] file-with-message.txt -echo -n "MESSAGE TO BE SIGNED" | freon sign create --openssh -g [group-id-goes-here] +freeon sign create --openssh -g [group-id-goes-here] file-with-message.txt +echo -n "MESSAGE TO BE SIGNED" | freeon sign create --openssh -g [group-id-goes-here] ``` ##### Terminating Incomplete Ceremonies @@ -123,7 +122,7 @@ echo -n "MESSAGE TO BE SIGNED" | freon sign create --openssh -g [group-id-goes-h You can run this command to flush any incomplete ceremonies. ```terminal -freon terminate [ceremony-id-goes-here] +freeon terminate [ceremony-id-goes-here] ``` > [!WARNING] @@ -134,12 +133,12 @@ freon terminate [ceremony-id-goes-here] Each client will need to run this command to participate in the ceremony. ```terminal -freon sign join -c [ceremony-id] file-with-message.txt -echo -n "MESSAGE TO BE SIGNED" | freon sign join -c [ceremony-id] +freeon sign join -c [ceremony-id] file-with-message.txt +echo -n "MESSAGE TO BE SIGNED" | freeon sign join -c [ceremony-id] # Identical: -freon sign join --ceremony [ceremony-id] file-with-message.txt -echo -n "MESSAGE TO BE SIGNED" | freon sign join --ceremony [ceremony-id] +freeon sign join --ceremony [ceremony-id] file-with-message.txt +echo -n "MESSAGE TO BE SIGNED" | freeon sign join --ceremony [ceremony-id] ``` ##### Optional Arguments @@ -147,10 +146,10 @@ echo -n "MESSAGE TO BE SIGNED" | freon sign join --ceremony [ceremony-id] You can furthermore pass the `-i` or `--identity` flag to specify the file path for your age secret keys. ```terminal -freon sign join -c [ceremony-id] -i /path/to/age.keys file-with-message.txt -echo -n "MESSAGE TO BE SIGNED" | freon sign join -i /path/to/age.keys -c [ceremony-id] +freeon sign join -c [ceremony-id] -i /path/to/age.keys file-with-message.txt +echo -n "MESSAGE TO BE SIGNED" | freeon sign join -i /path/to/age.keys -c [ceremony-id] # Identical -freon sign join --ceremony [ceremony-id] --identity /path/to/age.keys file-with-message.txt -echo -n "MESSAGE TO BE SIGNED" | freon sign join --identity /path/to/age.keys --ceremony [ceremony-id] +freeon sign join --ceremony [ceremony-id] --identity /path/to/age.keys file-with-message.txt +echo -n "MESSAGE TO BE SIGNED" | freeon sign join --identity /path/to/age.keys --ceremony [ceremony-id] ``` diff --git a/client/go.mod b/client/go.mod index ea08e7e..777bfe1 100644 --- a/client/go.mod +++ b/client/go.mod @@ -1,4 +1,4 @@ -module github.com/soatok/freon/client +module github.com/soatok/freeon/client go 1.25 @@ -8,6 +8,7 @@ require ( github.com/bytemare/ecc v0.8.2 github.com/bytemare/frost v0.0.0-20241019112700-8c6db5b04145 github.com/bytemare/secret-sharing v0.7.0 + github.com/soatok/freeon/client v0.0.0-20250831122941-3dcf071c280b github.com/stretchr/testify v1.10.0 ) diff --git a/client/go.sum b/client/go.sum index 3be0cfe..812a64f 100644 --- a/client/go.sum +++ b/client/go.sum @@ -26,6 +26,8 @@ github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uM github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/soatok/freeon/client v0.0.0-20250831122941-3dcf071c280b h1:/Vsazx182lA4Gsnzg40FefJSXWMIivDi8aSGdbSNBIU= +github.com/soatok/freeon/client v0.0.0-20250831122941-3dcf071c280b/go.mod h1:rVzD6TFMqqlsQcAXoo+RlUO6fVcJtHyuY1QKdXjnbzc= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= diff --git a/client/internal/crypto_test.go b/client/internal/crypto_test.go index e5422c6..bdb5b42 100644 --- a/client/internal/crypto_test.go +++ b/client/internal/crypto_test.go @@ -7,7 +7,7 @@ import ( "testing" "filippo.io/age" - "github.com/soatok/freon/client/internal" + "github.com/soatok/freeon/client/internal" ) func TestEncryptDecryptShare(t *testing.T) { diff --git a/client/internal/duct_test.go b/client/internal/duct_test.go index 9667636..6e06062 100644 --- a/client/internal/duct_test.go +++ b/client/internal/duct_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "testing" - "github.com/soatok/freon/client/internal" + "github.com/soatok/freeon/client/internal" "github.com/stretchr/testify/assert" ) @@ -46,7 +46,7 @@ func TestDuct(t *testing.T) { case "/sign/list": var req internal.ListSignRequest json.NewDecoder(r.Body).Decode(&req) - resp := internal.ListSignResponse{Ceremonies: []internal.FreonCeremonySummary{{Uid: "test-ceremony"}}} + resp := internal.ListSignResponse{Ceremonies: []internal.FreeonCeremonySummary{{Uid: "test-ceremony"}}} json.NewEncoder(w).Encode(resp) case "/keygen/send": var req internal.KeyGenMessageRequest diff --git a/client/internal/openssh_test.go b/client/internal/openssh_test.go index 0cc185d..b10c40e 100644 --- a/client/internal/openssh_test.go +++ b/client/internal/openssh_test.go @@ -6,7 +6,7 @@ import ( "crypto/sha512" "testing" - "github.com/soatok/freon/client/internal" + "github.com/soatok/freeon/client/internal" "github.com/stretchr/testify/assert" ) @@ -30,7 +30,7 @@ func TestOpenSSHEncode(t *testing.T) { var sig2 []byte h2 := sha256.Sum256([]byte("Signature Format")) sig2 = append(sig2, h2[:]...) - h2 = sha256.Sum256([]byte("Freon - OpenSSH")) + h2 = sha256.Sum256([]byte("Freeon - OpenSSH")) sig2 = append(sig2, h2[:]...) encoded2 := internal.OpenSSHEncode(pk2, sig2, namespace) diff --git a/client/internal/persistence.go b/client/internal/persistence.go index 381ca14..ec30713 100644 --- a/client/internal/persistence.go +++ b/client/internal/persistence.go @@ -18,26 +18,26 @@ func getConfigFile() (string, error) { if err != nil { return "", err } - return filepath.Join(homeDir, ".freon.json"), nil + return filepath.Join(homeDir, ".freeon.json"), nil } // Default user config -func NewUserConfig() (FreonConfig, error) { - config := FreonConfig{ +func NewUserConfig() (FreeonConfig, error) { + config := FreeonConfig{ Shares: []Shares{}, } err := config.Save() if err != nil { - return FreonConfig{}, err + return FreeonConfig{}, err } return config, nil } // Load the user config from a saved file -func LoadUserConfig() (FreonConfig, error) { +func LoadUserConfig() (FreeonConfig, error) { configPath, err := getConfigFile() if err != nil { - return FreonConfig{}, err + return FreeonConfig{}, err } file, err := os.Open(configPath) @@ -45,19 +45,19 @@ func LoadUserConfig() (FreonConfig, error) { if os.IsNotExist(err) { return NewUserConfig() } - return FreonConfig{}, err + return FreeonConfig{}, err } defer file.Close() - var conf FreonConfig + var conf FreeonConfig if err := json.NewDecoder(file).Decode(&conf); err != nil { - return FreonConfig{}, err + return FreeonConfig{}, err } return conf, err } -// This API felt more natural for me to implement than `func SaveUserConfig(cfg FreonConfig) error` -func (cfg FreonConfig) Save() error { +// This API felt more natural for me to implement than `func SaveUserConfig(cfg FreeonConfig) error` +func (cfg FreeonConfig) Save() error { configPath, err := getConfigFile() if err != nil { return err @@ -74,7 +74,7 @@ func (cfg FreonConfig) Save() error { return encoder.Encode(cfg) } -func (cfg FreonConfig) AddShare(host, groupID, publicKey, share string, otherShares map[string]string, myPartyID uint16) error { +func (cfg FreeonConfig) AddShare(host, groupID, publicKey, share string, otherShares map[string]string, myPartyID uint16) error { s := Shares{ Host: host, GroupID: groupID, diff --git a/client/internal/persistence_test.go b/client/internal/persistence_test.go index dc14e30..7796634 100644 --- a/client/internal/persistence_test.go +++ b/client/internal/persistence_test.go @@ -4,13 +4,13 @@ import ( "os" "testing" - "github.com/soatok/freon/client/internal" + "github.com/soatok/freeon/client/internal" "github.com/stretchr/testify/assert" ) func TestPersistence(t *testing.T) { // Create a temporary directory for the config file - tmpdir, err := os.MkdirTemp("", "freon-test-") + tmpdir, err := os.MkdirTemp("", "freeon-test-") assert.NoError(t, err) defer os.RemoveAll(tmpdir) diff --git a/client/internal/types.go b/client/internal/types.go index 41d2f41..0b3dfb0 100644 --- a/client/internal/types.go +++ b/client/internal/types.go @@ -11,7 +11,7 @@ type Shares struct { } // This may expand in future versions -type FreonConfig struct { +type FreeonConfig struct { Shares []Shares `json:"shares"` } @@ -141,7 +141,7 @@ type VapidResponse struct { Status string `json:"status"` } -type FreonCeremonySummary struct { +type FreeonCeremonySummary struct { Uid string Active bool Hash string @@ -155,5 +155,5 @@ type ListSignRequest struct { Offset int64 `json:"offset"` } type ListSignResponse struct { - Ceremonies []FreonCeremonySummary + Ceremonies []FreeonCeremonySummary } diff --git a/client/internal/util_test.go b/client/internal/util_test.go index f6ec4eb..8feec4b 100644 --- a/client/internal/util_test.go +++ b/client/internal/util_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/soatok/freon/client/internal" + "github.com/soatok/freeon/client/internal" "github.com/stretchr/testify/assert" ) @@ -29,7 +29,7 @@ func TestHashMessageForSanity(t *testing.T) { } func TestAmIElected(t *testing.T) { - hash := sha512.Sum384([]byte("freon testing")) + hash := sha512.Sum384([]byte("freeon testing")) tests := []struct { Elected bool MyID uint16 @@ -102,7 +102,7 @@ func TestUniqueID(t *testing.T) { } func TestSelectIndex(t *testing.T) { - hash := sha512.Sum384([]byte("freon testing")) + hash := sha512.Sum384([]byte("freeon testing")) index := internal.SelectIndex(hash[:], 8) assert.Equal(t, uint64(4), index) } diff --git a/client/main.go b/client/main.go index 0dbe77e..970008a 100644 --- a/client/main.go +++ b/client/main.go @@ -7,7 +7,7 @@ import ( "os" "strings" - "github.com/soatok/freon/client/internal" + "github.com/soatok/freeon/client/internal" ) // Entrypoint for the command line program @@ -22,7 +22,7 @@ func main() { args := os.Args[1:] // This is where commands are processed. - // Note that the first verb after `freon` is case insensitive. + // Note that the first verb after `freeon` is case insensitive. command := strings.ToLower(args[0]) subArgs := args[1:] switch command { @@ -36,11 +36,11 @@ func main() { subcommand := subArgs[0] switch subcommand { case "create": - FreonKeygenCreate(subArgs[1:]) + FreeonKeygenCreate(subArgs[1:]) case "join": - FreonKeygenJoin(subArgs[1:]) + FreeonKeygenJoin(subArgs[1:]) case "list": - FreonKeygenList(subArgs[1:]) + FreeonKeygenList(subArgs[1:]) default: fmt.Fprintf(os.Stderr, "Error: unknown keygen subcommand: %s\n\n", subcommand) fmt.Fprintf(os.Stderr, "%s\n", keygenUsage) @@ -57,13 +57,13 @@ func main() { subcommand := subArgs[0] switch subcommand { case "create": - FreonSignCreate(subArgs[1:]) + FreeonSignCreate(subArgs[1:]) case "list": - FreonSignList(subArgs[1:]) + FreeonSignList(subArgs[1:]) case "join": - FreonSignJoin(subArgs[1:]) + FreeonSignJoin(subArgs[1:]) case "get": - FreonSignGet(subArgs[1:]) + FreeonSignGet(subArgs[1:]) default: fmt.Fprintf(os.Stderr, "Error: unknown sign subcommand: %s\n\n", subcommand) fmt.Fprintf(os.Stderr, "%s\n", signUsage) @@ -71,7 +71,7 @@ func main() { } case "terminate": - FreonTerminate(subArgs) + FreeonTerminate(subArgs) case "help": if len(subArgs) == 0 { @@ -123,8 +123,8 @@ func readInput(filename string) ([]byte, error) { return io.ReadAll(os.Stdin) } -// CMD: `freon keygen create ...` -func FreonKeygenCreate(args []string) { +// CMD: `freeon keygen create ...` +func FreeonKeygenCreate(args []string) { // Parse CLI arguments: fs := flag.NewFlagSet("keygen create", flag.ExitOnError) fs.Usage = func() { fmt.Fprintf(os.Stderr, "%s\n", keygenCreateUsage) } @@ -182,8 +182,8 @@ func FreonKeygenCreate(args []string) { internal.InitKeyGenCeremony(*host, uint16(*participants), uint16(*threshold)) } -// CMD: `freon keygen join ...` -func FreonKeygenJoin(args []string) { +// CMD: `freeon keygen join ...` +func FreeonKeygenJoin(args []string) { // Parse CLI arguments: fs := flag.NewFlagSet("keygen join", flag.ExitOnError) fs.Usage = func() { fmt.Fprintf(os.Stderr, "%s\n", keygenJoinUsage) } @@ -227,14 +227,14 @@ func FreonKeygenJoin(args []string) { internal.JoinKeyGenCeremony(*host, *groupID, *recipient) } -// CMD: `freon keygen list ...` -func FreonKeygenList(args []string) { +// CMD: `freeon keygen list ...` +func FreeonKeygenList(args []string) { // The actual logic is implemented here: internal.ListKeyGen() } -// CMD: `freon sign create ...` -func FreonSignCreate(args []string) { +// CMD: `freeon sign create ...` +func FreeonSignCreate(args []string) { // Parse CLI arguments: fs := flag.NewFlagSet("sign create", flag.ExitOnError) fs.Usage = func() { fmt.Fprintf(os.Stderr, "%s\n", signCreateUsage) } @@ -288,8 +288,8 @@ func FreonSignCreate(args []string) { internal.InitSignCeremony(*host, *groupID, message, *openssh, *namespace) } -// CMD: `freon sign join ...` -func FreonSignJoin(args []string) { +// CMD: `freeon sign join ...` +func FreeonSignJoin(args []string) { // Parse CLI arguments: fs := flag.NewFlagSet("sign join", flag.ExitOnError) fs.Usage = func() { fmt.Fprintf(os.Stderr, "%s\n", signJoinUsage) } @@ -328,7 +328,7 @@ func FreonSignJoin(args []string) { internal.JoinSignCeremony(*ceremonyID, *host, *identity, message) } -func FreonSignList(args []string) { +func FreeonSignList(args []string) { // Parse CLI arguments: fs := flag.NewFlagSet("sign list", flag.ExitOnError) fs.Usage = func() { fmt.Fprintf(os.Stderr, "%s\n", signListUsage) } @@ -361,8 +361,8 @@ func FreonSignList(args []string) { internal.ListSign(*host, *groupID, *limit, *offset) } -// CMD: `freon sign get ...` -func FreonSignGet(args []string) { +// CMD: `freeon sign get ...` +func FreeonSignGet(args []string) { // Parse CLI arguments: fs := flag.NewFlagSet("sign get", flag.ExitOnError) fs.Usage = func() { fmt.Fprintf(os.Stderr, "%s\n", signGetUsage) } @@ -394,8 +394,8 @@ func FreonSignGet(args []string) { internal.GetSignSignature(*ceremonyID, *host) } -// CMD: `freon terminate ...` -func FreonTerminate(args []string) { +// CMD: `freeon terminate ...` +func FreeonTerminate(args []string) { // Parse CLI arguments: fs := flag.NewFlagSet("terminate", flag.ExitOnError) fs.Usage = func() { fmt.Fprintf(os.Stderr, "%s\n", terminateUsage) } diff --git a/client/usage.go b/client/usage.go index 4c839e8..b23ccfa 100644 --- a/client/usage.go +++ b/client/usage.go @@ -2,10 +2,10 @@ package main // This file contains the basic help text for each subcommand -const usage = `FREON - FOSS Resists Executive Overreaching Nations +const usage = `FREEON - FOSS Resists Extralegal Executive Overreaching Nations USAGE: - freon [OPTIONS] + freeon [OPTIONS] DESCRIPTION: Distributed Ed25519 signature generation using FROST (RFC 9591). @@ -23,20 +23,20 @@ COMMANDS: terminate Terminate incomplete ceremonies help Print this message or the help of the given subcommand(s) -Use 'freon --help' for more information on a specific command. +Use 'freeon --help' for more information on a specific command. EXAMPLES: - freon keygen create -h coordinator:8080 -n 5 -t 3 - freon sign create -g abc123 message.txt - freon sign join -c ceremony456 + freeon keygen create -h coordinator:8080 -n 5 -t 3 + freeon sign create -g abc123 message.txt + freeon sign join -c ceremony456 ` const keygenUsage = ` -FREON KEYGEN - Distributed Key Generation +freeon KEYGEN - Distributed Key Generation USAGE: - freon keygen + freeon keygen SUBCOMMANDS: create Initialize a new DKG ceremony @@ -45,10 +45,10 @@ SUBCOMMANDS: help Print this message or the help of the given subcommand(s) ` -const keygenCreateUsage = `FREON KEYGEN CREATE - Initialize DKG ceremony +const keygenCreateUsage = `freeon KEYGEN CREATE - Initialize DKG ceremony USAGE: - freon keygen create [OPTIONS] -h -n -t + freeon keygen create [OPTIONS] -h -n -t DESCRIPTION: Creates a new distributed key generation ceremony. Returns a Group ID @@ -62,16 +62,16 @@ OPTIONS: --help Print help information EXAMPLES: - freon keygen create -h coord.example.com:8080 -n 7 -t 3 - freon keygen create -h 192.168.1.100:8080 -n 5 -t 3 -r age1abc... + freeon keygen create -h coord.example.com:8080 -n 7 -t 3 + freeon keygen create -h 192.168.1.100:8080 -n 5 -t 3 -r age1abc... ` const keygenJoinUsage = ` -FREON KEYGEN JOIN - Join DKG ceremony +freeon KEYGEN JOIN - Join DKG ceremony USAGE: - freon keygen join [OPTIONS] -h -g + freeon keygen join [OPTIONS] -h -g DESCRIPTION: Join an existing DKG ceremony using the Group ID from the creator. @@ -84,15 +84,15 @@ OPTIONS: --help Print help information EXAMPLES: - freon keygen join -h coord.example.com:8080 -g grp_abc123def456 - freon keygen join -h coord.example.com:8080 -g grp_xyz789 -r ~/.ssh/id_ed25519.pub + freeon keygen join -h coord.example.com:8080 -g grp_abc123def456 + freeon keygen join -h coord.example.com:8080 -g grp_xyz789 -r ~/.ssh/id_ed25519.pub ` -const signUsage = `FREON SIGN - Signature Generation +const signUsage = `freeon SIGN - Signature Generation USAGE: - freon sign + freeon sign SUBCOMMANDS: create Initialize a new signature ceremony @@ -102,10 +102,10 @@ SUBCOMMANDS: ` -const signCreateUsage = `FREON SIGN CREATE - Initialize signature ceremony +const signCreateUsage = `freeon SIGN CREATE - Initialize signature ceremony USAGE: - freon sign create [OPTIONS] -g [MESSAGE] + freeon sign create [OPTIONS] -g [MESSAGE] DESCRIPTION: Creates a new signature ceremony for the specified group and message. @@ -123,16 +123,16 @@ OPTIONS: --namespace Specify a namespace for OpenSSH (default: "file") EXAMPLES: - freon sign create -g grp_abc123 message.txt - echo "Hello World" | freon sign create -g grp_abc123 - - freon sign create -g grp_abc123 --openssh --namespace git release.tar.gz + freeon sign create -g grp_abc123 message.txt + echo "Hello World" | freeon sign create -g grp_abc123 - + freeon sign create -g grp_abc123 --openssh --namespace git release.tar.gz ` -const signListUsage = `FREON SIGN LIST - List recent signing ceremonies +const signListUsage = `freeon SIGN LIST - List recent signing ceremonies USAGE: - freon sign list [OPTIONS] -g + freeon sign list [OPTIONS] -g DESCRIPTION: List recent signing ceremonies for the specified group. Results are @@ -146,17 +146,17 @@ OPTIONS: --help Print help information EXAMPLES: - freon sign list -g grp_abc123 - freon sign list -g grp_abc123 --limit 10 - freon sign list -g grp_abc123 --limit 20 --offset 40 - freon sign list -g grp_abc123 -h coord.example.com:8080 --limit 5 + freeon sign list -g grp_abc123 + freeon sign list -g grp_abc123 --limit 10 + freeon sign list -g grp_abc123 --limit 20 --offset 40 + freeon sign list -g grp_abc123 -h coord.example.com:8080 --limit 5 ` -const signJoinUsage = `FREON SIGN JOIN - Join signature ceremony +const signJoinUsage = `freeon SIGN JOIN - Join signature ceremony USAGE: - freon sign join [OPTIONS] -c [MESSAGE] + freeon sign join [OPTIONS] -c [MESSAGE] DESCRIPTION: Join an existing signature ceremony. The message must match what was @@ -172,16 +172,16 @@ OPTIONS: --help Print help information EXAMPLES: - freon sign join -c cer_def456 message.txt - echo "Hello World" | freon sign join -c cer_def456 - - freon sign join -c cer_def456 -i ~/.age/keys.txt message.txt + freeon sign join -c cer_def456 message.txt + echo "Hello World" | freeon sign join -c cer_def456 - + freeon sign join -c cer_def456 -i ~/.age/keys.txt message.txt ` -const signGetUsage = `FREON SIGN GET - Get signature from coordinator +const signGetUsage = `freeon SIGN GET - Get signature from coordinator USAGE: - freon sign get [OPTIONS] -c + freeon sign get [OPTIONS] -c DESCRIPTION: Query the coordinator for the final signature for a concluded @@ -193,15 +193,15 @@ OPTIONS: --help Print help information EXAMPLES: - freon sign get -c cer_def456 - freon sign get -h coord.example.com:8080 -c cer_def456 message.txt + freeon sign get -c cer_def456 + freeon sign get -h coord.example.com:8080 -c cer_def456 message.txt ` -const terminateUsage = `FREON TERMINATE - Terminate ceremonies +const terminateUsage = `freeon TERMINATE - Terminate ceremonies USAGE: - freon terminate + freeon terminate DESCRIPTION: Terminate an incomplete signature ceremony. Does not require @@ -214,6 +214,6 @@ OPTIONS: --help Print help information EXAMPLES: - freon terminate cer_def456 + freeon terminate cer_def456 ` diff --git a/coordinator/go.mod b/coordinator/go.mod index e7057bd..12c33d2 100644 --- a/coordinator/go.mod +++ b/coordinator/go.mod @@ -1,4 +1,4 @@ -module github.com/soatok/freon/coordinator +module github.com/soatok/freeon/coordinator go 1.25 @@ -7,6 +7,7 @@ require github.com/alexedwards/scs/v2 v2.9.0 require ( filippo.io/age v1.2.1 github.com/ncruces/go-sqlite3 v0.28.0 + github.com/soatok/freeon/coordinator v0.0.0-20250831122941-3dcf071c280b github.com/stretchr/testify v1.10.0 ) diff --git a/coordinator/go.sum b/coordinator/go.sum index e979aa6..63737c8 100644 --- a/coordinator/go.sum +++ b/coordinator/go.sum @@ -1,5 +1,7 @@ c2sp.org/CCTV/age v0.0.0-20240306222714-3ec4d716e805 h1:u2qwJeEvnypw+OCPUHmoZE3IqwfuN5kgDfo5MLzpNM0= +c2sp.org/CCTV/age v0.0.0-20240306222714-3ec4d716e805/go.mod h1:FomMrUJ2Lxt5jCLmZkG3FHa72zUprnhd3v/Z18Snm4w= filippo.io/age v1.2.1 h1:X0TZjehAZylOIj4DubWYU1vWQxv9bJpo+Uu2/LGhi1o= +filippo.io/age v1.2.1/go.mod h1:JL9ew2lTN+Pyft4RiNGguFfOpewKwSHm5ayKD/A4004= github.com/alexedwards/scs/v2 v2.9.0 h1:xa05mVpwTBm1iLeTMNFfAWpKUm4fXAW7CeAViqBVS90= github.com/alexedwards/scs/v2 v2.9.0/go.mod h1:ToaROZxyKukJKT/xLcVQAChi5k6+Pn1Gvmdl7h3RRj8= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -10,11 +12,14 @@ github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/soatok/freeon/coordinator v0.0.0-20250831122941-3dcf071c280b h1:2sXPhLKZdGd+et0dYUpgUe4H28bmic37tuTOY7fy4mE= +github.com/soatok/freeon/coordinator v0.0.0-20250831122941-3dcf071c280b/go.mod h1:32WJaYR5H8GI/sHSp+boVwy7+zPc6iJHI8OKxb9BKdY= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I= github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM= golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= diff --git a/coordinator/internal/config.go b/coordinator/internal/config.go index 0291b17..974a81c 100644 --- a/coordinator/internal/config.go +++ b/coordinator/internal/config.go @@ -20,7 +20,7 @@ func getConfigFile() (string, error) { if err != nil { return "", err } - return filepath.Join(homeDir, ".freon-coordinator.json"), nil + return filepath.Join(homeDir, ".freeon-coordinator.json"), nil } // Default user config diff --git a/coordinator/internal/config_test.go b/coordinator/internal/config_test.go index cc449be..2d09c03 100644 --- a/coordinator/internal/config_test.go +++ b/coordinator/internal/config_test.go @@ -5,7 +5,7 @@ import ( "path/filepath" "testing" - "github.com/soatok/freon/coordinator/internal" + "github.com/soatok/freeon/coordinator/internal" "github.com/stretchr/testify/assert" ) @@ -27,7 +27,7 @@ func TestServerConfig(t *testing.T) { } // Check if the file was created - configPath := filepath.Join(tempDir, ".freon-coordinator.json") + configPath := filepath.Join(tempDir, ".freeon-coordinator.json") _, err = os.Stat(configPath) assert.NoError(t, err) diff --git a/coordinator/internal/database.go b/coordinator/internal/database.go index 6ddfc34..41bdd72 100644 --- a/coordinator/internal/database.go +++ b/coordinator/internal/database.go @@ -81,10 +81,10 @@ func GetGroupRowId(db DBTX, groupUid string) (int, error) { } // Get the row ID for a given group -func GetGroupData(db DBTX, groupUid string) (FreonGroup, error) { +func GetGroupData(db DBTX, groupUid string) (FreeonGroup, error) { stmt, err := db.Prepare("SELECT id, threshold, participants, publicKey FROM keygroups WHERE uid = ?") if err != nil { - return FreonGroup{}, err + return FreeonGroup{}, err } defer stmt.Close() @@ -94,9 +94,9 @@ func GetGroupData(db DBTX, groupUid string) (FreonGroup, error) { var publicKey *string err = stmt.QueryRow(groupUid).Scan(&id, &threshold, &participants, &publicKey) if err != nil { - return FreonGroup{}, err + return FreeonGroup{}, err } - return FreonGroup{ + return FreeonGroup{ DbId: id, Uid: groupUid, Participants: participants, @@ -104,10 +104,10 @@ func GetGroupData(db DBTX, groupUid string) (FreonGroup, error) { PublicKey: publicKey, }, nil } -func GetGroupByID(db *sql.DB, groupID int64) (FreonGroup, error) { +func GetGroupByID(db *sql.DB, groupID int64) (FreeonGroup, error) { stmt, err := db.Prepare("SELECT id, uid, threshold, participants, publicKey FROM keygroups WHERE id = ?") if err != nil { - return FreonGroup{}, err + return FreeonGroup{}, err } defer stmt.Close() @@ -118,9 +118,9 @@ func GetGroupByID(db *sql.DB, groupID int64) (FreonGroup, error) { var publicKey *string err = stmt.QueryRow(groupID).Scan(&id, &uid, &threshold, &participants, &publicKey) if err != nil { - return FreonGroup{}, err + return FreeonGroup{}, err } - return FreonGroup{ + return FreeonGroup{ DbId: id, Uid: uid, Participants: participants, @@ -130,7 +130,7 @@ func GetGroupByID(db *sql.DB, groupID int64) (FreonGroup, error) { } // Get all of the participants for a group -func GetGroupParticipants(db DBTX, groupUid string) ([]FreonParticipant, error) { +func GetGroupParticipants(db DBTX, groupUid string) ([]FreeonParticipant, error) { stmt, err := db.Prepare(` SELECT p.id, @@ -151,7 +151,7 @@ func GetGroupParticipants(db DBTX, groupUid string) ([]FreonParticipant, error) } defer rows.Close() - var participants []FreonParticipant + var participants []FreeonParticipant for rows.Next() { var dbId int64 var groupId int64 @@ -160,7 +160,7 @@ func GetGroupParticipants(db DBTX, groupUid string) ([]FreonParticipant, error) if err := rows.Scan(&dbId, &groupId, &uid, &partyid); err != nil { return nil, err } - p := FreonParticipant{ + p := FreeonParticipant{ DbId: dbId, GroupID: groupId, Uid: uid, @@ -191,13 +191,13 @@ func GetParticipantID(db *sql.DB, groupUid string, myPartyID uint16) (int64, err return id, nil } -func GetCeremonyData(db *sql.DB, ceremonyID string) (FreonCeremonies, error) { +func GetCeremonyData(db *sql.DB, ceremonyID string) (FreeonCeremonies, error) { stmt, err := db.Prepare(`SELECT id, groupid, active, hash, signature, openssh, opensshnamespace FROM ceremonies WHERE uid = ?`) if err != nil { - return FreonCeremonies{}, err + return FreeonCeremonies{}, err } defer stmt.Close() @@ -210,9 +210,9 @@ func GetCeremonyData(db *sql.DB, ceremonyID string) (FreonCeremonies, error) { var opensshnamespace *string err = stmt.QueryRow(ceremonyID).Scan(&id, &groupid, &active, &hash, &signature, &openssh, &opensshnamespace) if err != nil { - return FreonCeremonies{}, err + return FreeonCeremonies{}, err } - return FreonCeremonies{ + return FreeonCeremonies{ DbId: id, GroupID: groupid, Uid: ceremonyID, @@ -224,7 +224,7 @@ func GetCeremonyData(db *sql.DB, ceremonyID string) (FreonCeremonies, error) { }, nil } -func GetRecentCeremonies(db *sql.DB, groupID string, limit, offset int64) ([]FreonCeremonySummary, error) { +func GetRecentCeremonies(db *sql.DB, groupID string, limit, offset int64) ([]FreeonCeremonySummary, error) { stmt, err := db.Prepare(`SELECT c.uid, c.hash, c.signature, c.openssh, c.opensshnamespace, c.active FROM ceremonies c @@ -242,7 +242,7 @@ func GetRecentCeremonies(db *sql.DB, groupID string, limit, offset int64) ([]Fre return nil, err } defer rows.Close() - var results []FreonCeremonySummary + var results []FreeonCeremonySummary for rows.Next() { var ceremonyID string var hash string @@ -259,7 +259,7 @@ func GetRecentCeremonies(db *sql.DB, groupID string, limit, offset int64) ([]Fre } else { ns = *opensshnamespace } - row := FreonCeremonySummary{ + row := FreeonCeremonySummary{ Uid: ceremonyID, Active: active, Hash: hash, @@ -272,7 +272,7 @@ func GetRecentCeremonies(db *sql.DB, groupID string, limit, offset int64) ([]Fre return results, nil } -func GetCeremonyPlayers(db *sql.DB, ceremonyID string) ([]FreonPlayers, error) { +func GetCeremonyPlayers(db *sql.DB, ceremonyID string) ([]FreeonPlayers, error) { stmt, err := db.Prepare(` SELECT x.id, @@ -293,7 +293,7 @@ func GetCeremonyPlayers(db *sql.DB, ceremonyID string) ([]FreonPlayers, error) { } defer rows.Close() - var players []FreonPlayers + var players []FreeonPlayers for rows.Next() { var dbId int64 var ceremonyId int64 @@ -302,7 +302,7 @@ func GetCeremonyPlayers(db *sql.DB, ceremonyID string) ([]FreonPlayers, error) { if err := rows.Scan(&dbId, &ceremonyId, &participantId, &partyId); err != nil { return nil, err } - p := FreonPlayers{ + p := FreeonPlayers{ DbId: dbId, CeremonyID: ceremonyId, ParticipantID: participantId, @@ -313,7 +313,7 @@ func GetCeremonyPlayers(db *sql.DB, ceremonyID string) ([]FreonPlayers, error) { return players, nil } -func GetKeygenMessagesSince(db *sql.DB, groupUid string, lastSeen int64) ([]FreonKeygenMessage, error) { +func GetKeygenMessagesSince(db *sql.DB, groupUid string, lastSeen int64) ([]FreeonKeygenMessage, error) { stmt, err := db.Prepare(` SELECT msg.id, @@ -335,7 +335,7 @@ func GetKeygenMessagesSince(db *sql.DB, groupUid string, lastSeen int64) ([]Freo } defer rows.Close() - var messages []FreonKeygenMessage + var messages []FreeonKeygenMessage for rows.Next() { var id int64 var group int64 @@ -348,7 +348,7 @@ func GetKeygenMessagesSince(db *sql.DB, groupUid string, lastSeen int64) ([]Freo if err != nil { return nil, err } - msg := FreonKeygenMessage{ + msg := FreeonKeygenMessage{ DbId: id, GroupID: group, Sender: sender, @@ -359,7 +359,7 @@ func GetKeygenMessagesSince(db *sql.DB, groupUid string, lastSeen int64) ([]Freo return messages, nil } -func GetSignMessagesSince(db *sql.DB, ceremonyUid string, lastSeen int64) ([]FreonSignMessage, error) { +func GetSignMessagesSince(db *sql.DB, ceremonyUid string, lastSeen int64) ([]FreeonSignMessage, error) { stmt, err := db.Prepare(` SELECT msg.id, @@ -381,7 +381,7 @@ func GetSignMessagesSince(db *sql.DB, ceremonyUid string, lastSeen int64) ([]Fre } defer rows.Close() - var messages []FreonSignMessage + var messages []FreeonSignMessage for rows.Next() { var id int64 var ceremony int64 @@ -394,7 +394,7 @@ func GetSignMessagesSince(db *sql.DB, ceremonyUid string, lastSeen int64) ([]Fre if err != nil { return nil, err } - msg := FreonSignMessage{ + msg := FreeonSignMessage{ DbId: id, CeremonyID: ceremony, Sender: sender, @@ -405,7 +405,7 @@ func GetSignMessagesSince(db *sql.DB, ceremonyUid string, lastSeen int64) ([]Fre return messages, nil } -func InsertGroup(db *sql.DB, g FreonGroup) (int64, error) { +func InsertGroup(db *sql.DB, g FreeonGroup) (int64, error) { stmt, err := db.Prepare(`INSERT INTO keygroups (uid, participants, threshold) VALUES (?, ?, ?)`) if err != nil { return 0, err @@ -421,7 +421,7 @@ func InsertGroup(db *sql.DB, g FreonGroup) (int64, error) { return id, nil } -func InsertCeremony(db *sql.DB, c FreonCeremonies) (int64, error) { +func InsertCeremony(db *sql.DB, c FreeonCeremonies) (int64, error) { stmt, err := db.Prepare(`INSERT INTO ceremonies (groupid, uid, active, hash) VALUES (?, ?, ?, ?)`) if err != nil { return 0, err @@ -437,7 +437,7 @@ func InsertCeremony(db *sql.DB, c FreonCeremonies) (int64, error) { return id, nil } -func InsertParticipant(db DBTX, p FreonParticipant) (int64, error) { +func InsertParticipant(db DBTX, p FreeonParticipant) (int64, error) { stmt, err := db.Prepare(`INSERT INTO participants (groupid, uid, partyid) VALUES (?, ?, ?)`) if err != nil { return 0, err @@ -453,7 +453,7 @@ func InsertParticipant(db DBTX, p FreonParticipant) (int64, error) { return id, nil } -func InsertPlayer(db *sql.DB, p FreonPlayers) (int64, error) { +func InsertPlayer(db *sql.DB, p FreeonPlayers) (int64, error) { stmt, err := db.Prepare(`INSERT INTO players (ceremonyid, participantid) VALUES (?, ?)`) if err != nil { return 0, err @@ -469,7 +469,7 @@ func InsertPlayer(db *sql.DB, p FreonPlayers) (int64, error) { return id, nil } -func InsertKeygenMessage(db *sql.DB, m FreonKeygenMessage) (int64, error) { +func InsertKeygenMessage(db *sql.DB, m FreeonKeygenMessage) (int64, error) { stmt, err := db.Prepare(`INSERT INTO keygenmsg (groupid, sender, message) VALUES (?, ?, ?)`) if err != nil { return 0, err @@ -486,7 +486,7 @@ func InsertKeygenMessage(db *sql.DB, m FreonKeygenMessage) (int64, error) { return id, nil } -func InsertSignMessage(db *sql.DB, m FreonSignMessage) (int64, error) { +func InsertSignMessage(db *sql.DB, m FreeonSignMessage) (int64, error) { stmt, err := db.Prepare(`INSERT INTO signmsg (ceremonyid, sender, message) VALUES (?, ?, ?)`) if err != nil { return 0, err @@ -503,9 +503,9 @@ func InsertSignMessage(db *sql.DB, m FreonSignMessage) (int64, error) { return id, nil } -func FinalizeGroup(db *sql.DB, g FreonGroup) error { +func FinalizeGroup(db *sql.DB, g FreeonGroup) error { if g.PublicKey == nil { - return errors.New("public key is not stored in FreonGroup struct") + return errors.New("public key is not stored in FreeonGroup struct") } stmt, err := db.Prepare(`UPDATE keygroups SET publicKey = ? WHERE id = ?`) if err != nil { @@ -518,7 +518,7 @@ func FinalizeGroup(db *sql.DB, g FreonGroup) error { return nil } -func FinalizeSignature(db *sql.DB, c FreonCeremonies, sig string) error { +func FinalizeSignature(db *sql.DB, c FreeonCeremonies, sig string) error { if !c.Active { return errors.New("group is already finalized") } diff --git a/coordinator/internal/database_test.go b/coordinator/internal/database_test.go index b931863..76dd2b0 100644 --- a/coordinator/internal/database_test.go +++ b/coordinator/internal/database_test.go @@ -6,7 +6,7 @@ import ( _ "github.com/ncruces/go-sqlite3/driver" _ "github.com/ncruces/go-sqlite3/embed" - "github.com/soatok/freon/coordinator/internal" + "github.com/soatok/freeon/coordinator/internal" "github.com/stretchr/testify/assert" ) @@ -47,7 +47,7 @@ func TestParticipantFunctions(t *testing.T) { assert.NoError(t, err) // Insert a group - group := internal.FreonGroup{ + group := internal.FreeonGroup{ Uid: "test_group", Participants: 3, Threshold: 2, @@ -56,7 +56,7 @@ func TestParticipantFunctions(t *testing.T) { assert.NoError(t, err) // Insert a participant - p := internal.FreonParticipant{ + p := internal.FreeonParticipant{ GroupID: gid, Uid: "test_participant", PartyID: 1, @@ -84,15 +84,15 @@ func TestCeremonyAndMessageFunctions(t *testing.T) { assert.NoError(t, err) // Insert a group and participant - group := internal.FreonGroup{Uid: "g", Participants: 2, Threshold: 2} + group := internal.FreeonGroup{Uid: "g", Participants: 2, Threshold: 2} gid, err := internal.InsertGroup(db, group) assert.NoError(t, err) - p := internal.FreonParticipant{GroupID: gid, Uid: "p", PartyID: 1} + p := internal.FreeonParticipant{GroupID: gid, Uid: "p", PartyID: 1} pid, err := internal.InsertParticipant(db, p) assert.NoError(t, err) // Insert a ceremony - c := internal.FreonCeremonies{ + c := internal.FreeonCeremonies{ GroupID: gid, Uid: "c", Active: true, @@ -108,7 +108,7 @@ func TestCeremonyAndMessageFunctions(t *testing.T) { assert.Equal(t, c.Uid, cData.Uid) // Insert a player - player := internal.FreonPlayers{ + player := internal.FreeonPlayers{ CeremonyID: cid, ParticipantID: pid, } @@ -136,7 +136,7 @@ func TestCeremonyAndMessageFunctions(t *testing.T) { assert.Equal(t, "sig", *cData.Signature) // InsertKeygenMessage - km := internal.FreonKeygenMessage{ + km := internal.FreeonKeygenMessage{ GroupID: gid, Sender: pid, Message: []byte("keygen message"), @@ -152,7 +152,7 @@ func TestCeremonyAndMessageFunctions(t *testing.T) { assert.Equal(t, km.Message, kms[0].Message) // InsertSignMessage - sm := internal.FreonSignMessage{ + sm := internal.FreeonSignMessage{ CeremonyID: cid, Sender: pid, Message: []byte("sign message"), @@ -174,7 +174,7 @@ func TestGroupFunctions(t *testing.T) { assert.NoError(t, err) // Insert a group - group := internal.FreonGroup{ + group := internal.FreeonGroup{ Uid: "test_group", Participants: 3, Threshold: 2, diff --git a/coordinator/internal/keygen.go b/coordinator/internal/keygen.go index 4de8f98..c6a1828 100644 --- a/coordinator/internal/keygen.go +++ b/coordinator/internal/keygen.go @@ -27,23 +27,23 @@ func NewKeyGroup(db *sql.DB, partySize, threshold uint16) (string, error) { } // Create a blank slate participant ID -func AddParticipant(db *sql.DB, groupUid string) (FreonParticipant, error) { +func AddParticipant(db *sql.DB, groupUid string) (FreeonParticipant, error) { tx, err := db.Begin() if err != nil { - return FreonParticipant{}, err + return FreeonParticipant{}, err } defer tx.Rollback() // Rollback on error groupData, err := GetGroupData(tx, groupUid) if err != nil { - return FreonParticipant{}, err + return FreeonParticipant{}, err } participants, err := GetGroupParticipants(tx, groupUid) if err != nil { - return FreonParticipant{}, err + return FreeonParticipant{}, err } if len(participants) >= int(groupData.Participants) { - return FreonParticipant{}, errors.New("cannot add participant: group is full") + return FreeonParticipant{}, errors.New("cannot add participant: group is full") } // Figure out the maximum party ID for existing participants @@ -54,18 +54,18 @@ func AddParticipant(db *sql.DB, groupUid string) (FreonParticipant, error) { } } if max == 0xFFFF { - return FreonParticipant{}, errors.New("cannot add participant: party ID would overflow") + return FreeonParticipant{}, errors.New("cannot add participant: party ID would overflow") } nextMaxId := max + 1 // Get a unique participant ID uid, err := UniqueID() if err != nil { - return FreonParticipant{}, err + return FreeonParticipant{}, err } uid = "p_" + uid - p := FreonParticipant{ + p := FreeonParticipant{ DbId: int64(0), GroupID: groupData.DbId, Uid: uid, @@ -74,28 +74,28 @@ func AddParticipant(db *sql.DB, groupUid string) (FreonParticipant, error) { } id, err := InsertParticipant(tx, p) if err != nil { - return FreonParticipant{}, err + return FreeonParticipant{}, err } p.DbId = id if err = tx.Commit(); err != nil { - return FreonParticipant{}, err + return FreeonParticipant{}, err } return p, nil } // Add a keygen message to the queue -func AddKeyGenMessage(db *sql.DB, groupUid string, myPartyID uint16, message []byte) (FreonKeygenMessage, error) { +func AddKeyGenMessage(db *sql.DB, groupUid string, myPartyID uint16, message []byte) (FreeonKeygenMessage, error) { group, err := GetGroupData(db, groupUid) if err != nil { - return FreonKeygenMessage{}, err + return FreeonKeygenMessage{}, err } participant, err := GetParticipantID(db, groupUid, myPartyID) if err != nil { - return FreonKeygenMessage{}, err + return FreeonKeygenMessage{}, err } - msg := FreonKeygenMessage{ + msg := FreeonKeygenMessage{ DbId: int64(0), GroupID: group.DbId, Sender: participant, @@ -103,7 +103,7 @@ func AddKeyGenMessage(db *sql.DB, groupUid string, myPartyID uint16, message []b } id, err := InsertKeygenMessage(db, msg) if err != nil { - return FreonKeygenMessage{}, err + return FreeonKeygenMessage{}, err } msg.DbId = id return msg, nil diff --git a/coordinator/internal/keygen_test.go b/coordinator/internal/keygen_test.go index ccb4e9f..ff9e929 100644 --- a/coordinator/internal/keygen_test.go +++ b/coordinator/internal/keygen_test.go @@ -6,7 +6,7 @@ import ( _ "github.com/ncruces/go-sqlite3/driver" _ "github.com/ncruces/go-sqlite3/embed" - "github.com/soatok/freon/coordinator/internal" + "github.com/soatok/freeon/coordinator/internal" "github.com/stretchr/testify/assert" ) diff --git a/coordinator/internal/sign.go b/coordinator/internal/sign.go index dd9d165..6063d1d 100644 --- a/coordinator/internal/sign.go +++ b/coordinator/internal/sign.go @@ -102,25 +102,25 @@ func PollSignCeremony(db *sql.DB, ceremonyID string, myPartyID uint16) (PollSign }, nil } -func AddSignMessage(db *sql.DB, ceremonyUid string, myPartyID uint16, message []byte) (FreonSignMessage, error) { +func AddSignMessage(db *sql.DB, ceremonyUid string, myPartyID uint16, message []byte) (FreeonSignMessage, error) { ceremony, err := GetCeremonyData(db, ceremonyUid) if err != nil { - return FreonSignMessage{}, err + return FreeonSignMessage{}, err } if !ceremony.Active { - return FreonSignMessage{}, errors.New("ceremony is not active or does not exist") + return FreeonSignMessage{}, errors.New("ceremony is not active or does not exist") } group, err := GetGroupByID(db, ceremony.GroupID) if err != nil { - return FreonSignMessage{}, err + return FreeonSignMessage{}, err } participant, err := GetParticipantID(db, group.Uid, myPartyID) if err != nil { - return FreonSignMessage{}, err + return FreeonSignMessage{}, err } - msg := FreonSignMessage{ + msg := FreeonSignMessage{ DbId: int64(0), CeremonyID: ceremony.DbId, Sender: participant, @@ -128,7 +128,7 @@ func AddSignMessage(db *sql.DB, ceremonyUid string, myPartyID uint16, message [] } id, err := InsertSignMessage(db, msg) if err != nil { - return FreonSignMessage{}, err + return FreeonSignMessage{}, err } msg.DbId = id return msg, nil diff --git a/coordinator/internal/sign_test.go b/coordinator/internal/sign_test.go index 103a35c..e7b9495 100644 --- a/coordinator/internal/sign_test.go +++ b/coordinator/internal/sign_test.go @@ -6,7 +6,7 @@ import ( _ "github.com/ncruces/go-sqlite3/driver" _ "github.com/ncruces/go-sqlite3/embed" - "github.com/soatok/freon/coordinator/internal" + "github.com/soatok/freeon/coordinator/internal" "github.com/stretchr/testify/assert" ) diff --git a/coordinator/internal/types.go b/coordinator/internal/types.go index a6486d0..94e54c6 100644 --- a/coordinator/internal/types.go +++ b/coordinator/internal/types.go @@ -1,6 +1,6 @@ package internal -type FreonGroup struct { +type FreeonGroup struct { DbId int64 Uid string Participants uint16 @@ -8,7 +8,7 @@ type FreonGroup struct { PublicKey *string } -type FreonParticipant struct { +type FreeonParticipant struct { DbId int64 GroupID int64 Uid string @@ -16,14 +16,14 @@ type FreonParticipant struct { State []byte } -type FreonKeygenMessage struct { +type FreeonKeygenMessage struct { DbId int64 GroupID int64 Sender int64 Message []byte } -type FreonCeremonies struct { +type FreeonCeremonies struct { DbId int64 GroupID int64 Uid string @@ -35,7 +35,7 @@ type FreonCeremonies struct { } // For public lists of signing ceremonies -type FreonCeremonySummary struct { +type FreeonCeremonySummary struct { Uid string Active bool Hash string @@ -44,14 +44,14 @@ type FreonCeremonySummary struct { OpenSSHNamespace string } -type FreonPlayers struct { +type FreeonPlayers struct { DbId int64 CeremonyID int64 ParticipantID int64 PartyID uint16 } -type FreonSignMessage struct { +type FreeonSignMessage struct { DbId int64 CeremonyID int64 Sender int64 diff --git a/coordinator/internal/util_test.go b/coordinator/internal/util_test.go index f8664f5..9663730 100644 --- a/coordinator/internal/util_test.go +++ b/coordinator/internal/util_test.go @@ -3,7 +3,7 @@ package internal_test import ( "testing" - "github.com/soatok/freon/coordinator/internal" + "github.com/soatok/freeon/coordinator/internal" "github.com/stretchr/testify/assert" ) diff --git a/coordinator/requesttypes.go b/coordinator/requesttypes.go index 5c90193..87c98f9 100644 --- a/coordinator/requesttypes.go +++ b/coordinator/requesttypes.go @@ -1,6 +1,6 @@ package main -import "github.com/soatok/freon/coordinator/internal" +import "github.com/soatok/freeon/coordinator/internal" type ResponseMainPage struct { Message string `json:"message"` @@ -64,7 +64,7 @@ type ListSignRequest struct { Offset *int64 `json:"offset"` } type ListSignResponse struct { - Ceremonies []internal.FreonCeremonySummary + Ceremonies []internal.FreeonCeremonySummary } type JoinSignRequest struct { diff --git a/coordinator/server.go b/coordinator/server.go index dafa7b5..0d06cf0 100644 --- a/coordinator/server.go +++ b/coordinator/server.go @@ -13,7 +13,7 @@ import ( "github.com/alexedwards/scs/v2" _ "github.com/ncruces/go-sqlite3/driver" _ "github.com/ncruces/go-sqlite3/embed" - "github.com/soatok/freon/coordinator/internal" + "github.com/soatok/freeon/coordinator/internal" ) var sessionManager *scs.SessionManager @@ -82,7 +82,7 @@ func sendError(w http.ResponseWriter, e error) { // Handler for index page func indexPage(w http.ResponseWriter, r *http.Request) { - response := ResponseMainPage{Message: "Freon Coordinator v0.0.0"} + response := ResponseMainPage{Message: "Freeon Coordinator v0.0.0"} w.Header().Set("Content-Type", "application/json") json.NewEncoder(w).Encode(response) } diff --git a/coordinator/tests/integration_test.go b/coordinator/tests/integration_test.go index c94e234..02a95eb 100644 --- a/coordinator/tests/integration_test.go +++ b/coordinator/tests/integration_test.go @@ -21,7 +21,7 @@ import ( "filippo.io/age" _ "github.com/ncruces/go-sqlite3/driver" _ "github.com/ncruces/go-sqlite3/embed" - "github.com/soatok/freon/coordinator/internal" + "github.com/soatok/freeon/coordinator/internal" "github.com/stretchr/testify/require" ) @@ -31,7 +31,7 @@ var ( ) func TestMain(m *testing.M) { - tempDir, err := os.MkdirTemp("", "freon-bins-") + tempDir, err := os.MkdirTemp("", "freeon-bins-") if err != nil { fmt.Printf("could not create temp dir: %v", err) os.Exit(1) @@ -89,7 +89,7 @@ func startCoordinator(t *testing.T) *coordinator { t.Helper() // Create a temporary directory for the coordinator's database - dir, err := os.MkdirTemp("", "freon-coordinator-test") + dir, err := os.MkdirTemp("", "freeon-coordinator-test") require.NoError(t, err) t.Cleanup(func() { os.RemoveAll(dir) }) @@ -108,7 +108,7 @@ func startCoordinator(t *testing.T) *coordinator { hostname := fmt.Sprintf("localhost:%d", port) // Create a temporary config file for the coordinator - configFile, err := os.CreateTemp("", "freon-coordinator-config-*.json") + configFile, err := os.CreateTemp("", "freeon-coordinator-config-*.json") require.NoError(t, err) defer os.Remove(configFile.Name()) @@ -150,7 +150,7 @@ func (c *coordinator) stop(t *testing.T) { func newClient(t *testing.T) *client { t.Helper() - homeDir, err := os.MkdirTemp("", "freon-client-test") + homeDir, err := os.MkdirTemp("", "freeon-client-test") require.NoError(t, err) t.Cleanup(func() { os.RemoveAll(homeDir) }) @@ -169,7 +169,7 @@ func newClient(t *testing.T) *client { } } -// run runs a freon client command +// run runs a freeon client command func (c *client) run(t *testing.T, args ...string) (string, error) { t.Helper() diff --git a/go.mod b/go.mod index 25f0b04..8071bdb 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/soatok/freon +module github.com/soatok/freeon go 1.25