fission-codes / fission

Fission CLI & server
https://runfission.com/docs
119 stars 14 forks source link

Add generate credentials command #612

Closed bgins closed 2 years ago

bgins commented 2 years ago

Summary

This PR adds a fission generate credentials command to create Ed25519 key pairs and their associated DIDs.

This PR fixes/implements the following bugs/features

The credentials subcommand has no options and only generates Ed25519 key pairs

Β»  ~/.local/bin/fission generate credentials --help
Usage: fission generate credentials 
  Generate an Ed25519 key pair and an associated DID

Available options:
  -h,--help                Show this help text

The output prints a private key, public key, and DID

Β»  ~/.local/bin/fission generate credentials
βœ… Generated an Ed25519 key pair and associated DID
πŸ—οΈ  Private key: <private-key>
πŸ”‘ Public key: <public-key>
πŸ†” DID: <DID>

This PR also adds a top-level generate command with no fallbacks. It must be used with the credentials subcommand. The description for the generate command in fission --help is "Generate key pairs and DIDs".

Test plan (required)

Compile, then run the fission credentials generate command to generate a test key pair and DID.

Check the help text for fission, fission generate and fission generate credentials.

Closing issues

Closes #613

Tasks

After Merge

expede commented 2 years ago

Code looks super reasonable πŸ™Œ I'm just going to build it and take it for a spin :)

expede commented 2 years ago

Looks good πŸ™Œ

[nix-shell:~/Documents/Work/Fission/fission]$ fission generate credentials
βœ… Generated an Ed25519 key pair and associated DID
πŸ—οΈ  Private key: [XXXXXXXXXXXXXXXXX]
πŸ”‘ Public key: U/yng963O2x+zVk+QlQAsMkgwyU2r1sMQWUALX6DEXU=
πŸ†” DID: did:key:z6Mkk77LH6Qh1rPPqcdegByTKj9LKRHphKdotyr3skm6AYct

Will the extra πŸ”‘ Public key field be confusing for this use case? πŸ€” I guess it's good to have it to be generic?

expede commented 2 years ago

Oh @bgins don't forget to bump the version before merging!

bgins commented 2 years ago

Will the extra πŸ”‘ Public key field be confusing for this use case? πŸ€” I guess it's good to have it to be generic?

@expede keeping it general was my thought here. We won't need it for the app append feature, but it could be useful in other use cases. We can write up some instructions for the append feature/commands explaining that they'll only need the private key and DID.