-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zoë Maas
committed
Oct 29, 2024
1 parent
19881bc
commit 705edad
Showing
8 changed files
with
143 additions
and
359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/oidf-client/__tests__/shared/CryptoDefaultCallback.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import {importJWK, JWK, jwtVerify, JWTVerifyOptions} from "jose"; | ||
import {com} from "@sphereon/openid-federation-client"; | ||
import ICryptoCallbackServiceJS = com.sphereon.oid.fed.client.crypto.ICryptoCallbackServiceJS; | ||
|
||
export const defaultCryptoJSImpl: ICryptoCallbackServiceJS = { | ||
verify: async (jwt: string, key: any): Promise<boolean> => { | ||
const jwk:JWK = { ...key } | ||
const publicKey = await importJWK(jwk) | ||
|
||
const now = new Date() | ||
const past = now.setDate(now.getDate() - 60) | ||
|
||
const options: JWTVerifyOptions = { | ||
currentDate: new Date(past) | ||
} | ||
|
||
const result = await jwtVerify(jwt, publicKey, options) | ||
return result !== undefined | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.