summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-10-28 20:55:36 -0700
committerRose Hogenson <rosehogenson@posteo.net>2025-10-28 20:55:36 -0700
commit25d822ed2251a8dfec8bf5934a067f38d22fae95 (patch)
tree448c41de0dccf5143d0db409a26f50cf74ed0105
parentcbd368cd7549c544bcf64281f6b4126299665639 (diff)
downloadroseh.moe-25d822ed2251a8dfec8bf5934a067f38d22fae95.tar.zst
Switch to ccl
-rw-r--r--go.mod2
-rw-r--r--go.sum4
-rw-r--r--roseh.moe.go29
-rw-r--r--tools/hashpw/hashpw.go4
4 files changed, 17 insertions, 22 deletions
diff --git a/go.mod b/go.mod
index e19a925..951c9f3 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.24.0
require (
golang.org/x/term v0.36.0
- roseh.moe/pkg/asspb v1.2.4
+ roseh.moe/pkg/ccl v0.0.0-20251029033439-2ffdc8b3ded7
roseh.moe/pkg/wordlist v1.0.2
)
diff --git a/go.sum b/go.sum
index f4d29f5..7cd601c 100644
--- a/go.sum
+++ b/go.sum
@@ -4,7 +4,7 @@ golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q=
golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss=
-roseh.moe/pkg/asspb v1.2.4 h1:IMJL+1cTo/7i4kfcF0KqnuM7yt6Q+vzxg1w1xaBmHqM=
-roseh.moe/pkg/asspb v1.2.4/go.mod h1:r7d5GjW56p7O/3Bs164uQd1un5eDAPA5gHj3UK93rE4=
+roseh.moe/pkg/ccl v0.0.0-20251029033439-2ffdc8b3ded7 h1:WmW1ymMGGFX9Ml9AlOvBCfzRjlrwnqfp2RonWIkHLAE=
+roseh.moe/pkg/ccl v0.0.0-20251029033439-2ffdc8b3ded7/go.mod h1:OCcZ30pQDtjXgqgpN8eLo6f/pTi6XVKIHPs1k+gups0=
roseh.moe/pkg/wordlist v1.0.2 h1:riB2RqCU5zXfCQjaPHYTXV/688FV9/Bp6Hnb0IAkP9c=
roseh.moe/pkg/wordlist v1.0.2/go.mod h1:2Jd7j6Qy5SElcrITJJNUcbxH9TPKYn0k+BJL3tsJdiY=
diff --git a/roseh.moe.go b/roseh.moe.go
index 762eb4e..696b64e 100644
--- a/roseh.moe.go
+++ b/roseh.moe.go
@@ -8,7 +8,6 @@ import (
"embed"
"encoding/base64"
"encoding/binary"
- "encoding/hex"
"flag"
"fmt"
"html/template"
@@ -20,7 +19,7 @@ import (
"sync"
"time"
- "roseh.moe/pkg/asspb"
+ "roseh.moe/pkg/ccl"
"roseh.moe/pkg/roseh.moe/internal/pwhash"
"roseh.moe/pkg/wordlist"
)
@@ -28,8 +27,8 @@ import (
var (
port = flag.Int("port", 42069, "port to listen on")
selfURL = flag.String("self-url", "http://localhost:42069", "base URL of the server")
- secretsFile = flag.String("secrets", "secrets.ass", "secrets file")
- configFile = flag.String("config", "config.ass", "configuration file (asspb format https://pkg.go.dev/roseh.moe/pkg/asspb)")
+ secretsFile = flag.String("secrets", "secrets.ccl", "secrets file")
+ configFile = flag.String("config", "config.ccl", "configuration file (ccl format https://pkg.go.dev/roseh.moe/pkg/ccl)")
serverStartTime = time.Now()
)
@@ -42,26 +41,20 @@ func loadSecrets() error {
return err
}
var secretsConfig struct {
- NotepadPassword string
- SecretKey string
+ NotepadPassword []byte
+ SecretKey []byte
}
- if err := asspb.Unmarshal(fileBytes, &secretsConfig); err != nil {
+ if err := ccl.Unmarshal(fileBytes, &secretsConfig); err != nil {
return fmt.Errorf("%s: %s", *secretsFile, err)
}
- if secretsConfig.NotepadPassword == "" {
+ if len(secretsConfig.NotepadPassword) == 0 {
return fmt.Errorf("%s: missing notepad-password", *secretsFile)
}
- if secretsConfig.SecretKey == "" {
+ if len(secretsConfig.SecretKey) == 0 {
return fmt.Errorf("%s: missing secret-key", *secretsFile)
}
- notepadPassword, err = hex.AppendDecode(nil, []byte(secretsConfig.NotepadPassword))
- if err != nil {
- return fmt.Errorf("bad notepad password: %s", err)
- }
- secretKey, err = hex.AppendDecode(nil, []byte(secretsConfig.SecretKey))
- if err != nil {
- return fmt.Errorf("bad secret key: %s", err)
- }
+ notepadPassword = secretsConfig.NotepadPassword
+ secretKey = secretsConfig.SecretKey
return nil
}
@@ -97,7 +90,7 @@ func loadConfig() (*serviceConfiguration, error) {
var fileConfig struct {
Redirect []struct{ Package, Command, To string }
}
- if err := asspb.Unmarshal(fileBytes, &fileConfig); err != nil {
+ if err := ccl.Unmarshal(fileBytes, &fileConfig); err != nil {
return nil, err
}
config := &serviceConfiguration{
diff --git a/tools/hashpw/hashpw.go b/tools/hashpw/hashpw.go
index ac9745d..526ad15 100644
--- a/tools/hashpw/hashpw.go
+++ b/tools/hashpw/hashpw.go
@@ -2,8 +2,10 @@ package main
import (
"crypto/rand"
+ "encoding/base64"
"fmt"
"os"
+ "slices"
"golang.org/x/term"
"roseh.moe/pkg/roseh.moe/internal/pwhash"
@@ -22,7 +24,7 @@ func hashpw() error {
if err != nil {
return err
}
- fmt.Printf("notepad-password=%x%x\n", hash, salt)
+ fmt.Printf("NotepadPassword:%q\n", base64.StdEncoding.EncodeToString(slices.Concat(hash, salt)))
return nil
}