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.
@@ -44,8 +44,9 @@ export default class Skapi {
44
44
  }) => Promise<WebSocket>): any;
45
45
  jwtLogin(params: {
46
46
  jwt: string;
47
- key_url: string;
48
- client_id: string;
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
@@ -23,7 +23,7 @@ export default class Skapi {
23
23
  set user(value) {
24
24
  }
25
25
  constructor(service, owner, options, __etc) {
26
- this.version = '1.0.36';
26
+ this.version = '1.0.37';
27
27
  this.session = null;
28
28
  this.connection = null;
29
29
  this.host = 'skapi';
@@ -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
- key_url: string;
38
- client_id: string;
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;
@@ -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 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skapi-js",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "Skapi: Backend API Library for HTML frontend.",
5
5
  "main": "./dist/skapi.module.js",
6
6
  "types": "./js/Main.d.ts",