Skip to content

Conversation

@JaredCorduan
Copy link
Contributor

hello again :)

This PR provides the inverse of the existing function decode_seed, a new function named encode_seed which takes a bytestring of length 32 and produces an nkey-encoded seed.

This function can be used to generate nkeys, with the onus of providing proper entropy left to the user. I believe this would resolve #3.

I added a low-tech property test, which checks that encoding followed by decoding is just the identity function. I am a big fan of hypothesis, but I was not sure the appetite here for adding new dependencies.

This function takes a bystring of length 32 and produces an nkey-encoded
seed. This function can be used to generate nkeys (with the onus of
providing proper entropy left to the user).
@JaredCorduan JaredCorduan force-pushed the encode_seed_function branch from 195955f to 259f17c Compare April 26, 2024 15:39
Copy link
Member

@wallyqs wallyqs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wallyqs wallyqs merged commit 7c3f02a into nats-io:main Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing functions to generate nkeys

3 participants