@internxt/sdk 1.11.12 → 1.11.13
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 +39 -1
- package/dist/auth/index.js +72 -0
- package/dist/auth/types.d.ts +21 -0
- package/dist/drive/users/index.d.ts +24 -0
- package/dist/drive/users/index.js +34 -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 { ChangePasswordWithLinkPayload, CryptoProvider, Keys, LoginDetails, PrivateKeys, RegisterDetails, RegisterPreCreatedUser, RegisterPreCreatedUserResponse, SecurityDetails, Token, TwoFactorAuthQR } from './types';
|
|
4
|
+
import { ChangePasswordWithLinkPayload, CryptoProvider, Keys, LoginDetails, PrivateKeys, RegisterDetails, RegisterOpaqueDetails, RegisterPreCreatedUser, RegisterPreCreatedUserResponse, SecurityDetails, Token, TwoFactorAuthQR } from './types';
|
|
5
5
|
import { paths } from '../schema';
|
|
6
6
|
export * from './types';
|
|
7
7
|
export declare class Auth {
|
|
@@ -11,6 +11,25 @@ export declare class Auth {
|
|
|
11
11
|
private readonly apiUrl;
|
|
12
12
|
static client(apiUrl: ApiUrl, appDetails: AppDetails, apiSecurity?: ApiSecurity): Auth;
|
|
13
13
|
private constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Runs the first phase (out of 2) of opaque registation of a new user
|
|
16
|
+
* @param email - The user email.
|
|
17
|
+
* @param registrationRequest - The opaque registration request.
|
|
18
|
+
* @returns The opaque sign up response.
|
|
19
|
+
*/
|
|
20
|
+
registerOpaqueStart(email: string, registrationRequest: string): Promise<{
|
|
21
|
+
signUpResponse: string;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Runs the second phase (out of 2) of opaque registation of a new user
|
|
25
|
+
* @param registrationRecord - The opaque registration record.
|
|
26
|
+
* @param registerDetails - The user registration details.
|
|
27
|
+
* @param startLoginRequest - The opaque start login request.
|
|
28
|
+
* @returns The opaque login response.
|
|
29
|
+
*/
|
|
30
|
+
registerOpaqueFinish(registrationRecord: string, registerDetails: RegisterOpaqueDetails, startLoginRequest: string): Promise<{
|
|
31
|
+
loginResponse: string;
|
|
32
|
+
}>;
|
|
14
33
|
/**
|
|
15
34
|
* Tries to register a new user
|
|
16
35
|
* @param registerDetails
|
|
@@ -61,6 +80,25 @@ export declare class Auth {
|
|
|
61
80
|
* @returns {Promise<void>} - Resolves successfuly when account is unblocked
|
|
62
81
|
*/
|
|
63
82
|
unblockAccount(token: string): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Runs the first phase (out of 2) of opaque log for the given user
|
|
85
|
+
* @param email - The user email.
|
|
86
|
+
* @param startLoginRequest - The opaque start login request.
|
|
87
|
+
* @param tfa - The two factor auth code.
|
|
88
|
+
* @returns The opaque login response.
|
|
89
|
+
*/
|
|
90
|
+
loginOpaqueStart(email: string, startLoginRequest: string, tfa: string | undefined): Promise<{
|
|
91
|
+
loginResponse: string;
|
|
92
|
+
}>;
|
|
93
|
+
/**
|
|
94
|
+
* Runs the second phase (out of 2) of opaque log for the given user
|
|
95
|
+
* @param email
|
|
96
|
+
* @param finishLoginRequest
|
|
97
|
+
*/
|
|
98
|
+
loginOpaqueFinish(email: string, finishLoginRequest: string): Promise<{
|
|
99
|
+
sessionID: string;
|
|
100
|
+
user: UserSettings;
|
|
101
|
+
}>;
|
|
64
102
|
/**
|
|
65
103
|
* Tries to log in a user given its login details
|
|
66
104
|
* @param details
|
package/dist/auth/index.js
CHANGED
|
@@ -64,6 +64,44 @@ var Auth = /** @class */ (function () {
|
|
|
64
64
|
Auth.client = function (apiUrl, appDetails, apiSecurity) {
|
|
65
65
|
return new Auth(apiUrl, appDetails, apiSecurity);
|
|
66
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* Runs the first phase (out of 2) of opaque registation of a new user
|
|
69
|
+
* @param email - The user email.
|
|
70
|
+
* @param registrationRequest - The opaque registration request.
|
|
71
|
+
* @returns The opaque sign up response.
|
|
72
|
+
*/
|
|
73
|
+
Auth.prototype.registerOpaqueStart = function (email, registrationRequest) {
|
|
74
|
+
return this.client.post('/register-opaque/start', {
|
|
75
|
+
email: email,
|
|
76
|
+
registrationRequest: registrationRequest,
|
|
77
|
+
}, this.basicHeaders());
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Runs the second phase (out of 2) of opaque registation of a new user
|
|
81
|
+
* @param registrationRecord - The opaque registration record.
|
|
82
|
+
* @param registerDetails - The user registration details.
|
|
83
|
+
* @param startLoginRequest - The opaque start login request.
|
|
84
|
+
* @returns The opaque login response.
|
|
85
|
+
*/
|
|
86
|
+
Auth.prototype.registerOpaqueFinish = function (registrationRecord, registerDetails, startLoginRequest) {
|
|
87
|
+
return this.client.post('/register-opaque/finish', {
|
|
88
|
+
name: registerDetails.name,
|
|
89
|
+
lastname: registerDetails.lastname,
|
|
90
|
+
email: registerDetails.email,
|
|
91
|
+
registrationRecord: registrationRecord,
|
|
92
|
+
keys: {
|
|
93
|
+
ecc: {
|
|
94
|
+
publicKey: registerDetails.keys.ecc.publicKey,
|
|
95
|
+
privateKey: registerDetails.keys.ecc.privateKey,
|
|
96
|
+
},
|
|
97
|
+
kyber: {
|
|
98
|
+
publicKey: registerDetails.keys.kyber.publicKey,
|
|
99
|
+
privateKey: registerDetails.keys.kyber.privateKey,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
startLoginRequest: startLoginRequest,
|
|
103
|
+
}, this.basicHeaders());
|
|
104
|
+
};
|
|
67
105
|
/**
|
|
68
106
|
* Tries to register a new user
|
|
69
107
|
* @param registerDetails
|
|
@@ -189,6 +227,39 @@ var Auth = /** @class */ (function () {
|
|
|
189
227
|
Auth.prototype.unblockAccount = function (token) {
|
|
190
228
|
return this.client.put('users/unblock-account', { token: token }, this.basicHeaders());
|
|
191
229
|
};
|
|
230
|
+
/**
|
|
231
|
+
* Runs the first phase (out of 2) of opaque log for the given user
|
|
232
|
+
* @param email - The user email.
|
|
233
|
+
* @param startLoginRequest - The opaque start login request.
|
|
234
|
+
* @param tfa - The two factor auth code.
|
|
235
|
+
* @returns The opaque login response.
|
|
236
|
+
*/
|
|
237
|
+
Auth.prototype.loginOpaqueStart = function (email, startLoginRequest, tfa) {
|
|
238
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
239
|
+
return __generator(this, function (_a) {
|
|
240
|
+
return [2 /*return*/, this.client.post('/auth/login-opaque/start', {
|
|
241
|
+
email: email,
|
|
242
|
+
startLoginRequest: startLoginRequest,
|
|
243
|
+
tfa: tfa,
|
|
244
|
+
}, this.basicHeaders())];
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* Runs the second phase (out of 2) of opaque log for the given user
|
|
250
|
+
* @param email
|
|
251
|
+
* @param finishLoginRequest
|
|
252
|
+
*/
|
|
253
|
+
Auth.prototype.loginOpaqueFinish = function (email, finishLoginRequest) {
|
|
254
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
255
|
+
return __generator(this, function (_a) {
|
|
256
|
+
return [2 /*return*/, this.client.post('/auth/login-opaque/finish', {
|
|
257
|
+
email: email,
|
|
258
|
+
finishLoginRequest: finishLoginRequest,
|
|
259
|
+
}, this.basicHeaders())];
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
};
|
|
192
263
|
/**
|
|
193
264
|
* Tries to log in a user given its login details
|
|
194
265
|
* @param details
|
|
@@ -343,6 +414,7 @@ var Auth = /** @class */ (function () {
|
|
|
343
414
|
return {
|
|
344
415
|
encryptedSalt: data.sKey,
|
|
345
416
|
tfaEnabled: data.tfa === true,
|
|
417
|
+
useOpaqueLogin: data.useOpaqueLogin === true,
|
|
346
418
|
};
|
|
347
419
|
});
|
|
348
420
|
};
|
package/dist/auth/types.d.ts
CHANGED
|
@@ -7,6 +7,26 @@ export interface LoginDetails {
|
|
|
7
7
|
password: Password;
|
|
8
8
|
tfaCode: string | undefined;
|
|
9
9
|
}
|
|
10
|
+
export type UserKeys = {
|
|
11
|
+
ecc: {
|
|
12
|
+
publicKey: string;
|
|
13
|
+
privateKey: string;
|
|
14
|
+
};
|
|
15
|
+
kyber: {
|
|
16
|
+
publicKey: string;
|
|
17
|
+
privateKey: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export interface RegisterOpaqueDetails {
|
|
21
|
+
name: string;
|
|
22
|
+
lastname: string;
|
|
23
|
+
email: Email;
|
|
24
|
+
mnemonic: string;
|
|
25
|
+
keys: UserKeys;
|
|
26
|
+
captcha: string;
|
|
27
|
+
referrer?: string;
|
|
28
|
+
referral?: string;
|
|
29
|
+
}
|
|
10
30
|
export interface RegisterDetails {
|
|
11
31
|
name: string;
|
|
12
32
|
lastname: string;
|
|
@@ -52,6 +72,7 @@ export declare class UserAccessError extends Error {
|
|
|
52
72
|
export interface SecurityDetails {
|
|
53
73
|
encryptedSalt: string;
|
|
54
74
|
tfaEnabled: boolean;
|
|
75
|
+
useOpaqueLogin: boolean;
|
|
55
76
|
}
|
|
56
77
|
export interface TwoFactorAuthQR {
|
|
57
78
|
qr: string;
|
|
@@ -2,6 +2,7 @@ import { paths } from '../../schema';
|
|
|
2
2
|
import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
|
|
3
3
|
import { UserSettings } from '../../shared/types/userSettings';
|
|
4
4
|
import { ChangePasswordPayload, ChangePasswordPayloadNew, CheckChangeEmailExpirationResponse, FriendInvite, InitializeUserResponse, PreCreateUserResponse, Token, UpdateProfilePayload, UserPublicKeyResponse, UserPublicKeyWithCreationResponse, VerifyEmailChangeResponse } from './types';
|
|
5
|
+
import { UserKeys } from '../../auth/types';
|
|
5
6
|
export * as UserTypes from './types';
|
|
6
7
|
export declare class Users {
|
|
7
8
|
private readonly client;
|
|
@@ -67,6 +68,29 @@ export declare class Users {
|
|
|
67
68
|
token: string;
|
|
68
69
|
newToken: string;
|
|
69
70
|
}>;
|
|
71
|
+
/**
|
|
72
|
+
* Runs the first phase (out of 2) of the password change.
|
|
73
|
+
* @param hmac - The HMAC to authenticate request.
|
|
74
|
+
* @param sessionID - The current session ID.
|
|
75
|
+
* @param registrationRequest - The opaque registration request.
|
|
76
|
+
* @returns {Promise<string>} A promise that returns opaque registration response.
|
|
77
|
+
*/
|
|
78
|
+
changePwdOpaqueStart(hmac: string, sessionID: string, registrationRequest: string): Promise<{
|
|
79
|
+
registrationResponse: string;
|
|
80
|
+
}>;
|
|
81
|
+
/**
|
|
82
|
+
* Runs the second phase (out of 2) of the password change.
|
|
83
|
+
* @param hmac - The HMAC to authenticate request.
|
|
84
|
+
* @param sessionID - The current session ID.
|
|
85
|
+
* @param registrationRecord - The opaque registration record.
|
|
86
|
+
* @param mnemonic - The user's encrypted mnemonic.
|
|
87
|
+
* @param keys - The user's encrypted keys.
|
|
88
|
+
* @param startLoginRequest - The opaque start login request.
|
|
89
|
+
* @returns {Promise<string>} A promise that returns opaque login response.
|
|
90
|
+
*/
|
|
91
|
+
changePwdOpaqueFinish(hmac: string, sessionID: string, registrationRecord: string, mnemonic: string, keys: UserKeys, startLoginRequest: string): Promise<{
|
|
92
|
+
loginResponse: string;
|
|
93
|
+
}>;
|
|
70
94
|
/**
|
|
71
95
|
* Pre registers an email
|
|
72
96
|
* @param email
|
|
@@ -164,6 +164,40 @@ var Users = /** @class */ (function () {
|
|
|
164
164
|
encryptVersion: payload.encryptVersion,
|
|
165
165
|
}, this.headers());
|
|
166
166
|
};
|
|
167
|
+
/**
|
|
168
|
+
* Runs the first phase (out of 2) of the password change.
|
|
169
|
+
* @param hmac - The HMAC to authenticate request.
|
|
170
|
+
* @param sessionID - The current session ID.
|
|
171
|
+
* @param registrationRequest - The opaque registration request.
|
|
172
|
+
* @returns {Promise<string>} A promise that returns opaque registration response.
|
|
173
|
+
*/
|
|
174
|
+
Users.prototype.changePwdOpaqueStart = function (hmac, sessionID, registrationRequest) {
|
|
175
|
+
return this.client.patch('/users/password-opaque/start', {
|
|
176
|
+
hmac: hmac,
|
|
177
|
+
sessionID: sessionID,
|
|
178
|
+
registrationRequest: registrationRequest,
|
|
179
|
+
}, this.headers());
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Runs the second phase (out of 2) of the password change.
|
|
183
|
+
* @param hmac - The HMAC to authenticate request.
|
|
184
|
+
* @param sessionID - The current session ID.
|
|
185
|
+
* @param registrationRecord - The opaque registration record.
|
|
186
|
+
* @param mnemonic - The user's encrypted mnemonic.
|
|
187
|
+
* @param keys - The user's encrypted keys.
|
|
188
|
+
* @param startLoginRequest - The opaque start login request.
|
|
189
|
+
* @returns {Promise<string>} A promise that returns opaque login response.
|
|
190
|
+
*/
|
|
191
|
+
Users.prototype.changePwdOpaqueFinish = function (hmac, sessionID, registrationRecord, mnemonic, keys, startLoginRequest) {
|
|
192
|
+
return this.client.patch('/users/password-opaque/finish', {
|
|
193
|
+
hmac: hmac,
|
|
194
|
+
sessionID: sessionID,
|
|
195
|
+
keys: keys,
|
|
196
|
+
mnemonic: mnemonic,
|
|
197
|
+
registrationRecord: registrationRecord,
|
|
198
|
+
startLoginRequest: startLoginRequest,
|
|
199
|
+
}, this.headers());
|
|
200
|
+
};
|
|
167
201
|
/**
|
|
168
202
|
* Pre registers an email
|
|
169
203
|
* @param email
|