api: refine signature types

Wrapping apiObject does not work as intended as the version field
is when fetching objects from the API. Thus we need to insert
the target path of the signature directly.
This commit is contained in:
Otto Bittner 2023-08-25 12:40:47 +02:00
parent 7ffa1344e3
commit 2b19632e09
7 changed files with 81 additions and 25 deletions

View file

@ -63,3 +63,10 @@ func (c CosignVerifier) VerifySignature(content, signature []byte) error {
return nil
}
// IsBase64 checks if the given byte slice is base64 encoded.
func IsBase64(signature []byte) error {
target := make([]byte, base64.StdEncoding.DecodedLen(len(signature)))
_, err := base64.StdEncoding.Decode(target, signature)
return err
}