generated from cubetiq/ts-project
Task: Completed tests and fixed for default and e2e encryption module
This commit is contained in:
parent
fd27e6f9dc
commit
23ee44e0e6
@ -1 +1 @@
|
||||
6ef348dd9b0b4f29e47f4f1c9d7b6255
|
||||
FEFM9AY2m5jDq6GZ+CfLIA==
|
@ -1 +1 @@
|
||||
56773703de5fdbe4292749c2505b6059a6698aad7881065df0818442f7d559b2
|
||||
67rKmuc6DiDukE0jsUP421Eizo4CreaL6Q7Pg/NmH/s=
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"key": "56773703de5fdbe4292749c2505b6059a6698aad7881065df0818442f7d559b2",
|
||||
"iv": "6ef348dd9b0b4f29e47f4f1c9d7b6255"
|
||||
"key": "67rKmuc6DiDukE0jsUP421Eizo4CreaL6Q7Pg/NmH/s=",
|
||||
"iv": "FEFM9AY2m5jDq6GZ+CfLIA=="
|
||||
}
|
||||
|
@ -37,6 +37,7 @@
|
||||
"prettier": "2.3.2",
|
||||
"ts-jest": "^27.1.3",
|
||||
"ts-node-dev": "^1.1.8",
|
||||
"tsconfig-paths": "^3.12.0",
|
||||
"typescript": "^4.4.2"
|
||||
},
|
||||
"lint-staged": {
|
||||
|
@ -1,20 +1,33 @@
|
||||
import { assertNotNullOrUndefined } from "../../util"
|
||||
import {
|
||||
assertNotNullOrUndefined,
|
||||
readFileToJson,
|
||||
readFileToString,
|
||||
} from "../../util"
|
||||
import { ICryptoProvider } from "../provider.crypto"
|
||||
import { decrypt as dec, encrypt as enc } from "./../core/default.crypto"
|
||||
|
||||
interface DefaultCryptoProviderOptions {
|
||||
key?: string | Buffer | null | undefined
|
||||
iv?: string | Buffer | null | undefined
|
||||
keyiVPath?: string | null | undefined
|
||||
jsonPath?: string | null | undefined
|
||||
}
|
||||
|
||||
export class DefaultCryptoProvider implements ICryptoProvider {
|
||||
private _key: string | Buffer | null | undefined
|
||||
private _iv: string | Buffer | null | undefined
|
||||
|
||||
constructor(
|
||||
key?: string | Buffer | null,
|
||||
iv?: string | Buffer | null,
|
||||
keyJsonFilePath?: string | null
|
||||
) {
|
||||
if (keyJsonFilePath) {
|
||||
const json: any = require(keyJsonFilePath)
|
||||
constructor(options: DefaultCryptoProviderOptions) {
|
||||
const { key, iv, keyiVPath, jsonPath } = options
|
||||
|
||||
if (keyiVPath) {
|
||||
const json: any = readFileToJson(keyiVPath)
|
||||
this._key = json.key
|
||||
this._iv = json.iv
|
||||
} else if (jsonPath) {
|
||||
const json: any = readFileToJson(jsonPath)
|
||||
this._key = readFileToString(json.keyPath)
|
||||
this._iv = readFileToString(json.ivPath)
|
||||
} else {
|
||||
this._key = key
|
||||
this._iv = iv || key
|
||||
|
@ -2,21 +2,32 @@ import { e2eDecrypt, e2eEncrypt } from ".."
|
||||
import {
|
||||
assertNotNullOrUndefined,
|
||||
isNullOrUndefinedOrEmpty,
|
||||
readFileToJson,
|
||||
readFileToString,
|
||||
} from "../../util"
|
||||
import { ICryptoProvider } from "../provider.crypto"
|
||||
|
||||
interface E2ECryptoProviderOptions {
|
||||
privateKey?: string | Buffer | null | undefined
|
||||
publicKey?: string | Buffer | null | undefined
|
||||
privateKeyPath?: string | null | undefined
|
||||
publicKeyPath?: string | null | undefined
|
||||
jsonPath?: string | null | undefined
|
||||
}
|
||||
|
||||
export class E2ECryptoProvider implements ICryptoProvider {
|
||||
private privateKey: string | Buffer | null | undefined
|
||||
private publicKey: string | Buffer | null | undefined
|
||||
|
||||
constructor(
|
||||
privateKey?: string | Buffer | null | undefined,
|
||||
publicKey?: string | Buffer | null | undefined,
|
||||
privateKeyPath?: string | null | undefined,
|
||||
publicKeyPath?: string | null | undefined,
|
||||
jsonPath?: string | null | undefined
|
||||
) {
|
||||
constructor(options: E2ECryptoProviderOptions) {
|
||||
const {
|
||||
privateKey,
|
||||
publicKey,
|
||||
privateKeyPath,
|
||||
publicKeyPath,
|
||||
jsonPath,
|
||||
} = options
|
||||
|
||||
let isPrivateKeyInitialized = false
|
||||
let isPublicKeyInitialized = false
|
||||
if (privateKeyPath) {
|
||||
@ -30,7 +41,7 @@ export class E2ECryptoProvider implements ICryptoProvider {
|
||||
}
|
||||
|
||||
if (!isPrivateKeyInitialized && !isPublicKeyInitialized && jsonPath) {
|
||||
const json = require(jsonPath)
|
||||
const json = readFileToJson(jsonPath)
|
||||
if (json.privateKey) {
|
||||
this.privateKey = json.privateKey
|
||||
isPrivateKeyInitialized = !isNullOrUndefinedOrEmpty(
|
||||
|
@ -1 +1,7 @@
|
||||
export {}
|
||||
import {
|
||||
CryptoProvider,
|
||||
DefaultCryptoProvider,
|
||||
E2ECryptoProvider,
|
||||
} from "./crypto"
|
||||
|
||||
export { CryptoProvider, DefaultCryptoProvider, E2ECryptoProvider }
|
||||
|
@ -1,3 +1,111 @@
|
||||
test("test", () => {
|
||||
expect(1).toBe(1)
|
||||
import {
|
||||
CryptoProvider,
|
||||
DefaultCryptoProvider,
|
||||
E2ECryptoProvider,
|
||||
} from "../src"
|
||||
|
||||
// DefaultCryptoProvider
|
||||
const key = "67rKmuc6DiDukE0jsUP421Eizo4CreaL6Q7Pg/NmH/s="
|
||||
const iv = "FEFM9AY2m5jDq6GZ+CfLIA=="
|
||||
const keyJsonFileValuesDefault = "./dummy/ase-256.json"
|
||||
const keyJsonFileKeysDefault = "./dummy/ase-256.keys.json"
|
||||
|
||||
// E2ECryptoProvider
|
||||
const PRIVATE_KEY_VALUE =
|
||||
"-----BEGIN RSA PRIVATE KEY----- MIIJKQIBAAKCAgEA0PfjoO54+QZui0EfssxGvHOm8bhDzQIIDcH/jUvN25E28MYF VOy1CgDk2n25eakhaaK8ogmP9PfczGpLalCGfVACCXNQFc60k6zjQY8lNY6DY2NJ 4qGR5OZsA2lhXgYtptqHCvGnqqIBpfYkddKzZOjQGZvUQ3XVZvEpkDuJGvPFW/+B 4NjsgSK0bJzygnJnbJYUHezBVRQynJRIxJmCZfuhqJM2w0FLB1/8TZVn9w3OC3DX avU7DfEGOlJb9evRrvdVGag14Pcy6SXoZ1jFscRJuXyWy1mLooTx6osj7V6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1mLooTx6osj7V6VYhnKZJrlRTAUxnGZLuBdqYztU7SNhZfmuCSIS+nd uqrdM9P3NPqgOqmIMTps0fcQg0DU5CFdWIy/FecErg1YaAhbEOqQO4QQlTmMDFFJ 63Y9rE3s9W5k30ZP8Ydxa8UT3su36ePzUGzWXUu2M8ffc8nnfiAvh1XgJiBqDJkm VEG3GzmDL0BfDLqMnhBJ2UaQPXK9w52masDgvHvyMEZoBaFBHtVICl4Jek6O9KSz 1uWcR/+C72fBEU4iA/h4rdH4PVMTP99YhN+Zd4w9UM2tITafCM3RdNbKZ3f+oXfF CjqNKiJI/VSLkErOKQnw/AiGT8dpmmFGl+DazUsYNEP3ScFUAI+ZqsUyh5q9SoCn YmcpuMbXLRLVYQJQASkYwBkCAwEAAQ== -----END PUBLIC KEY-----"
|
||||
const privatePublicJsonFileValuesDefault = "./dummy/private-public.json"
|
||||
const privatePublicJsonFileKeysDefault = "./dummy/private-public.keys.json"
|
||||
const privateKeyPath = "./dummy/private-key.pem"
|
||||
const publicKeyPath = "./dummy/public-key.pem"
|
||||
|
||||
// Text
|
||||
const TEXT = `Hello World and Then...!`
|
||||
|
||||
test("test: Default Encryption From Values", () => {
|
||||
const provider = CryptoProvider.newInstance(
|
||||
new DefaultCryptoProvider({
|
||||
key: key,
|
||||
iv: iv,
|
||||
})
|
||||
)
|
||||
|
||||
const encrypted = provider.encrypt(TEXT)
|
||||
const decrypted = provider.decrypt(encrypted)
|
||||
expect(decrypted).toBe(TEXT)
|
||||
})
|
||||
|
||||
test("test: Default Encryption From JsonFile Values", () => {
|
||||
const provider = CryptoProvider.newInstance(
|
||||
new DefaultCryptoProvider({
|
||||
keyiVPath: keyJsonFileValuesDefault,
|
||||
})
|
||||
)
|
||||
|
||||
const encrypted = provider.encrypt(TEXT)
|
||||
const decrypted = provider.decrypt(encrypted)
|
||||
expect(decrypted).toBe(TEXT)
|
||||
})
|
||||
|
||||
test("test: Default Encryption From JsonFile Keys Path", () => {
|
||||
const provider = CryptoProvider.newInstance(
|
||||
new DefaultCryptoProvider({
|
||||
jsonPath: keyJsonFileKeysDefault,
|
||||
})
|
||||
)
|
||||
|
||||
const encrypted = provider.encrypt(TEXT)
|
||||
const decrypted = provider.decrypt(encrypted)
|
||||
expect(decrypted).toBe(TEXT)
|
||||
})
|
||||
|
||||
test("test: E2E Encryption From Values", () => {
|
||||
const provider = CryptoProvider.newInstance(
|
||||
new E2ECryptoProvider({
|
||||
publicKey: PUBLIC_KEY_VALUE,
|
||||
privateKey: PRIVATE_KEY_VALUE,
|
||||
})
|
||||
)
|
||||
|
||||
const encrypted = provider.encrypt(TEXT)
|
||||
const decrypted = provider.decrypt(encrypted)
|
||||
expect(decrypted).toBe(TEXT)
|
||||
})
|
||||
|
||||
test("test: E2E Encryption From Files Values", () => {
|
||||
const provider = CryptoProvider.newInstance(
|
||||
new E2ECryptoProvider({
|
||||
privateKeyPath: privateKeyPath,
|
||||
publicKeyPath: publicKeyPath,
|
||||
})
|
||||
)
|
||||
|
||||
const encrypted = provider.encrypt(TEXT)
|
||||
const decrypted = provider.decrypt(encrypted)
|
||||
expect(decrypted).toBe(TEXT)
|
||||
})
|
||||
|
||||
test("test: E2E Encryption From JsonFile Values", () => {
|
||||
const provider = CryptoProvider.newInstance(
|
||||
new E2ECryptoProvider({
|
||||
jsonPath: privatePublicJsonFileValuesDefault,
|
||||
})
|
||||
)
|
||||
|
||||
const encrypted = provider.encrypt(TEXT)
|
||||
const decrypted = provider.decrypt(encrypted)
|
||||
expect(decrypted).toBe(TEXT)
|
||||
})
|
||||
|
||||
test("test: E2E Encryption From JsonFile Keys Path", () => {
|
||||
const provider = CryptoProvider.newInstance(
|
||||
new E2ECryptoProvider({
|
||||
jsonPath: privatePublicJsonFileKeysDefault,
|
||||
})
|
||||
)
|
||||
|
||||
const encrypted = provider.encrypt(TEXT)
|
||||
const decrypted = provider.decrypt(encrypted)
|
||||
expect(decrypted).toBe(TEXT)
|
||||
})
|
||||
|
@ -1,31 +1,28 @@
|
||||
import { readFileToString, readFileToJson } from "./../src/util"
|
||||
|
||||
const key = "67rKmuc6DiDukE0jsUP421Eizo4CreaL6Q7Pg/NmH/s="
|
||||
const iv = "FEFM9AY2m5jDq6GZ+CfLIA=="
|
||||
|
||||
test("test: readFileToString", () => {
|
||||
const value1 = readFileToString("./dummy/ase-256-32.key")
|
||||
const value2 = readFileToString("./dummy/ase-256-16.key")
|
||||
|
||||
expect(value1).toBe(
|
||||
"56773703de5fdbe4292749c2505b6059a6698aad7881065df0818442f7d559b2"
|
||||
)
|
||||
expect(value2).toBe("6ef348dd9b0b4f29e47f4f1c9d7b6255")
|
||||
expect(value1).toBe(key)
|
||||
expect(value2).toBe(iv)
|
||||
})
|
||||
|
||||
test("test: readFileToString with jsonFile key-paths", () => {
|
||||
const json = readFileToJson("./dummy/ase-256.keys.json")
|
||||
const value1 = readFileToString(json.keyPath)
|
||||
const value2 = readFileToString(json.ivPath)
|
||||
expect(value1).toBe(
|
||||
"56773703de5fdbe4292749c2505b6059a6698aad7881065df0818442f7d559b2"
|
||||
)
|
||||
expect(value2).toBe("6ef348dd9b0b4f29e47f4f1c9d7b6255")
|
||||
expect(value1).toBe(key)
|
||||
expect(value2).toBe(iv)
|
||||
})
|
||||
|
||||
test("test: readFileToString with jsonFile values", () => {
|
||||
const json = readFileToJson("./dummy/ase-256.json")
|
||||
const value1 = json.key
|
||||
const value2 = json.iv
|
||||
expect(value1).toBe(
|
||||
"56773703de5fdbe4292749c2505b6059a6698aad7881065df0818442f7d559b2"
|
||||
)
|
||||
expect(value2).toBe("6ef348dd9b0b4f29e47f4f1c9d7b6255")
|
||||
expect(value1).toBe(key)
|
||||
expect(value2).toBe(iv)
|
||||
})
|
||||
|
114
tsconfig.json
114
tsconfig.json
@ -1,100 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
||||
|
||||
/* Projects */
|
||||
// "incremental": true, /* Enable incremental compilation */
|
||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||
|
||||
/* Language and Environment */
|
||||
"target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
||||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
||||
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
||||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||
|
||||
/* Modules */
|
||||
"module": "commonjs", /* Specify what module code is generated. */
|
||||
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files */
|
||||
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
/* JavaScript Support */
|
||||
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
||||
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
||||
|
||||
/* Emit */
|
||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
||||
"outDir": "dist", /* Specify an output folder for all emitted files. */
|
||||
// "removeComments": true, /* Disable emitting comments. */
|
||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
||||
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
||||
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
||||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
||||
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
||||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
||||
|
||||
/* Interop Constraints */
|
||||
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
||||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||
|
||||
/* Type Checking */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
||||
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
||||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||
"lib": ["ES2015"],
|
||||
/* Completeness */
|
||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"sourceMap": false,
|
||||
"outDir": "dist",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"lib": ["ES2015"],
|
||||
"skipLibCheck": true,
|
||||
"experimentalDecorators": true,
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
},
|
||||
}
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user