Skip to content

Commit

Permalink
fix optional field in cose schema
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Callaway <bcallaway@google.com>
  • Loading branch information
bobcallaway authored and cpanato committed Nov 23, 2023
1 parent 0dccf0f commit ff9c3b9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
12 changes: 7 additions & 5 deletions pkg/generated/models/cose_v001_schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pkg/generated/restapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions pkg/types/cose/v0.0.1/cose_v0_0_1_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
}
},
"required": [
"publicKey",
"data"
"publicKey"
]
}
5 changes: 4 additions & 1 deletion pkg/types/cose/v0.0.1/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,13 @@ func (v *V001Entry) Unmarshal(pe models.ProposedEntry) error {
// Store the envelope hash.
// The CoseObj.Message is only populated during entry creation.
// When marshalling from the database (retrieval) the envelope
// hash must be decoded fromt he stored hex string.
// hash must be decoded from the stored hex string.
// The envelope hash is used to create the attestation key during
// retrieval of a record.
if len(v.CoseObj.Message) == 0 {
if v.CoseObj.Data == nil || v.CoseObj.Data.EnvelopeHash == nil || v.CoseObj.Data.EnvelopeHash.Value == nil {
return errors.New("envelope hash should have been previously computed")
}
b, err := hex.DecodeString(*v.CoseObj.Data.EnvelopeHash.Value)
if err != nil {
return err
Expand Down

0 comments on commit ff9c3b9

Please sign in to comment.