V1ProtoToDigest converts the given proto Digest to a Digest. Validation is performed to ensure the DigestType is known, and the value is a valid digest value for the given DigestType.
(protoDigest *modulev1.Digest)
| 67 | // Validation is performed to ensure the DigestType is known, and the value |
| 68 | // is a valid digest value for the given DigestType. |
| 69 | func V1ProtoToDigest(protoDigest *modulev1.Digest) (bufmodule.Digest, error) { |
| 70 | digestType, err := v1ProtoToDigestType(protoDigest.Type) |
| 71 | if err != nil { |
| 72 | return nil, err |
| 73 | } |
| 74 | casDigest, err := cas.NewDigest(cas.DigestTypeShake256, protoDigest.Value) |
| 75 | if err != nil { |
| 76 | return nil, err |
| 77 | } |
| 78 | return bufmodule.NewDigest(digestType, casDigest) |
| 79 | } |
| 80 | |
| 81 | // DigestToV1Beta1Proto converts the given Digest to a proto Digest. |
| 82 | func DigestToV1Beta1Proto(digest bufmodule.Digest) (*modulev1beta1.Digest, error) { |
no test coverage detected
searching dependent graphs…