Skip to content

Commit

Permalink
Merge pull request #105 from gregdhill/hoard-8.2.0
Browse files Browse the repository at this point in the history
grant json should use lowercase field names
  • Loading branch information
Greg Hill authored Mar 20, 2020
2 parents ec578c6 + 0e888d6 commit a4d179e
Show file tree
Hide file tree
Showing 14 changed files with 2,614 additions and 232 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# [Monax Hoard](https://github.com/monax/hoard) Changelog
## [8.2.0] - 2020-03-20
### Changed
- Grant json now uses lowercase field names for compatability with client lib


## [8.1.0] - 2020-03-09
### Changed
- Header now specifies arbitrary data payload
Expand Down Expand Up @@ -182,6 +187,7 @@ This is the first Hoard open source release and includes:
- Hoar-Daemon hoard
- Hoar-Control hoarctl CLI

[8.2.0]: https://github.com/monax/hoard/compare/v8.1.0...v8.2.0
[8.1.0]: https://github.com/monax/hoard/compare/v8.0.2...v8.1.0
[8.0.2]: https://github.com/monax/hoard/compare/v8.0.1...v8.0.2
[8.0.1]: https://github.com/monax/hoard/compare/v8.0.0...v8.0.1
Expand Down
2 changes: 1 addition & 1 deletion NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### Changed
- Header now specifies arbitrary data payload
- Grant json now uses lowercase field names for compatability with client lib

60 changes: 33 additions & 27 deletions grant/grant.pb.go

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

12 changes: 12 additions & 0 deletions grant/grant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package grant

import (
"encoding/base64"
"encoding/json"
"io/ioutil"
"strings"
"testing"
Expand Down Expand Up @@ -139,3 +140,14 @@ func deriveSecret(t *testing.T, data []byte) []byte {
assert.NoError(t, err)
return secret
}

func TestUnmarshal(t *testing.T) {
// the client library stores the grant with lowercase field names,
// we expect the go server to correctly unmarshal this
data := `{"spec":{"plaintext":{},"symmetric":null,"openpgp":null},"encryptedreferences":"eyJSZWZzIjpbeyJBZGRyZXNzIjoidDIzZjh1cTZsd3lJL2ZTTGJaMVJ2b3ZMYzFSSDMwWEk4cUlyUzBQZnljOD0iLCJTZWNyZXRLZXkiOiI0N0RFUXBqOEhCU2ErL1RJbVcrNUpDZXVRZVJrbTVOTXBKV1pHM2hTdUZVPSIsIlZlcnNpb24iOjF9LHsiQWRkcmVzcyI6Ii8rdWxUa0N6cFlnMnNQYVp0cVM4ZHljSkJMWTkzODd5WlBzdDhMWDVZTDA9IiwiU2VjcmV0S2V5IjoidGJ1ZGdCU2crYkhXSGlIbmx0ZU56TjhUVXZJODB5Z1M5SVVMaDRya2xFdz0ifV19","version":2}`
grant := new(Grant)
err := json.Unmarshal([]byte(data), grant)
require.NoError(t, err)
require.Equal(t, int32(2), grant.GetVersion())
require.NotNil(t, grant.GetSpec().GetPlaintext())
}
Loading

0 comments on commit a4d179e

Please sign in to comment.