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

fetch entity statement chains #8

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

berendsliedrecht
Copy link
Member

@berendsliedrecht berendsliedrecht commented Jul 12, 2024

  • feat: fetch entity statement chain

entityConfigurations,
}: FetchEntityStatementChainOptions) => {
// The trust anchors (i.e. the last item of the list) entity configuration will be used instead of a statement issued by a superior
const statements = [entityConfigurations[entityConfigurations.length - 1]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we check/ensure tbis array is non empty?

I think enabling noUncheckedIndexAccess or whatever it is called in TS compilerOptioms might be good

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added it which did not help here (but some other places it did) so I just added a check manually that it is non-empty.

Comment on lines 55 to 62
const results = await Promise.allSettled(promises)
for (const res of results) {
if (res.status === 'fulfilled') {
statements.push(res.value)
} else {
throw new OpenIdFederationError(ErrorCode.Validation, res.reason)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it fails when one fails, we can just use Promise.all right?

Would be good to pass an abort signal to the fetch methods so you can cancel all promises instantly when one fails.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a ticket for the abort signal. Optimalization for later I'd say.

Signed-off-by: Berend Sliedrecht <[email protected]>
@berendsliedrecht berendsliedrecht merged commit 74e0684 into main Jul 12, 2024
2 checks passed
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