|
1 | 1 | import { UserSettings } from '@internxt/sdk/dist/shared/types/userSettings'; |
2 | | -import Chance from 'chance'; |
3 | | -import { generateMnemonic } from 'bip39'; |
4 | | - |
5 | | -const randomDataGenerator = new Chance(); |
| 2 | +import crypto from 'node:crypto'; |
6 | 3 |
|
7 | 4 | export const UserFixture: UserSettings = { |
8 | | - userId: randomDataGenerator.natural({ min: 1 }).toString(), |
9 | | - uuid: randomDataGenerator.guid({ version: 4 }), |
10 | | - email: randomDataGenerator.email(), |
11 | | - name: randomDataGenerator.name(), |
12 | | - lastname: randomDataGenerator.name(), |
13 | | - username: randomDataGenerator.word(), |
14 | | - bridgeUser: randomDataGenerator.email(), |
15 | | - bucket: randomDataGenerator.string({ length: 24, pool: 'abcdef0123456789' }), |
16 | | - backupsBucket: randomDataGenerator.string({ length: 24, pool: 'abcdef0123456789' }), |
17 | | - root_folder_id: randomDataGenerator.natural({ min: 1 }), |
18 | | - rootFolderId: randomDataGenerator.guid({ version: 4 }), |
19 | | - rootFolderUuid: randomDataGenerator.guid({ version: 4 }), |
| 5 | + userId: crypto.randomBytes(16).toString('hex'), |
| 6 | + uuid: crypto.randomBytes(16).toString('hex'), |
| 7 | + email: crypto.randomBytes(16).toString('hex'), |
| 8 | + name: crypto.randomBytes(16).toString('hex'), |
| 9 | + lastname: crypto.randomBytes(16).toString('hex'), |
| 10 | + username: crypto.randomBytes(16).toString('hex'), |
| 11 | + bridgeUser: crypto.randomBytes(16).toString('hex'), |
| 12 | + bucket: crypto.randomBytes(16).toString('hex'), |
| 13 | + backupsBucket: crypto.randomBytes(16).toString('hex'), |
| 14 | + root_folder_id: crypto.randomInt(1, 9999), |
| 15 | + rootFolderId: crypto.randomBytes(16).toString('hex'), |
| 16 | + rootFolderUuid: crypto.randomBytes(16).toString('hex'), |
20 | 17 | sharedWorkspace: false, |
21 | | - credit: randomDataGenerator.natural({ min: 1, max: 9999 }), |
22 | | - mnemonic: generateMnemonic(), |
23 | | - privateKey: randomDataGenerator.string({ |
24 | | - length: randomDataGenerator.integer({ min: 500, max: 1000 }), |
25 | | - pool: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', |
26 | | - }), |
27 | | - publicKey: randomDataGenerator.string({ |
28 | | - length: randomDataGenerator.integer({ min: 500, max: 1000 }), |
29 | | - pool: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', |
30 | | - }), |
31 | | - revocationKey: randomDataGenerator.string({ |
32 | | - length: randomDataGenerator.integer({ min: 500, max: 1000 }), |
33 | | - pool: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', |
34 | | - }), |
| 18 | + credit: crypto.randomInt(1, 9999), |
| 19 | + mnemonic: crypto.randomBytes(16).toString('hex'), |
| 20 | + privateKey: crypto.randomBytes(16).toString('hex'), |
| 21 | + publicKey: crypto.randomBytes(16).toString('hex'), |
| 22 | + revocationKey: crypto.randomBytes(16).toString('hex'), |
35 | 23 | teams: false, |
36 | 24 | appSumoDetails: null, |
37 | 25 | registerCompleted: true, |
38 | 26 | hasReferralsProgram: false, |
39 | | - createdAt: randomDataGenerator.date(), |
40 | | - avatar: randomDataGenerator.url(), |
| 27 | + createdAt: new Date(), |
| 28 | + avatar: crypto.randomBytes(16).toString('hex'), |
41 | 29 | emailVerified: true, |
42 | 30 | keys: { |
43 | 31 | ecc: { |
44 | | - privateKey: randomDataGenerator.string({ |
45 | | - length: randomDataGenerator.integer({ min: 500, max: 1000 }), |
46 | | - pool: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', |
47 | | - }), |
48 | | - publicKey: randomDataGenerator.string({ |
49 | | - length: randomDataGenerator.integer({ min: 500, max: 1000 }), |
50 | | - pool: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', |
51 | | - }), |
52 | | - revocationKey: randomDataGenerator.string({ |
53 | | - length: randomDataGenerator.integer({ min: 500, max: 1000 }), |
54 | | - pool: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', |
55 | | - }), |
| 32 | + privateKey: crypto.randomBytes(16).toString('hex'), |
| 33 | + publicKey: crypto.randomBytes(16).toString('hex'), |
| 34 | + revocationKey: crypto.randomBytes(16).toString('hex'), |
56 | 35 | }, |
57 | 36 | kyber: { |
58 | | - privateKyberKey: randomDataGenerator.string({ |
59 | | - length: randomDataGenerator.integer({ min: 500, max: 1000 }), |
60 | | - pool: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', |
61 | | - }), |
62 | | - publicKyberKey: randomDataGenerator.string({ |
63 | | - length: randomDataGenerator.integer({ min: 500, max: 1000 }), |
64 | | - pool: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', |
65 | | - }), |
| 37 | + privateKyberKey: crypto.randomBytes(16).toString('hex'), |
| 38 | + publicKyberKey: crypto.randomBytes(16).toString('hex'), |
66 | 39 | }, |
67 | 40 | }, |
68 | 41 | }; |
|
0 commit comments