Skip to content

Commit

Permalink
include validityUrl in signature (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyaxt authored and hajimehoshi committed Feb 6, 2018
1 parent 863fe49 commit ab1da27
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions go/signedexchange/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,25 @@ func (s *Signer) serializeSignedMessage(i *Input) ([]byte, error) {
}

mes = append(mes,
// "4.2. The text string "date" to the integer value of date."
// "4.2. The text string "validityUrl" to the byte string value of validityUrl."
// [spec text]
cbor.GenerateMapEntry(func(keyE *cbor.Encoder, valueE *cbor.Encoder) {
keyE.EncodeTextString("validityUrl")
valueE.EncodeByteString([]byte(s.ValidityUrl.String()))
}),
// "4.3. The text string "date" to the integer value of date."
// [spec text]
cbor.GenerateMapEntry(func(keyE *cbor.Encoder, valueE *cbor.Encoder) {
keyE.EncodeTextString("date")
valueE.EncodeInt(s.Date.Unix())
}),
// "4.3. The text string "expires" to the integer value of expires."
// "4.4. The text string "expires" to the integer value of expires."
// [spec text]
cbor.GenerateMapEntry(func(keyE *cbor.Encoder, valueE *cbor.Encoder) {
keyE.EncodeTextString("expires")
valueE.EncodeInt(s.Expires.Unix())
}),
// "4.4. The text string "headers" to the CBOR representation (Section
// "4.5. The text string "headers" to the CBOR representation (Section
// 3.4) of exchange's headers."
cbor.GenerateMapEntry(func(keyE *cbor.Encoder, valueE *cbor.Encoder) {
keyE.EncodeTextString("headers")
Expand Down

0 comments on commit ab1da27

Please sign in to comment.