Compare commits
2
Commits
72dd386bbf
...
4e1258302f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e1258302f | ||
|
|
f8c796db9b |
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 sneak
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
# which needs the version stamped into the binary.
|
# which needs the version stamped into the binary.
|
||||||
|
|
||||||
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
||||||
LDFLAGS := -s -w -X 'git.eeqj.de/sneak/keyfunc/internal/cli.Version=$(VERSION)'
|
LDFLAGS := -s -w -X 'sneak.berlin/go/keyfunc/internal/cli.Version=$(VERSION)'
|
||||||
|
|
||||||
.PHONY: default bootstrap setup build test lint fmt fmt-check check \
|
.PHONY: default bootstrap setup build test lint fmt fmt-check check \
|
||||||
docker cibuild hooks clean
|
docker cibuild hooks clean
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
# keyfunc
|
# keyfunc
|
||||||
|
|
||||||
`keyfunc` is a Go command-line tool by [@sneak](https://sneak.berlin) — its
|
`keyfunc` is an MIT-licensed Go command-line tool by
|
||||||
license is not yet chosen
|
[@sneak](https://sneak.berlin) that turns a BIP-39 mnemonic into SSH keys, age
|
||||||
([#14](https://git.eeqj.de/sneak/keyfunc/issues/14)) — that turns a BIP-39
|
identities and child mnemonics, each of which can be recreated from that
|
||||||
mnemonic into SSH keys, age identities and child mnemonics, each of which can be
|
mnemonic at any time. The same mnemonic, key type and index always give the same
|
||||||
recreated from that mnemonic at any time. The same mnemonic, key type and index
|
key.
|
||||||
always give the same key.
|
|
||||||
|
|
||||||
It uses the BIP-85 entropy deriver from `git.eeqj.de/sneak/secret/pkg/bip85` and
|
It uses the BIP-85 entropy deriver from `git.eeqj.de/sneak/secret/pkg/bip85` and
|
||||||
takes the same steps as that repository's `agehd` package.
|
takes the same steps as that repository's `agehd` package.
|
||||||
@@ -16,7 +15,13 @@ them, and `keyfunc mnemonic ...` for child mnemonics derived from the main one.
|
|||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
Build from a clone and run the binary:
|
Install with Go:
|
||||||
|
|
||||||
|
```
|
||||||
|
go install sneak.berlin/go/keyfunc/cmd/keyfunc@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Or build from a clone and run the binary:
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone git@git.eeqj.de:sneak/keyfunc.git
|
git clone git@git.eeqj.de:sneak/keyfunc.git
|
||||||
@@ -306,14 +311,14 @@ standard: most Makefile targets are thin shims over an executable in
|
|||||||
|
|
||||||
The open issues that stand between the tree and a 1.0 release:
|
The open issues that stand between the tree and a 1.0 release:
|
||||||
|
|
||||||
- [#14 Choose a license and add LICENSE](https://git.eeqj.de/sneak/keyfunc/issues/14)
|
- [#38 Lint and test as phases of the Dockerfile, as the current repo policy requires](https://git.eeqj.de/sneak/keyfunc/issues/38)
|
||||||
- [#15 Decide the Go module path before 1.0](https://git.eeqj.de/sneak/keyfunc/issues/15)
|
- [#39 make fmt and make fmt-check cover Markdown with prettier](https://git.eeqj.de/sneak/keyfunc/issues/39)
|
||||||
|
- [#40 The linter config, .gitignore and .dockerignore from the current templates](https://git.eeqj.de/sneak/keyfunc/issues/40)
|
||||||
|
- [#42 go-bip39 no longer exists upstream: keep it, or copy it into the repo?](https://git.eeqj.de/sneak/keyfunc/issues/42)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Not yet chosen. The license is the owner's decision, still open on the tracker
|
MIT. The full text is in [`LICENSE`](LICENSE).
|
||||||
([#14](https://git.eeqj.de/sneak/keyfunc/issues/14)); the `LICENSE` file is added
|
|
||||||
when that issue is answered.
|
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/cli"
|
"sneak.berlin/go/keyfunc/internal/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module git.eeqj.de/sneak/keyfunc
|
module sneak.berlin/go/keyfunc
|
||||||
|
|
||||||
go 1.26.0
|
go 1.26.0
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/agekey"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/derive"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/agekey"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/derive"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The recipients the example mnemonic produces at the first two
|
// The recipients the example mnemonic produces at the first two
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/derive"
|
|
||||||
"git.eeqj.de/sneak/secret/pkg/bip85"
|
"git.eeqj.de/sneak/secret/pkg/bip85"
|
||||||
"github.com/btcsuite/btcd/btcutil/hdkeychain"
|
"github.com/btcsuite/btcd/btcutil/hdkeychain"
|
||||||
bip39 "github.com/tyler-smith/go-bip39"
|
bip39 "github.com/tyler-smith/go-bip39"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/derive"
|
||||||
)
|
)
|
||||||
|
|
||||||
// english is the number BIP-85 gives the English word list.
|
// english is the number BIP-85 gives the English word list.
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/childmnemonic"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/derive"
|
|
||||||
"github.com/btcsuite/btcd/btcutil/hdkeychain"
|
"github.com/btcsuite/btcd/btcutil/hdkeychain"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
bip39 "github.com/tyler-smith/go-bip39"
|
bip39 "github.com/tyler-smith/go-bip39"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/childmnemonic"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/derive"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The lengths the tool offers, and one it does not.
|
// The lengths the tool offers, and one it does not.
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/agekey"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/cli/options"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/derive"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/agekey"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/cli/options"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/derive"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Command returns the age command and everything under it.
|
// Command returns the age command and everything under it.
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/agekey"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/mnemonic"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/agekey"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/mnemonic"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTheAgeCommandsPrintTheKey(t *testing.T) {
|
func TestTheAgeCommandsPrintTheKey(t *testing.T) {
|
||||||
|
|||||||
+4
-4
@@ -10,11 +10,11 @@ import (
|
|||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/cli/age"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/cli/mnemonic"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/cli/options"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/cli/ssh"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/cli/age"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/cli/mnemonic"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/cli/options"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/cli/ssh"
|
||||||
)
|
)
|
||||||
|
|
||||||
// devVersion is what Version holds until a build stamps a real one.
|
// devVersion is what Version holds until a build stamps a real one.
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/childmnemonic"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/cli"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/derive"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/mnemonic"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
bip39 "github.com/tyler-smith/go-bip39"
|
bip39 "github.com/tyler-smith/go-bip39"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/childmnemonic"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/cli"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/derive"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/mnemonic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The two lines the README says the example mnemonic produces.
|
// The two lines the README says the example mnemonic produces.
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ package mnemonic
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/childmnemonic"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/cli/options"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/derive"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/childmnemonic"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/cli/options"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/derive"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Command returns the mnemonic command.
|
// Command returns the mnemonic command.
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ package options
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/mnemonic"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/mnemonic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Add gives a command the flags that every command has. They are
|
// Add gives a command the flags that every command has. They are
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/cli/options"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/derive"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/mnemonic"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/sshkey"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/cli/options"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/derive"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/mnemonic"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/sshkey"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Command returns the ssh command and everything under it.
|
// Command returns the ssh command and everything under it.
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/cli"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/cli/ssh"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/mnemonic"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/cli"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/cli/ssh"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/mnemonic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// runAsTool, set in the environment of a re-executed test binary, tells
|
// runAsTool, set in the environment of a re-executed test binary, tells
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/derive"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/derive"
|
||||||
)
|
)
|
||||||
|
|
||||||
// application is the number the SSH key type uses.
|
// application is the number the SSH key type uses.
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/mnemonic"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/mnemonic"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Two more mnemonics that pass the checksum, so a test can tell which
|
// Two more mnemonics that pass the checksum, so a test can tell which
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/derive"
|
|
||||||
"git.eeqj.de/sneak/keyfunc/internal/sshkey"
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
"golang.org/x/crypto/ssh/agent"
|
"golang.org/x/crypto/ssh/agent"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/derive"
|
||||||
|
"sneak.berlin/go/keyfunc/internal/sshkey"
|
||||||
)
|
)
|
||||||
|
|
||||||
// agentDirectoryMode is what the directory holding the agent socket
|
// agentDirectoryMode is what the directory holding the agent socket
|
||||||
|
|||||||
Reference in New Issue
Block a user