-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/sprind 116 #169
Feature/sprind 116 #169
Conversation
… openid_wallet_provider into the client registration metadata
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #169 +/- ##
========================================
Coverage 48.11% 48.11%
========================================
Files 75 75
Lines 5175 5175
Branches 1761 1800 +39
========================================
Hits 2490 2490
Misses 2682 2682
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
… into feature/SPRIND-116 # Conflicts: # pnpm-lock.yaml
… into feature/SPRIND-116 # Conflicts: # packages/oid4vci-common/lib/types/ServerMetadata.ts # packages/oid4vci-common/lib/types/v1_0_13.types.ts # packages/siop-oid4vp/lib/op/OP.ts # pnpm-lock.yaml
… constructor of the OpenID4VCIClient's constructor
@@ -235,16 +235,22 @@ export class URI implements AuthorizationRequestURI { | |||
return { scheme, authorizationRequestPayload } | |||
} | |||
|
|||
public static async parseAndResolve(uri: string) { | |||
public static async parseAndResolve(uri: string, rpRegistrationMetadata?: RPRegistrationMetadataPayload) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make make it more functional, and split the logic on it for something like
public static async parseAndResolve(uri: string, rpRegistrationMetadata?: RPRegistrationMetadataPayload) { | |
/** | |
* Parses the URI and resolves the registration metadata | |
* @param uri | |
* @param rpRegistrationMetadata | |
* @returns Promise<{scheme: string, authorizationRequestPayload: AuthorizationRequestPayload, requestObjectJwt: RequestObjectJwt, registrationMetadata: RPRegistrationMetadataPayload}> | |
*/ | |
public static async parseAndResolve(uri: string, rpRegistrationMetadata?: RPRegistrationMetadataPayload) { | |
if (!uri) { | |
throw Error(SIOPErrors.BAD_PARAMS) | |
} | |
const { authorizationRequestPayload, scheme } = this.parse(uri) | |
const requestObjectJwt = await fetchByReferenceOrUseByValue( | |
authorizationRequestPayload.client_metadata_uri, | |
authorizationRequestPayload.client_metadata | |
) | |
const registrationMetadata = await this.resolveRegistrationMetadata( | |
rpRegistrationMetadata, | |
authorizationRequestPayload, | |
) | |
assertValidRPRegistrationMedataPayload(registrationMetadata) | |
return { scheme, authorizationRequestPayload, requestObjectJwt, registrationMetadata } | |
} | |
/** | |
* Resolves the registration metadata | |
* @param providedMetadata | |
* @param authPayload | |
* @returns Promise<RPRegistrationMetadataPayload> | |
*/ | |
private static async resolveRegistrationMetadata( | |
providedMetadata?: RPRegistrationMetadataPayload, | |
authPayload?: AuthorizationRequestPayload | |
): Promise<RPRegistrationMetadataPayload> { | |
if (providedMetadata) { | |
return providedMetadata | |
} | |
return await fetchByReferenceOrUseByValue( | |
authPayload?.['client_metadata_uri'] ?? authPayload?.['registration_uri'], | |
authPayload?.['client_metadata'] ?? authPayload?.['registration'] | |
) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code wise looks fine with an small remark
… into feature/SPRIND-116
No description provided.