New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@workos-inc/authkit-js

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@workos-inc/authkit-js - npm Package Compare versions

Comparing version 0.7.1 to 0.7.2

3

dist/index.d.ts

@@ -25,2 +25,3 @@ interface User {

}
type OnRefreshResponse = Omit<AuthenticationResponse, "refreshToken">;

@@ -39,3 +40,3 @@ interface CreateClientOptions {

onBeforeAutoRefresh?: () => boolean;
onRefresh?: (_: AuthenticationResponse) => void;
onRefresh?: (_: OnRefreshResponse) => void;
onRefreshFailure?: (args: {

@@ -42,0 +43,0 @@ signIn: Awaited<ReturnType<typeof createClient>>["signIn"];

@@ -677,3 +677,3 @@ "use strict";

var REFRESH_LOCK_NAME = "WORKOS_REFRESH_SESSION";
var _state, _refreshTimer, _clientId, _redirectUri, _baseUrl, _devMode, _onBeforeAutoRefresh, _onRedirectCallback, _onRefresh, _onRefreshFailure, _refreshBufferInterval, _Client_instances, handleCallback_fn, scheduleAutomaticRefresh_fn, refreshSession_fn, doRefresh_fn, shouldRefresh_fn, redirect_fn, getAccessToken_fn, useCookie_get;
var _state, _refreshTimer, _clientId, _redirectUri, _baseUrl, _devMode, _onBeforeAutoRefresh, _onRedirectCallback, _onRefreshCallback, _onRefreshFailure, _refreshBufferInterval, _Client_instances, handleCallback_fn, scheduleAutomaticRefresh_fn, refreshSession_fn, doRefresh_fn, shouldRefresh_fn, redirect_fn, getAccessToken_fn, useCookie_get, onRefresh_fn;
var Client = class {

@@ -705,3 +705,3 @@ constructor(clientId, {

__privateAdd(this, _onRedirectCallback);
__privateAdd(this, _onRefresh);
__privateAdd(this, _onRefreshCallback);
__privateAdd(this, _onRefreshFailure);

@@ -719,3 +719,3 @@ __privateAdd(this, _refreshBufferInterval);

__privateSet(this, _onRedirectCallback, onRedirectCallback);
__privateSet(this, _onRefresh, onRefresh);
__privateSet(this, _onRefreshCallback, onRefresh);
__privateSet(this, _onRefreshFailure, onRefreshFailure);

@@ -807,3 +807,3 @@ __privateSet(this, _refreshBufferInterval, refreshBufferInterval);

_onRedirectCallback = new WeakMap();
_onRefresh = new WeakMap();
_onRefreshCallback = new WeakMap();
_onRefreshFailure = new WeakMap();

@@ -841,3 +841,3 @@ _refreshBufferInterval = new WeakMap();

setSessionData(authenticationResponse, { devMode: __privateGet(this, _devMode) });
__privateGet(this, _onRefresh) && __privateGet(this, _onRefresh).call(this, authenticationResponse);
__privateMethod(this, _Client_instances, onRefresh_fn).call(this, authenticationResponse);
__privateGet(this, _onRedirectCallback).call(this, { state, ...authenticationResponse });

@@ -916,3 +916,3 @@ }

setSessionData(authenticationResponse, { devMode: __privateGet(this, _devMode) });
__privateGet(this, _onRefresh) && __privateGet(this, _onRefresh).call(this, authenticationResponse);
__privateMethod(this, _Client_instances, onRefresh_fn).call(this, authenticationResponse);
return authenticationResponse;

@@ -987,2 +987,8 @@ });

};
onRefresh_fn = async function(authenticationResponse) {
if (__privateGet(this, _onRefreshCallback)) {
const { refreshToken: _refreshToken, ...onRefreshData } = authenticationResponse;
__privateGet(this, _onRefreshCallback).call(this, onRefreshData);
}
};
async function createClient(clientId, options = {}) {

@@ -989,0 +995,0 @@ const client = new Client(clientId, options);

{
"name": "@workos-inc/authkit-js",
"version": "0.7.1",
"version": "0.7.2",
"description": "AuthKit SDK",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -23,2 +23,3 @@ import {

import { withLock, LockError } from "./utils/locking";
import { OnRefreshResponse } from "./interfaces/authentication-response.interface";

@@ -57,3 +58,5 @@ interface RedirectOptions {

readonly #onRedirectCallback: (params: RedirectParams) => void;
readonly #onRefresh: ((response: AuthenticationResponse) => void) | undefined;
readonly #onRefreshCallback:
| ((response: OnRefreshResponse) => void)
| undefined;
readonly #onRefreshFailure:

@@ -96,3 +99,3 @@ | ((params: { signIn: () => Promise<void> }) => void)

this.#onRedirectCallback = onRedirectCallback;
this.#onRefresh = onRefresh;
this.#onRefreshCallback = onRefresh;
this.#onRefreshFailure = onRefreshFailure;

@@ -202,3 +205,3 @@ this.#refreshBufferInterval = refreshBufferInterval;

setSessionData(authenticationResponse, { devMode: this.#devMode });
this.#onRefresh && this.#onRefresh(authenticationResponse);
this.#onRefresh(authenticationResponse);
this.#onRedirectCallback({ state, ...authenticationResponse });

@@ -318,3 +321,3 @@ }

setSessionData(authenticationResponse, { devMode: this.#devMode });
this.#onRefresh && this.#onRefresh(authenticationResponse);
this.#onRefresh(authenticationResponse);
return authenticationResponse;

@@ -413,2 +416,11 @@ });

}
async #onRefresh(authenticationResponse: AuthenticationResponse) {
if (this.#onRefreshCallback) {
// there's no good reason for client code to access the refresh token
const { refreshToken: _refreshToken, ...onRefreshData } =
authenticationResponse;
this.#onRefreshCallback(onRefreshData);
}
}
}

@@ -415,0 +427,0 @@

@@ -12,2 +12,4 @@ import { User, UserRaw } from "./user.interface";

export type OnRefreshResponse = Omit<AuthenticationResponse, "refreshToken">;
export interface AuthenticationResponseRaw {

@@ -14,0 +16,0 @@ user: UserRaw;

@@ -1,2 +0,5 @@

import { AuthenticationResponse } from "./authentication-response.interface";
import {
AuthenticationResponse,
OnRefreshResponse,
} from "./authentication-response.interface";
import { createClient } from "../create-client";

@@ -17,3 +20,3 @@

onBeforeAutoRefresh?: () => boolean;
onRefresh?: (_: AuthenticationResponse) => void;
onRefresh?: (_: OnRefreshResponse) => void;
onRefreshFailure?: (args: {

@@ -20,0 +23,0 @@ signIn: Awaited<ReturnType<typeof createClient>>["signIn"];

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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