Skip to content

Conversation

@AmaseCocoa
Copy link
Member

@AmaseCocoa AmaseCocoa commented Jan 25, 2026

resolve #55

I fixed this in going out, I review and make additional fixes after returned to home.

@AmaseCocoa AmaseCocoa self-assigned this Jan 25, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @AmaseCocoa, 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 addresses a bug in the inbox key verification logic by enhancing the system's ability to handle diverse public key representations. The changes ensure that the signature verification process can robustly interpret and utilize public keys, whether they are provided as PEM-encoded strings, or encapsulated within CryptographicKey or Multikey objects. This resolves issue #55 by making the key retrieval and validation more flexible and resilient to different input formats.

Highlights

  • Enhanced Key Handling: The public key verification logic has been refactored to correctly process various input formats, including PEM-encoded strings, CryptographicKey objects, and Multikey objects.
  • Improved Type Safety: The system now explicitly checks the type of the public key and raises a TypeError for unsupported formats, ensuring that only valid RSAPublicKey instances are used for verification.
  • Streamlined Verification: The Verifier initialization and key storage now directly utilize the resolved RSAPublicKey object, simplifying the flow and preventing potential issues with nested key access.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@codecov
Copy link

codecov bot commented Jan 25, 2026

Codecov Report

❌ Patch coverage is 61.38614% with 39 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/apkit/kv/inmemory.py 64.44% 13 Missing and 3 partials ⚠️
src/apkit/helper/inbox.py 59.37% 7 Missing and 6 partials ⚠️
src/apkit/cache.py 54.54% 7 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@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 aims to fix the logic for retrieving public keys for signature verification. The changes correctly handle more key representations, such as PEM-encoded strings and wrapper objects. However, the new key handling logic contains a flaw where it would incorrectly reject an already valid RSAPublicKey object. I've provided a critical comment with a suggested fix to make the logic more robust and correct.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@AmaseCocoa
Copy link
Member Author

AmaseCocoa commented Jan 26, 2026

  • I should use DER for key caching done

AmaseCocoa and others added 2 commits January 26, 2026 22:41
   - Refactor InboxVerifier to store public keys in DER format,
     simplifying
     retrieval and removal of Multibase/PEM logic for cached keys.
   - Move TTL logic from Cache wrapper to KeyValueStore backend.
   - Enhance InMemoryKV with LRU eviction and namespace support.
   - Add pytest-asyncio for asynchronous testing of caching logic.
   - Include unit tests for RSA and Ed25519 key storage in DER.
@AmaseCocoa
Copy link
Member Author

AmaseCocoa commented Jan 26, 2026

I'd like to test this before merging since it changes the cache logic.

@AmaseCocoa AmaseCocoa marked this pull request as draft January 26, 2026 14:02
@AmaseCocoa AmaseCocoa marked this pull request as ready for review January 27, 2026 01:26
@AmaseCocoa AmaseCocoa merged commit 6ffd513 into main Jan 27, 2026
7 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.

[BUG] getting public keys from cache does not work

3 participants