This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as dotenv from "dotenv"; | |
export const DEFAULT_ENV_FILE_MAP = { | |
production: ".env.production", | |
development: ".env.development", | |
test: ".env.test", | |
}; | |
type Config = Record<string, string | false | undefined>; | |
type ConfigFn = (defaultFilemap: Config) => Config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { randomBytes, scrypt, timingSafeEqual } from "crypto"; | |
/* | |
#Wikipedia: | |
Scrypt: https://en.wikipedia.org/wiki/Scrypt | |
PBKDF2: https://en.wikipedia.org/wiki/PBKDF2 | |
*/ | |
const SALT_LENGTH_BYTES = 32; | |
const HASH_LENGTH_BYTES = 64; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { isNativeError } from "util/types"; | |
/* Type Definitions */ | |
export type ResultOk<T> = { | |
ok: true; | |
value: T; | |
}; | |
export type ResultError<E extends Error = Error> = { | |
ok: false; | |
error: E; |