Skip to content

Commit

Permalink
chore: some changes
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra committed Oct 24, 2024
1 parent a07722a commit de7be0f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/oid4vci/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface Oid4vciClientOptions {
export class Oid4vciClient {
public constructor(private options: Oid4vciClientOptions) {}

public async isDpopSupported(options: { authorizationServer: string; issuerMetadata: IssuerMetadataResult }) {
public isDpopSupported(options: { authorizationServer: string; issuerMetadata: IssuerMetadataResult }) {
const authorizationServerMetadata = getAuthorizationServerMetadataFromList(
options.issuerMetadata.authorizationServers,
options.authorizationServer
Expand Down
3 changes: 3 additions & 0 deletions packages/oid4vci/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export {
} from './metadata/credential-issuer/credential-configurations'

export type { AuthorizationServerMetadata } from './metadata/authorization-server/v-authorization-server-metadata'
export { getAuthorizationServerMetadataFromList } from './metadata/authorization-server/authorization-server-metadata'

export {
AccessTokenErrorResponse,
Expand Down Expand Up @@ -60,3 +61,5 @@ export type {
export type { IssuerMetadataResult } from './metadata/fetch-issuer-metadata'

export { JwtProofTypeIdentifier } from './formats/proof-type/jwt/v-jwt-proof-type'

export { RequestDpopOptions } from './authorization/dpop/dpop'
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ export async function fetchAuthorizationServerMetadata(
)

// issuer param MUST match
if (authorizationServerResult && authorizationServerResult.issuer !== issuer) {
throw new Oid4vcError(
`The 'issuer' parameter '${authorizationServerResult.issuer}' in the well known authorization server metadata at '${authorizationServerWellKnownMetadataUrl}' does not match the provided issuer '${issuer}'.`
)
if (authorizationServerResult) {
if (authorizationServerResult.issuer !== issuer) {
throw new Oid4vcError(
`The 'issuer' parameter '${authorizationServerResult.issuer}' in the well known authorization server metadata at '${authorizationServerWellKnownMetadataUrl}' does not match the provided issuer '${issuer}'.`
)
}
return authorizationServerResult
}

return authorizationServerResult
return null
}

export function getAuthorizationServerMetadataFromList(
Expand All @@ -60,7 +63,9 @@ export function getAuthorizationServerMetadataFromList(

if (!authorizationServerMetadata) {
throw new Oid4vcError(
`Authorization server '${issuer}' not found in list of authorization servers. Availalbe authorization servers are ${authorizationServersMetadata.map((as) => `'${as.issuer}'`).join(', ')}`
`Authorization server '${issuer}' not found in list of authorization servers. Availalbe authorization servers are ${authorizationServersMetadata
.map((as) => `'${as.issuer}'`)
.join(', ')}`
)
}

Expand Down

0 comments on commit de7be0f

Please sign in to comment.