feat: panel-hosted Reality keys (keyStore, payload keyMaterial, backfill, cleanup)
This commit is contained in:
+6
-1
@@ -20,7 +20,10 @@ function emptyData() {
|
||||
completedJobRetentionDays: 7
|
||||
},
|
||||
users: [], servers: [], agents: [], enrollmentTokens: [], customers: [],
|
||||
nodes: [], nodeClients: [], jobs: [], activity: [], observations: [], subscriptionAccess: [], subscriptionClients: []
|
||||
nodes: [], nodeClients: [], jobs: [], activity: [], observations: [], subscriptionAccess: [], subscriptionClients: [],
|
||||
// Panel-hosted Reality keypairs: { "reality-<nodeId>": { privateKey, publicKey, updatedAt } }.
|
||||
// An object (not a collection), so it is not part of COLLECTIONS validation.
|
||||
keyStore: {}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -40,6 +43,7 @@ class Store {
|
||||
this.data = JSON.parse(raw);
|
||||
this.data.subscriptionAccess ||= [];
|
||||
this.data.subscriptionClients ||= [];
|
||||
this.data.keyStore ||= {};
|
||||
this.#validate(this.data);
|
||||
} catch (error) {
|
||||
if (error.code !== 'ENOENT') throw error;
|
||||
@@ -81,6 +85,7 @@ class Store {
|
||||
const copy = structuredClone(next);
|
||||
copy.subscriptionAccess ||= [];
|
||||
copy.subscriptionClients ||= [];
|
||||
copy.keyStore ||= {};
|
||||
this.#validate(copy);
|
||||
for (const key of Object.keys(draft)) delete draft[key];
|
||||
Object.assign(draft, copy);
|
||||
|
||||
Reference in New Issue
Block a user