skapi-js 1.0.36 → 1.0.37
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/skapi.js +1 -1
- package/dist/skapi.js.map +1 -1
- package/dist/skapi.module.js +1 -1
- package/dist/skapi.module.js.map +1 -1
- package/js/main/skapi.d.ts +3 -2
- package/js/main/skapi.js +1 -1
- package/js/methods/user.d.ts +3 -2
- package/js/methods/user.js +11 -0
- package/package.json +1 -1
package/js/main/skapi.d.ts
CHANGED
|
@@ -44,8 +44,9 @@ export default class Skapi {
|
|
|
44
44
|
}) => Promise<WebSocket>): any;
|
|
45
45
|
jwtLogin(params: {
|
|
46
46
|
jwt: string;
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
keyUrl: string;
|
|
48
|
+
clientId: string;
|
|
49
|
+
provider: string;
|
|
49
50
|
}): Promise<string>;
|
|
50
51
|
consumeTicket(params: {
|
|
51
52
|
ticket_id: string;
|
package/js/main/skapi.js
CHANGED
package/js/methods/user.d.ts
CHANGED
|
@@ -34,8 +34,9 @@ export declare function resendSignupConfirmation(redirect: string): Promise<'SUC
|
|
|
34
34
|
export declare function recoverAccount(redirect?: boolean | string): Promise<"SUCCESS: Recovery e-mail has been sent.">;
|
|
35
35
|
export declare function jwtLogin(params: {
|
|
36
36
|
jwt: string;
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
keyUrl: string;
|
|
38
|
+
clientId: string;
|
|
39
|
+
provider: string;
|
|
39
40
|
}): Promise<any>;
|
|
40
41
|
export declare function login(form: Form<{
|
|
41
42
|
username?: string;
|
package/js/methods/user.js
CHANGED
|
@@ -342,6 +342,17 @@ export async function recoverAccount(redirect = false) {
|
|
|
342
342
|
return 'SUCCESS: Recovery e-mail has been sent.';
|
|
343
343
|
}
|
|
344
344
|
export async function jwtLogin(params) {
|
|
345
|
+
validator.Params(params, {
|
|
346
|
+
jwt: 'string',
|
|
347
|
+
clientId: 'string',
|
|
348
|
+
keyUrl: (v) => validator.Url(v),
|
|
349
|
+
provider: (v) => {
|
|
350
|
+
if (v.length > 4) {
|
|
351
|
+
throw new SkapiError('"provider" is too long. Should be less than 4 characters', { code: 'INVALID_PARAMETER' });
|
|
352
|
+
}
|
|
353
|
+
return v;
|
|
354
|
+
}
|
|
355
|
+
}, ['jwt', 'keyUrl', 'clientId']);
|
|
345
356
|
let { hashedPassword, username } = await request.bind(this)("jwt-login", params);
|
|
346
357
|
try {
|
|
347
358
|
return login.bind(this)({ username: username, password: hashedPassword });
|