You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each device is identified by an "identity key". We need to know which cores belong to which device. Each device should own at most one core in each namespace, and at least one core in the 'auth' namespace.
So that we can use our existing indexer, we can use the device identity public key as docId. The other fields need to be:
e.g. fields names of the format ${namespace}CoreId.
The authCoreId should always match the core ID of the auth core where it is written.
Validation
To validate this message, we need to validate ownership of the secret keys for each core. We can store this in a signature record, where we sign the core keys (as buffers), using the core secret key.
We don't need to convert these to string because we don't need to use them in any SQL queries (unlike the coreId fields above). That saves a round-trip from buffer-string-buffer.
We also need to validate ownership of the identity key - unlikely that someone would say their cores belong to someone else, but maybe best to be sure?
Should we allow core ownership records to be modified? If not we can "trick" sqlite-indexer to only index the first ownership record by:
Before sending to the indexer (e.g. in IndexWriter) check the authCoreId matches the core where it is written
Replace links with an empty array
Pass a custom getWinner function to sqlite-indexer to pick the winner with the lowest index (from versionId)
Should we validate at index time or at read time? Might make sense to keep the validation in the indexer, then we only need to validate once rather than on every read. Should just drop/ignore invalid records.
Where should responsibility for writing the core ownership record lie? It should happen when the auth core is first created. Maybe in CoreManager?
API
classCoreOwnership{constructor({coreManager: CoreManager,authDataStore: DataStore,keyManager: KeyManager})// Write the ownership record to the auth core.writeOwnership(): Promise<void>// Return the identity key of the device that owns the core with the given keygetOwner(coreKey: Buffer): Promise<Buffer>// Return the core key for the core owned by deviceId in the given namespacegetCoreKey(deviceKey: Buffer,namespace: Namespace): Promise<Buffer>}
Should we allow core ownership records to be modified?
Don't have any useful input on this one. Just reading about the "trick" doesn't seem inspiring from a code maintenance perspective, but not sure what allowing modifications entails in practice.
Should we validate at index time or at read time?
Leaning towards at index time
Where should responsibility for writing the core ownership record lie?
Description
Each device is identified by an "identity key". We need to know which cores belong to which device. Each device should own at most one core in each namespace, and at least one core in the 'auth' namespace.
So that we can use our existing indexer, we can use the device identity public key as
docId
. The other fields need to be:e.g. fields names of the format
${namespace}CoreId
.The
authCoreId
should always match the core ID of the auth core where it is written.Validation
To validate this message, we need to validate ownership of the secret keys for each core. We can store this in a signature record, where we sign the core keys (as buffers), using the core secret key.
We don't need to convert these to string because we don't need to use them in any SQL queries (unlike the coreId fields above). That saves a round-trip from buffer-string-buffer.
We also need to validate ownership of the identity key - unlikely that someone would say their cores belong to someone else, but maybe best to be sure?
Questions
authCoreId
matches the core where it is writtenlinks
with an empty arraygetWinner
function to sqlite-indexer to pick the winner with the lowest index (from versionId)API
Tasks
dataType.createWithDocId()
method #190coreOwnership
records toIndexWriter
#210coreOwnership
, but don't expose it to the public APIgetOwner
andgetCoreKey
methodsThe text was updated successfully, but these errors were encountered: