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

feat: add support for ocsp reason code suspended #306

Merged
merged 5 commits into from
Nov 27, 2024

Conversation

chershentan
Copy link
Contributor

Summary

To support the new reason code 1001 which represents the suspended document status on OCSP responder

Changes

  • update ValidOcspReasonCode to validate reason code 1001
  • update OcspResponderRevocationReason to return SUSPENDED for reason code 1001
  • Add test cases for these updates

@@ -40,7 +40,7 @@ export type DidSignedIssuanceStatusArray = Static<typeof DidSignedIssuanceStatus
* OCSP response
*/

export const ValidOcspReasonCode = Number.withConstraint((n) => n >= 0 && n <= 10 && n != 7);
export const ValidOcspReasonCode = Number.withConstraint((n) => [1, 2, 3, 4, 5, 6, 8, 9, 10, 1001].includes(n));
Copy link
Contributor

Choose a reason for hiding this comment

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

I was just thinking, would this be simpler and still work?

export const ValidOcspReasonCode = Number.withConstraint((n) => Object.values(OcspResponderRevocationReason).includes(n));

This will need to import OcspResponderRevocationReason from revocation.types.ts into this file though. But what you have works too!

Copy link
Contributor

Choose a reason for hiding this comment

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

Another thing is, n >= 0 && n <= 10 && n != 7 includes 0 but [1, 2, 3, 4, 5, 6, 8, 9, 10, 1001] doesn't. So maybe need to add 0 if we prefer listing out the numbers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch!
I will follow your suggestion as it is cleaner

chershentan and others added 2 commits November 26, 2024 14:54
….type.ts

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@chershentan chershentan merged commit b4e30a5 into master Nov 27, 2024
6 checks passed
@chershentan chershentan deleted the feat/add-support-for-ocsp-reason-code-suspended branch November 27, 2024 02:12
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