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

Some potential improvements for the OpaqueSigner interface #110

Open
CallMeZhou opened this issue Mar 9, 2024 · 2 comments
Open

Some potential improvements for the OpaqueSigner interface #110

CallMeZhou opened this issue Mar 9, 2024 · 2 comments

Comments

@CallMeZhou
Copy link

CallMeZhou commented Mar 9, 2024

1. The main purpose of OpaqueSigner is to sign payloads. Why does it have to implement a Public() method? Public key is irrelevant to signing itself, but is for verification. (if the Public() is not required in all use cases, please document when it can be ignored.)
2. The SignPayload method doesn't accept context argument. What if the real signer is working remotely (i.e., Azure Key Vault)? Even a locally installed encryptor hardware should be regarded as a "remote device" from software's perspective. (just in my opinion)
3. The documents of OpaqueSigner provides too little information. It would be better if it had some usage examples, in what cases will a method be called for what purposes, some precautions, and etc.

@CallMeZhou
Copy link
Author

Now I see why "Public()". It's for embedding the public key in the JWT header. Makes sense but still should be documented --- I didn't understand it until I read a big part of the source code.

(I found the answer in genericSigner.Sign())

@jsha
Copy link
Collaborator

jsha commented Mar 12, 2024

Also Public() is part of the standard library crypto.Signer interface.

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

No branches or pull requests

2 participants