A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
feat: open source notesnook crypto module (#329)
Abdullah Attab4ce1efc1a9d
diff --git a/packages/crypto/.npmignore b/packages/crypto/.npmignorenew file mode 100644index 000000000..8b9e4f928--- /dev/null+++ b/packages/crypto/.npmignore@@ -0,0 +1,5 @@+*++!dist/**/**/*+!package.json+!README.md\ No newline at end of filediff --git a/packages/crypto/index.ts b/packages/crypto/index.tsnew file mode 100644index 000000000..1c45873a5--- /dev/null+++ b/packages/crypto/index.ts@@ -0,0 +1,124 @@+import { ready } from "libsodium-wrappers";+import Decryption from "./src/decryption";+import Encryption from "./src/encryption";+import { INNCrypto, IStreamable } from "./src/interfaces";+import KeyUtils from "./src/keyutils";+import Password from "./src/password";+import {+ Cipher,+ EncryptionKey,+ OutputFormat,+ Plaintext,+ SerializedKey,+ Chunk,+} from "./src/types";++export class NNCrypto implements INNCrypto {+ private isReady: boolean = false;++ private async init() {+ if (this.isReady) return;+ await ready;+ this.isReady = true;+ }++ async encrypt(+ key: SerializedKey,+ plaintext: Plaintext,+ outputFormat: OutputFormat = "uint8array"+ ): Promise<Cipher> {+ await this.init();+ return Encryption.encrypt(key, plaintext, outputFormat);+ }++ async decrypt(+ key: SerializedKey,+ cipherData: Cipher,+ outputFormat: OutputFormat = "text"+ ): Promise<Plaintext> {+ await this.init();+ return Decryption.decrypt(key, cipherData, outputFormat);+ }++ async hash(password: string, salt: string): Promise<string> {+ await this.init();+ return Password.hash(password, salt);+ }++ async deriveKey(password: string, salt?: string): Promise<EncryptionKey> {+ await this.init();+ return KeyUtils.deriveKey(password, salt);+ }++ async exportKey(password: string, salt?: string): Promise<SerializedKey> {+ await this.init();+ return KeyUtils.exportKey(password, salt);+ }++ async createEncryptionStream(+ key: SerializedKey,+ stream: IStreamable+ ): Promise<string> {+ await this.init();+ const encryptionStream = Encryption.createStream(key);+ while (true) {+ const chunk = await stream.read();+ if (!chunk) break;++ const { data, final } = chunk;+ if (!data) break;++ const encryptedChunk: Chunk = {+ data: encryptionStream.write(data, final),+ final,+ };+ await stream.write(encryptedChunk);++ if (final) break;+ }+ return encryptionStream.header;+ }++ async createDecryptionStream(+ iv: string,+ key: SerializedKey,+ stream: IStreamable+ ) {+ await this.init();+ const decryptionStream = Decryption.createStream(iv, key);+ while (true) {+ const chunk = await stream.read();+ if (!chunk) break;++ const { data, final } = chunk;+ if (!data) break;++ const decryptedChunk: Chunk = {+ data: decryptionStream.read(data),+ final,+ };+ await stream.write(decryptedChunk);++ if (final) break;+ }+ }++ async encryptStream(+ key: SerializedKey,+ stream: IStreamable,+ _streamId?: string+ ): Promise<string> {+ await this.init();+ return await this.createEncryptionStream(key, stream);+ }++ async decryptStream(+ key: SerializedKey,+ iv: string,+ stream: IStreamable,+ _streamId?: string+ ): Promise<void> {+ await this.init();+ await this.createDecryptionStream(iv, key, stream);+ }+}diff --git a/packages/crypto/package-lock.json b/packages/crypto/package-lock.jsonnew file mode 100644index 000000000..b9971cd8c--- /dev/null+++ b/packages/crypto/package-lock.json@@ -0,0 +1,71 @@+{+ "name": "@notesnook/crypto",+ "version": "1.0.0",+ "lockfileVersion": 2,+ "requires": true,+ "packages": {+ "": {+ "name": "@notesnook/crypto",+ "version": "1.0.0",+ "license": "ISC",+ "dependencies": {+ "libsodium-wrappers": "^0.7.9"+ },+ "devDependencies": {+ "@types/libsodium-wrappers": "^0.7.9"+ }+ },+ "../streamablefs": {+ "version": "1.0.0",+ "extraneous": true,+ "license": "ISC",+ "dependencies": {+ "localforage": "^1.10.0"+ },+ "devDependencies": {+ "@types/localforage": "^0.0.34",+ "typescript": "^4.4.3"+ }+ },+ "node_modules/@types/libsodium-wrappers": {+ "version": "0.7.9",+ "resolved": "https://registry.npmjs.org/@types/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz",+ "integrity": "sha512-LisgKLlYQk19baQwjkBZZXdJL0KbeTpdEnrAfz5hQACbklCY0gVFnsKUyjfNWF1UQsCSjw93Sj5jSbiO8RPfdw==",+ "dev": true+ },+ "node_modules/libsodium": {+ "version": "0.7.9",+ "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.9.tgz",+ "integrity": "sha512-gfeADtR4D/CM0oRUviKBViMGXZDgnFdMKMzHsvBdqLBHd9ySi6EtYnmuhHVDDYgYpAO8eU8hEY+F8vIUAPh08A=="+ },+ "node_modules/libsodium-wrappers": {+ "version": "0.7.9",+ "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz",+ "integrity": "sha512-9HaAeBGk1nKTRFRHkt7nzxqCvnkWTjn1pdjKgcUnZxj0FyOP4CnhgFhMdrFfgNsukijBGyBLpP2m2uKT1vuWhQ==",+ "dependencies": {+ "libsodium": "^0.7.0"+ }+ }+ },+ "dependencies": {+ "@types/libsodium-wrappers": {+ "version": "0.7.9",+ "resolved": "https://registry.npmjs.org/@types/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz",+ "integrity": "sha512-LisgKLlYQk19baQwjkBZZXdJL0KbeTpdEnrAfz5hQACbklCY0gVFnsKUyjfNWF1UQsCSjw93Sj5jSbiO8RPfdw==",+ "dev": true+ },+ "libsodium": {+ "version": "0.7.9",+ "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.9.tgz",+ "integrity": "sha512-gfeADtR4D/CM0oRUviKBViMGXZDgnFdMKMzHsvBdqLBHd9ySi6EtYnmuhHVDDYgYpAO8eU8hEY+F8vIUAPh08A=="+ },+ "libsodium-wrappers": {+ "version": "0.7.9",+ "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz",+ "integrity": "sha512-9HaAeBGk1nKTRFRHkt7nzxqCvnkWTjn1pdjKgcUnZxj0FyOP4CnhgFhMdrFfgNsukijBGyBLpP2m2uKT1vuWhQ==",+ "requires": {+ "libsodium": "^0.7.0"+ }+ }+ }+}diff --git a/packages/crypto/package.json b/packages/crypto/package.jsonnew file mode 100644index 000000000..ac29b529d--- /dev/null+++ b/packages/crypto/package.json@@ -0,0 +1,25 @@+{+ "name": "@notesnook/crypto",+ "private": false,+ "description": "An easy to use wrapper around libsodium exposing essential cryptographic methods. Currently only Web is supported.",+ "version": "1.0.0",+ "main": "dist/index.js",+ "types": "dist/index.d.ts",+ "scripts": {+ "build": "tsc --declaration --outDir ./dist"+ },+ "keywords": [],+ "author": "",+ "license": "MIT",+ "dependencies": {+ "libsodium-wrappers": "^0.7.9"+ },+ "devDependencies": {+ "@types/libsodium-wrappers": "^0.7.9"+ },+ "repository": {+ "type": "git",+ "url": "https://github.com/streetwriters/notesnook.git",+ "directory": "packages/crypto"+ }+}diff --git a/packages/crypto/src/decryption.ts b/packages/crypto/src/decryption.tsnew file mode 100644index 000000000..0c9ba3bfb--- /dev/null+++ b/packages/crypto/src/decryption.ts@@ -0,0 +1,94 @@+import {+ crypto_aead_xchacha20poly1305_ietf_decrypt,+ crypto_secretstream_xchacha20poly1305_init_pull,+ crypto_secretstream_xchacha20poly1305_pull,+ to_base64,+ from_base64,+ base64_variants,+ StateAddress,+ to_string,+ from_hex,+} from "libsodium-wrappers";+import KeyUtils from "./keyutils";+import {+ Cipher,+ EncryptionKey,+ OutputFormat,+ Plaintext,+ SerializedKey,+} from "./types";++export default class Decryption {+ private static transformInput(cipherData: Cipher): Uint8Array {+ let input: Uint8Array | null = null;+ if (+ typeof cipherData.cipher === "string" &&+ cipherData.format === "base64"+ ) {+ input = from_base64(+ cipherData.cipher,+ base64_variants.URLSAFE_NO_PADDING+ );+ } else if (+ typeof cipherData.cipher === "string" &&+ cipherData.format === "hex"+ ) {+ input = from_hex(cipherData.cipher);+ } else if (cipherData.cipher instanceof Uint8Array) {+ input = cipherData.cipher;+ }+ if (!input) throw new Error("Data cannot be null.");+ return input;+ }++ static decrypt(+ key: SerializedKey,+ cipherData: Cipher,+ outputFormat: OutputFormat = "text"+ ): Plaintext {+ if (!key.salt && cipherData.salt) key.salt = cipherData.salt;+ const encryptionKey = KeyUtils.transform(key);++ const input = this.transformInput(cipherData);+ const plaintext = crypto_aead_xchacha20poly1305_ietf_decrypt(+ null,+ input,+ null,+ from_base64(cipherData.iv),+ encryptionKey.key+ );++ return {+ format: outputFormat,+ data:+ outputFormat === "base64"+ ? to_base64(plaintext, base64_variants.ORIGINAL)+ : outputFormat === "text"+ ? to_string(plaintext)+ : plaintext,+ };+ }++ static createStream(header: string, key: SerializedKey): DecryptionStream {+ return new DecryptionStream(header, KeyUtils.transform(key));+ }+}++class DecryptionStream {+ state: StateAddress;+ constructor(header: string, key: EncryptionKey) {+ this.state = crypto_secretstream_xchacha20poly1305_init_pull(+ from_base64(header),+ key.key+ );+ }++ read(chunk: Uint8Array): Uint8Array {+ const { message } = crypto_secretstream_xchacha20poly1305_pull(+ this.state,+ chunk,+ null+ );+ return message;+ }+}diff --git a/packages/crypto/src/encryption.ts b/packages/crypto/src/encryption.tsnew file mode 100644index 000000000..8b8274fd8--- /dev/null+++ b/packages/crypto/src/encryption.ts@@ -0,0 +1,105 @@+import {+ crypto_aead_xchacha20poly1305_ietf_encrypt,+ crypto_secretstream_xchacha20poly1305_init_push,+ crypto_secretstream_xchacha20poly1305_push,+ randombytes_buf,+ crypto_aead_xchacha20poly1305_ietf_NPUBBYTES,+ crypto_secretstream_xchacha20poly1305_TAG_FINAL,+ crypto_secretstream_xchacha20poly1305_TAG_MESSAGE,+ to_base64,+ from_base64,+ base64_variants,+ StateAddress,+} from "libsodium-wrappers";+import KeyUtils from "./keyutils";+import {+ Cipher,+ EncryptionKey,+ OutputFormat,+ Plaintext,+ SerializedKey,+} from "./types";++const encoder = new TextEncoder();+export default class Encryption {+ private static transformInput(plaintext: Plaintext): Uint8Array {+ let data: Uint8Array | null = null;+ if (typeof plaintext.data === "string" && plaintext.format === "base64") {+ data = from_base64(plaintext.data, base64_variants.ORIGINAL);+ } else if (typeof plaintext.data === "string") {+ data = encoder.encode(plaintext.data);+ } else if (plaintext.data instanceof Uint8Array) {+ data = plaintext.data;+ }+ if (!data) throw new Error("Data cannot be null.");+ return data;+ }++ static encrypt(+ key: SerializedKey,+ plaintext: Plaintext,+ outputFormat: OutputFormat = "uint8array"+ ): Cipher {+ const encryptionKey = KeyUtils.transform(key);+ const data = this.transformInput(plaintext);++ const nonce = randombytes_buf(crypto_aead_xchacha20poly1305_ietf_NPUBBYTES);++ const cipher: string | Uint8Array =+ crypto_aead_xchacha20poly1305_ietf_encrypt(+ data,+ null,+ null,+ nonce,+ encryptionKey.key+ );++ let output: string | Uint8Array = cipher;+ if (outputFormat === "base64") {+ output = to_base64(cipher, base64_variants.URLSAFE_NO_PADDING);+ }++ const iv = to_base64(nonce);+ return {+ format: outputFormat,+ alg: getAlgorithm(base64_variants.URLSAFE_NO_PADDING),+ cipher: output,+ iv,+ salt: encryptionKey.salt,+ length: data.length,+ };+ }++ static createStream(key: SerializedKey): EncryptionStream {+ return new EncryptionStream(KeyUtils.transform(key));+ }+}++class EncryptionStream {+ state: StateAddress;+ header: string;+ constructor(key: EncryptionKey) {+ const { state, header } = crypto_secretstream_xchacha20poly1305_init_push(+ key.key,+ "base64"+ );+ this.state = state;+ this.header = header;+ }++ write(chunk: Uint8Array, final?: boolean): Uint8Array {+ return crypto_secretstream_xchacha20poly1305_push(+ this.state,+ chunk,+ null,+ final+ ? crypto_secretstream_xchacha20poly1305_TAG_FINAL+ : crypto_secretstream_xchacha20poly1305_TAG_MESSAGE+ );+ }+}++function getAlgorithm(base64Variant: base64_variants) {+ //Template: encryptionAlgorithm-kdfAlgorithm-base64variant+ return `xcha-argon2i13-${base64Variant}`;+}diff --git a/packages/crypto/src/interfaces.ts b/packages/crypto/src/interfaces.tsnew file mode 100644index 000000000..fbcb3e30c--- /dev/null+++ b/packages/crypto/src/interfaces.ts@@ -0,0 +1,46 @@+import {+ Cipher,+ EncryptionKey,+ OutputFormat,+ Plaintext,+ SerializedKey,+ Chunk,+} from "./types";++export interface IStreamable {+ read(): Promise<Chunk | undefined>;+ write(chunk: Chunk | undefined): Promise<void>;+}++export interface INNCrypto {+ encrypt(+ key: SerializedKey,+ plaintext: Plaintext,+ outputFormat?: OutputFormat+ ): Promise<Cipher>;++ decrypt(+ key: SerializedKey,+ cipherData: Cipher,+ outputFormat?: OutputFormat+ ): Promise<Plaintext>;++ hash(password: string, salt: string): Promise<string>;++ deriveKey(password: string, salt?: string): Promise<EncryptionKey>;++ exportKey(password: string, salt?: string): Promise<SerializedKey>;++ encryptStream(+ key: SerializedKey,+ stream: IStreamable,+ streamId?: string+ ): Promise<string>;++ decryptStream(+ key: SerializedKey,+ iv: string,+ stream: IStreamable,+ streamId?: string+ ): Promise<void>;+}diff --git a/packages/crypto/src/keyutils.ts b/packages/crypto/src/keyutils.tsnew file mode 100644index 000000000..ba24cf319--- /dev/null+++ b/packages/crypto/src/keyutils.ts@@ -0,0 +1,57 @@+import {+ from_base64,+ to_base64,+ randombytes_buf,+ crypto_pwhash,+ crypto_pwhash_SALTBYTES,+ crypto_pwhash_ALG_ARGON2I13,+ crypto_aead_xchacha20poly1305_ietf_KEYBYTES,+} from "libsodium-wrappers";+import { EncryptionKey, SerializedKey } from "./types";++export default class KeyUtils {+ static deriveKey(password: string, salt?: string): EncryptionKey {+ let saltBytes: Uint8Array;+ if (!salt) saltBytes = randombytes_buf(crypto_pwhash_SALTBYTES);+ else {+ saltBytes = from_base64(salt);+ }++ if (!saltBytes)+ throw new Error("Could not generate bytes from the given salt.");++ const key = crypto_pwhash(+ crypto_aead_xchacha20poly1305_ietf_KEYBYTES,+ password,+ saltBytes,+ 3, // operations limit+ 1024 * 1024 * 8, // memory limit (8MB)+ crypto_pwhash_ALG_ARGON2I13+ );++ return {+ key,+ salt: typeof salt === "string" ? salt : to_base64(saltBytes),+ };+ }++ static exportKey(password: string, salt?: string): SerializedKey {+ const { key, salt: keySalt } = this.deriveKey(password, salt);+ return { key: to_base64(key), salt: keySalt };+ }++ /**+ * Takes in either a password or a serialized encryption key+ * and spits out a key that can be directly used for encryption/decryption.+ * @param input+ */+ static transform(input: SerializedKey): EncryptionKey {+ if ("password" in input && !!input.password) {+ const { password, salt } = input;+ return this.deriveKey(password, salt);+ } else if ("key" in input && !!input.salt && !!input.key) {+ return { key: from_base64(input.key), salt: input.salt };+ }+ throw new Error("Invalid input.");+ }+}diff --git a/packages/crypto/src/password.ts b/packages/crypto/src/password.tsnew file mode 100644index 000000000..c2af55082--- /dev/null+++ b/packages/crypto/src/password.ts@@ -0,0 +1,22 @@+import {+ crypto_generichash,+ crypto_pwhash,+ crypto_pwhash_ALG_ARGON2ID13,+ crypto_pwhash_SALTBYTES,+} from "libsodium-wrappers";++export default class Password {+ static hash(password: string, salt: string): string {+ const saltBytes = crypto_generichash(crypto_pwhash_SALTBYTES, salt);+ const hash = crypto_pwhash(+ 32,+ password,+ saltBytes,+ 3, // operations limit+ 1024 * 1024 * 64, // memory limit (8MB)+ crypto_pwhash_ALG_ARGON2ID13,+ "base64"+ );+ return hash;+ }+}diff --git a/packages/crypto/src/types.ts b/packages/crypto/src/types.tsnew file mode 100644index 000000000..d894e5ecf--- /dev/null+++ b/packages/crypto/src/types.ts@@ -0,0 +1,33 @@+import { StringOutputFormat, Uint8ArrayOutputFormat } from "libsodium-wrappers";++export type OutputFormat = Uint8ArrayOutputFormat | StringOutputFormat;++export type Cipher = {+ format: OutputFormat;+ alg: string;+ cipher: string | Uint8Array;+ iv: string;+ salt: string;+ length: number;+};++export type Plaintext = {+ format: OutputFormat;+ data: string | Uint8Array;+};++export type SerializedKey = {+ password?: string;+ key?: string;+ salt?: string;+};++export type EncryptionKey = {+ key: Uint8Array;+ salt: string;+};++export type Chunk = {+ data: Uint8Array;+ final: boolean;+};diff --git a/packages/crypto/tsconfig.json b/packages/crypto/tsconfig.jsonnew file mode 100644index 000000000..57ed62ce8--- /dev/null+++ b/packages/crypto/tsconfig.json@@ -0,0 +1,104 @@+{+ "compilerOptions": {+ "outDir": "./dist",+ "declaration": true,+ /* 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": "es2016" /* 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": "./", /* 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. */+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */++ /* 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. */++ /* Completeness */+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */+ "skipLibCheck": true /* Skip type checking all .d.ts files. */+ },+ "include": ["src/", "index.ts"]+}