asherah 1.0.6 → 1.0.9
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 +13 -8
- package/binaries/libasherah-arm64.dylib +0 -0
- package/binaries/libasherah-arm64.so +0 -0
- package/binaries/libasherah-debug-arm64.dylib +0 -0
- package/binaries/libasherah-debug-arm64.so +0 -0
- package/binaries/libasherah-debug-x64.dylib +0 -0
- package/binaries/libasherah-debug-x64.so +0 -0
- package/binaries/libasherah-x64.dylib +0 -0
- package/binaries/libasherah-x64.so +0 -0
- package/index.js +27 -14
- package/package.json +1 -1
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
|
|
8
|
+
```javascript
|
|
9
|
+
import { setup, encrypt, decrypt } from 'asherah'
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
setup({
|
|
12
|
+
kmsType: 'static',
|
|
13
|
+
metastore: 'memory',
|
|
14
|
+
serviceName: 'TestService',
|
|
15
|
+
productId: 'TestProduct',
|
|
16
|
+
verbose: true,
|
|
17
|
+
sessionCache: true
|
|
18
|
+
});
|
|
12
19
|
|
|
13
|
-
|
|
20
|
+
const data = Buffer.from('mysecretdata', 'utf8');
|
|
14
21
|
|
|
15
|
-
|
|
22
|
+
const encrypted = encrypt('partition', data);
|
|
16
23
|
console.log(encrypted);
|
|
17
24
|
|
|
18
|
-
|
|
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
|
|
Binary file
|
package/index.js
CHANGED
|
@@ -36,20 +36,33 @@ import cobhan from 'cobhan'
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* @param {string} kmsType
|
|
40
|
-
* @param {string} metastore
|
|
41
|
-
* @param {string}
|
|
42
|
-
* @param {string}
|
|
43
|
-
* @param {string} [
|
|
44
|
-
* @param {string} [
|
|
45
|
-
* @param {
|
|
46
|
-
* @param {string}
|
|
47
|
-
* @param {
|
|
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 {boolean} [args.verbose]
|
|
50
|
+
* @param {boolean} [args.sessionCache]
|
|
51
51
|
*/
|
|
52
|
-
function setup(
|
|
52
|
+
function setup({
|
|
53
|
+
kmsType,
|
|
54
|
+
metastore,
|
|
55
|
+
serviceName,
|
|
56
|
+
productId,
|
|
57
|
+
rdbmsConnectionString = null,
|
|
58
|
+
dynamoDbEndpoint = null,
|
|
59
|
+
dynamoDbRegion = null,
|
|
60
|
+
dynamoDbTableName = null,
|
|
61
|
+
enableRegionSuffix = null,
|
|
62
|
+
preferredRegion = null,
|
|
63
|
+
verbose = false,
|
|
64
|
+
sessionCache = false
|
|
65
|
+
}) {
|
|
53
66
|
const kmsTypeBuffer = cobhan.string_to_cbuffer(kmsType)
|
|
54
67
|
const metastoreBuffer = cobhan.string_to_cbuffer(metastore)
|
|
55
68
|
const rdbmsConnectionStringBuffer = cobhan.string_to_cbuffer(rdbmsConnectionString)
|
|
@@ -128,4 +141,4 @@ function encrypt(partitionId, data) {
|
|
|
128
141
|
return dataRowRecord;
|
|
129
142
|
}
|
|
130
143
|
|
|
131
|
-
export
|
|
144
|
+
export { encrypt, decrypt, setup };
|