Skip to content

Commit

Permalink
Merge pull request #104 from gregdhill/v8.1.0
Browse files Browse the repository at this point in the history
header should allow for arbitrary metadata
  • Loading branch information
Greg Hill authored Mar 9, 2020
2 parents 44e126c + 805f281 commit ec578c6
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 153 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.1.0] - 2020-03-09
### Changed
- Header now specifies arbitrary data payload


## [8.0.2] - 2020-03-09
### Fixed
- NPM package.json now includes proto defs and README
Expand Down Expand Up @@ -177,6 +182,7 @@ This is the first Hoard open source release and includes:
- Hoar-Daemon hoard
- Hoar-Control hoarctl CLI

[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
[8.0.0]: https://github.com/monax/hoard/compare/v7.2.0...v8.0.0
Expand Down
4 changes: 2 additions & 2 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### Fixed
- NPM package.json now includes proto defs and README
### Changed
- Header now specifies arbitrary data payload

100 changes: 42 additions & 58 deletions api/api.pb.go

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

18 changes: 5 additions & 13 deletions hoard-js/proto/api_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,10 @@ export class Header extends jspb.Message {
getSalt_asB64(): string;
setSalt(value: Uint8Array | string): void;

getName(): string;
setName(value: string): void;

getType(): string;
setType(value: string): void;

clearTagsList(): void;
getTagsList(): Array<string>;
setTagsList(value: Array<string>): void;
addTags(value: string, index?: number): string;
getData(): Uint8Array | string;
getData_asU8(): Uint8Array;
getData_asB64(): string;
setData(value: Uint8Array | string): void;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Header.AsObject;
Expand All @@ -120,9 +114,7 @@ export class Header extends jspb.Message {
export namespace Header {
export type AsObject = {
salt: Uint8Array | string,
name: string,
type: string,
tagsList: Array<string>,
data: Uint8Array | string,
}
}

Expand Down
103 changes: 26 additions & 77 deletions hoard-js/proto/api_pb.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,19 +643,12 @@ proto.api.ReferenceAndGrantSpec.prototype.hasGrantspec = function() {
* @constructor
*/
proto.api.Header = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.api.Header.repeatedFields_, null);
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.api.Header, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.api.Header.displayName = 'proto.api.Header';
}
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.api.Header.repeatedFields_ = [4];



if (jspb.Message.GENERATE_TO_OBJECT) {
Expand Down Expand Up @@ -686,9 +679,7 @@ proto.api.Header.prototype.toObject = function(opt_includeInstance) {
proto.api.Header.toObject = function(includeInstance, msg) {
var f, obj = {
salt: msg.getSalt_asB64(),
name: jspb.Message.getFieldWithDefault(msg, 2, ""),
type: jspb.Message.getFieldWithDefault(msg, 3, ""),
tagsList: jspb.Message.getRepeatedField(msg, 4)
data: msg.getData_asB64()
};

if (includeInstance) {
Expand Down Expand Up @@ -730,16 +721,8 @@ proto.api.Header.deserializeBinaryFromReader = function(msg, reader) {
msg.setSalt(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setType(value);
break;
case 4:
var value = /** @type {string} */ (reader.readString());
msg.addTags(value);
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setData(value);
break;
default:
reader.skipField();
Expand Down Expand Up @@ -777,27 +760,13 @@ proto.api.Header.serializeBinaryToWriter = function(message, writer) {
f
);
}
f = message.getName();
f = message.getData_asU8();
if (f.length > 0) {
writer.writeString(
writer.writeBytes(
2,
f
);
}
f = message.getType();
if (f.length > 0) {
writer.writeString(
3,
f
);
}
f = message.getTagsList();
if (f.length > 0) {
writer.writeRepeatedString(
4,
f
);
}
};


Expand Down Expand Up @@ -841,61 +810,41 @@ proto.api.Header.prototype.setSalt = function(value) {


/**
* optional string Name = 2;
* @return {string}
* optional bytes Data = 2;
* @return {!(string|Uint8Array)}
*/
proto.api.Header.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};


/** @param {string} value */
proto.api.Header.prototype.setName = function(value) {
jspb.Message.setField(this, 2, value);
proto.api.Header.prototype.getData = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};


/**
* optional string Type = 3;
* optional bytes Data = 2;
* This is a type-conversion wrapper around `getData()`
* @return {string}
*/
proto.api.Header.prototype.getType = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};


/** @param {string} value */
proto.api.Header.prototype.setType = function(value) {
jspb.Message.setField(this, 3, value);
};


/**
* repeated string Tags = 4;
* @return {!Array.<string>}
*/
proto.api.Header.prototype.getTagsList = function() {
return /** @type {!Array.<string>} */ (jspb.Message.getRepeatedField(this, 4));
};


/** @param {!Array.<string>} value */
proto.api.Header.prototype.setTagsList = function(value) {
jspb.Message.setField(this, 4, value || []);
proto.api.Header.prototype.getData_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getData()));
};


/**
* @param {!string} value
* @param {number=} opt_index
* optional bytes Data = 2;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getData()`
* @return {!Uint8Array}
*/
proto.api.Header.prototype.addTags = function(value, opt_index) {
jspb.Message.addToRepeatedField(this, 4, value, opt_index);
proto.api.Header.prototype.getData_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getData()));
};


proto.api.Header.prototype.clearTagsList = function() {
this.setTagsList([]);
/** @param {!(string|Uint8Array)} value */
proto.api.Header.prototype.setData = function(value) {
jspb.Message.setField(this, 2, value);
};


Expand Down
4 changes: 4 additions & 0 deletions project/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ func FullVersion() string {
// release tagging script: ./scripts/tag_release.sh
var History relic.ImmutableHistory = relic.NewHistory("Monax Hoard", "https://github.com/monax/hoard").
MustDeclareReleases(
"8.1.0 - 2020-03-09",
`### Changed
- Header now specifies arbitrary data payload
`,
"8.0.2 - 2020-03-09",
`### Fixed
- NPM package.json now includes proto defs and README
Expand Down
5 changes: 2 additions & 3 deletions protobuf/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ message ReferenceAndGrantSpec {

message Header {
bytes Salt = 1;
string Name = 2;
string Type = 3;
repeated string Tags = 4;
// Metadata
bytes Data = 2;
}

message Plaintext {
Expand Down

0 comments on commit ec578c6

Please sign in to comment.