1- // packages/core/src/config/defaults.ts
2- export const DefaultConfig = {
3- saltLengths : { low : 12 , high : 16 } as const ,
4- argon : {
5- low : { time : 5 , mem : 64 * 1024 , parallelism : 1 } ,
6- middle : { time : 20 , mem : 64 * 1024 , parallelism : 1 } ,
7- high : { time : 40 , mem : 64 * 1024 , parallelism : 1 }
8- } ,
9- chunkSize : 512 * 1024 // 512 KiB
1+ import { VersionRegistry } from './VersionRegistry.js' ;
2+ import { AESGCM } from '../algorithms/encryption/aes-gmc/AESGCM.js' ;
3+ import { Argon2KDF } from '../algorithms/kdf/Argon2.js' ;
4+ import { VersionDescriptor } from '../types/index.js' ;
5+
6+ export const DEFAULT_DIFFICULTIES = {
7+ low : { time : 5 , mem : 64 * 1024 , parallelism : 1 } ,
8+ middle : { time : 20 , mem : 64 * 1024 , parallelism : 1 } ,
9+ high : { time : 40 , mem : 64 * 1024 , parallelism : 1 } ,
10+ } as const ;
11+
12+ const v0 : VersionDescriptor = {
13+ id : 0 ,
14+ cipher : AESGCM ,
15+ kdf : new Argon2KDF ( DEFAULT_DIFFICULTIES ) ,
16+ saltLengths : { low : 12 , high : 16 } ,
17+ difficulties : DEFAULT_DIFFICULTIES ,
18+ defaultChunkSize : 512 * 1024 ,
1019} ;
11- export type Difficulty = keyof typeof DefaultConfig . argon ;
12- export type SaltStrength = keyof typeof DefaultConfig . saltLengths ;
20+
21+ VersionRegistry . register ( v0 ) ;
22+
23+ export type SaltStrength = 'low' | 'high' ;
24+ export type Difficulty = keyof typeof DEFAULT_DIFFICULTIES ;
0 commit comments