Skip to content

Instantly share code, notes, and snippets.

@Schniz
Created April 9, 2018 21:49
Show Gist options
  • Save Schniz/3ccdb9164556610c73fa509bcf81f644 to your computer and use it in GitHub Desktop.
Save Schniz/3ccdb9164556610c73fa509bcf81f644 to your computer and use it in GitHub Desktop.
opaque types for bcrypt
opaque type bcrypt$hashed = string;
declare module "bcrypt" {
declare module.exports: {
hash: (password: string, saltRounds: number) => Promise<bcrypt$hashed>,
compare: (
password: string,
hashedPassword: bcrypt$hashed
) => Promise<boolean>,
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment