|
1 | 1 | import { UserSettings } from '@internxt/sdk/dist/shared/types/userSettings'; |
2 | | -import crypto from 'node:crypto'; |
| 2 | +import Chance from 'chance'; |
| 3 | +import { generateMnemonic } from 'bip39'; |
| 4 | + |
| 5 | +const randomDataGenerator = new Chance(); |
3 | 6 |
|
4 | 7 | export const UserFixture: UserSettings = { |
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'), |
| 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 }), |
17 | 20 | sharedWorkspace: false, |
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'), |
| 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 | + }), |
23 | 35 | teams: false, |
24 | 36 | appSumoDetails: null, |
25 | 37 | registerCompleted: true, |
26 | 38 | hasReferralsProgram: false, |
27 | | - createdAt: new Date(), |
28 | | - avatar: crypto.randomBytes(16).toString('hex'), |
| 39 | + createdAt: randomDataGenerator.date(), |
| 40 | + avatar: randomDataGenerator.url(), |
29 | 41 | emailVerified: true, |
30 | 42 | keys: { |
31 | 43 | ecc: { |
32 | | - privateKey: crypto.randomBytes(16).toString('hex'), |
33 | | - publicKey: crypto.randomBytes(16).toString('hex'), |
34 | | - revocationKey: crypto.randomBytes(16).toString('hex'), |
| 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 | + }), |
35 | 56 | }, |
36 | 57 | kyber: { |
37 | | - privateKyberKey: crypto.randomBytes(16).toString('hex'), |
38 | | - publicKyberKey: crypto.randomBytes(16).toString('hex'), |
| 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 | + }), |
39 | 66 | }, |
40 | 67 | }, |
41 | 68 | }; |
|
0 commit comments