@internxt/sdk 1.9.21 → 1.9.23

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.
@@ -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
@@ -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
@@ -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;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@internxt/sdk",
3
3
  "author": "Internxt <hello@internxt.com>",
4
- "version": "1.9.21",
4
+ "version": "1.9.23",
5
5
  "description": "An sdk for interacting with Internxt's services",
6
6
  "repository": {
7
7
  "type": "git",