Skip to content
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

Merged
merged 14 commits into from
Jan 14, 2025
Merged

Feature/sprind 116 #169

merged 14 commits into from
Jan 14, 2025

Conversation

zoemaas
Copy link
Contributor

@zoemaas zoemaas commented Nov 20, 2024

No description provided.

@zoemaas zoemaas self-assigned this Nov 20, 2024
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 48.11%. Comparing base (8b78e93) to head (642c60b).
Report is 18 commits behind head on develop.

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           
Flag Coverage Δ
unittest 48.11% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

… 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
@zoemaas zoemaas marked this pull request as ready for review November 25, 2024 16:10
@@ -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) {
Copy link

@ronal2do ronal2do Jan 7, 2025

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

Suggested change
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']
)
}

Copy link

@ronal2do ronal2do left a 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

@zoemaas zoemaas merged commit c159817 into develop Jan 14, 2025
4 checks passed
@zoemaas zoemaas deleted the feature/SPRIND-116 branch January 14, 2025 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants