ssbc / ssb-keys

keyfile operations for ssb
36 stars 26 forks source link

allow generate() to return SSB URIs as keys.id #98

Closed staltz closed 2 years ago

staltz commented 2 years ago

Context: we're introducing new feed formats in ssb-db2, but to generate the keys for those feed formats, ...

Problem: we're calling generate() and then mutating the return value keys such that keys.id is an SSB URI for the corresponding feed type. Sad example: https://github.com/ssbc/ssb-db2/blob/f976aac9a4bd4ee804b9f4cd24511dec52cb5d9d/test/basic.js#L372-L376

Solution: this PR allows you to pass an argument to generate() informing it of which feed format this key is for, which then automatically determines what the keys.id should be.