@econ-v1/app-sdk 7.6.38 → 7.6.40

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.
@@ -35,7 +35,9 @@ export declare const NODE_BUILTINS: ReadonlySet<string>;
35
35
  * for by the node-app-memory flip, econ-v1/node-app-memory#40). `statfsSync`,
36
36
  * `deflateRawSync`, `inflateRawSync` and `setSystemTime` arrive with the
37
37
  * third (node-app-memory's switch to Burger), likewise listed ahead of the
38
- * release that ships them.
38
+ * release that ships them. `createCipheriv`, `createDecipheriv` (aes-256-gcm)
39
+ * and `scryptSync` arrive with the crypto pack (node-app-burger ADR 006, for
40
+ * node-app-pii and node-app-distributed-backup), also ahead of its release.
39
41
  */
40
42
  export declare const BURGER_EXPORTS: Readonly<Record<BurgerModule, readonly string[]>>;
41
43
  /**
@@ -189,7 +189,16 @@ var BURGER_EXPORTS = {
189
189
  ],
190
190
  "burger:os": ["platform", "arch", "cpus", "totalmem", "freemem", "hostname", "tmpdir", "homedir", "EOL"],
191
191
  "burger:worker_threads": ["isMainThread", "workerData", "parentPort", "threadId"],
192
- "burger:crypto": ["randomUUID", "randomBytes", "createHash", "createHmac", "timingSafeEqual"],
192
+ "burger:crypto": [
193
+ "randomUUID",
194
+ "randomBytes",
195
+ "createHash",
196
+ "createHmac",
197
+ "timingSafeEqual",
198
+ "createCipheriv",
199
+ "createDecipheriv",
200
+ "scryptSync"
201
+ ],
193
202
  "burger:buffer": ["Buffer"],
194
203
  "burger:sqlite": ["Database"],
195
204
  "burger:zlib": [
@@ -184,7 +184,16 @@ var BURGER_EXPORTS = {
184
184
  ],
185
185
  "burger:os": ["platform", "arch", "cpus", "totalmem", "freemem", "hostname", "tmpdir", "homedir", "EOL"],
186
186
  "burger:worker_threads": ["isMainThread", "workerData", "parentPort", "threadId"],
187
- "burger:crypto": ["randomUUID", "randomBytes", "createHash", "createHmac", "timingSafeEqual"],
187
+ "burger:crypto": [
188
+ "randomUUID",
189
+ "randomBytes",
190
+ "createHash",
191
+ "createHmac",
192
+ "timingSafeEqual",
193
+ "createCipheriv",
194
+ "createDecipheriv",
195
+ "scryptSync"
196
+ ],
188
197
  "burger:buffer": ["Buffer"],
189
198
  "burger:sqlite": ["Database"],
190
199
  "burger:zlib": [
@@ -300,6 +300,8 @@ declare module "burger:worker_threads" {
300
300
  }
301
301
 
302
302
  declare module "burger:crypto" {
303
+ import type { Buffer } from "burger:buffer";
304
+
303
305
  export type HashAlgorithm = "sha256" | "sha512" | "sha1";
304
306
  export type DigestEncoding = "hex" | "base64";
305
307
  export interface Hash {
@@ -313,12 +315,60 @@ declare module "burger:crypto" {
313
315
  export function createHash(algorithm: HashAlgorithm): Hash;
314
316
  export function createHmac(algorithm: HashAlgorithm, key: string | Uint8Array): Hmac;
315
317
  export function timingSafeEqual(a: Uint8Array, b: Uint8Array): boolean;
318
+
319
+ // Crypto pack (node-app-burger ADR 006): AES-256-GCM and scrypt, with Node's semantics.
320
+ /** A string (UTF-8 unless an encoding is given), `ArrayBuffer` or view. */
321
+ export type BinaryLike = string | ArrayBuffer | ArrayBufferView;
322
+ /** The one cipher Burger provides (the name is case-insensitive at runtime). */
323
+ export type CipherGCMTypes = "aes-256-gcm";
324
+ export type CipherEncoding = "utf8" | "utf-8" | "hex" | "base64" | "base64url" | "latin1" | "binary";
325
+ export interface CipherGCMOptions {
326
+ /** 16 only (Node's other GCM tag lengths are refused). */
327
+ authTagLength?: 16;
328
+ /** Encoding of a string `key`. */
329
+ encoding?: CipherEncoding;
330
+ }
331
+ interface GCMBase<Self> {
332
+ /** The output for `data` at once: ciphertext, or plaintext not yet authenticated. */
333
+ update(data: string | ArrayBufferView, inputEncoding?: CipherEncoding): Buffer;
334
+ update(data: string | ArrayBufferView, inputEncoding: CipherEncoding | undefined, outputEncoding: CipherEncoding): string;
335
+ final(): Buffer;
336
+ final(outputEncoding: CipherEncoding): string;
337
+ /** Additional authenticated data, before the first `update()`. */
338
+ setAAD(buffer: BinaryLike, options?: { encoding?: CipherEncoding; plaintextLength?: number }): Self;
339
+ }
340
+ export interface CipherGCM extends GCMBase<CipherGCM> {
341
+ /** The 16-byte tag, after `final()`. */
342
+ getAuthTag(): Buffer;
343
+ }
344
+ export interface DecipherGCM extends GCMBase<DecipherGCM> {
345
+ /** The 16-byte tag to check; `final()` throws if it does not authenticate. */
346
+ setAuthTag(buffer: BinaryLike, encoding?: CipherEncoding): DecipherGCM;
347
+ }
348
+ /** A 32-byte key and a 12-byte IV. */
349
+ export function createCipheriv(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, options?: CipherGCMOptions): CipherGCM;
350
+ export function createDecipheriv(algorithm: CipherGCMTypes, key: BinaryLike, iv: BinaryLike, options?: CipherGCMOptions): DecipherGCM;
351
+ /** Node's names and defaults (N 16384, r 8, p 1, maxmem 32 MiB); Burger also caps memory and work per app. */
352
+ export interface ScryptOptions {
353
+ N?: number;
354
+ cost?: number;
355
+ r?: number;
356
+ blockSize?: number;
357
+ p?: number;
358
+ parallelization?: number;
359
+ maxmem?: number;
360
+ }
361
+ export function scryptSync(password: BinaryLike, salt: BinaryLike, keylen: number, options?: ScryptOptions): Buffer;
362
+
316
363
  const crypto: {
317
364
  randomUUID: typeof randomUUID;
318
365
  randomBytes: typeof randomBytes;
319
366
  createHash: typeof createHash;
320
367
  createHmac: typeof createHmac;
321
368
  timingSafeEqual: typeof timingSafeEqual;
369
+ createCipheriv: typeof createCipheriv;
370
+ createDecipheriv: typeof createDecipheriv;
371
+ scryptSync: typeof scryptSync;
322
372
  };
323
373
  export default crypto;
324
374
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@econ-v1/app-sdk",
3
- "version": "7.6.38",
3
+ "version": "7.6.40",
4
4
  "description": "TypeScript SDK for building Node mini-app plugins (Bun runtime) on the Lightning-powered marketplace daemon",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "author": "Node contributors",