asherah 4.0.24 → 4.0.25

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.
Files changed (2) hide show
  1. package/npm/index.js +16 -1
  2. package/package.json +9 -9
package/npm/index.js CHANGED
@@ -215,12 +215,27 @@ function set_log_hook(callback) {
215
215
  return native.setLogHook(callback);
216
216
  }
217
217
 
218
+ // Wrap decrypt/decryptAsync to accept both String and Buffer inputs.
219
+ // The native functions take Buffer to avoid V8 UTF-16→UTF-8 string conversion
220
+ // overhead that scales with payload size.
221
+ function toBuffer(input) {
222
+ return typeof input === 'string' ? Buffer.from(input) : input;
223
+ }
224
+ function decrypt(partitionId, dataRowRecord) {
225
+ return native.decrypt(partitionId, toBuffer(dataRowRecord));
226
+ }
227
+ function decryptAsync(partitionId, dataRowRecord) {
228
+ return native.decryptAsync(partitionId, toBuffer(dataRowRecord));
229
+ }
230
+
218
231
  // Export everything from native addon
219
232
  Object.assign(module.exports, native);
220
233
 
221
234
  // Override setup/setupAsync with normalizing versions
222
235
  module.exports.setup = setup;
223
236
  module.exports.setupAsync = setupAsync;
237
+ module.exports.decrypt = decrypt;
238
+ module.exports.decryptAsync = decryptAsync;
224
239
 
225
240
  // snake_case aliases for canonical API compatibility
226
241
  module.exports.setup_async = setupAsync;
@@ -228,7 +243,7 @@ module.exports.shutdown_async = native.shutdownAsync;
228
243
  module.exports.encrypt_async = native.encryptAsync;
229
244
  module.exports.encrypt_string = native.encryptString;
230
245
  module.exports.encrypt_string_async = native.encryptStringAsync;
231
- module.exports.decrypt_async = native.decryptAsync;
246
+ module.exports.decrypt_async = decryptAsync;
232
247
  module.exports.decrypt_string = native.decryptString;
233
248
  module.exports.decrypt_string_async = native.decryptStringAsync;
234
249
  module.exports.set_max_stack_alloc_item_size = native.setMaxStackAllocItemSize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asherah",
3
- "version": "4.0.24",
3
+ "version": "4.0.25",
4
4
  "private": false,
5
5
  "description": "Asherah envelope encryption and key rotation library",
6
6
  "main": "npm/index.js",
@@ -40,13 +40,13 @@
40
40
  "node": ">= 18"
41
41
  },
42
42
  "optionalDependencies": {
43
- "asherah-darwin-arm64": "4.0.24",
44
- "asherah-darwin-x64": "4.0.24",
45
- "asherah-linux-x64-gnu": "4.0.24",
46
- "asherah-linux-arm64-gnu": "4.0.24",
47
- "asherah-linux-x64-musl": "4.0.24",
48
- "asherah-linux-arm64-musl": "4.0.24",
49
- "asherah-windows-x64": "4.0.24",
50
- "asherah-windows-arm64": "4.0.24"
43
+ "asherah-darwin-arm64": "4.0.25",
44
+ "asherah-darwin-x64": "4.0.25",
45
+ "asherah-linux-x64-gnu": "4.0.25",
46
+ "asherah-linux-arm64-gnu": "4.0.25",
47
+ "asherah-linux-x64-musl": "4.0.25",
48
+ "asherah-linux-arm64-musl": "4.0.25",
49
+ "asherah-windows-x64": "4.0.25",
50
+ "asherah-windows-arm64": "4.0.25"
51
51
  }
52
52
  }