Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom PrefixByte Support #66

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Custom PrefixByte Support #66

wants to merge 3 commits into from

Conversation

lxfontes
Copy link

Allow programs to introduce their own prefixes, avoiding collision with known prefixes.
Scenario: Signing binary 'modules' using pub keys prefixed with M.

var modulePrefix PrefixByte = 12 << 3 // Base32-encodes to 'M...'

// register new prefix
nkeys.AddPublicPrefix(modulePrefix, "module")

// creating a new pair
moduleKey, _ := CreatePair(modulePrefix)

// prefix name Stringer returns 'module' instead of 'unknown'
modulePrefix.String()

// use .PrivateKey(), .PublicKey(), .Sign(), .Verify() as usual

The resulting data looks like:

Seed SMAPILBZ447DMKKISBEUPTV4M6OMLGPSGSZDWEYRDH3OPSCFW2HG5H5CNQ
Pub MDDWNXZNY4OM2EFCQO7MOPOS4SGHOVBNV5GZ53T3LWHMHRSN5VFDFN6Y
Private PD2CYOPHHY3CSSEQJFD45PDHTTCZT4RUWI5RGEIZ63T4QRNWRZXJ7R3G34W4OHGNCCRIHPWHHXJOJDDXKQW26TM65Z5V3DWDYZG62SRSHSQQ

Signed-off-by: Lucas Fontes <[email protected]>
Signed-off-by: Lucas Fontes <[email protected]>
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.

1 participant