Skip to content

Commit 099628e

Browse files
committed
Migrate base92 package to external repository and update dependencies
This commit updates the project to use an external base92 package from github.com/presbrey/pkg, removing the local implementation. Key changes include: 1. Updated import paths for base92 package across multiple files 2. Replaced local base92 encoding methods with new package functions 3. Updated go.mod to include the new external package dependency 4. Upgraded Go version and dependency versions 5. Simplified base92 encoding and decoding calls in main and test files The migration ensures minimal code changes while leveraging an externalized base92 implementation. Dependency management and import paths have been carefully updated to maintain project compatibility.
1 parent edae53d commit 099628e

File tree

8 files changed

+28
-310
lines changed

8 files changed

+28
-310
lines changed

cmd/a2a/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"strings"
1111

1212
"github.com/presbrey/argon2aes"
13-
"github.com/presbrey/argon2aes/pkg/base92"
13+
"github.com/presbrey/pkg/base92"
1414
"github.com/spf13/pflag"
1515
"golang.org/x/term"
1616
)
@@ -150,7 +150,7 @@ func readInput(inputFile string) ([]byte, error) {
150150
} else if useURL64 {
151151
input, err = base64.URLEncoding.DecodeString(string(input))
152152
} else if useBase92 {
153-
input, err = base92.DefaultEncoding.DecodeString(string(input))
153+
input, err = base92.Decode(string(input))
154154
}
155155
return input, err
156156
}
@@ -164,7 +164,7 @@ func writeOutput(outputFile string, data []byte) error {
164164
} else if useURL64 {
165165
output = []byte(base64.RawURLEncoding.EncodeToString(data))
166166
} else if useBase92 {
167-
output = []byte(base92.DefaultEncoding.EncodeToString(data))
167+
output = []byte(base92.Encode(data))
168168
} else {
169169
output = data
170170
}

cmd/a2a/main_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"path/filepath"
99
"testing"
1010

11-
"github.com/presbrey/argon2aes/pkg/base92"
11+
"github.com/presbrey/pkg/base92"
1212
)
1313

1414
func TestMain(t *testing.T) {
@@ -344,7 +344,7 @@ func TestMain(t *testing.T) {
344344
outFile := filepath.Join(tempDir, "encrypted_base92.bin")
345345
decryptedFile := filepath.Join(tempDir, "decrypted_base92.txt")
346346

347-
base92Plaintext := base92.DefaultEncoding.EncodeToString(plaintext)
347+
base92Plaintext := base92.Encode(plaintext)
348348
err := os.WriteFile(inFile, []byte(base92Plaintext), 0644)
349349
if err != nil {
350350
t.Fatalf("Failed to write input file: %v", err)
@@ -385,7 +385,7 @@ func TestMain(t *testing.T) {
385385
}
386386

387387
// Decode base92
388-
decodedDecrypted, err := base92.DefaultEncoding.DecodeString(string(decrypted))
388+
decodedDecrypted, err := base92.Decode(string(decrypted))
389389
if err != nil {
390390
t.Fatalf("Failed to decode base92: %v", err)
391391
}

go.mod

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
module github.com/presbrey/argon2aes
22

3-
go 1.22.6
3+
go 1.24.1
44

5-
require golang.org/x/crypto v0.31.0
5+
require golang.org/x/crypto v0.37.0
6+
7+
require github.com/presbrey/pkg v0.0.0-20250415144029-937e795b1bec
68

79
require (
810
github.com/spf13/pflag v1.0.5
9-
golang.org/x/sys v0.28.0 // indirect
10-
golang.org/x/term v0.27.0
11+
golang.org/x/sys v0.32.0 // indirect
12+
golang.org/x/term v0.31.0
1113
)

go.sum

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
github.com/presbrey/pkg v0.0.0-20250415144029-937e795b1bec h1:hcAYL4+45OjLIepOwfhXQQua+4T0m9j0Gr99YiBwvPw=
2+
github.com/presbrey/pkg v0.0.0-20250415144029-937e795b1bec/go.mod h1:I8Rap5JEPoUt68ti00rORmGKwAf32txqJk5ks074Apw=
13
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
24
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
3-
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
4-
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
5-
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
6-
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
7-
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
8-
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
5+
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
6+
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
7+
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
8+
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
9+
golang.org/x/term v0.31.0 h1:erwDkOK1Msy6offm1mOgvspSkslFnIGsFnxOKoufg3o=
10+
golang.org/x/term v0.31.0/go.mod h1:R4BeIy7D95HzImkxGkTW1UQTtP54tio2RyHz7PwK0aw=

pkg/base92/base92.go

Lines changed: 0 additions & 109 deletions
This file was deleted.

pkg/base92/base92_test.go

Lines changed: 0 additions & 177 deletions
This file was deleted.

pkg/vault/vault.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"time"
1212

1313
"github.com/presbrey/argon2aes"
14-
"github.com/presbrey/argon2aes/pkg/base92"
14+
"github.com/presbrey/pkg/base92"
1515
)
1616

1717
// Vault holds encrypted environment data of various types and provides thread-safe access
@@ -41,7 +41,7 @@ func LoadB92(fsys fs.FS, path, key string) (*Vault, error) {
4141
}
4242

4343
d = []byte(strings.ReplaceAll(string(d), "\n", ""))
44-
d, err = base92.DefaultEncoding.DecodeString(string(d))
44+
d, err = base92.Decode(string(d))
4545
if err != nil {
4646
return nil, err
4747
}

0 commit comments

Comments
 (0)