Skip to content

Commit d7cae17

Browse files
committed
fix: update function signatures and move jose to devDependencies and Delete remote-jwks-cache.ts
1 parent b21411e commit d7cae17

File tree

8 files changed

+20
-77
lines changed

8 files changed

+20
-77
lines changed

lib/__tests__/sdk/utilities/token-utils.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ vi.mock('@kinde/jwt-validator', () => ({
2121
}));
2222

2323
import * as mocks from '../../mocks';
24-
import { describe, it, expect, beforeAll, afterEach, vi } from 'vitest';
24+
import { describe, it, expect, beforeAll, afterEach } from 'vitest';
2525
import {
2626
type TokenCollection,
2727
commitTokensToSession,

lib/sdk/clients/browser/authcode-with-pkce.ts

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,7 @@ const createAuthCodeWithPKCEClient = (options: BrowserPKCEClientOptions) => {
114114
if (!(await isAuthenticated())) {
115115
throw new Error('Cannot get user details, no authentication credential found');
116116
}
117-
return (await utilities.getUserFromSession(
118-
sessionManager,
119-
client.tokenValidationDetails
120-
))!;
117+
return (await utilities.getUserFromSession(sessionManager))!;
121118
};
122119

123120
/**
@@ -209,12 +206,7 @@ const createAuthCodeWithPKCEClient = (options: BrowserPKCEClientOptions) => {
209206
);
210207
}
211208

212-
return await tokenClaims.getClaimValue(
213-
sessionManager,
214-
claim,
215-
type,
216-
client.tokenValidationDetails
217-
);
209+
return await tokenClaims.getClaimValue(sessionManager, claim, type);
218210
};
219211

220212
/**
@@ -233,12 +225,7 @@ const createAuthCodeWithPKCEClient = (options: BrowserPKCEClientOptions) => {
233225
`Cannot return claim "${claim}", no authentication credential found`
234226
);
235227
}
236-
return await tokenClaims.getClaim(
237-
sessionManager,
238-
claim,
239-
type,
240-
client.tokenValidationDetails
241-
);
228+
return await tokenClaims.getClaim(sessionManager, claim, type);
242229
};
243230

244231
/**
@@ -256,11 +243,7 @@ const createAuthCodeWithPKCEClient = (options: BrowserPKCEClientOptions) => {
256243
`Cannot return permission "${name}", no authentication credential found`
257244
);
258245
}
259-
return await tokenClaims.getPermission(
260-
sessionManager,
261-
name,
262-
client.tokenValidationDetails
263-
);
246+
return await tokenClaims.getPermission(sessionManager, name);
264247
};
265248

266249
/**
@@ -273,10 +256,7 @@ const createAuthCodeWithPKCEClient = (options: BrowserPKCEClientOptions) => {
273256
'Cannot return user organization, no authentication credential found'
274257
);
275258
}
276-
return await tokenClaims.getOrganization(
277-
sessionManager,
278-
client.tokenValidationDetails
279-
);
259+
return await tokenClaims.getOrganization(sessionManager);
280260
};
281261

282262
/**
@@ -290,10 +270,7 @@ const createAuthCodeWithPKCEClient = (options: BrowserPKCEClientOptions) => {
290270
'Cannot return user organizations, no authentication credential found'
291271
);
292272
}
293-
return await tokenClaims.getUserOrganizations(
294-
sessionManager,
295-
client.tokenValidationDetails
296-
);
273+
return await tokenClaims.getUserOrganizations(sessionManager);
297274
};
298275

299276
/**
@@ -310,10 +287,7 @@ const createAuthCodeWithPKCEClient = (options: BrowserPKCEClientOptions) => {
310287
'Cannot return user permissions, no authentication credential found'
311288
);
312289
}
313-
return await tokenClaims.getPermissions(
314-
sessionManager,
315-
client.tokenValidationDetails
316-
);
290+
return await tokenClaims.getPermissions(sessionManager);
317291
};
318292

319293
/**

lib/sdk/clients/server/authorization-code.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,7 @@ const createAuthorizationCodeClient = (
139139
if (!(await isAuthenticated(sessionManager))) {
140140
throw new Error('Cannot get user details, no authentication credential found');
141141
}
142-
return (await utilities.getUserFromSession(
143-
sessionManager,
144-
client.tokenValidationDetails
145-
))!;
142+
return (await utilities.getUserFromSession(sessionManager))!;
146143
};
147144

148145
/**

lib/sdk/clients/server/with-auth-utilities.ts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,7 @@ const withAuthUtilities = (
110110
);
111111
}
112112

113-
return await tokenClaims.getClaimValue(
114-
sessionManager,
115-
claim,
116-
type,
117-
validationDetails
118-
);
113+
return await tokenClaims.getClaimValue(sessionManager, claim, type);
119114
};
120115

121116
/**
@@ -136,12 +131,7 @@ const withAuthUtilities = (
136131
`Cannot return claim "${claim}", no authentication credential found`
137132
);
138133
}
139-
return await tokenClaims.getClaim(
140-
sessionManager,
141-
claim,
142-
type,
143-
validationDetails
144-
);
134+
return await tokenClaims.getClaim(sessionManager, claim, type);
145135
};
146136

147137
/**
@@ -161,7 +151,7 @@ const withAuthUtilities = (
161151
`Cannot return permission "${name}", no authentication credential found`
162152
);
163153
}
164-
return await tokenClaims.getPermission(sessionManager, name, validationDetails);
154+
return await tokenClaims.getPermission(sessionManager, name);
165155
};
166156

167157
/**
@@ -177,7 +167,7 @@ const withAuthUtilities = (
177167
'Cannot return user organization, no authentication credential found'
178168
);
179169
}
180-
return await tokenClaims.getOrganization(sessionManager, validationDetails);
170+
return await tokenClaims.getOrganization(sessionManager);
181171
};
182172

183173
/**
@@ -194,7 +184,7 @@ const withAuthUtilities = (
194184
'Cannot return user organizations, no authentication credential found'
195185
);
196186
}
197-
return await tokenClaims.getUserOrganizations(sessionManager, validationDetails);
187+
return await tokenClaims.getUserOrganizations(sessionManager);
198188
};
199189

200190
/**
@@ -214,7 +204,7 @@ const withAuthUtilities = (
214204
'Cannot return user permissions, no authentication credential found'
215205
);
216206
}
217-
return await tokenClaims.getPermissions(sessionManager, validationDetails);
207+
return await tokenClaims.getPermissions(sessionManager);
218208
};
219209

220210
/**

lib/sdk/utilities/feature-flags.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ export const getFlag = async (
2929
((await getClaimValue(
3030
sessionManager,
3131
'feature_flags',
32-
'access_token',
33-
validationDetails
32+
'access_token'
3433
)) as FeatureFlags) ?? {};
3534
const flag = featureFlags[code];
3635

lib/sdk/utilities/remote-jwks-cache.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"eslint-plugin-prettier": "^5.2.6",
6161
"eslint-plugin-promise": "^7.2.1",
6262
"husky": "^8.0.3",
63+
"jose": "^6.0.10",
6364
"jsdom": "^22.0.0",
6465
"lint-staged": "^13.2.2",
6566
"ncp": "^2.0.0",
@@ -73,7 +74,6 @@
7374
"@kinde/jwt-decoder": "^0.2.0",
7475
"@kinde/jwt-validator": "^0.4.0",
7576
"@typescript-eslint/parser": "^8.30.1",
76-
"jose": "^6.0.10",
7777
"uncrypto": "^0.1.3"
7878
},
7979
"packageManager": "[email protected]+sha512.cdf928fca20832cd59ec53826492b7dc25dc524d4370b6b4adbf65803d32efaa6c1c88147c0ae4e8d579a6c9eec715757b50d4fa35eea179d868eada4ed043af"

pnpm-lock.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)