Skip to content

Commit

Permalink
Revert content type following PR337 discussion.
Browse files Browse the repository at this point in the history
  • Loading branch information
deeglaze committed Dec 24, 2024
1 parent 6621414 commit 9d62700
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
8 changes: 1 addition & 7 deletions corim/signedcorim.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import (
)

var (
ContentType = "application/corim-unsigned+cbor"
oldContentType = "application/rim+cbor"
ContentType = "application/rim+cbor"
NoExternalData = []byte("")
HeaderLabelCorimMeta = int64(8)
)
Expand Down Expand Up @@ -65,11 +64,6 @@ func (o *SignedCorim) processHdrs() error {
return errors.New("missing mandatory content type")
}

// Compatibility step from older spec draft
if v == oldContentType {
v = ContentType
}

if v != ContentType {
return fmt.Errorf("expecting content type %q, got %q instead", ContentType, v)
}
Expand Down
6 changes: 3 additions & 3 deletions corim/signedcorim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func TestSignedCorim_FromCOSE_fail_corim_bad_cbor(t *testing.T) {
[
/ protected / << {
/ alg / 1: -7, / ECDSA 256 /
/ content-type / 3: "application/corim-unsigned+cbor",
/ content-type / 3: "application/rim+cbor",
/ corim-meta / 8: h'a200a1006941434d45204c74642e01a101c11a5fad2056'
} >>,
/ unprotected / {},
Expand Down Expand Up @@ -315,7 +315,7 @@ func TestSignedCorim_FromCOSE_fail_invalid_corim(t *testing.T) {
[
/ protected / << {
/ alg / 1: -7, / ECDSA 256 /
/ content-type / 3: "application/corim-unsigned+cbor",
/ content-type / 3: "application/rim+cbor",
/ corim-meta / 8: h'a200a1006941434d45204c74642e01a101c11a5fad2056'
} >>,
/ unprotected / {},
Expand Down Expand Up @@ -396,7 +396,7 @@ func TestSignedCorim_FromCOSE_fail_unexpected_content_type(t *testing.T) {
var actual SignedCorim
err := actual.FromCOSE(tv)

assert.EqualError(t, err, `processing COSE headers: expecting content type "application/corim-unsigned+cbor", got "application/cbor" instead`)
assert.EqualError(t, err, `processing COSE headers: expecting content type "application/rim+cbor", got "application/cbor" instead`)
}

func unsignedCorimFromCBOR(t *testing.T, cbor []byte) *UnsignedCorim {
Expand Down

0 comments on commit 9d62700

Please sign in to comment.