Current behavior (JS)
JS CLI implements key create by generating an Ed25519 signer, formatting it as a key string, and printing either:
- default: # then
- --json: pretty JSON { did, key }
export async function createKey({ json }) {
const signer = await ed25519.generate()
const key = ed25519.format(signer)
if (json) {
console.log(JSON.stringify({ did: signer.did(), key }, null, 2))
} else {
console.log(`# ${signer.did()}`)
console.log(key)
}
}
guppy does not have a key create command
Proposed behavior (Go)
- use go-ucanto Ed25519 signer (ed25519.Generate() + ed25519.Format(signer))
- print the same default text format as JS
- Add --json output to guppy key create to match JS
Something like this can be easily added
var keyCreate = &cobra.Command{
Use: "key create",
Short: "Generate and print a new ed25519 key pair",
Long: "Generates and prints a new ed25519 key pair. Does not change your current signing key.",
RunE: func(cmd *cobra.Command, args []string) error {
signer, err := ed25519.Generate()
if err != nil {
return err
}
key, err := ed25519.Format(signer)
if err != nil {
return err
}
did := signer.DID().String()
cmd.Printf("# %s\n%s\n", did, key)
return nil
},
}
Current behavior (JS)
JS CLI implements key create by generating an Ed25519 signer, formatting it as a key string, and printing either:
guppy does not have a key create command
Proposed behavior (Go)
Something like this can be easily added