asherah 1.0.7 → 1.0.10

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/README.md CHANGED
@@ -5,18 +5,23 @@ This is a wrapper of the Asherah Go implementation using the Cobhan FFI library
5
5
  Example code:
6
6
 
7
7
 
8
- ```
9
- import asherah from 'asherah'
8
+ ```javascript
9
+ import { setup, encrypt, decrypt } from 'asherah'
10
10
 
11
- asherah.setup('static', 'memory', null, null, null, null, null, 'TestService', 'TestProduct', null, true, true)
11
+ setup({
12
+ kmsType: 'static',
13
+ metastore: 'memory',
14
+ serviceName: 'TestService',
15
+ productId: 'TestProduct',
16
+ verbose: true,
17
+ sessionCache: true
18
+ });
12
19
 
13
- var data = Buffer.from('mysecretdata', 'utf8');
20
+ const data = Buffer.from('mysecretdata', 'utf8');
14
21
 
15
- var encrypted = asherah.encrypt('partition', data);
22
+ const encrypted = encrypt('partition', data);
16
23
  console.log(encrypted);
17
24
 
18
- var decrypted = asherah.decrypt('partition', encrypted);
19
-
25
+ const decrypted = decrypt('partition', encrypted);
20
26
  console.log("Decrypted: " + decrypted.toString('utf8'));
21
-
22
27
  ```
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/index.js CHANGED
@@ -36,20 +36,35 @@ import cobhan from 'cobhan'
36
36
  });
37
37
 
38
38
  /**
39
- * @param {string} kmsType
40
- * @param {string} metastore
41
- * @param {string} [rdbmsConnectionString]
42
- * @param {string} [dynamoDbEndpoint]
43
- * @param {string} [dynamoDbRegion]
44
- * @param {string} [dynamoDbTableName]
45
- * @param {boolean} [enableRegionSuffix]
46
- * @param {string} serviceName
47
- * @param {string} productId
48
- * @param {string} [preferredRegion]
49
- * @param {boolean} verbose
50
- * @param {boolean} sessionCache
39
+ * @param {string} args.kmsType
40
+ * @param {string} args.metastore
41
+ * @param {string} args.serviceName
42
+ * @param {string} args.productId
43
+ * @param {string} [args.rdbmsConnectionString]
44
+ * @param {string} [args.dynamoDbEndpoint]
45
+ * @param {string} [args.dynamoDbRegion]
46
+ * @param {string} [args.dynamoDbTableName]
47
+ * @param {boolean} [args.enableRegionSuffix]
48
+ * @param {string} [args.preferredRegion]
49
+ * @param {string} [args.regionMap]
50
+ * @param {boolean} [args.verbose]
51
+ * @param {boolean} [args.sessionCache]
51
52
  */
52
- function setup(kmsType, metastore, rdbmsConnectionString, dynamoDbEndpoint, dynamoDbRegion, dynamoDbTableName, enableRegionSuffix, serviceName, productId, preferredRegion, verbose, sessionCache) {
53
+ function setup({
54
+ kmsType,
55
+ metastore,
56
+ serviceName,
57
+ productId,
58
+ rdbmsConnectionString = null,
59
+ dynamoDbEndpoint = null,
60
+ dynamoDbRegion = null,
61
+ dynamoDbTableName = null,
62
+ enableRegionSuffix = null,
63
+ preferredRegion = null,
64
+ regionMap = null,
65
+ verbose = false,
66
+ sessionCache = false
67
+ }) {
53
68
  const kmsTypeBuffer = cobhan.string_to_cbuffer(kmsType)
54
69
  const metastoreBuffer = cobhan.string_to_cbuffer(metastore)
55
70
  const rdbmsConnectionStringBuffer = cobhan.string_to_cbuffer(rdbmsConnectionString)
@@ -60,10 +75,11 @@ function setup(kmsType, metastore, rdbmsConnectionString, dynamoDbEndpoint, dyna
60
75
  const serviceNameBuffer = cobhan.string_to_cbuffer(serviceName)
61
76
  const productIdBuffer = cobhan.string_to_cbuffer(productId)
62
77
  const preferredRegionBuffer = cobhan.string_to_cbuffer(preferredRegion)
78
+ const regionMapBuffer = cobhan.string_to_cbuffer(regionMap)
63
79
  const verboseInt = verbose ? 1 : 0
64
80
  const sessionCacheInt = sessionCache ? 1 : 0
65
81
 
66
- const result = libasherah.Setup(kmsTypeBuffer, metastoreBuffer, rdbmsConnectionStringBuffer, dynamoDbEndpointBuffer, dynamoDbRegionBuffer, dynamoDbTableNameBuffer, enableRegionSuffixInt, serviceNameBuffer, productIdBuffer, preferredRegionBuffer, verboseInt, sessionCacheInt);
82
+ const result = libasherah.Setup(kmsTypeBuffer, metastoreBuffer, rdbmsConnectionStringBuffer, dynamoDbEndpointBuffer, dynamoDbRegionBuffer, dynamoDbTableNameBuffer, enableRegionSuffixInt, serviceNameBuffer, productIdBuffer, preferredRegionBuffer, regionMapBuffer, verboseInt, sessionCacheInt);
67
83
  if (result < 0) {
68
84
  throw new Error('setup failed: ' + result);
69
85
  }
@@ -128,4 +144,4 @@ function encrypt(partitionId, data) {
128
144
  return dataRowRecord;
129
145
  }
130
146
 
131
- export default { encrypt, decrypt, setup };
147
+ export { encrypt, decrypt, setup };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asherah",
3
- "version": "1.0.7",
3
+ "version": "1.0.10",
4
4
  "description": "Asherah envelope encryption and key rotation library",
5
5
  "main": "index.js",
6
6
  "type": "module",