Skip to content

Commit c965a16

Browse files
author
Paulo Marcos
committed
feat: add currentDevice property to current device
1 parent ce90f54 commit c965a16

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/identities/identity/devices.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class Devices {
111111

112112
if (this.#devicesMap[currentId]) {
113113
this.#devicesMap[currentId] = merge(
114-
{ ...this.#devicesMap[currentId] },
114+
{ ...this.#devicesMap[currentId], current: true },
115115
pick(this.#currentDeviceDescriptor, DESCRIPTOR_SENSITIVE_KEYS),
116116
);
117117
}
@@ -174,11 +174,11 @@ export const createDevices = async (currentDevice, identityDescriptor, didm, sto
174174
await storage.set(getCurrentDeviceKey(identityDescriptor.id), currentDeviceDescriptor, { encrypt: true });
175175
await orbitdbStore.put(currentDeviceDescriptor.id, currentDeviceWithoutSensitiveKeys);
176176

177-
return new Devices(currentDevice, identityDescriptor, didm, orbitdbStore);
177+
return new Devices(currentDeviceDescriptor, identityDescriptor, didm, orbitdbStore);
178178
};
179179

180180
export const restoreDevices = async (identityDescriptor, didm, storage, orbitdb) => {
181-
const currentDeviceDescriptor = await storage.get(getCurrentDeviceKey(identityDescriptor.id));
181+
const currentDeviceDescriptor = await storage.get(identityDescriptor.id);
182182
const orbitdbStore = await loadStore(orbitdb, ORBITDB_STORE_NAME, ORBITDB_STORE_TYPE);
183183

184184
return new Devices(currentDeviceDescriptor, identityDescriptor, didm, orbitdbStore);

0 commit comments

Comments
 (0)