Refine constructors of package `verifier`
shizhMSFT opened this issue · comments
Shiwei Zhang commented
#186 has refactored the package verifier
according to this design where the constructors of notation.Verifier
are
func New() (notation.Verifier, error)
func NewVerifier(trustPolicy *trustpolicy.Document, pluginManager plugin.Manager) (notation.Verifier, error)
However, the constructor APIs do not match the original design. The constructors should be updated to
func New(trustPolicy *trustpolicy.Document, trustStore truststore.X509TrustStore, pluginManager plugin.Manager) (notation.Verifier, error)
func NewFromConfig() (notation.Verifier, error)
to match the original design where New()
--> NewFromConfig()
, NewVerifier()
--> New()
.
Note: The API naming is consistent with #200.
Patrick Zheng commented
Got it. Will make the change today.
Shiwei Zhang commented
Here's the diagram to help understanding.
classDiagram
direction LR
Verifier ..> TrustPolicy: Dependency
Verifier ..> TrustStore: Dependency
TrustPolicy --> TrustStore
Verifier ..> PluginManager: Dependency
Shiwei Zhang commented
Please also note that the plugin.Manager
can be nil
but *trustpolicy.Document
and truststore.X509TrustStore
MUST NOT be nil.