all: switch key format to Bech32

Use the BIP173 format, which is whole-word selectable, markup safe, and
case insensitive.

AGE-SECRET-KEY-1FPSHVEFQXYSX5MMFDE6ZCGRTV4JHQGRFWSS8WETVDSSX76TVV4JQU272CR

See https://groups.google.com/d/msg/age-dev/UAjkvLoCr9I/l4Q1h3OPAgAJ.

All bech32 Go packages have funky APIs, internal types, or case
handling, so include a heavily refactored version of the reference
implementation, and the tests from github.com/btcsuite/btcutil/bech32.
This commit is contained in:
Filippo Valsorda
2019-12-27 17:13:20 +01:00
committed by Filippo Valsorda
parent 8c600131ec
commit 9a84e437b1
6 changed files with 303 additions and 18 deletions
+1 -1
View File
@@ -53,6 +53,6 @@ func generate(out io.Writer) {
}
fmt.Fprintf(out, "# created: %s\n", time.Now().Format(time.RFC3339))
fmt.Fprintf(out, "# %s\n", k.Recipient())
fmt.Fprintf(out, "# public key: %s\n", k.Recipient())
fmt.Fprintf(out, "%s\n", k)
}
+1 -1
View File
@@ -21,7 +21,7 @@ import (
func parseRecipient(arg string) (age.Recipient, error) {
switch {
case strings.HasPrefix(arg, "pubkey:"):
case strings.HasPrefix(arg, "age1"):
return age.ParseX25519Recipient(arg)
case strings.HasPrefix(arg, "ssh-"):
return age.ParseSSHRecipient(arg)