hypercore-protocol / hypercore-next

Hypercore 10 is an append only log with multi-writer primitives built in.
MIT License
150 stars 15 forks source link

Add support for postload option #34

Closed andrewosh closed 3 years ago

andrewosh commented 3 years ago

In Corestore, we store a core's name/namespace (used for key generation) in Hypercore's new userData header field.

If you first create a core by name (i.e. corestore.get({ name: 'main' })), then you close/reopen the store, and then get it by public key (i.e. corestore.get(key)), the core will not be writable, since the name is the write capability.

With this change, Corestore can attempt to load a name/namespace and do key generation during Hypercore.open, so the name is no longer the write capability.