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

Update Verifier's verify method to return Result type instead of boolean #150

Open
Gozala opened this issue Dec 1, 2022 · 0 comments
Open
Assignees

Comments

@Gozala
Copy link
Collaborator

Gozala commented Dec 1, 2022

Currently Verifier interface defines verify method as follows:

interface Verifier<ID extends DID = DID, Alg extends SigAlg = SigAlg> {
  verify<T>(payload: ByteView<T>, signature: Signature<T, Alg>): Await<boolean>
  // ...
}

This really problematic because it makes it impossible to communicate why verification has failed. In some cases it may be because signature is invalid, or because signature algorithm does not match the algorithm of the verifier. Or perhaps verifier needs to load key on demand but fail to do so.

Result type is much better fit as it can communicate reason why verification has failed.

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