Skip to content

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

lxfontes added 3 commits July 19, 2024 12:08
Signed-off-by: Lucas Fontes <[email protected]>
Signed-off-by: Lucas Fontes <[email protected]>
@derekcollison derekcollison requested a review from aricart July 22, 2024 16:07
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