-
Notifications
You must be signed in to change notification settings - Fork 2
/
bcrypt.d.ts
45 lines (38 loc) · 1.12 KB
/
bcrypt.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/// <reference types="node" />
import { FastifyPluginCallback } from 'fastify'
declare module 'fastify' {
interface FastifyInstance {
bcrypt: {
/**
* Hashes a string and returns a promise which
* resolves with the hash result.
*/
hash: (pwd: string) => Promise<string>
/**
* Hashes data and then compares it to a hash,
* returns a promise that resolve with the
* result of the comparison.
*/
compare: (data: string, hash: string) => Promise<boolean>
}
}
interface FastifyRequest {
/**
* Hashes a string and returns a promise
* which resolves with the has result.
*/
bcryptHash: (pwd: string) => Promise<string>
/**
* Hashes data and then compares it to a hash,
* returns a promise that resolves with the
* result of the comparison.
*/
bcryptCompare: (data: string, hash: string) => Promise<boolean>
}
}
interface bcryptPluginOpts {
saltWorkFactor: number
}
declare const fastifyBcrypt: FastifyPluginCallback<NonNullable<bcryptPluginOpts>>
export default fastifyBcrypt
export { fastifyBcrypt }