Skip to content

refactor(digital-certificate): return certificate parse results#30

Open
Yorizel wants to merge 1 commit into
masterfrom
digital-certificate-neverthrow
Open

refactor(digital-certificate): return certificate parse results#30
Yorizel wants to merge 1 commit into
masterfrom
digital-certificate-neverthrow

Conversation

@Yorizel

@Yorizel Yorizel commented May 6, 2026

Copy link
Copy Markdown
Member

Summary

  • make parseCertificate return neverthrow ResultAsync instead of throwing as the normal error contract
  • make parseCertificateFromDer return Result
  • parse ICP-Brasil subjectAltName otherName values for CPF/CNPJ
  • replace FOT CLI/config build wiring with bunup

Validation

  • bun test libraries/digital-certificate/tests
  • bun x tsc -p libraries/digital-certificate/tsconfig.json --noEmit
  • bun run --cwd libraries/digital-certificate build

Summary by cubic

Refactors certificate parsing to return neverthrow results and adds CPF/CNPJ extraction from ICP‑Brasil Subject Alternative Name. Also migrates the build to bunup.

  • Refactors

    • parseCertificate now returns ResultAsync<CertificateInfo, CertificateParseError>; parseCertificateFromDer returns Result<CertificateInfo, CertificateParseError>.
    • X.509 parser reads ICP‑Brasil otherName OIDs in subjectAltName and normalizes CPF/CNPJ; CertificateInfo now includes subjectAltName.
    • Build migrated to bunup; added neverthrow; bumped @f-o-t/asn1 and @f-o-t/crypto.
  • Migration

    • Update call sites to handle results: use isErr() and value/error for parseCertificate (ResultAsync) and parseCertificateFromDer (Result).

Written for commit 5a5a06d. Summary will update on new commits.

@coderabbitai

coderabbitai Bot commented May 6, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Yorizel has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 60 minutes before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 17564524-4c2b-4a3f-bdfe-3a042a217297

📥 Commits

Reviewing files that changed from the base of the PR and between d8db79c and 5a5a06d.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • libraries/digital-certificate/__tests__/certificate.test.ts
  • libraries/digital-certificate/__tests__/mtls.test.ts
  • libraries/digital-certificate/__tests__/parse-lacuna-certs.ts
  • libraries/digital-certificate/__tests__/performance.test.ts
  • libraries/digital-certificate/__tests__/test-helpers.ts
  • libraries/digital-certificate/__tests__/xml-signer.test.ts
  • libraries/digital-certificate/bunup.config.ts
  • libraries/digital-certificate/fot.config.ts
  • libraries/digital-certificate/package.json
  • libraries/digital-certificate/src/certificate.ts
  • libraries/digital-certificate/src/schemas.ts
  • libraries/digital-certificate/src/types.ts
  • libraries/digital-certificate/src/x509.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch digital-certificate-neverthrow
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch digital-certificate-neverthrow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 14 files

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.

1 participant