Skip to content

Drop pkg:jose#194

Merged
kevmoo merged 1 commit intofirebase:mainfrom
kevmoo:crypto-better
Mar 19, 2026
Merged

Drop pkg:jose#194
kevmoo merged 1 commit intofirebase:mainfrom
kevmoo:crypto-better

Conversation

@kevmoo
Copy link
Copy Markdown
Collaborator

@kevmoo kevmoo commented Mar 19, 2026

No description provided.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on refactoring the JWT handling within the dart_firebase_admin package by removing the pkg:jose dependency. This change simplifies the codebase by consolidating JWT operations under the pkg:dart_jsonwebtoken library, leading to a more consistent and potentially lighter dependency footprint. The core logic for fetching, storing, and verifying public keys has been updated to integrate seamlessly with the chosen JWT library.

Highlights

  • Dependency Removal: The pkg:jose dependency has been removed from the project, streamlining the JWT handling process.
  • JWT Key Management Refactor: The internal key fetching and storage mechanisms for JWTs have been updated to use Map<String, JWTKey> instead of JsonWebKeyStore, aligning with the dart_jsonwebtoken package's capabilities.
  • Verification Logic Update: The JWT verification logic in PublicKeySignatureVerifier was modified to directly use JWT.verify with the new key map structure, replacing the JsonWebToken.decodeAndVerify method.
  • JWKS Parsing Enhancement: The JwksFetcher now manually parses the JWKS response to extract keys, including a null check for the 'keys' array, and converts them into JWTKey objects.
  • Test Suite Adjustment: The unit tests for JWT functionality were updated to reflect the changes in key handling and dependency removal, now utilizing pointycastle for RSA public key generation in mock scenarios.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully removes the jose package and replaces its functionality with dart_jsonwebtoken. The changes are well-executed across the codebase, including updating key fetching, JWT verification logic, and adapting the tests. I have one suggestion to improve the robustness of parsing public keys from the Google certs endpoint.

@kevmoo
Copy link
Copy Markdown
Collaborator Author

kevmoo commented Mar 19, 2026

@Lyokone ?

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 19, 2026

Codecov Report

❌ Patch coverage is 20.00000% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.67%. Comparing base (4a4fc49) to head (1636682).
⚠️ Report is 72 commits behind head on main.

Files with missing lines Patch % Lines
...ackages/dart_firebase_admin/lib/src/utils/jwt.dart 20.00% 16 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #194       +/-   ##
===========================================
+ Coverage   56.49%   73.67%   +17.17%     
===========================================
  Files          52      105       +53     
  Lines        3995     6712     +2717     
===========================================
+ Hits         2257     4945     +2688     
- Misses       1738     1767       +29     
Flag Coverage Δ
unittests 73.67% <20.00%> (+17.17%) ⬆️

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

} on JWTException catch (e) {
throw JwtException(
JwtErrorCode.unknown,
e is JWTUndefinedException ? e.message : '${e.runtimeType}: e.message',
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

There a bug that got fixed, too! (e.message) was not being evaluated – just a string.

@kevmoo
Copy link
Copy Markdown
Collaborator Author

kevmoo commented Mar 19, 2026

We can ignore the code coverage delta, I'm guessing 😄

@kevmoo kevmoo merged commit c818077 into firebase:main Mar 19, 2026
11 of 12 checks passed
@kevmoo kevmoo deleted the crypto-better branch March 19, 2026 18:37
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