@ipbyrne/mongo-encrypted-query
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -6,3 +6,3 @@ { | ||
"license": "Apache-2.0", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"main": "dist/index.js", | ||
@@ -9,0 +9,0 @@ "typings": "dist/index.d.ts", |
@@ -6,3 +6,3 @@ import { | ||
} from "./utils"; | ||
import { decrypt, generate } from "./cipher/cipher"; | ||
import { decrypt, encrypt, generate } from "./cipher/cipher"; | ||
import { PrivateKeyJwk, Data } from "./types"; | ||
@@ -16,8 +16,22 @@ import * as Types from "./types"; | ||
export const encryptData = (data: Data, privateKeyJwk: PrivateKeyJwk) => { | ||
const encryptedData = createEncryptedObject(data, privateKeyJwk); | ||
return encryptedData; | ||
export const encryptData = ( | ||
data: Data | any, | ||
privateKeyJwk: PrivateKeyJwk | ||
): any => { | ||
const type = typeof data; | ||
if (Array.isArray(data)) { | ||
return data.map((d: any) => encryptData(d, privateKeyJwk)); | ||
} | ||
if (type === "object") { | ||
const encryptedData = createEncryptedObject(data, privateKeyJwk); | ||
return encryptedData; | ||
} | ||
return encrypt(data, privateKeyJwk as PrivateKeyJwk); | ||
}; | ||
export const decryptData = (data: any, privateKeyJwk: PrivateKeyJwk): any => { | ||
export const decryptData = ( | ||
data: Data | any, | ||
privateKeyJwk: PrivateKeyJwk | ||
): any => { | ||
const type = typeof data; | ||
@@ -24,0 +38,0 @@ if (Array.isArray(data)) { |
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
30509
396