@wjsc/remote-config-client
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -15,3 +15,3 @@ const fs = require('fs'); | ||
client.get = clientProxy.get(security, client.get, privateKey, passphrase); | ||
client.set = clientProxy.set(security, client.set, publicKey); | ||
client.set = clientProxy.set(security, client.set, privateKey, passphrase, publicKey); | ||
@@ -18,0 +18,0 @@ return client; |
const LIMIT = ':'; | ||
const get = ( { privateDecrypt, hash }, get, privateKey, passphrase ) => { | ||
const formatNamespace = (secure, privateEncrypt, namespace, privateKey, passphrase) => secure | ||
? namespace + LIMIT + privateEncrypt(namespace, privateKey, passphrase) | ||
: namespace; | ||
const get = ( { privateEncrypt, privateDecrypt }, get, privateKey, passphrase ) => { | ||
return new Proxy(get, { | ||
apply: (target, thisArg, [{ namespace, key, secure = true }, callback]) => { | ||
return target.call(thisArg, { | ||
namespace: namespace + LIMIT + hash(namespace), | ||
namespace: formatNamespace(secure, privateEncrypt, namespace, privateKey, passphrase), | ||
key, | ||
@@ -20,7 +25,7 @@ }, | ||
const set = ( { publicEncrypt, hash }, set, publicKey ) => { | ||
const set = ( { privateEncrypt, publicEncrypt }, set, privateKey, passphrase, publicKey ) => { | ||
return new Proxy(set, { | ||
apply: (target, thisArg, [{ namespace, key, value, secure = true }, callback]) => { | ||
return target.call(thisArg, { | ||
namespace: namespace + LIMIT + hash(namespace), | ||
namespace: formatNamespace(secure, privateEncrypt, namespace, privateKey, passphrase), | ||
key, | ||
@@ -27,0 +32,0 @@ value: secure ? publicEncrypt( value, publicKey ) : value, |
{ | ||
"name": "@wjsc/remote-config-client", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -97,2 +97,3 @@ # remote-config-grpc | ||
Options: | ||
-x, --share Do not encrypt value | ||
-r, --private <path> Private key path | ||
@@ -113,5 +114,4 @@ -p, --passphrase <path> Passphrase | ||
Options: | ||
-x, --share Do not encrypt value | ||
-u, --public <path> Public key path | ||
-r, --private <path> Private key path | ||
-p, --passphrase <path> Passphrase | ||
-n, --namespace <namespace> Config namespace | ||
@@ -118,0 +118,0 @@ -k, --key <key> Config key |
const crypto = require("crypto"); | ||
const hash = (str, algorithm, options) => | ||
crypto.createHash(algorithm || 'sha256', options).update(str).digest("hex"); | ||
const publicEncrypt = (utf8Data, key) => | ||
@@ -44,4 +41,3 @@ crypto.publicEncrypt(key, Buffer.from(utf8Data, 'utf8')).toString('base64'); | ||
privateDecrypt, | ||
privateEncrypt, | ||
hash | ||
privateEncrypt | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8686