aboutsummaryrefslogtreecommitdiffstats
path: root/config/hash.ts
diff options
context:
space:
mode:
Diffstat (limited to 'config/hash.ts')
-rw-r--r--config/hash.ts88
1 files changed, 88 insertions, 0 deletions
diff --git a/config/hash.ts b/config/hash.ts
new file mode 100644
index 0000000..abe7dd0
--- /dev/null
+++ b/config/hash.ts
@@ -0,0 +1,88 @@
1/**
2 * Config source: https://git.io/JfefW
3 *
4 * Feel free to let us know via PR, if you find something broken in this config
5 * file.
6 */
7
8import Env from '@ioc:Adonis/Core/Env';
9import { hashConfig } from '@adonisjs/core/build/config';
10
11/*
12|--------------------------------------------------------------------------
13| Hash Config
14|--------------------------------------------------------------------------
15|
16| The `HashConfig` relies on the `HashList` interface which is
17| defined inside `contracts` directory.
18|
19*/
20export default hashConfig({
21 /*
22 |--------------------------------------------------------------------------
23 | Default hasher
24 |--------------------------------------------------------------------------
25 |
26 | By default we make use of the argon hasher to hash values. However, feel
27 | free to change the default value
28 |
29 | Default is set to bcrypt to prevent breaking-changes.
30 */
31 default: Env.get('HASH_DRIVER', 'scrypt'),
32
33 list: {
34 scrypt: {
35 driver: 'scrypt',
36 cost: 16_384,
37 blockSize: 8,
38 parallelization: 1,
39 saltSize: 16,
40 keyLength: 64,
41 maxMemory: 32 * 1024 * 1024,
42 },
43 /*
44 |--------------------------------------------------------------------------
45 | Argon
46 |--------------------------------------------------------------------------
47 |
48 | Argon mapping uses the `argon2` driver to hash values.
49 |
50 | Make sure you install the underlying dependency for this driver to work.
51 | https://www.npmjs.com/package/phc-argon2.
52 |
53 | npm install phc-argon2
54 |
55 */
56 argon: {
57 driver: 'argon2',
58 variant: 'id',
59 iterations: 3,
60 memory: 4096,
61 parallelism: 1,
62 saltSize: 16,
63 },
64
65 /*
66 |--------------------------------------------------------------------------
67 | Bcrypt
68 |--------------------------------------------------------------------------
69 |
70 | Bcrypt mapping uses the `bcrypt` driver to hash values.
71 |
72 | Make sure you install the underlying dependency for this driver to work.
73 | https://www.npmjs.com/package/phc-bcrypt.
74 |
75 | npm install phc-bcrypt
76 |
77 */
78 bcrypt: {
79 driver: 'bcrypt',
80 rounds: 10,
81 },
82
83 legacy: {
84 // @ts-expect-error
85 driver: 'legacy',
86 },
87 },
88});