Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ go build -o /tmp/ward ./cmd/ward # build the CLI binary
```

There is no Makefile or CI config; the commands above are the full toolchain.
Go version is pinned to **1.26.4** in `go.mod`.
Go version is pinned to **1.27.1** in `go.mod`.

## Architecture

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ ward install

## ⚡ Requirements

- Go >= **1.26** (to build)
- Go >= **1.27** (to build)
- `git` on `PATH` (used by the pre-commit hook to stage the store)
- Optional: `gpg` with gpg-agent (for the gpg unlock path)
- Optional: an ssh key at `~/.ssh/id_ed25519` or `~/.ssh/id_rsa` (for the ssh unlock path)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/taigrr/gitward

go 1.26.5
go 1.27.1

require (
filippo.io/age v1.3.1
Expand Down
5 changes: 5 additions & 0 deletions internal/crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ import (
// DEKSize is the data-encryption-key length (AES-256).
const DEKSize = 32

const defaultScryptWorkFactor = 18

var scryptWorkFactor = defaultScryptWorkFactor

// NewDEK returns a fresh random data-encryption key.
func NewDEK() ([]byte, error) {
k := make([]byte, DEKSize)
Expand Down Expand Up @@ -160,6 +164,7 @@ func WrapDEKPassphrase(dek []byte, passphrase string) (string, error) {
if err != nil {
return "", err
}
r.SetWorkFactor(scryptWorkFactor)
var buf bytes.Buffer
armorW := armor.NewWriter(&buf)
w, err := age.Encrypt(armorW, r)
Expand Down
12 changes: 12 additions & 0 deletions internal/crypto/scrypt_testhook.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package crypto

// SetScryptWorkFactorForTesting lowers the passphrase KDF cost in tests that
// create many throwaway stores. It returns a restore function for callers that
// need to preserve the previous setting.
func SetScryptWorkFactorForTesting(logN int) func() {
old := scryptWorkFactor
scryptWorkFactor = logN
return func() {
scryptWorkFactor = old
}
}
7 changes: 7 additions & 0 deletions internal/engine/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ import (

const pass = "test-passphrase-123"

func TestMain(m *testing.M) {
restore := crypto.SetScryptWorkFactorForTesting(4)
code := m.Run()
restore()
os.Exit(code)
}

// newRepo creates a throwaway git repo (via go-git, no git binary) and returns
// its root.
func newRepo(t *testing.T) (string, *git.Repository) {
Expand Down
Loading