@internxt/sdk 1.9.2 → 1.9.4
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
CHANGED
|
@@ -94,12 +94,11 @@ export declare class Auth {
|
|
|
94
94
|
*/
|
|
95
95
|
confirmDeactivation(token: string): Promise<void>;
|
|
96
96
|
/**
|
|
97
|
-
*
|
|
98
|
-
* @param email
|
|
97
|
+
* Check credentials
|
|
99
98
|
* @param hashedPassword
|
|
100
99
|
* @returns
|
|
101
100
|
*/
|
|
102
|
-
areCredentialsCorrect(
|
|
101
|
+
areCredentialsCorrect(hashedPassword: string, token?: Token): Promise<boolean>;
|
|
103
102
|
/**
|
|
104
103
|
* Send email to change password
|
|
105
104
|
* @param email
|
package/dist/auth/index.js
CHANGED
|
@@ -91,7 +91,7 @@ var Auth = /** @class */ (function () {
|
|
|
91
91
|
kyber: {
|
|
92
92
|
publicKey: registerDetails.keys.kyber.publicKey,
|
|
93
93
|
privateKeyEncrypted: registerDetails.keys.kyber.privateKeyEncrypted,
|
|
94
|
-
}
|
|
94
|
+
},
|
|
95
95
|
},
|
|
96
96
|
referral: registerDetails.referral,
|
|
97
97
|
referrer: registerDetails.referrer,
|
|
@@ -189,7 +189,7 @@ var Auth = /** @class */ (function () {
|
|
|
189
189
|
kyber: {
|
|
190
190
|
publicKey: keys.kyber.publicKey,
|
|
191
191
|
privateKeyEncrypted: keys.kyber.privateKeyEncrypted,
|
|
192
|
-
}
|
|
192
|
+
},
|
|
193
193
|
},
|
|
194
194
|
}, this.basicHeaders())
|
|
195
195
|
.then(function (data) {
|
|
@@ -222,7 +222,7 @@ var Auth = /** @class */ (function () {
|
|
|
222
222
|
kyber: {
|
|
223
223
|
publicKey: keys.kyber.publicKey,
|
|
224
224
|
privateKeyEncrypted: keys.kyber.privateKeyEncrypted,
|
|
225
|
-
}
|
|
225
|
+
},
|
|
226
226
|
}, this.headersWithToken(token));
|
|
227
227
|
};
|
|
228
228
|
/**
|
|
@@ -301,26 +301,24 @@ var Auth = /** @class */ (function () {
|
|
|
301
301
|
return this.client.get("/confirmDeactivation/".concat(token), this.basicHeaders());
|
|
302
302
|
};
|
|
303
303
|
/**
|
|
304
|
-
*
|
|
305
|
-
* @param email
|
|
304
|
+
* Check credentials
|
|
306
305
|
* @param hashedPassword
|
|
307
306
|
* @returns
|
|
308
307
|
*/
|
|
309
|
-
Auth.prototype.areCredentialsCorrect = function (
|
|
308
|
+
Auth.prototype.areCredentialsCorrect = function (hashedPassword, token) {
|
|
310
309
|
var _a;
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
310
|
+
var url = '/auth/are-credentials-correct';
|
|
311
|
+
return this.client
|
|
312
|
+
.getWithParams(url, { hashedPassword: hashedPassword }, this.headersWithToken(token !== null && token !== void 0 ? token : (_a = this.apiSecurity) === null || _a === void 0 ? void 0 : _a.token))
|
|
313
|
+
.then(function (res) {
|
|
314
|
+
return res;
|
|
315
|
+
})
|
|
316
|
+
.catch(function (error) {
|
|
317
|
+
var _a, _b, _c;
|
|
318
|
+
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
|
|
320
319
|
return false;
|
|
321
320
|
}
|
|
322
|
-
|
|
323
|
-
throw new Error("Request failed with error ".concat(res.status));
|
|
321
|
+
throw new Error("Request failed with status ".concat((_b = error.response) === null || _b === void 0 ? void 0 : _b.status, ": ").concat((_c = error.response) === null || _c === void 0 ? void 0 : _c.data));
|
|
324
322
|
});
|
|
325
323
|
};
|
|
326
324
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
|
|
2
2
|
import { UserSettings } from '../../shared/types/userSettings';
|
|
3
|
-
import { ChangePasswordPayload, ChangePasswordPayloadNew, CheckChangeEmailExpirationResponse, FriendInvite, InitializeUserResponse, PreCreateUserResponse, UpdateProfilePayload, UserPublicKeyResponse, VerifyEmailChangeResponse } from './types';
|
|
3
|
+
import { ChangePasswordPayload, ChangePasswordPayloadNew, CheckChangeEmailExpirationResponse, FriendInvite, InitializeUserResponse, PreCreateUserResponse, Token, UpdateProfilePayload, UserPublicKeyResponse, VerifyEmailChangeResponse } from './types';
|
|
4
4
|
export * as UserTypes from './types';
|
|
5
5
|
export declare class Users {
|
|
6
6
|
private readonly client;
|
|
@@ -94,7 +94,7 @@ export declare class Users {
|
|
|
94
94
|
/**
|
|
95
95
|
* Sends verification email
|
|
96
96
|
*/
|
|
97
|
-
sendVerificationEmail(): Promise<void>;
|
|
97
|
+
sendVerificationEmail(token?: Token): Promise<void>;
|
|
98
98
|
/**
|
|
99
99
|
* Verifies user email
|
|
100
100
|
*/
|
|
@@ -132,4 +132,5 @@ export declare class Users {
|
|
|
132
132
|
email: string;
|
|
133
133
|
}): Promise<UserPublicKeyResponse>;
|
|
134
134
|
private headers;
|
|
135
|
+
private headersWithToken;
|
|
135
136
|
}
|
|
@@ -153,14 +153,15 @@ var Users = /** @class */ (function () {
|
|
|
153
153
|
/**
|
|
154
154
|
* Sends verification email
|
|
155
155
|
*/
|
|
156
|
-
Users.prototype.sendVerificationEmail = function () {
|
|
157
|
-
|
|
156
|
+
Users.prototype.sendVerificationEmail = function (token) {
|
|
157
|
+
var _a;
|
|
158
|
+
return this.client.post('/users/email-verification/send', {}, this.headersWithToken(token !== null && token !== void 0 ? token : (_a = this.apiSecurity) === null || _a === void 0 ? void 0 : _a.token));
|
|
158
159
|
};
|
|
159
160
|
/**
|
|
160
161
|
* Verifies user email
|
|
161
162
|
*/
|
|
162
163
|
Users.prototype.verifyEmail = function (payload) {
|
|
163
|
-
return this.client.post('/
|
|
164
|
+
return this.client.post('/users/email-verification', payload, this.headers());
|
|
164
165
|
};
|
|
165
166
|
/**
|
|
166
167
|
* Change user email by new email
|
|
@@ -204,6 +205,9 @@ var Users = /** @class */ (function () {
|
|
|
204
205
|
Users.prototype.headers = function () {
|
|
205
206
|
return (0, headers_1.headersWithToken)(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token);
|
|
206
207
|
};
|
|
208
|
+
Users.prototype.headersWithToken = function (token) {
|
|
209
|
+
return (0, headers_1.headersWithToken)(this.appDetails.clientName, this.appDetails.clientVersion, token);
|
|
210
|
+
};
|
|
207
211
|
return Users;
|
|
208
212
|
}());
|
|
209
213
|
exports.Users = Users;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UUID, UserSettings } from '../../shared/types/userSettings';
|
|
2
|
+
export type Token = string;
|
|
2
3
|
export interface InitializeUserResponse {
|
|
3
4
|
email: string;
|
|
4
5
|
bucket: string;
|
|
@@ -18,8 +19,8 @@ export interface ChangePasswordPayloadNew {
|
|
|
18
19
|
newEncryptedSalt: string;
|
|
19
20
|
encryptedMnemonic: string;
|
|
20
21
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
* @deprecated encryptedPrivateKey field is depercated, use keys.encryptedPrivateKey instead
|
|
23
|
+
*/
|
|
23
24
|
encryptedPrivateKey: string;
|
|
24
25
|
keys: {
|
|
25
26
|
encryptedPrivateKey: string;
|
|
@@ -22,11 +22,11 @@ export interface UserSettings {
|
|
|
22
22
|
keys: {
|
|
23
23
|
ecc: {
|
|
24
24
|
publicKey: string;
|
|
25
|
-
|
|
25
|
+
privateKey: string;
|
|
26
26
|
};
|
|
27
27
|
kyber: {
|
|
28
28
|
publicKey: string;
|
|
29
|
-
|
|
29
|
+
privateKey: string;
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
32
|
teams?: boolean;
|