@visorcraft/mongreldb 0.34.0 → 0.36.0

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.
Binary file
package/native.d.ts CHANGED
@@ -240,6 +240,36 @@ export declare class Database {
240
240
  static withPath(path: string): Database
241
241
  /** Open an existing database from disk. */
242
242
  static open(path: string): Database
243
+ /**
244
+ * Open an existing database that has `require_auth = true`, verifying
245
+ * the supplied credentials. Every subsequent operation on the returned
246
+ * handle is checked against the authenticated principal's permissions.
247
+ * Throws if the database does not require auth (use `open` instead) or
248
+ * if the credentials are invalid.
249
+ */
250
+ static openWithCredentials(path: string, username: string, password: string): Database
251
+ /**
252
+ * Create a fresh database with `require_auth = true` and a single admin
253
+ * user. The returned handle is already authenticated as that admin.
254
+ */
255
+ static createWithCredentials(path: string, adminUsername: string, adminPassword: string): Database
256
+ /**
257
+ * Convert a credentialless database to a credentialed one in place:
258
+ * creates the first admin user, sets `require_auth = true`, and caches
259
+ * the admin principal on this handle. After this call, the database can
260
+ * only be reopened via `openWithCredentials`.
261
+ */
262
+ enableAuth(adminUsername: string, adminPassword: string): void
263
+ /** Disable `require_auth`, reverting to credentialless mode (recovery). */
264
+ disableAuth(): void
265
+ /** Returns `true` if this database has `require_auth = true`. */
266
+ requireAuthEnabled(): boolean
267
+ /**
268
+ * Re-resolve the cached principal from the on-disk catalog, picking up
269
+ * role/permission changes made by other handles. No-op on credentialless
270
+ * databases.
271
+ */
272
+ refreshPrincipal(): void
243
273
  /** Create a new table with the given schema. */
244
274
  createTable(name: string, schema: SchemaSpec): bigint
245
275
  /** Drop a table by name. */
@@ -385,6 +415,17 @@ export declare class Database {
385
415
  static createEncrypted(path: string, passphrase: string): Database
386
416
  /** Open an existing encrypted database with its passphrase. */
387
417
  static openEncrypted(path: string, passphrase: string): Database
418
+ /**
419
+ * Open an existing encrypted database that has `require_auth = true`,
420
+ * combining the encryption passphrase with credential verification.
421
+ */
422
+ static openEncryptedWithCredentials(path: string, passphrase: string, username: string, password: string): Database
423
+ /**
424
+ * Create a fresh encrypted database with `require_auth = true` and a
425
+ * single admin user. Composes encryption-at-rest with credential
426
+ * enforcement.
427
+ */
428
+ static createEncryptedWithCredentials(path: string, passphrase: string, adminUsername: string, adminPassword: string): Database
388
429
  }
389
430
  /** A handle to one table inside a [`Database`]. */
390
431
  export declare class TableHandle {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visorcraft/mongreldb",
3
- "version": "0.34.0",
3
+ "version": "0.36.0",
4
4
  "description": "High-performance Node.js bindings for MongrelDB with native in-process storage, sub-ms writes, and hybrid indexing.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",