Skip to content

Commit

Permalink
fix: Fixed typos in the comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zoemaas committed Oct 22, 2024
1 parent 6fe01f4 commit 485b689
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions packages/oidf-client/src/agent/OIDFClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import {
ResolveTrustChainArgs,
ResolveTrustChainCallbackResult
} from "../types/IOIDFClient";
import * as jose from 'jose'
import {
com
} from "../../../../../OpenID-Federation/build/js/packages/openid-federation-modules-openid-federation-client";
import {schema} from "../index";
import FederationClient = com.sphereon.oid.fed.client.FederationClient;
import {JWK, JWTVerifyOptions} from "jose";
import {JWK} from 'ssi-types'


export const oidfClientMethods: Array<string> = [
'resolveTrustChain',
Expand All @@ -35,11 +35,10 @@ export class OIDFClient implements IAgentPlugin {
if (cryptoServiceCallback) {
this.oidfClient = new FederationClient(null, cryptoServiceCallback)
} else {
// FIXME pass in the verification function of the JWSService,
this.oidfClient = new FederationClient(
null, {
q3t: async (jwt: string, key: any): Promise<boolean> => {
// FIXME For some reason the keys is the key object are messed up
// FIXME For some reason the keys in the key object are messed up
const jwk: JWK = {
kty: key.e3s_1,
kid: key.f3s_1,
Expand All @@ -56,17 +55,11 @@ export class OIDFClient implements IAgentPlugin {
'x5t#S256': key.q3s_1,
}

const publicKey = await jose.importJWK(jwk)

const now = new Date()
const past = now.setDate(now.getDate() - 60)

const options: JWTVerifyOptions = {
currentDate: new Date(past)
}

const result = await jose.jwtVerify(jwt, publicKey, options)
return result !== undefined
//FIXME Find a way to pass in the context
return !(await this.verifyJwt({
jws: jwt,
jwk
})).error
}
})
}
Expand Down

0 comments on commit 485b689

Please sign in to comment.