refactor: swap pkg/{io,log,i18n} imports to go-io/go-log/go-i18n
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
f597122a1a
commit
7468c38906
15 changed files with 36 additions and 24 deletions
|
|
@ -36,12 +36,12 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
coreerr "forge.lthn.ai/core/go/pkg/framework/core"
|
||||
coreerr "forge.lthn.ai/core/go-log"
|
||||
|
||||
"forge.lthn.ai/core/go-crypt/crypt"
|
||||
"forge.lthn.ai/core/go-crypt/crypt/lthn"
|
||||
"forge.lthn.ai/core/go-crypt/crypt/pgp"
|
||||
"forge.lthn.ai/core/go/pkg/io"
|
||||
"forge.lthn.ai/core/go-io"
|
||||
)
|
||||
|
||||
// Default durations for challenge and session lifetimes.
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
"forge.lthn.ai/core/go-crypt/crypt/lthn"
|
||||
"forge.lthn.ai/core/go-crypt/crypt/pgp"
|
||||
"forge.lthn.ai/core/go/pkg/io"
|
||||
"forge.lthn.ai/core/go-io"
|
||||
)
|
||||
|
||||
// helper creates a fresh Authenticator backed by MockMedium.
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
"github.com/stretchr/testify/require"
|
||||
|
||||
"forge.lthn.ai/core/go-crypt/crypt/lthn"
|
||||
"forge.lthn.ai/core/go/pkg/io"
|
||||
"forge.lthn.ai/core/go-io"
|
||||
)
|
||||
|
||||
// --- MemorySessionStore ---
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ package testcmd
|
|||
|
||||
import (
|
||||
"forge.lthn.ai/core/cli/pkg/cli"
|
||||
"forge.lthn.ai/core/go/pkg/i18n"
|
||||
"forge.lthn.ai/core/go-i18n"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/i18n"
|
||||
"forge.lthn.ai/core/go-i18n"
|
||||
)
|
||||
|
||||
type packageCoverage struct {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
"runtime"
|
||||
"strings"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/i18n"
|
||||
"forge.lthn.ai/core/go-i18n"
|
||||
)
|
||||
|
||||
func runTest(verbose, coverage, short bool, pkg, run string, race, jsonOutput bool) error {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
|
||||
core "forge.lthn.ai/core/go/pkg/framework/core"
|
||||
core "forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// SHA256File computes the SHA-256 checksum of a file and returns it as a hex string.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package crypt
|
||||
|
||||
import (
|
||||
core "forge.lthn.ai/core/go/pkg/framework/core"
|
||||
core "forge.lthn.ai/core/go-log"
|
||||
)
|
||||
|
||||
// Encrypt encrypts data with a passphrase using ChaCha20-Poly1305.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
core "forge.lthn.ai/core/go/pkg/framework/core"
|
||||
core "forge.lthn.ai/core/go-log"
|
||||
"golang.org/x/crypto/argon2"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
"crypto/sha256"
|
||||
"io"
|
||||
|
||||
core "forge.lthn.ai/core/go/pkg/framework/core"
|
||||
core "forge.lthn.ai/core/go-log"
|
||||
"golang.org/x/crypto/argon2"
|
||||
"golang.org/x/crypto/hkdf"
|
||||
"golang.org/x/crypto/scrypt"
|
||||
|
|
|
|||
|
|
@ -9,16 +9,18 @@ import (
|
|||
"github.com/ProtonMail/go-crypto/openpgp"
|
||||
"github.com/ProtonMail/go-crypto/openpgp/armor"
|
||||
"github.com/ProtonMail/go-crypto/openpgp/packet"
|
||||
core "forge.lthn.ai/core/go/pkg/framework/core"
|
||||
|
||||
core "forge.lthn.ai/core/go-log"
|
||||
framework "forge.lthn.ai/core/go/pkg/framework/core"
|
||||
)
|
||||
|
||||
// Service implements the core.Crypt interface using OpenPGP.
|
||||
// Service implements the framework.Crypt interface using OpenPGP.
|
||||
type Service struct {
|
||||
core *core.Core
|
||||
core *framework.Core
|
||||
}
|
||||
|
||||
// New creates a new OpenPGP service instance.
|
||||
func New(c *core.Core) (any, error) {
|
||||
func New(c *framework.Core) (any, error) {
|
||||
return &Service{core: c}, nil
|
||||
}
|
||||
|
||||
|
|
@ -172,7 +174,7 @@ func (s *Service) DecryptPGP(privateKey, message, passphrase string, opts ...any
|
|||
}
|
||||
|
||||
// HandleIPCEvents handles PGP-related IPC messages.
|
||||
func (s *Service) HandleIPCEvents(c *core.Core, msg core.Message) error {
|
||||
func (s *Service) HandleIPCEvents(c *framework.Core, msg framework.Message) error {
|
||||
switch m := msg.(type) {
|
||||
case map[string]any:
|
||||
action, _ := m["action"].(string)
|
||||
|
|
@ -187,5 +189,5 @@ func (s *Service) HandleIPCEvents(c *core.Core, msg core.Message) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Ensure Service implements core.Crypt.
|
||||
var _ core.Crypt = (*Service)(nil)
|
||||
// Ensure Service implements framework.Crypt.
|
||||
var _ framework.Crypt = (*Service)(nil)
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ import (
|
|||
"bytes"
|
||||
"testing"
|
||||
|
||||
core "forge.lthn.ai/core/go/pkg/framework/core"
|
||||
framework "forge.lthn.ai/core/go/pkg/framework/core"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestCreateKeyPair(t *testing.T) {
|
||||
c, _ := core.New()
|
||||
c, _ := framework.New()
|
||||
s := &Service{core: c}
|
||||
|
||||
privKey, err := s.CreateKeyPair("test user", "password123")
|
||||
|
|
@ -19,7 +19,7 @@ func TestCreateKeyPair(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestEncryptDecrypt(t *testing.T) {
|
||||
c, _ := core.New()
|
||||
c, _ := framework.New()
|
||||
s := &Service{core: c}
|
||||
|
||||
passphrase := "secret"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"crypto/cipher"
|
||||
"crypto/rand"
|
||||
|
||||
core "forge.lthn.ai/core/go/pkg/framework/core"
|
||||
core "forge.lthn.ai/core/go-log"
|
||||
"golang.org/x/crypto/chacha20poly1305"
|
||||
)
|
||||
|
||||
|
|
|
|||
5
go.mod
5
go.mod
|
|
@ -5,6 +5,9 @@ go 1.26.0
|
|||
require (
|
||||
forge.lthn.ai/core/cli v0.1.0
|
||||
forge.lthn.ai/core/go v0.1.0
|
||||
forge.lthn.ai/core/go-i18n v0.0.1
|
||||
forge.lthn.ai/core/go-io v0.0.1
|
||||
forge.lthn.ai/core/go-log v0.0.1
|
||||
forge.lthn.ai/core/go-store v0.1.3
|
||||
github.com/ProtonMail/go-crypto v1.3.0
|
||||
github.com/spf13/cobra v1.10.2
|
||||
|
|
@ -13,6 +16,7 @@ require (
|
|||
)
|
||||
|
||||
require (
|
||||
forge.lthn.ai/core/go-inference v0.0.1 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/charmbracelet/bubbletea v1.3.10 // indirect
|
||||
github.com/charmbracelet/colorprofile v0.4.2 // indirect
|
||||
|
|
@ -28,7 +32,6 @@ require (
|
|||
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-localereader v0.0.1 // indirect
|
||||
|
|
|
|||
9
go.sum
9
go.sum
|
|
@ -2,6 +2,14 @@ forge.lthn.ai/core/cli v0.1.0 h1:2XRiEMVzUElnQlZnHYDyfKIKQVPcCzGuYHlnz55GjsM=
|
|||
forge.lthn.ai/core/cli v0.1.0/go.mod h1:mZ7dzccfzo0BP2dE7Mwuw9dXuIowiEd1G5ZGMoLuxVc=
|
||||
forge.lthn.ai/core/go v0.1.0 h1:Ow/1NTajrrNPO0zgkskEyEGdx4SKpiNqTaqM0txNOYI=
|
||||
forge.lthn.ai/core/go v0.1.0/go.mod h1:lwi0tccAlg5j3k6CfoNJEueBc5l9mUeSBX/x6uY8ZbQ=
|
||||
forge.lthn.ai/core/go-i18n v0.0.1 h1:7I2cOv3GCc7MssLny/CAnwz3L7/Y4iqwzrCRQMQ+teA=
|
||||
forge.lthn.ai/core/go-i18n v0.0.1/go.mod h1:nyiGwZ3jV4h9Yge6mSrKVTo7CI1LI/p3ydI+9jUnMtk=
|
||||
forge.lthn.ai/core/go-inference v0.0.1 h1:hf5eOzm5sNDifhb0BscMTyKEkB44r2Tv58wakHGvtz4=
|
||||
forge.lthn.ai/core/go-inference v0.0.1/go.mod h1:pq2JCmbWLHgik0QdAflGb3raJcCGC44xt8rCUtDjFys=
|
||||
forge.lthn.ai/core/go-io v0.0.1 h1:N/GCl6Asusfr4gs53JZixJVtqcnerQ6GcxSN8F8iJXY=
|
||||
forge.lthn.ai/core/go-io v0.0.1/go.mod h1:l+gG/G5TMIOTG8G7y0dg4fh1a7Suy8wCYVwsz4duV7M=
|
||||
forge.lthn.ai/core/go-log v0.0.1 h1:x/E6EfF9vixzqiLHQOl2KT25HyBcMc9qiBkomqVlpPg=
|
||||
forge.lthn.ai/core/go-log v0.0.1/go.mod h1:r14MXKOD3LF/sI8XUJQhRk/SZHBE7jAFVuCfgkXoZPw=
|
||||
forge.lthn.ai/core/go-store v0.1.3 h1:CSVTRdsOXm2pl+FCs12fHOc9eM88DcZRY6HghN98w/I=
|
||||
forge.lthn.ai/core/go-store v0.1.3/go.mod h1:op+ftjAqYskPv4OGvHZQf7/DLiRnFIdT0XCQTKR/GjE=
|
||||
github.com/ProtonMail/go-crypto v1.3.0 h1:ILq8+Sf5If5DCpHQp4PbZdS1J7HDFRXz/+xKBiRGFrw=
|
||||
|
|
@ -27,7 +35,6 @@ github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJ
|
|||
github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg8=
|
||||
github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue