@noy-db/as-noydb 0.4.0-pre.4 → 0.4.0-pre.5

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/index.d.ts CHANGED
@@ -26,7 +26,7 @@ import { WriteNoydbBundleOptions, Vault, NoydbBundleHeader } from '@noy-db/hub';
26
26
  * **No `acknowledgeRisks: true` on `write()`.** Writing a `.noydb` to
27
27
  * disk is a legitimate encrypted-tier destination — the bytes are
28
28
  * ciphertext. The applicable risk is "don't also store the
29
- * passphrase on the same disk", not "don't write the bytes". The risk
29
+ * secret on the same disk", not "don't write the bytes". The risk
30
30
  * is therefore documented rather than gated.
31
31
  *
32
32
  * @packageDocumentation
@@ -52,7 +52,7 @@ declare function download(vault: Vault, options?: AsNoydbDownloadOptions): Promi
52
52
  /**
53
53
  * Node file-write. No `acknowledgeRisks` gate — the bytes are
54
54
  * ciphertext; persisting them to disk is a legitimate encrypted-tier
55
- * destination. Store the passphrase separately.
55
+ * destination. Store the secret separately.
56
56
  */
57
57
  declare function write(vault: Vault, path: string, options?: AsNoydbOptions): Promise<void>;
58
58
  /**
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * **@noy-db/as-noydb** — encrypted `.noydb` bundle export.\n *\n * The sole member of the Fork · As **encrypted tier**. Wraps the core\n * `writeNoydbBundle()` primitive with:\n *\n * 1. The `canExportBundle` authorization gate — default\n * on for owner/admin, off for operator/viewer/client. The\n * asymmetric default reflects asymmetric risk: a bundle is inert\n * without the KEK, so owner backups don't need the per-format\n * friction of the plaintext tier.\n * 2. The usual audit-ledger entry (`type: 'as-export'`,\n * `encrypted: true`) so regulators see every bundle egress even\n * though contents stay encrypted.\n * 3. Ergonomic browser-download / Node-file-write / in-memory-bytes\n * helpers that parallel the plaintext-tier siblings.\n *\n * **Zero-knowledge preserved.** Unlike `as-csv` / `as-json` / …, this\n * package never reveals a single byte of plaintext to its caller or\n * any downstream handler. The vault's DEKs re-encrypt the body before\n * it leaves the gate; the bundle header is the minimal-disclosure\n * shape defined in `docs/reference/architecture.md`.\n *\n * **No `acknowledgeRisks: true` on `write()`.** Writing a `.noydb` to\n * disk is a legitimate encrypted-tier destination — the bytes are\n * ciphertext. The applicable risk is \"don't also store the\n * passphrase on the same disk\", not \"don't write the bytes\". The risk\n * is therefore documented rather than gated.\n *\n * @packageDocumentation\n */\n\nimport type { Vault, WriteNoydbBundleOptions, NoydbBundleHeader } from '@noy-db/hub'\nimport { writeNoydbBundle as coreWrite, readNoydbBundleHeader } from '@noy-db/hub'\n\nexport type AsNoydbOptions = WriteNoydbBundleOptions\n\nexport interface AsNoydbDownloadOptions extends AsNoydbOptions {\n /** Filename offered to the browser. Default uses the vault's bundle handle. */\n readonly filename?: string\n}\n\n/**\n * Produce the encrypted bundle as a `Uint8Array`. Caller decides the\n * sink — upload to S3, attach to email, store in IndexedDB, …\n */\nexport async function toBytes(vault: Vault, options: AsNoydbOptions = {}): Promise<Uint8Array> {\n vault.assertCanExport('bundle')\n return coreWrite(vault, options)\n}\n\n/**\n * Browser download — wraps `toBytes()` in a Blob + triggers the\n * browser save-as prompt. Default filename uses the vault's stable\n * bundle handle (so repeated backups sort lexically and dedupe by\n * prefix in file listings).\n */\nexport async function download(vault: Vault, options: AsNoydbDownloadOptions = {}): Promise<void> {\n const bytes = await toBytes(vault, options)\n const filename = options.filename ?? `vault-${await vault.getBundleHandle()}.noydb`\n const blob = new Blob([bytes as BlobPart], { type: 'application/octet-stream' })\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = filename\n a.click()\n URL.revokeObjectURL(url)\n}\n\n/**\n * Node file-write. No `acknowledgeRisks` gate — the bytes are\n * ciphertext; persisting them to disk is a legitimate encrypted-tier\n * destination. Store the passphrase separately.\n */\nexport async function write(\n vault: Vault,\n path: string,\n options: AsNoydbOptions = {},\n): Promise<void> {\n const bytes = await toBytes(vault, options)\n const { writeFile } = await import('node:fs/promises')\n await writeFile(path, bytes)\n}\n\n/**\n * Peek at the header of a received bundle without unpacking the body.\n * Useful for due diligence on bundles obtained from external parties\n * — confirm the handle, the compression algorithm, and the declared\n * body size before committing to decrypt.\n */\nexport function peek(bytes: Uint8Array): NoydbBundleHeader {\n return readNoydbBundleHeader(bytes)\n}\n"],"mappings":";AAiCA,SAAS,oBAAoB,WAAW,6BAA6B;AAarE,eAAsB,QAAQ,OAAc,UAA0B,CAAC,GAAwB;AAC7F,QAAM,gBAAgB,QAAQ;AAC9B,SAAO,UAAU,OAAO,OAAO;AACjC;AAQA,eAAsB,SAAS,OAAc,UAAkC,CAAC,GAAkB;AAChG,QAAM,QAAQ,MAAM,QAAQ,OAAO,OAAO;AAC1C,QAAM,WAAW,QAAQ,YAAY,SAAS,MAAM,MAAM,gBAAgB,CAAC;AAC3E,QAAM,OAAO,IAAI,KAAK,CAAC,KAAiB,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAC/E,QAAM,MAAM,IAAI,gBAAgB,IAAI;AACpC,QAAM,IAAI,SAAS,cAAc,GAAG;AACpC,IAAE,OAAO;AACT,IAAE,WAAW;AACb,IAAE,MAAM;AACR,MAAI,gBAAgB,GAAG;AACzB;AAOA,eAAsB,MACpB,OACA,MACA,UAA0B,CAAC,GACZ;AACf,QAAM,QAAQ,MAAM,QAAQ,OAAO,OAAO;AAC1C,QAAM,EAAE,UAAU,IAAI,MAAM,OAAO,aAAkB;AACrD,QAAM,UAAU,MAAM,KAAK;AAC7B;AAQO,SAAS,KAAK,OAAsC;AACzD,SAAO,sBAAsB,KAAK;AACpC;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * **@noy-db/as-noydb** — encrypted `.noydb` bundle export.\n *\n * The sole member of the Fork · As **encrypted tier**. Wraps the core\n * `writeNoydbBundle()` primitive with:\n *\n * 1. The `canExportBundle` authorization gate — default\n * on for owner/admin, off for operator/viewer/client. The\n * asymmetric default reflects asymmetric risk: a bundle is inert\n * without the KEK, so owner backups don't need the per-format\n * friction of the plaintext tier.\n * 2. The usual audit-ledger entry (`type: 'as-export'`,\n * `encrypted: true`) so regulators see every bundle egress even\n * though contents stay encrypted.\n * 3. Ergonomic browser-download / Node-file-write / in-memory-bytes\n * helpers that parallel the plaintext-tier siblings.\n *\n * **Zero-knowledge preserved.** Unlike `as-csv` / `as-json` / …, this\n * package never reveals a single byte of plaintext to its caller or\n * any downstream handler. The vault's DEKs re-encrypt the body before\n * it leaves the gate; the bundle header is the minimal-disclosure\n * shape defined in `docs/reference/architecture.md`.\n *\n * **No `acknowledgeRisks: true` on `write()`.** Writing a `.noydb` to\n * disk is a legitimate encrypted-tier destination — the bytes are\n * ciphertext. The applicable risk is \"don't also store the\n * secret on the same disk\", not \"don't write the bytes\". The risk\n * is therefore documented rather than gated.\n *\n * @packageDocumentation\n */\n\nimport type { Vault, WriteNoydbBundleOptions, NoydbBundleHeader } from '@noy-db/hub'\nimport { writeNoydbBundle as coreWrite, readNoydbBundleHeader } from '@noy-db/hub'\n\nexport type AsNoydbOptions = WriteNoydbBundleOptions\n\nexport interface AsNoydbDownloadOptions extends AsNoydbOptions {\n /** Filename offered to the browser. Default uses the vault's bundle handle. */\n readonly filename?: string\n}\n\n/**\n * Produce the encrypted bundle as a `Uint8Array`. Caller decides the\n * sink — upload to S3, attach to email, store in IndexedDB, …\n */\nexport async function toBytes(vault: Vault, options: AsNoydbOptions = {}): Promise<Uint8Array> {\n vault.assertCanExport('bundle')\n return coreWrite(vault, options)\n}\n\n/**\n * Browser download — wraps `toBytes()` in a Blob + triggers the\n * browser save-as prompt. Default filename uses the vault's stable\n * bundle handle (so repeated backups sort lexically and dedupe by\n * prefix in file listings).\n */\nexport async function download(vault: Vault, options: AsNoydbDownloadOptions = {}): Promise<void> {\n const bytes = await toBytes(vault, options)\n const filename = options.filename ?? `vault-${await vault.getBundleHandle()}.noydb`\n const blob = new Blob([bytes as BlobPart], { type: 'application/octet-stream' })\n const url = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = url\n a.download = filename\n a.click()\n URL.revokeObjectURL(url)\n}\n\n/**\n * Node file-write. No `acknowledgeRisks` gate — the bytes are\n * ciphertext; persisting them to disk is a legitimate encrypted-tier\n * destination. Store the secret separately.\n */\nexport async function write(\n vault: Vault,\n path: string,\n options: AsNoydbOptions = {},\n): Promise<void> {\n const bytes = await toBytes(vault, options)\n const { writeFile } = await import('node:fs/promises')\n await writeFile(path, bytes)\n}\n\n/**\n * Peek at the header of a received bundle without unpacking the body.\n * Useful for due diligence on bundles obtained from external parties\n * — confirm the handle, the compression algorithm, and the declared\n * body size before committing to decrypt.\n */\nexport function peek(bytes: Uint8Array): NoydbBundleHeader {\n return readNoydbBundleHeader(bytes)\n}\n"],"mappings":";AAiCA,SAAS,oBAAoB,WAAW,6BAA6B;AAarE,eAAsB,QAAQ,OAAc,UAA0B,CAAC,GAAwB;AAC7F,QAAM,gBAAgB,QAAQ;AAC9B,SAAO,UAAU,OAAO,OAAO;AACjC;AAQA,eAAsB,SAAS,OAAc,UAAkC,CAAC,GAAkB;AAChG,QAAM,QAAQ,MAAM,QAAQ,OAAO,OAAO;AAC1C,QAAM,WAAW,QAAQ,YAAY,SAAS,MAAM,MAAM,gBAAgB,CAAC;AAC3E,QAAM,OAAO,IAAI,KAAK,CAAC,KAAiB,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAC/E,QAAM,MAAM,IAAI,gBAAgB,IAAI;AACpC,QAAM,IAAI,SAAS,cAAc,GAAG;AACpC,IAAE,OAAO;AACT,IAAE,WAAW;AACb,IAAE,MAAM;AACR,MAAI,gBAAgB,GAAG;AACzB;AAOA,eAAsB,MACpB,OACA,MACA,UAA0B,CAAC,GACZ;AACf,QAAM,QAAQ,MAAM,QAAQ,OAAO,OAAO;AAC1C,QAAM,EAAE,UAAU,IAAI,MAAM,OAAO,aAAkB;AACrD,QAAM,UAAU,MAAM,KAAK;AAC7B;AAQO,SAAS,KAAK,OAAsC;AACzD,SAAO,sBAAsB,KAAK;AACpC;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noy-db/as-noydb",
3
- "version": "0.4.0-pre.4",
3
+ "version": "0.4.0-pre.5",
4
4
  "description": "Encrypted .noydb bundle export for noy-db — wraps writeNoydbBundle() with the RFC #249 canExportBundle authorization gate and ergonomic browser/node helpers. Sole member of the @noy-db/as-* encrypted tier — ciphertext in, ciphertext out.",
5
5
  "license": "MIT",
6
6
  "author": "vLannaAi <vicio@lanna.ai>",
@@ -32,11 +32,11 @@
32
32
  "node": ">=22.0.0"
33
33
  },
34
34
  "peerDependencies": {
35
- "@noy-db/hub": "0.4.0-pre.4"
35
+ "@noy-db/hub": "0.4.0-pre.5"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "^22.0.0",
39
- "@noy-db/hub": "0.4.0-pre.4"
39
+ "@noy-db/hub": "0.4.0-pre.5"
40
40
  },
41
41
  "keywords": [
42
42
  "noy-db",