@internxt/sdk 1.9.21 → 1.9.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.d.ts +2 -1
- package/dist/auth/index.js +14 -0
- package/dist/auth/types.d.ts +20 -0
- package/dist/drive/backups/index.d.ts +44 -0
- package/dist/drive/backups/index.js +52 -0
- package/dist/drive/storage/types.d.ts +22 -12
- package/dist/drive/users/index.d.ts +7 -0
- package/dist/drive/users/index.js +9 -0
- package/package.json +1 -1
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApiSecurity, ApiUrl, AppDetails } from '../shared';
|
|
2
2
|
import { TeamsSettings } from '../shared/types/teams';
|
|
3
3
|
import { UserSettings, UUID } from '../shared/types/userSettings';
|
|
4
|
-
import { CryptoProvider, Keys, LoginDetails, PrivateKeys, RegisterDetails, RegisterPreCreatedUser, RegisterPreCreatedUserResponse, SecurityDetails, Token, TwoFactorAuthQR } from './types';
|
|
4
|
+
import { ChangePasswordWithLinkPayload, CryptoProvider, Keys, LoginDetails, PrivateKeys, RegisterDetails, RegisterPreCreatedUser, RegisterPreCreatedUserResponse, SecurityDetails, Token, TwoFactorAuthQR } from './types';
|
|
5
5
|
export * from './types';
|
|
6
6
|
export declare class Auth {
|
|
7
7
|
private readonly client;
|
|
@@ -152,6 +152,7 @@ export declare class Auth {
|
|
|
152
152
|
* @param keys
|
|
153
153
|
*/
|
|
154
154
|
changePasswordWithLink(token: string | undefined, password: string, salt: string, mnemonic: string, keys?: PrivateKeys): Promise<void>;
|
|
155
|
+
legacyRecoverAccount({ token, encryptedPassword, encryptedSalt, encryptedMnemonic, eccEncryptedMnemonic, kyberEncryptedMnemonic, keys, }: ChangePasswordWithLinkPayload): Promise<void>;
|
|
155
156
|
/**
|
|
156
157
|
* Reset account with token
|
|
157
158
|
* @param token
|
package/dist/auth/index.js
CHANGED
|
@@ -433,6 +433,20 @@ var Auth = /** @class */ (function () {
|
|
|
433
433
|
privateKeys: keys,
|
|
434
434
|
}, this.basicHeaders());
|
|
435
435
|
};
|
|
436
|
+
Auth.prototype.legacyRecoverAccount = function (_a) {
|
|
437
|
+
var token = _a.token, encryptedPassword = _a.encryptedPassword, encryptedSalt = _a.encryptedSalt, encryptedMnemonic = _a.encryptedMnemonic, eccEncryptedMnemonic = _a.eccEncryptedMnemonic, kyberEncryptedMnemonic = _a.kyberEncryptedMnemonic, keys = _a.keys;
|
|
438
|
+
var accountRecoverPayload = {
|
|
439
|
+
password: encryptedPassword,
|
|
440
|
+
salt: encryptedSalt,
|
|
441
|
+
mnemonic: encryptedMnemonic,
|
|
442
|
+
asymmetricEncryptedMnemonic: {
|
|
443
|
+
ecc: eccEncryptedMnemonic,
|
|
444
|
+
hybrid: kyberEncryptedMnemonic,
|
|
445
|
+
},
|
|
446
|
+
keys: keys,
|
|
447
|
+
};
|
|
448
|
+
return this.client.put("/users/legacy-recover-account?token=".concat(token), accountRecoverPayload, this.basicHeaders());
|
|
449
|
+
};
|
|
436
450
|
/**
|
|
437
451
|
* Reset account with token
|
|
438
452
|
* @param token
|
package/dist/auth/types.d.ts
CHANGED
|
@@ -64,3 +64,23 @@ export interface PrivateKeys {
|
|
|
64
64
|
ecc?: string;
|
|
65
65
|
kyber?: string;
|
|
66
66
|
}
|
|
67
|
+
export interface PrivateKeysExtended {
|
|
68
|
+
ecc: {
|
|
69
|
+
public: string;
|
|
70
|
+
private: string;
|
|
71
|
+
revocationKey: string;
|
|
72
|
+
};
|
|
73
|
+
kyber: {
|
|
74
|
+
public: string;
|
|
75
|
+
private: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface ChangePasswordWithLinkPayload {
|
|
79
|
+
token: string;
|
|
80
|
+
encryptedPassword: string;
|
|
81
|
+
encryptedSalt: string;
|
|
82
|
+
encryptedMnemonic: string;
|
|
83
|
+
eccEncryptedMnemonic?: string;
|
|
84
|
+
kyberEncryptedMnemonic?: string;
|
|
85
|
+
keys: PrivateKeysExtended;
|
|
86
|
+
}
|
|
@@ -1,15 +1,59 @@
|
|
|
1
1
|
import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
|
|
2
2
|
import { Device, DeviceBackup } from './types';
|
|
3
|
+
import { DriveFolderData } from '../storage/types';
|
|
3
4
|
export declare class Backups {
|
|
4
5
|
private readonly client;
|
|
5
6
|
private readonly appDetails;
|
|
6
7
|
private readonly apiSecurity;
|
|
7
8
|
static client(apiUrl: ApiUrl, appDetails: AppDetails, apiSecurity: ApiSecurity): Backups;
|
|
8
9
|
private constructor();
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use `getBackupDevices` instead.
|
|
12
|
+
* This method uses the old drive backend, while `getBackupDevices` uses the new drive backend.
|
|
13
|
+
*/
|
|
9
14
|
getAllDevices(): Promise<Device[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves the list of backup devices associated with the user's account.
|
|
17
|
+
*
|
|
18
|
+
* @returns {Promise<Device[]>} A promise that resolves to an array of Devices.
|
|
19
|
+
*/
|
|
20
|
+
getBackupDevices(): Promise<Device[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Retrieves a list of all devices represented as folders.
|
|
23
|
+
*
|
|
24
|
+
* This method sends a GET request to the `/backup/deviceAsFolder` endpoint
|
|
25
|
+
* and returns an array of `DriveFolderData` objects, each representing a device
|
|
26
|
+
* as a folder in the drive.
|
|
27
|
+
*
|
|
28
|
+
* @returns {Promise<DriveFolderData[]>} A promise that resolves to an array of DriveFolderData.
|
|
29
|
+
*/
|
|
30
|
+
getAllDevicesAsFolder(): Promise<DriveFolderData[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves all backups associated with a specific device identified by its mac ID.
|
|
33
|
+
*
|
|
34
|
+
* @param mac - The mac ID of the device for which backups are to be retrieved.
|
|
35
|
+
* @returns A promise that resolves to an array of DeviceBackups.
|
|
36
|
+
*/
|
|
10
37
|
getAllBackups(mac: string): Promise<DeviceBackup[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Deletes a backup by its ID.
|
|
40
|
+
*
|
|
41
|
+
* @param backupId - The unique identifier of the backup to be deleted.
|
|
42
|
+
* @returns A promise that resolves when the backup is successfully deleted.
|
|
43
|
+
*/
|
|
11
44
|
deleteBackup(backupId: number): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Use `deleteBackupDevice` instead.
|
|
47
|
+
* This method uses the old drive backend, while `deleteBackupDevice` uses the new drive backend.
|
|
48
|
+
*/
|
|
12
49
|
deleteDevice(deviceId: number): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Deletes a backup device by its ID.
|
|
52
|
+
*
|
|
53
|
+
* @param deviceId - The unique identifier of the device to be deleted.
|
|
54
|
+
* @returns A promise that resolves when the device is successfully deleted.
|
|
55
|
+
*/
|
|
56
|
+
deleteBackupDevice(deviceId: number): Promise<void>;
|
|
13
57
|
/**
|
|
14
58
|
* Returns the needed headers for the module requests
|
|
15
59
|
* @private
|
|
@@ -12,22 +12,74 @@ var Backups = /** @class */ (function () {
|
|
|
12
12
|
Backups.client = function (apiUrl, appDetails, apiSecurity) {
|
|
13
13
|
return new Backups(apiUrl, appDetails, apiSecurity);
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use `getBackupDevices` instead.
|
|
17
|
+
* This method uses the old drive backend, while `getBackupDevices` uses the new drive backend.
|
|
18
|
+
*/
|
|
15
19
|
Backups.prototype.getAllDevices = function () {
|
|
16
20
|
return this.client
|
|
17
21
|
.get('/backup/device', this.headers());
|
|
18
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves the list of backup devices associated with the user's account.
|
|
25
|
+
*
|
|
26
|
+
* @returns {Promise<Device[]>} A promise that resolves to an array of Devices.
|
|
27
|
+
*/
|
|
28
|
+
Backups.prototype.getBackupDevices = function () {
|
|
29
|
+
return this.client
|
|
30
|
+
.get('/backup/devices', this.headers());
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves a list of all devices represented as folders.
|
|
34
|
+
*
|
|
35
|
+
* This method sends a GET request to the `/backup/deviceAsFolder` endpoint
|
|
36
|
+
* and returns an array of `DriveFolderData` objects, each representing a device
|
|
37
|
+
* as a folder in the drive.
|
|
38
|
+
*
|
|
39
|
+
* @returns {Promise<DriveFolderData[]>} A promise that resolves to an array of DriveFolderData.
|
|
40
|
+
*/
|
|
41
|
+
Backups.prototype.getAllDevicesAsFolder = function () {
|
|
42
|
+
return this.client
|
|
43
|
+
.get('/backup/deviceAsFolder', this.headers());
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Retrieves all backups associated with a specific device identified by its mac ID.
|
|
47
|
+
*
|
|
48
|
+
* @param mac - The mac ID of the device for which backups are to be retrieved.
|
|
49
|
+
* @returns A promise that resolves to an array of DeviceBackups.
|
|
50
|
+
*/
|
|
19
51
|
Backups.prototype.getAllBackups = function (mac) {
|
|
20
52
|
return this.client
|
|
21
53
|
.get("/backup/".concat(mac), this.headers());
|
|
22
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* Deletes a backup by its ID.
|
|
57
|
+
*
|
|
58
|
+
* @param backupId - The unique identifier of the backup to be deleted.
|
|
59
|
+
* @returns A promise that resolves when the backup is successfully deleted.
|
|
60
|
+
*/
|
|
23
61
|
Backups.prototype.deleteBackup = function (backupId) {
|
|
24
62
|
return this.client
|
|
25
63
|
.delete("/backup/".concat(backupId), this.headers());
|
|
26
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated Use `deleteBackupDevice` instead.
|
|
67
|
+
* This method uses the old drive backend, while `deleteBackupDevice` uses the new drive backend.
|
|
68
|
+
*/
|
|
27
69
|
Backups.prototype.deleteDevice = function (deviceId) {
|
|
28
70
|
return this.client
|
|
29
71
|
.delete("/backup/device/".concat(deviceId), this.headers());
|
|
30
72
|
};
|
|
73
|
+
/**
|
|
74
|
+
* Deletes a backup device by its ID.
|
|
75
|
+
*
|
|
76
|
+
* @param deviceId - The unique identifier of the device to be deleted.
|
|
77
|
+
* @returns A promise that resolves when the device is successfully deleted.
|
|
78
|
+
*/
|
|
79
|
+
Backups.prototype.deleteBackupDevice = function (deviceId) {
|
|
80
|
+
return this.client
|
|
81
|
+
.delete("/backup/devices/".concat(deviceId), this.headers());
|
|
82
|
+
};
|
|
31
83
|
/**
|
|
32
84
|
* Returns the needed headers for the module requests
|
|
33
85
|
* @private
|
|
@@ -12,6 +12,7 @@ export interface DriveFolderData {
|
|
|
12
12
|
icon_id: number | null;
|
|
13
13
|
name: string;
|
|
14
14
|
plain_name: string;
|
|
15
|
+
plainName?: string | null;
|
|
15
16
|
parentId: number | null;
|
|
16
17
|
parent_id: number | null;
|
|
17
18
|
parentUuid: string;
|
|
@@ -82,21 +83,30 @@ export interface FolderChild {
|
|
|
82
83
|
plainName?: string;
|
|
83
84
|
}
|
|
84
85
|
export interface FetchFolderContentResponse {
|
|
85
|
-
|
|
86
|
-
children: FolderChild[];
|
|
87
|
-
color: string;
|
|
88
|
-
createdAt: string;
|
|
89
|
-
encrypt_version: string;
|
|
90
|
-
files: DriveFileData[];
|
|
91
|
-
icon: string;
|
|
86
|
+
type: string;
|
|
92
87
|
id: number;
|
|
88
|
+
parentId: number | null;
|
|
89
|
+
parentUuid: string | null;
|
|
93
90
|
name: string;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
parent_id: number;
|
|
97
|
-
updatedAt: string;
|
|
91
|
+
parent: string | null;
|
|
92
|
+
bucket: string;
|
|
98
93
|
userId: number;
|
|
99
|
-
|
|
94
|
+
user: any | null;
|
|
95
|
+
encryptVersion: string;
|
|
96
|
+
deleted: boolean;
|
|
97
|
+
deletedAt: string | null;
|
|
98
|
+
createdAt: string;
|
|
99
|
+
updatedAt: string;
|
|
100
|
+
uuid: string;
|
|
101
|
+
plainName: string | null;
|
|
102
|
+
size: number;
|
|
103
|
+
removed: boolean;
|
|
104
|
+
removedAt: string | null;
|
|
105
|
+
creationTime: string;
|
|
106
|
+
modificationTime: string;
|
|
107
|
+
status: string;
|
|
108
|
+
children: FolderChild[];
|
|
109
|
+
files: DriveFileData[];
|
|
100
110
|
}
|
|
101
111
|
export interface FileMeta {
|
|
102
112
|
bucket: string;
|
|
@@ -152,6 +152,13 @@ export declare class Users {
|
|
|
152
152
|
getPublicKeyByEmail({ email }: {
|
|
153
153
|
email: string;
|
|
154
154
|
}): Promise<UserPublicKeyResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Generate mnemonic
|
|
157
|
+
*/
|
|
158
|
+
generateMnemonic(): Promise<{
|
|
159
|
+
mnemonic: string;
|
|
160
|
+
}>;
|
|
161
|
+
private basicHeaders;
|
|
155
162
|
private headers;
|
|
156
163
|
private headersWithToken;
|
|
157
164
|
}
|
|
@@ -230,6 +230,15 @@ var Users = /** @class */ (function () {
|
|
|
230
230
|
var email = _a.email;
|
|
231
231
|
return this.client.get("/users/public-key/".concat(email), this.headers());
|
|
232
232
|
};
|
|
233
|
+
/**
|
|
234
|
+
* Generate mnemonic
|
|
235
|
+
*/
|
|
236
|
+
Users.prototype.generateMnemonic = function () {
|
|
237
|
+
return this.client.get('/users/generate-mnemonic', this.basicHeaders());
|
|
238
|
+
};
|
|
239
|
+
Users.prototype.basicHeaders = function () {
|
|
240
|
+
return (0, headers_1.basicHeaders)(this.appDetails.clientName, this.appDetails.clientVersion);
|
|
241
|
+
};
|
|
233
242
|
Users.prototype.headers = function () {
|
|
234
243
|
return (0, headers_1.headersWithToken)(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token);
|
|
235
244
|
};
|