Skip to content

Conversation

@alvarowolfx
Copy link
Collaborator

Towards #3645

@alvarowolfx alvarowolfx requested review from a team as code owners December 2, 2025 21:21
@alvarowolfx
Copy link
Collaborator Author

See #3828 for big picture

@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

❌ Patch coverage is 81.81818% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.26%. Comparing base (c5caaa1) to head (5d701aa).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/auth/src/signer.rs 81.81% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3969      +/-   ##
==========================================
- Coverage   95.31%   95.26%   -0.05%     
==========================================
  Files         164      165       +1     
  Lines        6252     6274      +22     
==========================================
+ Hits         5959     5977      +18     
- Misses        293      297       +4     

☔ 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.

Copy link
Collaborator

@coryan coryan left a comment

Choose a reason for hiding this comment

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

In addition to the stuff around async_trait: I am not sure what is the minimum bar for test coverage, but 0% is not it. Please add some tests.


/// A trait for types that can sign content.
#[async_trait::async_trait]
pub trait SigningProvider: Send + Sync + std::fmt::Debug {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typically we expose public traits like this so the type (in this case Signer) can be mocked, but I don't see a clear need, nor a way to initial a signer with a mock. Thoughts?

Copy link
Collaborator Author

@alvarowolfx alvarowolfx Dec 3, 2025

Choose a reason for hiding this comment

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

Customers can provide their own way of signing blob (not sure yet how this is used, but the other SDKs provide that), so the use case is both for mocking like you mentioned, but also for letting customers implement their own logic to sign things.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Customers can provide their own way of signing blob (not sure yet how this is used, but the other SDKs provide that), so the use case is both for mocking like you mentioned, but also for letting customers implement their own logic to sign things.

Fine, but I still cannot create a Signer from a signer provide, can I? That is, if I write:

impl SigningProvider for MyCoolSigner { ... }

how do I get that inside a Signer so I can use it to sign URLs or something?

Copy link
Collaborator Author

@alvarowolfx alvarowolfx left a comment

Choose a reason for hiding this comment

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

Initially I haven't added tests because this PR is not adding any SigningProvider impl, but I added some basic tests mocking the trait.


/// A trait for types that can sign content.
#[async_trait::async_trait]
pub trait SigningProvider: Send + Sync + std::fmt::Debug {
Copy link
Collaborator Author

@alvarowolfx alvarowolfx Dec 3, 2025

Choose a reason for hiding this comment

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

Customers can provide their own way of signing blob (not sure yet how this is used, but the other SDKs provide that), so the use case is both for mocking like you mentioned, but also for letting customers implement their own logic to sign things.

Comment on lines +28 to +31
impl<T> std::convert::From<T> for Signer
where
T: SigningProvider + Send + Sync + 'static,
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, I see the From thing. Yup.

Comment on lines +49 to +51
/// The content is typically a string-to-sign generated by the caller.
/// Returns the signature as a base64 encoded string (or other format depending on implementation,
/// but typically hex or base64).
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: reflow.

Comment on lines +64 to +65
/// It is typically the Google service account client email address from the Google Developers Console
/// in the form of "xxx@developer.gserviceaccount.com". Required.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: reflow.

@alvarowolfx
Copy link
Collaborator Author

@coryan I'll fix the comments on coming PRs

@alvarowolfx alvarowolfx merged commit 2f038c8 into googleapis:main Dec 3, 2025
29 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.

3 participants