feat(registry): adds default and custom registries for signing algorithms parsing

This commit is contained in:
Steve Moyer
2025-07-04 10:04:40 -04:00
parent 6d514d0061
commit d3378a0608
3 changed files with 261 additions and 3 deletions

View File

@@ -43,10 +43,16 @@ type Varsig interface {
Encode() []byte
}
// Decode converts the provided data into one of the registered Varsig
// types.
// Decode converts the provided data into one of the Varsig types
// provided by the DefaultRegistry.
func Decode(data []byte) (Varsig, error) {
return DefaultSignAlgorithmRegistry().Decode(bytes.NewReader(data))
return DefaultRegistry().Decode(data)
}
// DecodeStream converts data read from the provided io.Reader into one
// of the Varsig types provided by the DefaultRegistry.
func DecodeStream(r *bytes.Reader) (Varsig, error) {
return DefaultRegistry().DecodeStream(r)
}
type varsig struct {