@sovereignbase/explorer 0.0.0-alpha.5 → 0.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/class.cjs +115 -39
- package/dist/class.cjs.map +1 -1
- package/dist/class.d.cts +82 -34
- package/dist/class.d.cts.map +1 -1
- package/dist/class.d.ts +82 -34
- package/dist/class.d.ts.map +1 -1
- package/dist/class.js +116 -40
- package/dist/class.js.map +1 -1
- package/package.json +3 -3
package/dist/class.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { URLString } from "@sovereignbase/storage";
|
|
3
3
|
import { DeepReadonly } from "@sovereignbase/utils";
|
|
4
|
-
import { CipherKey } from "@sovereignbase/cryptosuite";
|
|
4
|
+
import { CipherKey, CipherMessage, DecapsulateKey, EncapsulateKey, KeyOffer } from "@sovereignbase/cryptosuite";
|
|
5
5
|
import { SequencedArrayChange, SequencedArrayDelta } from "@sovereignbase/sequenced";
|
|
6
6
|
import { DeviceBindingStorage } from "@sovereignbase/hardware-bound";
|
|
7
7
|
/**
|
|
@@ -73,6 +73,8 @@ export type AuthenticationResult =
|
|
|
73
73
|
export type AuthenticationSetupParams = Readonly<{
|
|
74
74
|
/** The display name assigned to the credential. */
|
|
75
75
|
credentialName: string;
|
|
76
|
+
/** Optional virtual entropy used to establish an existing database. */
|
|
77
|
+
virtualEntropy?: Uint8Array;
|
|
76
78
|
/** The storage mechanism used to bind the credential to the device. */
|
|
77
79
|
bindingStorage: DeviceBindingStorage;
|
|
78
80
|
}>;
|
|
@@ -135,20 +137,27 @@ export declare class ExplorerError extends Error {
|
|
|
135
137
|
constructor(code: ExplorerErrorCode, message?: string, options?: ErrorOptions);
|
|
136
138
|
}
|
|
137
139
|
/**
|
|
138
|
-
* Provides
|
|
139
|
-
* the database's synchronized entries.
|
|
140
|
+
* Provides access to an authenticated Sovereignbase database.
|
|
140
141
|
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
142
|
+
* Manages database authentication, encrypted object storage, credential
|
|
143
|
+
* registration, database linking, and synchronized entries.
|
|
143
144
|
*/
|
|
144
145
|
export declare class Explorer {
|
|
145
146
|
/** The identifier of the authenticated database. */
|
|
146
147
|
static databaseID: string;
|
|
147
|
-
/** Indicates whether
|
|
148
|
+
/** Indicates whether a database has been authenticated. */
|
|
148
149
|
static isAuthenticated: boolean;
|
|
150
|
+
/** The base URL used to access database objects. */
|
|
149
151
|
private static storageURL;
|
|
152
|
+
/** The event target used for Explorer events. */
|
|
150
153
|
private static eventTarget?;
|
|
154
|
+
/** The data PIN associated with the current session. */
|
|
155
|
+
private static dataPIN;
|
|
156
|
+
/** The virtual entropy associated with the authenticated database. */
|
|
157
|
+
private static virtualEntropy;
|
|
158
|
+
/** The secret used to access the authenticated database. */
|
|
151
159
|
private static databaseSecret;
|
|
160
|
+
/** The credential information associated with the current authentication. */
|
|
152
161
|
private static sessionCredential?;
|
|
153
162
|
/**
|
|
154
163
|
* Caches cipher keys by object identifier.
|
|
@@ -158,48 +167,80 @@ export declare class Explorer {
|
|
|
158
167
|
*/
|
|
159
168
|
static readonly cipherKeyCache: Map<string, CipherKey>;
|
|
160
169
|
/**
|
|
161
|
-
* Authenticates a database using a data PIN and device
|
|
170
|
+
* Authenticates a database using a data PIN and an existing device binding.
|
|
162
171
|
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* new credential. Otherwise, loads the existing credential.
|
|
172
|
+
* Establishes the authenticated database context and records the credential
|
|
173
|
+
* used for authentication.
|
|
166
174
|
*
|
|
167
|
-
*
|
|
175
|
+
* When setup parameters are provided, registers a credential using the
|
|
176
|
+
* supplied virtual entropy or generates new virtual entropy.
|
|
168
177
|
*
|
|
169
|
-
* @param dataPIN The PIN
|
|
170
|
-
* @param storageURL The base URL used to access
|
|
171
|
-
* @param setupParams Optional parameters for
|
|
178
|
+
* @param dataPIN The PIN associated with the database.
|
|
179
|
+
* @param storageURL The base URL used to access database objects.
|
|
180
|
+
* @param setupParams Optional parameters for registering a credential.
|
|
181
|
+
*
|
|
182
|
+
* @param credentialId An optional credential identifier used to restrict credential selection.
|
|
172
183
|
* @returns The authentication result.
|
|
173
184
|
*/
|
|
174
|
-
static authenticate(dataPIN: string, storageURL: URLString, setupParams?: AuthenticationSetupParams): Promise<AuthenticationResult>;
|
|
185
|
+
static authenticate(dataPIN: string, storageURL: URLString, setupParams?: AuthenticationSetupParams, credentialId?: string): Promise<AuthenticationResult>;
|
|
186
|
+
/** The number of consecutive failed database linking PIN attempts. */
|
|
187
|
+
private static failCounter;
|
|
188
|
+
/**
|
|
189
|
+
* Prepares an authenticated database for linking to another device.
|
|
190
|
+
*
|
|
191
|
+
* Verifies the current data PIN and prepares an encrypted transfer
|
|
192
|
+
* containing the information required to access the same database.
|
|
193
|
+
*
|
|
194
|
+
* Repeated PIN failures cause the current page to reload.
|
|
195
|
+
*
|
|
196
|
+
* @param dataPIN The PIN associated with the authenticated database.
|
|
197
|
+
* @param encapsulateKey The key used to establish encryption for the transfer.
|
|
198
|
+
* @returns The key offer and encrypted transfer message, or `false`
|
|
199
|
+
* if the supplied PIN is incorrect.
|
|
200
|
+
*/
|
|
201
|
+
static prepareDatabaseLink(dataPIN: string, encapsulateKey: EncapsulateKey): Promise<[keyOffer: KeyOffer, cipherMessage: CipherMessage] | false>;
|
|
175
202
|
/**
|
|
176
|
-
*
|
|
203
|
+
* Links the current device to an existing database.
|
|
177
204
|
*
|
|
178
|
-
*
|
|
205
|
+
* Accesses the transferred database information, creates a device binding,
|
|
206
|
+
* and registers a credential for the existing database.
|
|
207
|
+
*
|
|
208
|
+
* @param keyOffer The key offer associated with the database link.
|
|
209
|
+
* @param cipherMessage The encrypted database linking message.
|
|
210
|
+
* @param decapsulateKey The key used to establish decryption for the transfer.
|
|
211
|
+
* @param credentialName The display name assigned to the new credential.
|
|
212
|
+
* @param storageURL The base URL used to access database objects.
|
|
213
|
+
* @returns `true` if the database was linked and authenticated;
|
|
214
|
+
* otherwise, `false`.
|
|
215
|
+
*/
|
|
216
|
+
static linkToDatabase(keyOffer: KeyOffer, cipherMessage: CipherMessage, decapsulateKey: DecapsulateKey, credentialName: string, storageURL: URLString): Promise<boolean>;
|
|
217
|
+
/**
|
|
218
|
+
* Permanently revokes a registered database credential.
|
|
219
|
+
*
|
|
220
|
+
* Removes the credential's persisted data and registration from
|
|
221
|
+
* the authenticated database.
|
|
179
222
|
*
|
|
180
223
|
* @param credentialID The identifier of the credential to revoke.
|
|
181
224
|
* @throws {ExplorerError} If the database is not authenticated.
|
|
182
225
|
*/
|
|
183
226
|
static permanentlyDeleteCredential(credentialID: string): Promise<void>;
|
|
184
227
|
/**
|
|
185
|
-
* Returns the registered credentials
|
|
186
|
-
*
|
|
187
|
-
* The returned tuple contains a cleanup function, the current credential
|
|
188
|
-
* entries, and the identifier of the current session's credential.
|
|
228
|
+
* Returns the registered database credentials.
|
|
189
229
|
*
|
|
190
|
-
*
|
|
230
|
+
* Optionally registers a listener for changes to the credential entries.
|
|
231
|
+
* The returned cleanup function removes the registered listener.
|
|
191
232
|
*
|
|
192
233
|
* @param onChange An optional callback invoked when the entries change.
|
|
193
|
-
* @returns The cleanup function, credential entries, and
|
|
234
|
+
* @returns The cleanup function, credential entries, and identifier
|
|
235
|
+
* of the current session's credential.
|
|
194
236
|
* @throws {ExplorerError} If the database is not authenticated.
|
|
195
237
|
*/
|
|
196
238
|
static listCredentialEntries(onChange?: (splice: CredentialEntriesChange) => void): Promise<[cleanup: () => void, entries: DeepReadonly<Array<CredentialEntry>>, sessionCredentialID: string]>;
|
|
197
239
|
/**
|
|
198
|
-
* Returns the recently accessed objects
|
|
240
|
+
* Returns the recently accessed database objects.
|
|
199
241
|
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* if any.
|
|
242
|
+
* Optionally registers a listener for changes to the recent entries.
|
|
243
|
+
* The returned cleanup function removes the registered listener.
|
|
203
244
|
*
|
|
204
245
|
* @param onChange An optional callback invoked when the entries change.
|
|
205
246
|
* @returns The cleanup function and recent entries.
|
|
@@ -207,9 +248,9 @@ export declare class Explorer {
|
|
|
207
248
|
*/
|
|
208
249
|
static listRecentEntries(onChange?: (splice: RecentEntriesChange) => void): Promise<[cleanup: () => void, entries: DeepReadonly<Array<RecentEntry>>]>;
|
|
209
250
|
/**
|
|
210
|
-
* Loads an encrypted object
|
|
251
|
+
* Loads an encrypted database object by its identifier.
|
|
211
252
|
*
|
|
212
|
-
* Caches the cipher key if
|
|
253
|
+
* Caches the supplied cipher key if no key has been cached for the object.
|
|
213
254
|
*
|
|
214
255
|
* @typeParam T The expected type of the loaded object.
|
|
215
256
|
* @param id The identifier of the object to load.
|
|
@@ -219,9 +260,9 @@ export declare class Explorer {
|
|
|
219
260
|
*/
|
|
220
261
|
static loadObjectByID<T>(id: string, cipherKey: CipherKey, onNetworkResponse?: (data: unknown) => void | Promise<void>): Promise<T | undefined>;
|
|
221
262
|
/**
|
|
222
|
-
* Encrypts and stores
|
|
263
|
+
* Encrypts and stores a database object by its identifier.
|
|
223
264
|
*
|
|
224
|
-
* Caches the cipher key if
|
|
265
|
+
* Caches the supplied cipher key if no key has been cached for the object.
|
|
225
266
|
*
|
|
226
267
|
* @typeParam T The type of the object to store.
|
|
227
268
|
* @param id The identifier of the object to store.
|
|
@@ -230,7 +271,9 @@ export declare class Explorer {
|
|
|
230
271
|
*/
|
|
231
272
|
static storeObjectByID<T>(id: string, object: T, cipherKey: CipherKey): Promise<void>;
|
|
232
273
|
/**
|
|
233
|
-
* Deletes a
|
|
274
|
+
* Deletes a database object by its identifier.
|
|
275
|
+
*
|
|
276
|
+
* Removes the persisted object and its corresponding recent entry.
|
|
234
277
|
*
|
|
235
278
|
* @param id The identifier of the object to delete.
|
|
236
279
|
*/
|
|
@@ -247,8 +290,9 @@ export declare class Explorer {
|
|
|
247
290
|
*/
|
|
248
291
|
static apply(data: unknown): void;
|
|
249
292
|
/**
|
|
250
|
-
* Registers an event listener for the specified event
|
|
293
|
+
* Registers an event listener for the specified Explorer event.
|
|
251
294
|
*
|
|
295
|
+
* @typeParam K The event name that determines the event detail type.
|
|
252
296
|
* @param type The event type.
|
|
253
297
|
* @param listener The event listener, or `null`.
|
|
254
298
|
* @param options The event listener options.
|
|
@@ -258,14 +302,16 @@ export declare class Explorer {
|
|
|
258
302
|
* Removes an event listener previously registered with
|
|
259
303
|
* {@link addEventListener}.
|
|
260
304
|
*
|
|
305
|
+
* @typeParam K The event name that determines the listener type.
|
|
261
306
|
* @param type The event type.
|
|
262
307
|
* @param listener The event listener to remove, or `null`.
|
|
263
308
|
* @param options The event listener options.
|
|
264
309
|
*/
|
|
265
310
|
static removeEventListener<K extends keyof ExplorerEventMap>(type: K, listener: ExplorerEventListenerFor<K> | null, options?: boolean | EventListenerOptions): void;
|
|
266
311
|
/**
|
|
267
|
-
* Dispatches an event to
|
|
312
|
+
* Dispatches an Explorer event to registered listeners.
|
|
268
313
|
*
|
|
314
|
+
* @typeParam K The event name that determines the event detail type.
|
|
269
315
|
* @param type The event type.
|
|
270
316
|
* @param detail The value exposed through `CustomEvent.detail`.
|
|
271
317
|
*/
|
|
@@ -277,6 +323,7 @@ export declare class Explorer {
|
|
|
277
323
|
* @returns Whether the value has a string discriminator.
|
|
278
324
|
*/
|
|
279
325
|
private static isExplorerDelta;
|
|
326
|
+
/** The cached recent entries list. */
|
|
280
327
|
private static recentEntries?;
|
|
281
328
|
/**
|
|
282
329
|
* Loads or returns the cached recent entries list.
|
|
@@ -288,6 +335,7 @@ export declare class Explorer {
|
|
|
288
335
|
* @throws {ExplorerError} If the database is not authenticated.
|
|
289
336
|
*/
|
|
290
337
|
private static loadRecentEntries;
|
|
338
|
+
/** The cached credential entries list. */
|
|
291
339
|
private static credentialEntries?;
|
|
292
340
|
/**
|
|
293
341
|
* Loads or returns the cached credential entries list.
|
package/dist/class.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.d.cts","names":[],"sources":["../src/RecentEntries/class.ts","../src/CredentialEntries/class.ts","../src/.types/type.ts","../src/.errors/class.ts","../src/class.ts"],"mappings":";;;;;;;;;KAsBY;;EAEV;;EAGA;;EAGA,WAAW;;EAGX;;;;;KAMU,qBAAqB,2BACb,aAAa,oBAAoB;;;;KAMzC,sBAAsB,aAChC,qBAAqB;;;;KCpBX;;EAEV;;EAGA,SAAS;;EAGT,SAAS;;EAGT;;EAGA;;EAGA;;EAGA,YAAY;;IAEV;;IAGA;;;;;;KAqCQ,yBAAyB,+BACb,aAAa,oBAAoB;;;;KAM7C,0BAA0B,aACpC,qBAAqB;;;;YC1FX;;;;;;;;;;YAWA,4BAA4B;;EAEtC;;EAGA,gBAAgB;;;;;;;;YASN,gBACV,qBAAqB;;;;YAKX;;EAEV;;EAGA,OAAO;;;;;;;YAQG,sBAAsB,gBAAgB,sBAC5C,OAAO,YAAY,iBAAiB;EACpC,YAAY,OAAO,YAAY,iBAAiB;;;;;;;YAO1C,yBAAyB,oBACnC,gBAAgB,mBACZ,sBAAsB,KACtB;;
|
|
1
|
+
{"version":3,"file":"class.d.cts","names":[],"sources":["../src/RecentEntries/class.ts","../src/CredentialEntries/class.ts","../src/.types/type.ts","../src/.errors/class.ts","../src/class.ts"],"mappings":";;;;;;;;;KAsBY;;EAEV;;EAGA;;EAGA,WAAW;;EAGX;;;;;KAMU,qBAAqB,2BACb,aAAa,oBAAoB;;;;KAMzC,sBAAsB,aAChC,qBAAqB;;;;KCpBX;;EAEV;;EAGA,SAAS;;EAGT,SAAS;;EAGT;;EAGA;;EAGA;;EAGA,YAAY;;IAEV;;IAGA;;;;;;KAqCQ,yBAAyB,+BACb,aAAa,oBAAoB;;;;KAM7C,0BAA0B,aACpC,qBAAqB;;;;YC1FX;;;;;;;;;;YAWA,4BAA4B;;EAEtC;;EAGA,iBAAiB;;EAGjB,gBAAgB;;;;;;;;YASN,gBACV,qBAAqB;;;;YAKX;;EAEV;;EAGA,OAAO;;;;;;;YAQG,sBAAsB,gBA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iBAKA;;;;;;;;;;iBAWM;;iBA+BN;;;;;;;;;;iBAWM"}
|
package/dist/class.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { URLString } from "@sovereignbase/storage";
|
|
3
3
|
import { DeepReadonly } from "@sovereignbase/utils";
|
|
4
4
|
import { DeviceBindingStorage } from "@sovereignbase/hardware-bound";
|
|
5
|
-
import { CipherKey } from "@sovereignbase/cryptosuite";
|
|
5
|
+
import { CipherKey, CipherMessage, DecapsulateKey, EncapsulateKey, KeyOffer } from "@sovereignbase/cryptosuite";
|
|
6
6
|
import { SequencedArrayChange, SequencedArrayDelta } from "@sovereignbase/sequenced";
|
|
7
7
|
/**
|
|
8
8
|
* Describes an entry in the recent objects list.
|
|
@@ -73,6 +73,8 @@ export type AuthenticationResult =
|
|
|
73
73
|
export type AuthenticationSetupParams = Readonly<{
|
|
74
74
|
/** The display name assigned to the credential. */
|
|
75
75
|
credentialName: string;
|
|
76
|
+
/** Optional virtual entropy used to establish an existing database. */
|
|
77
|
+
virtualEntropy?: Uint8Array;
|
|
76
78
|
/** The storage mechanism used to bind the credential to the device. */
|
|
77
79
|
bindingStorage: DeviceBindingStorage;
|
|
78
80
|
}>;
|
|
@@ -135,20 +137,27 @@ export declare class ExplorerError extends Error {
|
|
|
135
137
|
constructor(code: ExplorerErrorCode, message?: string, options?: ErrorOptions);
|
|
136
138
|
}
|
|
137
139
|
/**
|
|
138
|
-
* Provides
|
|
139
|
-
* the database's synchronized entries.
|
|
140
|
+
* Provides access to an authenticated Sovereignbase database.
|
|
140
141
|
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
142
|
+
* Manages database authentication, encrypted object storage, credential
|
|
143
|
+
* registration, database linking, and synchronized entries.
|
|
143
144
|
*/
|
|
144
145
|
export declare class Explorer {
|
|
145
146
|
/** The identifier of the authenticated database. */
|
|
146
147
|
static databaseID: string;
|
|
147
|
-
/** Indicates whether
|
|
148
|
+
/** Indicates whether a database has been authenticated. */
|
|
148
149
|
static isAuthenticated: boolean;
|
|
150
|
+
/** The base URL used to access database objects. */
|
|
149
151
|
private static storageURL;
|
|
152
|
+
/** The event target used for Explorer events. */
|
|
150
153
|
private static eventTarget?;
|
|
154
|
+
/** The data PIN associated with the current session. */
|
|
155
|
+
private static dataPIN;
|
|
156
|
+
/** The virtual entropy associated with the authenticated database. */
|
|
157
|
+
private static virtualEntropy;
|
|
158
|
+
/** The secret used to access the authenticated database. */
|
|
151
159
|
private static databaseSecret;
|
|
160
|
+
/** The credential information associated with the current authentication. */
|
|
152
161
|
private static sessionCredential?;
|
|
153
162
|
/**
|
|
154
163
|
* Caches cipher keys by object identifier.
|
|
@@ -158,48 +167,80 @@ export declare class Explorer {
|
|
|
158
167
|
*/
|
|
159
168
|
static readonly cipherKeyCache: Map<string, CipherKey>;
|
|
160
169
|
/**
|
|
161
|
-
* Authenticates a database using a data PIN and device
|
|
170
|
+
* Authenticates a database using a data PIN and an existing device binding.
|
|
162
171
|
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* new credential. Otherwise, loads the existing credential.
|
|
172
|
+
* Establishes the authenticated database context and records the credential
|
|
173
|
+
* used for authentication.
|
|
166
174
|
*
|
|
167
|
-
*
|
|
175
|
+
* When setup parameters are provided, registers a credential using the
|
|
176
|
+
* supplied virtual entropy or generates new virtual entropy.
|
|
168
177
|
*
|
|
169
|
-
* @param dataPIN The PIN
|
|
170
|
-
* @param storageURL The base URL used to access
|
|
171
|
-
* @param setupParams Optional parameters for
|
|
178
|
+
* @param dataPIN The PIN associated with the database.
|
|
179
|
+
* @param storageURL The base URL used to access database objects.
|
|
180
|
+
* @param setupParams Optional parameters for registering a credential.
|
|
181
|
+
*
|
|
182
|
+
* @param credentialId An optional credential identifier used to restrict credential selection.
|
|
172
183
|
* @returns The authentication result.
|
|
173
184
|
*/
|
|
174
|
-
static authenticate(dataPIN: string, storageURL: URLString, setupParams?: AuthenticationSetupParams): Promise<AuthenticationResult>;
|
|
185
|
+
static authenticate(dataPIN: string, storageURL: URLString, setupParams?: AuthenticationSetupParams, credentialId?: string): Promise<AuthenticationResult>;
|
|
186
|
+
/** The number of consecutive failed database linking PIN attempts. */
|
|
187
|
+
private static failCounter;
|
|
188
|
+
/**
|
|
189
|
+
* Prepares an authenticated database for linking to another device.
|
|
190
|
+
*
|
|
191
|
+
* Verifies the current data PIN and prepares an encrypted transfer
|
|
192
|
+
* containing the information required to access the same database.
|
|
193
|
+
*
|
|
194
|
+
* Repeated PIN failures cause the current page to reload.
|
|
195
|
+
*
|
|
196
|
+
* @param dataPIN The PIN associated with the authenticated database.
|
|
197
|
+
* @param encapsulateKey The key used to establish encryption for the transfer.
|
|
198
|
+
* @returns The key offer and encrypted transfer message, or `false`
|
|
199
|
+
* if the supplied PIN is incorrect.
|
|
200
|
+
*/
|
|
201
|
+
static prepareDatabaseLink(dataPIN: string, encapsulateKey: EncapsulateKey): Promise<[keyOffer: KeyOffer, cipherMessage: CipherMessage] | false>;
|
|
175
202
|
/**
|
|
176
|
-
*
|
|
203
|
+
* Links the current device to an existing database.
|
|
177
204
|
*
|
|
178
|
-
*
|
|
205
|
+
* Accesses the transferred database information, creates a device binding,
|
|
206
|
+
* and registers a credential for the existing database.
|
|
207
|
+
*
|
|
208
|
+
* @param keyOffer The key offer associated with the database link.
|
|
209
|
+
* @param cipherMessage The encrypted database linking message.
|
|
210
|
+
* @param decapsulateKey The key used to establish decryption for the transfer.
|
|
211
|
+
* @param credentialName The display name assigned to the new credential.
|
|
212
|
+
* @param storageURL The base URL used to access database objects.
|
|
213
|
+
* @returns `true` if the database was linked and authenticated;
|
|
214
|
+
* otherwise, `false`.
|
|
215
|
+
*/
|
|
216
|
+
static linkToDatabase(keyOffer: KeyOffer, cipherMessage: CipherMessage, decapsulateKey: DecapsulateKey, credentialName: string, storageURL: URLString): Promise<boolean>;
|
|
217
|
+
/**
|
|
218
|
+
* Permanently revokes a registered database credential.
|
|
219
|
+
*
|
|
220
|
+
* Removes the credential's persisted data and registration from
|
|
221
|
+
* the authenticated database.
|
|
179
222
|
*
|
|
180
223
|
* @param credentialID The identifier of the credential to revoke.
|
|
181
224
|
* @throws {ExplorerError} If the database is not authenticated.
|
|
182
225
|
*/
|
|
183
226
|
static permanentlyDeleteCredential(credentialID: string): Promise<void>;
|
|
184
227
|
/**
|
|
185
|
-
* Returns the registered credentials
|
|
186
|
-
*
|
|
187
|
-
* The returned tuple contains a cleanup function, the current credential
|
|
188
|
-
* entries, and the identifier of the current session's credential.
|
|
228
|
+
* Returns the registered database credentials.
|
|
189
229
|
*
|
|
190
|
-
*
|
|
230
|
+
* Optionally registers a listener for changes to the credential entries.
|
|
231
|
+
* The returned cleanup function removes the registered listener.
|
|
191
232
|
*
|
|
192
233
|
* @param onChange An optional callback invoked when the entries change.
|
|
193
|
-
* @returns The cleanup function, credential entries, and
|
|
234
|
+
* @returns The cleanup function, credential entries, and identifier
|
|
235
|
+
* of the current session's credential.
|
|
194
236
|
* @throws {ExplorerError} If the database is not authenticated.
|
|
195
237
|
*/
|
|
196
238
|
static listCredentialEntries(onChange?: (splice: CredentialEntriesChange) => void): Promise<[cleanup: () => void, entries: DeepReadonly<Array<CredentialEntry>>, sessionCredentialID: string]>;
|
|
197
239
|
/**
|
|
198
|
-
* Returns the recently accessed objects
|
|
240
|
+
* Returns the recently accessed database objects.
|
|
199
241
|
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* if any.
|
|
242
|
+
* Optionally registers a listener for changes to the recent entries.
|
|
243
|
+
* The returned cleanup function removes the registered listener.
|
|
203
244
|
*
|
|
204
245
|
* @param onChange An optional callback invoked when the entries change.
|
|
205
246
|
* @returns The cleanup function and recent entries.
|
|
@@ -207,9 +248,9 @@ export declare class Explorer {
|
|
|
207
248
|
*/
|
|
208
249
|
static listRecentEntries(onChange?: (splice: RecentEntriesChange) => void): Promise<[cleanup: () => void, entries: DeepReadonly<Array<RecentEntry>>]>;
|
|
209
250
|
/**
|
|
210
|
-
* Loads an encrypted object
|
|
251
|
+
* Loads an encrypted database object by its identifier.
|
|
211
252
|
*
|
|
212
|
-
* Caches the cipher key if
|
|
253
|
+
* Caches the supplied cipher key if no key has been cached for the object.
|
|
213
254
|
*
|
|
214
255
|
* @typeParam T The expected type of the loaded object.
|
|
215
256
|
* @param id The identifier of the object to load.
|
|
@@ -219,9 +260,9 @@ export declare class Explorer {
|
|
|
219
260
|
*/
|
|
220
261
|
static loadObjectByID<T>(id: string, cipherKey: CipherKey, onNetworkResponse?: (data: unknown) => void | Promise<void>): Promise<T | undefined>;
|
|
221
262
|
/**
|
|
222
|
-
* Encrypts and stores
|
|
263
|
+
* Encrypts and stores a database object by its identifier.
|
|
223
264
|
*
|
|
224
|
-
* Caches the cipher key if
|
|
265
|
+
* Caches the supplied cipher key if no key has been cached for the object.
|
|
225
266
|
*
|
|
226
267
|
* @typeParam T The type of the object to store.
|
|
227
268
|
* @param id The identifier of the object to store.
|
|
@@ -230,7 +271,9 @@ export declare class Explorer {
|
|
|
230
271
|
*/
|
|
231
272
|
static storeObjectByID<T>(id: string, object: T, cipherKey: CipherKey): Promise<void>;
|
|
232
273
|
/**
|
|
233
|
-
* Deletes a
|
|
274
|
+
* Deletes a database object by its identifier.
|
|
275
|
+
*
|
|
276
|
+
* Removes the persisted object and its corresponding recent entry.
|
|
234
277
|
*
|
|
235
278
|
* @param id The identifier of the object to delete.
|
|
236
279
|
*/
|
|
@@ -247,8 +290,9 @@ export declare class Explorer {
|
|
|
247
290
|
*/
|
|
248
291
|
static apply(data: unknown): void;
|
|
249
292
|
/**
|
|
250
|
-
* Registers an event listener for the specified event
|
|
293
|
+
* Registers an event listener for the specified Explorer event.
|
|
251
294
|
*
|
|
295
|
+
* @typeParam K The event name that determines the event detail type.
|
|
252
296
|
* @param type The event type.
|
|
253
297
|
* @param listener The event listener, or `null`.
|
|
254
298
|
* @param options The event listener options.
|
|
@@ -258,14 +302,16 @@ export declare class Explorer {
|
|
|
258
302
|
* Removes an event listener previously registered with
|
|
259
303
|
* {@link addEventListener}.
|
|
260
304
|
*
|
|
305
|
+
* @typeParam K The event name that determines the listener type.
|
|
261
306
|
* @param type The event type.
|
|
262
307
|
* @param listener The event listener to remove, or `null`.
|
|
263
308
|
* @param options The event listener options.
|
|
264
309
|
*/
|
|
265
310
|
static removeEventListener<K extends keyof ExplorerEventMap>(type: K, listener: ExplorerEventListenerFor<K> | null, options?: boolean | EventListenerOptions): void;
|
|
266
311
|
/**
|
|
267
|
-
* Dispatches an event to
|
|
312
|
+
* Dispatches an Explorer event to registered listeners.
|
|
268
313
|
*
|
|
314
|
+
* @typeParam K The event name that determines the event detail type.
|
|
269
315
|
* @param type The event type.
|
|
270
316
|
* @param detail The value exposed through `CustomEvent.detail`.
|
|
271
317
|
*/
|
|
@@ -277,6 +323,7 @@ export declare class Explorer {
|
|
|
277
323
|
* @returns Whether the value has a string discriminator.
|
|
278
324
|
*/
|
|
279
325
|
private static isExplorerDelta;
|
|
326
|
+
/** The cached recent entries list. */
|
|
280
327
|
private static recentEntries?;
|
|
281
328
|
/**
|
|
282
329
|
* Loads or returns the cached recent entries list.
|
|
@@ -288,6 +335,7 @@ export declare class Explorer {
|
|
|
288
335
|
* @throws {ExplorerError} If the database is not authenticated.
|
|
289
336
|
*/
|
|
290
337
|
private static loadRecentEntries;
|
|
338
|
+
/** The cached credential entries list. */
|
|
291
339
|
private static credentialEntries?;
|
|
292
340
|
/**
|
|
293
341
|
* Loads or returns the cached credential entries list.
|
package/dist/class.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.d.ts","names":[],"sources":["../src/RecentEntries/class.ts","../src/CredentialEntries/class.ts","../src/.types/type.ts","../src/.errors/class.ts","../src/class.ts"],"mappings":";;;;;;;;;KAsBY;;EAEV;;EAGA;;EAGA,WAAW;;EAGX;;;;;KAMU,qBAAqB,2BACb,aAAa,oBAAoB;;;;KAMzC,sBAAsB,aAChC,qBAAqB;;;;KCpBX;;EAEV;;EAGA,SAAS;;EAGT,SAAS;;EAGT;;EAGA;;EAGA;;EAGA,YAAY;;IAEV;;IAGA;;;;;;KAqCQ,yBAAyB,+BACb,aAAa,oBAAoB;;;;KAM7C,0BAA0B,aACpC,qBAAqB;;;;YC1FX;;;;;;;;;;YAWA,4BAA4B;;EAEtC;;EAGA,gBAAgB;;;;;;;;YASN,gBACV,qBAAqB;;;;YAKX;;EAEV;;EAGA,OAAO;;;;;;;YAQG,sBAAsB,gBAAgB,sBAC5C,OAAO,YAAY,iBAAiB;EACpC,YAAY,OAAO,YAAY,iBAAiB;;;;;;;YAO1C,yBAAyB,oBACnC,gBAAgB,mBACZ,sBAAsB,KACtB;;
|
|
1
|
+
{"version":3,"file":"class.d.ts","names":[],"sources":["../src/RecentEntries/class.ts","../src/CredentialEntries/class.ts","../src/.types/type.ts","../src/.errors/class.ts","../src/class.ts"],"mappings":";;;;;;;;;KAsBY;;EAEV;;EAGA;;EAGA,WAAW;;EAGX;;;;;KAMU,qBAAqB,2BACb,aAAa,oBAAoB;;;;KAMzC,sBAAsB,aAChC,qBAAqB;;;;KCpBX;;EAEV;;EAGA,SAAS;;EAGT,SAAS;;EAGT;;EAGA;;EAGA;;EAGA,YAAY;;IAEV;;IAGA;;;;;;KAqCQ,yBAAyB,+BACb,aAAa,oBAAoB;;;;KAM7C,0BAA0B,aACpC,qBAAqB;;;;YC1FX;;;;;;;;;;YAWA,4BAA4B;;EAEtC;;EAGA,iBAAiB;;EAGjB,gBAAgB;;;;;;;;YASN,gBACV,qBAAqB;;;;YAKX;;EAEV;;EAGA,OAAO;;;;;;;YAQG,sBAAsB,gBAAgB,sBAC5C,OAAO,YAAY,iBAAiB;EACpC,YAAY,OAAO,YAAY,iBAAiB;;;;;;;YAO1C,yBAAyB,oBACnC,gBAAgB,mBACZ,sBAAsB,KACtB;;KCjEM;;;;;;;;;;;;;;;qBAgBC,sBAAsB;;WAExB,MAAM;;;;;;;;EAUb,YAAA,MAAM,mBACN,kBACA,UAAU;;;;;;;;qBCu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