Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@screencloud/auth-sdk

Package Overview
Dependencies
Maintainers
2
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@screencloud/auth-sdk - npm Package Compare versions

Comparing version 2.0.4 to 2.1.0

4

build/Auth.d.ts
import { EventEmitter } from '@screencloud/event-emitter';
import { AuthServiceErrorResponse, AuthServiceSuccessResponse } from './authRestfulTypes';
import { AuthLoggedOutEvent, IAuthRefreshError, IAuthSession } from './types';
import { AuthLoggedOutEvent, IAuthRefreshError, IAuthSession, IRefreshParameters } from './types';
export declare function isAuthSession(session: IAuthSession | any): session is IAuthSession;

@@ -49,3 +49,3 @@ export declare function isAuthCache(x: IAuthCache | any): x is IAuthCache;

}): Promise<T_RESPONSE | AuthServiceErrorResponse>;
refresh(): Promise<IAuthSession>;
refresh(parameters?: IRefreshParameters): Promise<IAuthSession>;
setCache(session: IAuthSession | null, date?: number): void;

@@ -52,0 +52,0 @@ shouldRefresh(): boolean;

@@ -228,5 +228,6 @@ "use strict";

};
Auth.prototype.refresh = function () {
Auth.prototype.refresh = function (parameters) {
if (parameters === void 0) { parameters = { shouldFetchSkillJar: false }; }
return __awaiter(this, void 0, void 0, function () {
var response, e_2, error, claims, token, session;
var response, shouldFetchSkillJar, path, e_2, error, claims, token, skilljar, session;
return __generator(this, function (_a) {

@@ -239,3 +240,5 @@ switch (_a.label) {

_a.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.fetchJson('/token/refresh')];
shouldFetchSkillJar = parameters.shouldFetchSkillJar;
path = "/token/refresh" + (shouldFetchSkillJar ? "?skilljar=1" : '');
return [4 /*yield*/, this.fetchJson(path)];
case 2:

@@ -250,3 +253,3 @@ response = _a.sent();

case 4:
error = response.error, claims = response.claims, token = response.token;
error = response.error, claims = response.claims, token = response.token, skilljar = response.skilljar;
// error message received, throw to forward

@@ -258,3 +261,3 @@ if (isAuthSessionError(error)) {

}
session = { claims: claims, token: token };
session = { claims: claims, token: token, skilljar: skilljar };
if (!isAuthSession(session)) {

@@ -261,0 +264,0 @@ this.log('refresh() received invalid payload', response);

@@ -58,2 +58,5 @@ "use strict";

token: 'eyFooFoo',
skilljar: {
loginToken: 'loginToken',
}
};

@@ -69,2 +72,5 @@ var defaultSessionWithPC = {

token: 'eyFooFoo',
skilljar: {
loginToken: 'loginToken',
}
};

@@ -71,0 +77,0 @@ var defaultConfig = {

import { AuthServiceSuccessResponse, PublicUserIdentity, User } from './authRestfulTypes';
export interface IRefreshParameters {
shouldFetchSkillJar?: boolean;
}
export interface IAuthBaseClaims {

@@ -19,5 +22,9 @@ aud: string;

}
export interface ISkillJar {
loginToken: string;
}
export interface IAuthSession {
claims: IAuthClaims;
token: string;
skilljar?: ISkillJar;
}

@@ -24,0 +31,0 @@ export interface IAuthRefreshError {

@@ -67,3 +67,3 @@ {

},
"version": "2.0.4"
"version": "2.1.0"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc