@internxt/sdk 1.9.8 → 1.9.11

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,4 +1,4 @@
1
- import { Token, CryptoProvider, Keys, LoginDetails, RegisterDetails, SecurityDetails, TwoFactorAuthQR, RegisterPreCreatedUser, RegisterPreCreatedUserResponse } from './types';
1
+ import { Token, CryptoProvider, Keys, LoginDetails, RegisterDetails, SecurityDetails, TwoFactorAuthQR, RegisterPreCreatedUser, RegisterPreCreatedUserResponse, PrivateKeys } from './types';
2
2
  import { UserSettings, UUID } from '../shared/types/userSettings';
3
3
  import { TeamsSettings } from '../shared/types/teams';
4
4
  import { ApiSecurity, ApiUrl, AppDetails } from '../shared';
@@ -121,8 +121,9 @@ export declare class Auth {
121
121
  * @param password
122
122
  * @param salt
123
123
  * @param mnemonic
124
+ * @param keys
124
125
  */
125
- changePasswordWithLink(token: string | undefined, password: string, salt: string, mnemonic: string): Promise<void>;
126
+ changePasswordWithLink(token: string | undefined, password: string, salt: string, mnemonic: string, keys?: PrivateKeys): Promise<void>;
126
127
  /**
127
128
  * Reset account with token
128
129
  * @param token
@@ -355,12 +355,14 @@ var Auth = /** @class */ (function () {
355
355
  * @param password
356
356
  * @param salt
357
357
  * @param mnemonic
358
+ * @param keys
358
359
  */
359
- Auth.prototype.changePasswordWithLink = function (token, password, salt, mnemonic) {
360
+ Auth.prototype.changePasswordWithLink = function (token, password, salt, mnemonic, keys) {
360
361
  return this.client.put("/users/recover-account?token=".concat(token, "&reset=false"), {
361
362
  password: password,
362
363
  salt: salt,
363
364
  mnemonic: mnemonic,
365
+ privateKeys: keys,
364
366
  }, this.basicHeaders());
365
367
  };
366
368
  /**
@@ -60,3 +60,7 @@ export interface BasicAuth {
60
60
  username: string;
61
61
  password: string;
62
62
  }
63
+ export interface PrivateKeys {
64
+ ecc?: string;
65
+ kyber?: string;
66
+ }
@@ -3,5 +3,6 @@ export * from './share';
3
3
  export * from './users';
4
4
  export * from './referrals';
5
5
  export * from './payments';
6
+ export * from './payments/object-storage';
6
7
  export * from './backups';
7
8
  export * from './trash';
@@ -19,5 +19,6 @@ __exportStar(require("./share"), exports);
19
19
  __exportStar(require("./users"), exports);
20
20
  __exportStar(require("./referrals"), exports);
21
21
  __exportStar(require("./payments"), exports);
22
+ __exportStar(require("./payments/object-storage"), exports);
22
23
  __exportStar(require("./backups"), exports);
23
24
  __exportStar(require("./trash"), exports);
@@ -0,0 +1,36 @@
1
+ import { ApiUrl, AppDetails } from '../../shared';
2
+ import { CreatedSubscriptionData } from './types';
3
+ interface ObjectStoragePlan {
4
+ id: string;
5
+ bytes: number;
6
+ interval: 'year' | 'month' | 'lifetime';
7
+ amount: number;
8
+ currency: string;
9
+ decimalAmount: number;
10
+ }
11
+ export declare class ObjectStorage {
12
+ private readonly client;
13
+ private readonly appDetails;
14
+ static client(apiUrl: ApiUrl, appDetails: AppDetails): ObjectStorage;
15
+ private constructor();
16
+ getObjectStoragePlanById(priceId: string, currency?: string): Promise<ObjectStoragePlan>;
17
+ createCustomerForObjectStorage({ name, email, country, companyVatId, }: {
18
+ name: string;
19
+ email: string;
20
+ country?: string;
21
+ companyVatId?: string;
22
+ }): Promise<{
23
+ customerId: string;
24
+ token: string;
25
+ }>;
26
+ createObjectStorageSubscription({ customerId, plan, token, companyName, vatId, promoCodeId, }: {
27
+ customerId: string;
28
+ plan: ObjectStoragePlan;
29
+ token: string;
30
+ companyName: string;
31
+ vatId: string;
32
+ promoCodeId?: string;
33
+ }): Promise<CreatedSubscriptionData>;
34
+ private headers;
35
+ }
36
+ export {};
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ObjectStorage = void 0;
4
+ var headers_1 = require("../../shared/headers");
5
+ var client_1 = require("../../shared/http/client");
6
+ var ObjectStorage = /** @class */ (function () {
7
+ function ObjectStorage(apiUrl, appDetails) {
8
+ this.client = client_1.HttpClient.create(apiUrl);
9
+ this.appDetails = appDetails;
10
+ }
11
+ ObjectStorage.client = function (apiUrl, appDetails) {
12
+ return new ObjectStorage(apiUrl, appDetails);
13
+ };
14
+ ObjectStorage.prototype.getObjectStoragePlanById = function (priceId, currency) {
15
+ var query = new URLSearchParams();
16
+ priceId !== undefined && query.set('planId', priceId);
17
+ currency !== undefined && query.set('currency', currency);
18
+ return this.client.get("/object-storage-plan-by-id?".concat(query.toString()), this.headers());
19
+ };
20
+ ObjectStorage.prototype.createCustomerForObjectStorage = function (_a) {
21
+ var name = _a.name, email = _a.email, country = _a.country, companyVatId = _a.companyVatId;
22
+ return this.client.post('/create-customer-for-object-storage', {
23
+ name: name,
24
+ email: email,
25
+ country: country,
26
+ companyVatId: companyVatId,
27
+ }, this.headers());
28
+ };
29
+ ObjectStorage.prototype.createObjectStorageSubscription = function (_a) {
30
+ var customerId = _a.customerId, plan = _a.plan, token = _a.token, companyName = _a.companyName, vatId = _a.vatId, promoCodeId = _a.promoCodeId;
31
+ var priceId = plan.id, currency = plan.currency;
32
+ return this.client.post('/create-subscription-for-object-storage', {
33
+ customerId: customerId,
34
+ priceId: priceId,
35
+ token: token,
36
+ currency: currency,
37
+ companyName: companyName,
38
+ companyVatId: vatId,
39
+ promoCodeId: promoCodeId,
40
+ }, this.headers());
41
+ };
42
+ ObjectStorage.prototype.headers = function () {
43
+ return (0, headers_1.basicHeaders)(this.appDetails.clientName, this.appDetails.clientVersion);
44
+ };
45
+ return ObjectStorage;
46
+ }());
47
+ exports.ObjectStorage = ObjectStorage;
@@ -127,7 +127,10 @@ export interface InvoicePayload {
127
127
  limit?: number;
128
128
  }
129
129
  export type UserSubscription = {
130
- type: 'free' | 'lifetime';
130
+ type: 'free';
131
+ } | {
132
+ type: 'lifetime';
133
+ productId?: string;
131
134
  } | {
132
135
  type: 'subscription';
133
136
  subscriptionId: string;
@@ -137,12 +140,13 @@ export type UserSubscription = {
137
140
  interval: 'year' | 'month';
138
141
  nextPayment: number;
139
142
  priceId: string;
143
+ productId?: string;
140
144
  userType?: UserType;
141
- planId?: string;
142
145
  plan?: StoragePlan;
143
146
  };
144
147
  export interface DisplayPrice {
145
148
  id: string;
149
+ productId?: string;
146
150
  bytes: number;
147
151
  interval: 'year' | 'month' | 'lifetime';
148
152
  amount: number;
@@ -182,5 +186,6 @@ export type CreatedSubscriptionData = {
182
186
  export type AvailableProducts = {
183
187
  featuresPerService: {
184
188
  antivirus: boolean;
189
+ backups: boolean;
185
190
  };
186
191
  };
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.8",
4
+ "version": "1.9.11",
5
5
  "description": "An sdk for interacting with Internxt's services",
6
6
  "repository": {
7
7
  "type": "git",