asherah 1.3.2 → 1.3.3

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/package.json +1 -1
  2. package/src/napiasherah.cc +46 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asherah",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Asherah envelope encryption and key rotation library",
5
5
  "main": "dist/asherah.js",
6
6
  "repository": {
@@ -293,8 +293,17 @@ Napi::Value Napi_SetupJson(const Napi::CallbackInfo &info) {
293
293
  est_intermediate_key_overhead =
294
294
  productIdLength.Int32Value() + serviceNameLength.Int32Value();
295
295
 
296
+ if(unlikely(verbose_flag)) {
297
+ debug_log("Calling asherah-cobhan SetupJson");
298
+ }
299
+
296
300
  // extern GoInt32 SetupJson(void* configJson);
297
301
  GoInt32 result = SetupJson(configJsonCobhanBuffer);
302
+
303
+ if(unlikely(verbose_flag)) {
304
+ debug_log("Returned from asherah-cobhan SetupJson");
305
+ }
306
+
298
307
  if (unlikely(result < 0)) {
299
308
  return LogErrorAndThrow(env,
300
309
  setupjson_failed_message + std::to_string(result));
@@ -332,10 +341,19 @@ Napi::Value encrypt_to_json(Napi::Env &env, size_t partition_bytes,
332
341
  std::string(" failed to allocate cobhan output buffer"));
333
342
  }
334
343
 
344
+ if(unlikely(verbose_flag)) {
345
+ debug_log("Calling asherah-cobhan EncryptToJson");
346
+ }
347
+
335
348
  // extern GoInt32 EncryptToJson(void* partitionIdPtr, void* dataPtr, void*
336
349
  // jsonPtr);
337
350
  GoInt32 result = EncryptToJson(partitionIdCobhanBuffer, dataCobhanBuffer,
338
351
  cobhanOutputBuffer);
352
+
353
+ if(unlikely(verbose_flag)) {
354
+ debug_log("Returning from asherah-cobhan EncryptToJson");
355
+ }
356
+
339
357
  if (unlikely(result < 0)) {
340
358
  return LogErrorAndThrow(env,
341
359
  encrypt_failed_message + std::to_string(result));
@@ -657,10 +675,19 @@ Napi::Value Napi_DecryptFromJsonToBuffer(const Napi::CallbackInfo &info) {
657
675
  std::string(" failed to allocate cobhan output buffer"));
658
676
  }
659
677
 
678
+ if(unlikely(verbose_flag)) {
679
+ debug_log("Calling asherah-cobhan DecryptFromJson");
680
+ }
681
+
660
682
  // extern GoInt32 DecryptFromJson(void* partitionIdPtr, void* jsonPtr, void*
661
683
  // dataPtr);
662
684
  GoInt32 result = DecryptFromJson(partitionIdCobhanBuffer,
663
685
  inputJsonCobhanBuffer, cobhanOutputBuffer);
686
+
687
+ if(unlikely(verbose_flag)) {
688
+ debug_log("Returned from asherah-cobhan DecryptFromJson");
689
+ }
690
+
664
691
  if (unlikely(result < 0)) {
665
692
  return LogErrorAndThrow(env,
666
693
  decrypt_failed_message + std::to_string(result));
@@ -784,10 +811,19 @@ Napi::Value Napi_DecryptFromJsonToString(const Napi::CallbackInfo &info) {
784
811
  std::string(" failed to allocate cobhan output buffer"));
785
812
  }
786
813
 
814
+ if(unlikely(verbose_flag)) {
815
+ debug_log("Calling asherah-cobhan DecryptFromJson");
816
+ }
817
+
787
818
  // extern GoInt32 DecryptFromJson(void* partitionIdPtr, void* jsonPtr, void*
788
819
  // dataPtr);
789
820
  GoInt32 result = DecryptFromJson(partitionIdCobhanBuffer,
790
821
  inputJsonCobhanBuffer, cobhanOutputBuffer);
822
+
823
+ if(unlikely(verbose_flag)) {
824
+ debug_log("Returned from asherah-cobhan DecryptFromJson");
825
+ }
826
+
791
827
  if (unlikely(result < 0)) {
792
828
  return LogErrorAndThrow(env,
793
829
  decrypt_failed_message + std::to_string(result));
@@ -806,7 +842,17 @@ Napi::Value Napi_Shutdown(const Napi::CallbackInfo &info) {
806
842
 
807
843
  setup_state = 0;
808
844
  // extern void Shutdown();
845
+
846
+ if(unlikely(verbose_flag)) {
847
+ debug_log("Calling asherah-cobhan Shutdown");
848
+ }
849
+
809
850
  Shutdown();
851
+
852
+ if(unlikely(verbose_flag)) {
853
+ debug_log("Returned from asherah-cobhan Shutdown");
854
+ }
855
+
810
856
  return env.Null();
811
857
  }
812
858