Repository Modernization Plan - Phase 2B: Remove redundant Algorithm() from Opts interfaces#70
Merged
Conversation
1d88a60 to
12cceae
Compare
Remove Algorithm() string method from KeyGenOpts, KeyDerivOpts, and KeyImportOpts interfaces. Every implementation returned the constant 'IDEMIX' unconditionally — a single-algorithm repo has no need for algorithm dispatch. Also removes the IDEMIX constant and all 11 boilerplate Algorithm() method implementations from opts structs. Error messages in impl.go now use reflect.TypeOf(opts) for context. Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
12cceae to
5d32348
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove redundant Algorithm() from Opts interfaces
Fixes #63
What
Removes the
Algorithm() stringmethod fromKeyGenOpts,KeyDerivOpts, andKeyImportOptsinterfaces, along with all 11 boilerplate implementations across opts structs.Why
Every single implementation returned the hardcoded constant
"IDEMIX". In a single-algorithm repository, algorithm dispatch via string identifiers is unnecessary overhead. The only two call sites were error messages inimpl.go, which now usereflect.TypeOf(opts)for equivalent (and more informative) context.Changes
bccsp/types/crypto.goAlgorithm() stringfromKeyGenOpts,KeyDerivOpts,KeyImportOptsbccsp/types/idemixopts.goIDEMIXconstant + 11Algorithm()method implementationsbccsp/impl.goopts.Algorithm()withreflect.TypeOf(opts)in 2 error messagesInterfaces after this change