Skip to content

Commit 13a2ecd

Browse files
authored
Merge pull request #129 from internxt/fix/upgrade-sdk-to-1.6.4
[_]: fix/bump-to-internxt-sdk-1.6.4
2 parents eef38ee + 484b472 commit 13a2ecd

File tree

10 files changed

+120
-54
lines changed

10 files changed

+120
-54
lines changed

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ $ npm install -g @internxt/cli
3131
$ internxt COMMAND
3232
running command...
3333
$ internxt (--version)
34-
@internxt/cli/1.3.0 win32-x64 node-v20.2.0
34+
@internxt/cli/1.3.1 darwin-x64 node-v20.12.2
3535
$ internxt --help [COMMAND]
3636
USAGE
3737
$ internxt COMMAND
@@ -52,18 +52,18 @@ USAGE
5252
* [`internxt logs`](#internxt-logs)
5353
* [`internxt move-file`](#internxt-move-file)
5454
* [`internxt move-folder`](#internxt-move-folder)
55-
* [`internxt move file`](#internxt-move-file-1)
56-
* [`internxt move folder`](#internxt-move-folder-1)
55+
* [`internxt move file`](#internxt-move-file)
56+
* [`internxt move folder`](#internxt-move-folder)
5757
* [`internxt rename`](#internxt-rename)
5858
* [`internxt trash`](#internxt-trash)
5959
* [`internxt trash-clear`](#internxt-trash-clear)
6060
* [`internxt trash-list`](#internxt-trash-list)
6161
* [`internxt trash-restore-file`](#internxt-trash-restore-file)
6262
* [`internxt trash-restore-folder`](#internxt-trash-restore-folder)
63-
* [`internxt trash clear`](#internxt-trash-clear-1)
64-
* [`internxt trash list`](#internxt-trash-list-1)
65-
* [`internxt trash restore file`](#internxt-trash-restore-file-1)
66-
* [`internxt trash restore folder`](#internxt-trash-restore-folder-1)
63+
* [`internxt trash clear`](#internxt-trash-clear)
64+
* [`internxt trash list`](#internxt-trash-list)
65+
* [`internxt trash restore file`](#internxt-trash-restore-file)
66+
* [`internxt trash restore folder`](#internxt-trash-restore-folder)
6767
* [`internxt upload`](#internxt-upload)
6868
* [`internxt webdav ACTION`](#internxt-webdav-action)
6969
* [`internxt webdav-config ACTION`](#internxt-webdav-config-action)
@@ -84,7 +84,7 @@ EXAMPLES
8484
$ internxt add-cert
8585
```
8686

87-
_See code: [src/commands/add-cert.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/add-cert.ts)_
87+
_See code: [src/commands/add-cert.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/add-cert.ts)_
8888

8989
## `internxt config`
9090

@@ -113,7 +113,7 @@ EXAMPLES
113113
$ internxt config
114114
```
115115

116-
_See code: [src/commands/config.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/config.ts)_
116+
_See code: [src/commands/config.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/config.ts)_
117117

118118
## `internxt create-folder`
119119

@@ -134,7 +134,7 @@ EXAMPLES
134134
$ internxt create-folder
135135
```
136136

137-
_See code: [src/commands/create-folder.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/create-folder.ts)_
137+
_See code: [src/commands/create-folder.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/create-folder.ts)_
138138

139139
## `internxt download`
140140

@@ -157,7 +157,7 @@ EXAMPLES
157157
$ internxt download
158158
```
159159

160-
_See code: [src/commands/download.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/download.ts)_
160+
_See code: [src/commands/download.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/download.ts)_
161161

162162
## `internxt list`
163163

@@ -191,15 +191,15 @@ EXAMPLES
191191
$ internxt list
192192
```
193193

194-
_See code: [src/commands/list.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/list.ts)_
194+
_See code: [src/commands/list.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/list.ts)_
195195

196196
## `internxt login`
197197

198198
Logs into an Internxt account. If the account is two-factor protected, then an extra code will be required.
199199

200200
```
201201
USAGE
202-
$ internxt login [-n] [-e <value>] [-p <value>] [-w <value>]
202+
$ internxt login [-n] [-e <value>] [-p <value>] [-w 123456]
203203
204204
FLAGS
205205
-e, --email=<value> The email to log in
@@ -217,7 +217,7 @@ EXAMPLES
217217
$ internxt login
218218
```
219219

220-
_See code: [src/commands/login.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/login.ts)_
220+
_See code: [src/commands/login.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/login.ts)_
221221

222222
## `internxt logout`
223223

@@ -234,7 +234,7 @@ EXAMPLES
234234
$ internxt logout
235235
```
236236

237-
_See code: [src/commands/logout.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/logout.ts)_
237+
_See code: [src/commands/logout.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/logout.ts)_
238238

239239
## `internxt logs`
240240

@@ -251,7 +251,7 @@ EXAMPLES
251251
$ internxt logs
252252
```
253253

254-
_See code: [src/commands/logs.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/logs.ts)_
254+
_See code: [src/commands/logs.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/logs.ts)_
255255

256256
## `internxt move-file`
257257

@@ -279,7 +279,7 @@ EXAMPLES
279279
$ internxt move-file
280280
```
281281

282-
_See code: [src/commands/move-file.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/move-file.ts)_
282+
_See code: [src/commands/move-file.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/move-file.ts)_
283283

284284
## `internxt move-folder`
285285

@@ -307,7 +307,7 @@ EXAMPLES
307307
$ internxt move-folder
308308
```
309309

310-
_See code: [src/commands/move-folder.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/move-folder.ts)_
310+
_See code: [src/commands/move-folder.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/move-folder.ts)_
311311

312312
## `internxt move file`
313313

@@ -384,7 +384,7 @@ EXAMPLES
384384
$ internxt rename
385385
```
386386

387-
_See code: [src/commands/rename.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/rename.ts)_
387+
_See code: [src/commands/rename.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/rename.ts)_
388388

389389
## `internxt trash`
390390

@@ -408,7 +408,7 @@ EXAMPLES
408408
$ internxt trash
409409
```
410410

411-
_See code: [src/commands/trash.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/trash.ts)_
411+
_See code: [src/commands/trash.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/trash.ts)_
412412

413413
## `internxt trash-clear`
414414

@@ -435,7 +435,7 @@ EXAMPLES
435435
$ internxt trash-clear
436436
```
437437

438-
_See code: [src/commands/trash-clear.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/trash-clear.ts)_
438+
_See code: [src/commands/trash-clear.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/trash-clear.ts)_
439439

440440
## `internxt trash-list`
441441

@@ -471,7 +471,7 @@ EXAMPLES
471471
$ internxt trash-list
472472
```
473473

474-
_See code: [src/commands/trash-list.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/trash-list.ts)_
474+
_See code: [src/commands/trash-list.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/trash-list.ts)_
475475

476476
## `internxt trash-restore-file`
477477

@@ -499,7 +499,7 @@ EXAMPLES
499499
$ internxt trash-restore-file
500500
```
501501

502-
_See code: [src/commands/trash-restore-file.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/trash-restore-file.ts)_
502+
_See code: [src/commands/trash-restore-file.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/trash-restore-file.ts)_
503503

504504
## `internxt trash-restore-folder`
505505

@@ -527,7 +527,7 @@ EXAMPLES
527527
$ internxt trash-restore-folder
528528
```
529529

530-
_See code: [src/commands/trash-restore-folder.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/trash-restore-folder.ts)_
530+
_See code: [src/commands/trash-restore-folder.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/trash-restore-folder.ts)_
531531

532532
## `internxt trash clear`
533533

@@ -662,7 +662,7 @@ EXAMPLES
662662
$ internxt upload
663663
```
664664

665-
_See code: [src/commands/upload.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/upload.ts)_
665+
_See code: [src/commands/upload.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/upload.ts)_
666666

667667
## `internxt webdav ACTION`
668668

@@ -685,7 +685,7 @@ EXAMPLES
685685
$ internxt webdav status
686686
```
687687

688-
_See code: [src/commands/webdav.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/webdav.ts)_
688+
_See code: [src/commands/webdav.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/webdav.ts)_
689689

690690
## `internxt webdav-config ACTION`
691691

@@ -713,7 +713,7 @@ EXAMPLES
713713
$ internxt webdav-config change-port
714714
```
715715

716-
_See code: [src/commands/webdav-config.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/webdav-config.ts)_
716+
_See code: [src/commands/webdav-config.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/webdav-config.ts)_
717717

718718
## `internxt whoami`
719719

@@ -730,7 +730,7 @@ EXAMPLES
730730
$ internxt whoami
731731
```
732732

733-
_See code: [src/commands/whoami.ts](https://github.com/internxt/cli/blob/v1.3.0/src/commands/whoami.ts)_
733+
_See code: [src/commands/whoami.ts](https://github.com/internxt/cli/blob/v1.3.1/src/commands/whoami.ts)_
734734
<!-- commandsstop -->
735735

736736
# Current Limitations

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"author": "Internxt <[email protected]>",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "Internxt CLI to manage your encrypted storage",
55
"scripts": {
66
"build": "tsc",
@@ -37,7 +37,7 @@
3737
"dependencies": {
3838
"@internxt/inxt-js": "^2.0.11",
3939
"@internxt/lib": "^1.2.1",
40-
"@internxt/sdk": "^1.5.25",
40+
"@internxt/sdk": "1.6.4",
4141
"@oclif/core": "^3",
4242
"axios": "^1.7.7",
4343
"bip39": "^3.1.0",

src/commands/create-folder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default class CreateFolder extends Command {
5757
const newFolder = await createNewFolder;
5858
CLIUtils.done();
5959
CLIUtils.success(
60-
`Folder ${newFolder.plain_name} created successfully, view it at view it at ${ConfigService.instance.get('DRIVE_URL')}/folder/${newFolder.uuid}`,
60+
`Folder ${newFolder.plainName} created successfully, view it at view it at ${ConfigService.instance.get('DRIVE_URL')}/folder/${newFolder.uuid}`,
6161
);
6262
}
6363
}

src/services/crypto.service.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ export class CryptoService {
1010
public static readonly instance: CryptoService = new CryptoService();
1111

1212
public static readonly cryptoProvider: CryptoProvider = {
13-
encryptPasswordHash(password: Password, encryptedSalt: string): string {
13+
encryptPasswordHash(password: Password, encryptedSalt: string): Promise<string> {
1414
const salt = CryptoService.instance.decryptText(encryptedSalt);
1515
const hashObj = CryptoService.instance.passToHash({ password, salt });
16-
return CryptoService.instance.encryptText(hashObj.hash);
16+
return Promise.resolve(CryptoService.instance.encryptText(hashObj.hash));
1717
},
1818
async generateKeys(password: Password): Promise<Keys> {
1919
const { privateKeyArmoredEncrypted, publicKeyArmored, revocationCertificate } =
@@ -22,6 +22,14 @@ export class CryptoService {
2222
privateKeyEncrypted: privateKeyArmoredEncrypted,
2323
publicKey: publicKeyArmored,
2424
revocationCertificate: revocationCertificate,
25+
ecc: {
26+
privateKeyEncrypted: privateKeyArmoredEncrypted,
27+
publicKey: publicKeyArmored,
28+
},
29+
kyber: {
30+
privateKeyEncrypted: null,
31+
publicKey: null
32+
}
2533
};
2634
return keys;
2735
},

src/webdav/handlers/MKCOL.handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class MKCOLRequestHandler implements WebDavMethodHandler {
4545

4646
await driveDatabaseManager.createFolder(
4747
{
48-
name: newFolder.plain_name,
48+
name: newFolder.plainName,
4949
status: 'EXISTS',
5050
encryptedName: newFolder.name,
5151
bucket: newFolder.bucket,

test/fixtures/auth.fixture.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { UserSettings } from '@internxt/sdk/dist/shared/types/userSettings';
22
import crypto from 'crypto';
33

4-
export const UserFixture = {
4+
export const UserFixture: UserSettings = {
55
userId: crypto.randomBytes(16).toString('hex'),
66
uuid: crypto.randomBytes(16).toString('hex'),
77
email: crypto.randomBytes(16).toString('hex'),
@@ -20,6 +20,17 @@ export const UserFixture = {
2020
privateKey: crypto.randomBytes(16).toString('hex'),
2121
publicKey: crypto.randomBytes(16).toString('hex'),
2222
revocationKey: crypto.randomBytes(16).toString('hex'),
23+
keys: {
24+
ecc: {
25+
privateKey: crypto.randomBytes(16).toString('hex'),
26+
publicKey: crypto.randomBytes(16).toString('hex'),
27+
revocationKey: crypto.randomBytes(16).toString('hex'),
28+
},
29+
kyber: {
30+
privateKyberKey: crypto.randomBytes(16).toString('hex'),
31+
publicKyberKey: crypto.randomBytes(16).toString('hex'),
32+
}
33+
},
2334
teams: false,
2435
appSumoDetails: null,
2536
registerCompleted: true,
@@ -47,6 +58,17 @@ export const UserSettingsFixture: UserSettings = {
4758
privateKey: UserFixture.privateKey,
4859
publicKey: UserFixture.publicKey,
4960
revocationKey: UserFixture.revocationKey,
61+
keys: {
62+
ecc: {
63+
privateKey: UserFixture.keys.ecc.privateKey,
64+
publicKey: UserFixture.keys.ecc.publicKey,
65+
revocationKey: UserFixture.revocationKey,
66+
},
67+
kyber: {
68+
privateKyberKey: UserFixture.keys.kyber.privateKyberKey,
69+
publicKyberKey: UserFixture.keys.kyber.publicKyberKey,
70+
}
71+
},
5072
teams: UserFixture.teams,
5173
appSumoDetails: UserFixture.appSumoDetails,
5274
registerCompleted: UserFixture.registerCompleted,

test/services/crypto.service.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('Crypto service', () => {
5757
expect(spyConfigService).to.be.calledWith(envEndpoint.key);
5858
});
5959

60-
it('When a password is hashed using CryptoProvider, then it is hashed correctly', () => {
60+
it('When a password is hashed using CryptoProvider, then it is hashed correctly', async () => {
6161
const envEndpoint: { key: keyof ConfigKeys; value: string } = {
6262
key: 'APP_CRYPTO_SECRET',
6363
value: crypto.randomBytes(16).toString('hex'),
@@ -74,7 +74,7 @@ describe('Crypto service', () => {
7474

7575
const encryptedSalt = CryptoService.instance.encryptText(password.salt);
7676
const hashedAndEncryptedPassword = CryptoService.cryptoProvider.encryptPasswordHash(password.value, encryptedSalt);
77-
const hashedPassword = CryptoService.instance.decryptText(hashedAndEncryptedPassword);
77+
const hashedPassword = CryptoService.instance.decryptText(await hashedAndEncryptedPassword);
7878

7979
const expectedHashedPassword = crypto
8080
.pbkdf2Sync(password.value, Buffer.from(password.salt, 'hex'), 10000, 256 / 8, 'sha1')
@@ -110,6 +110,14 @@ describe('Crypto service', () => {
110110
privateKeyEncrypted: keysReturned.privateKeyArmoredEncrypted,
111111
publicKey: keysReturned.publicKeyArmored,
112112
revocationCertificate: keysReturned.revocationCertificate,
113+
kyber: {
114+
privateKeyEncrypted: null,
115+
publicKey: null,
116+
},
117+
ecc: {
118+
privateKeyEncrypted: keysReturned.privateKeyArmoredEncrypted,
119+
publicKey: keysReturned.publicKeyArmored,
120+
}
113121
};
114122

115123
const resultedKeys = await CryptoService.cryptoProvider.generateKeys(password);

test/services/drive/drive-folder.service.test.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,19 @@ describe('Drive folder Service', () => {
8484
bucket: 'bucket1',
8585
id: 0,
8686
name: 'folder-1',
87-
plain_name: 'folder-1',
88-
createdAt: '',
89-
updatedAt: '',
87+
plainName: 'folder-1',
88+
createdAt: new Date(),
89+
updatedAt: new Date(),
9090
userId: 0,
9191
uuid: '1234-5678-9012-3456',
9292
parentUuid: '0123-5678-9012-3456',
93+
encryptVersion: 'aes-03',
94+
creationTime: new Date(),
95+
deleted: false,
96+
deletedAt: null,
97+
modificationTime: new Date(),
98+
removed: false,
99+
removedAt: null,
93100
};
94101
sandbox
95102
.stub(Storage.prototype, 'createFolder')
@@ -101,6 +108,6 @@ describe('Drive folder Service', () => {
101108
});
102109

103110
const newFolder = await createFolder;
104-
expect(newFolder.plain_name).to.be.eq('folder-1');
111+
expect(newFolder.plainName).to.be.eq('folder-1');
105112
});
106113
});

0 commit comments

Comments
 (0)