Skip to main content

@idpass/data-collect-core / DeviceIdentity

Class: DeviceIdentity

Defined in: services/DeviceIdentity.ts:37

Constructors​

Constructor​

new DeviceIdentity(): DeviceIdentity

Returns​

DeviceIdentity

Methods​

getOrCreateDeviceId()​

getOrCreateDeviceId(): Promise<string>

Defined in: services/DeviceIdentity.ts:60

Return the persisted device id, generating and persisting one if absent.

Returns​

Promise<string>


reset()​

reset(): Promise<void>

Defined in: services/DeviceIdentity.ts:86

Drop the persisted id so the next call generates a new one. Provided for test ergonomics and the (rare) operator-initiated re-enrollment flow.

Returns​

Promise<void>


close()​

close(): Promise<void>

Defined in: services/DeviceIdentity.ts:103

Close the underlying IndexedDB connection. Required before any caller can indexedDB.deleteDatabase(...) — open connections block deletion. Mainly used by tests; production code holds a single instance for the lifetime of the app.

Returns​

Promise<void>