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

@logto/client

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@logto/client - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

1

lib/index.d.ts

@@ -46,5 +46,4 @@ import { type IdTokenClaims, type UserInfoResponse, type InteractionMode, type AccessTokenClaims } from '@logto/js';

private verifyIdToken;
private saveCodeToken;
private saveAccessTokenMap;
private loadAccessTokenMap;
}

41

lib/index.js

@@ -105,4 +105,3 @@ import { Prompt, withDefaultScopes, decodeIdToken, decodeAccessToken, fetchUserInfo, generateSignInUri, verifyAndParseCodeFromCallbackUri, fetchTokenByAuthorizationCode, revoke, generateSignOutUri, fetchTokenByRefreshToken, verifyIdToken, fetchOidcConfig } from '@logto/js';

async handleSignInCallback(callbackUri) {
const { logtoConfig, adapter } = this;
const { requester } = adapter;
const { requester } = this.adapter;
const signInSession = await this.getSignInSession();

@@ -114,5 +113,8 @@ if (!signInSession) {

const code = verifyAndParseCodeFromCallbackUri(callbackUri, redirectUri, state);
const { appId: clientId } = logtoConfig;
// NOTE: Will add scope to accessTokenKey when needed. (Linear issue LOG-1589)
const accessTokenKey = buildAccessTokenKey();
const { appId: clientId } = this.logtoConfig;
const { tokenEndpoint } = await this.getOidcConfig();
const codeTokenResponse = await fetchTokenByAuthorizationCode({
const requestedAt = Math.round(Date.now() / 1000);
const { idToken, refreshToken, accessToken, scope, expiresIn } = await fetchTokenByAuthorizationCode({
clientId,

@@ -124,4 +126,15 @@ tokenEndpoint,

}, requester);
await this.verifyIdToken(codeTokenResponse.idToken);
await this.saveCodeToken(codeTokenResponse);
await this.verifyIdToken(idToken);
await this.setRefreshToken(refreshToken ?? null);
await this.setIdToken(idToken);
this.accessTokenMap.set(accessTokenKey, {
token: accessToken,
scope,
/** The `expiresAt` variable provides an approximate estimation of the actual `exp` property
* in the token claims. It is utilized by the client to determine if the cached access token
* has expired and when a new access token should be requested.
*/
expiresAt: requestedAt + expiresIn,
});
await this.saveAccessTokenMap();
await this.setSignInSession(null);

@@ -180,2 +193,3 @@ }

const { tokenEndpoint } = await this.getOidcConfig();
const requestedAt = Math.round(Date.now() / 1000);
const { accessToken, refreshToken, idToken, scope, expiresIn } = await fetchTokenByRefreshToken({

@@ -190,3 +204,7 @@ clientId,

scope,
expiresAt: Math.round(Date.now() / 1000) + expiresIn,
/** The `expiresAt` variable provides an approximate estimation of the actual `exp` property
* in the token claims. It is utilized by the client to determine if the cached access token
* has expired and when a new access token should be requested.
*/
expiresAt: requestedAt + expiresIn,
});

@@ -207,11 +225,2 @@ await this.saveAccessTokenMap();

}
async saveCodeToken({ refreshToken, idToken, scope, accessToken, expiresIn, }) {
await this.setRefreshToken(refreshToken ?? null);
await this.setIdToken(idToken);
// NOTE: Will add scope to accessTokenKey when needed. (Linear issue LOG-1589)
const accessTokenKey = buildAccessTokenKey();
const expiresAt = Date.now() / 1000 + expiresIn;
this.accessTokenMap.set(accessTokenKey, { token: accessToken, scope, expiresAt });
await this.saveAccessTokenMap();
}
async saveAccessTokenMap() {

@@ -218,0 +227,0 @@ const data = {};

{
"name": "@logto/client",
"version": "2.2.0",
"version": "2.2.1",
"type": "module",

@@ -30,4 +30,4 @@ "main": "./lib/index.cjs",

"devDependencies": {
"@silverhand/eslint-config": "^3.0.1",
"@silverhand/ts-config": "^3.0.0",
"@silverhand/eslint-config": "^4.0.1",
"@silverhand/ts-config": "^4.0.0",
"@swc/core": "^1.3.50",

@@ -37,3 +37,3 @@ "@swc/jest": "^0.2.24",

"@types/node": "^18.0.0",
"eslint": "^8.38.0",
"eslint": "^8.44.0",
"jest": "^29.5.0",

@@ -43,3 +43,3 @@ "jest-matcher-specific-error": "^1.0.0",

"nock": "^13.3.0",
"prettier": "^2.8.7",
"prettier": "^3.0.0",
"text-encoder": "^0.0.4",

@@ -46,0 +46,0 @@ "type-fest": "^3.0.0",

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