diff --git a/__tests__/QrCodeDataService.test.ts b/__tests__/QrCodeDataService.test.ts index 160f82b538a9dda3142fe0798b8e867481533dcb..bfef66f3aa36d4f91e8f0dbab2bb10a89ce5245a 100644 --- a/__tests__/QrCodeDataService.test.ts +++ b/__tests__/QrCodeDataService.test.ts @@ -44,9 +44,9 @@ const emailData: MessageData = { const documentData: DocumentData = { author: "Craig McCracken", documentTitle: "The_Powerpuff_Girls", - documentDescription: "cartoon for kids", creationDate: new Date().toDateString(), - documentPages: 10, + lastModDate: new Date().toDateString(), + documentPages: 2, }; /** diff --git a/dist/generated/qrcode_data_pb.js b/dist/generated/qrcode_data_pb.js index 4fb64d64b1f48e4470c501d4a69072f64a6d8792..715ecb797da2445592cff22c25a5d4272d70c2f0 100644 --- a/dist/generated/qrcode_data_pb.js +++ b/dist/generated/qrcode_data_pb.js @@ -2294,6 +2294,1407 @@ $root.vereign = (function () { }; return WrapperData; })(); + qrcode_data.CertIssuer = (function () { + /** + * Properties of a CertIssuer. + * @memberof vereign.protobuf.qrcode_data + * @interface ICertIssuer + * @property {string|null} [countryName] CertIssuer countryName + * @property {string|null} [organizationName] CertIssuer organizationName + * @property {string|null} [commonName] CertIssuer commonName + */ + /** + * Constructs a new CertIssuer. + * @memberof vereign.protobuf.qrcode_data + * @classdesc Represents a CertIssuer. + * @implements ICertIssuer + * @constructor + * @param {vereign.protobuf.qrcode_data.ICertIssuer=} [properties] Properties to set + */ + function CertIssuer(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + /** + * CertIssuer countryName. + * @member {string} countryName + * @memberof vereign.protobuf.qrcode_data.CertIssuer + * @instance + */ + CertIssuer.prototype.countryName = ""; + /** + * CertIssuer organizationName. + * @member {string} organizationName + * @memberof vereign.protobuf.qrcode_data.CertIssuer + * @instance + */ + CertIssuer.prototype.organizationName = ""; + /** + * CertIssuer commonName. + * @member {string} commonName + * @memberof vereign.protobuf.qrcode_data.CertIssuer + * @instance + */ + CertIssuer.prototype.commonName = ""; + /** + * Creates a new CertIssuer instance using the specified properties. + * @function create + * @memberof vereign.protobuf.qrcode_data.CertIssuer + * @static + * @param {vereign.protobuf.qrcode_data.ICertIssuer=} [properties] Properties to set + * @returns {vereign.protobuf.qrcode_data.CertIssuer} CertIssuer instance + */ + CertIssuer.create = function create(properties) { + return new CertIssuer(properties); + }; + /** + * Encodes the specified CertIssuer message. Does not implicitly {@link vereign.protobuf.qrcode_data.CertIssuer.verify|verify} messages. + * @function encode + * @memberof vereign.protobuf.qrcode_data.CertIssuer + * @static + * @param {vereign.protobuf.qrcode_data.ICertIssuer} message CertIssuer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CertIssuer.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.countryName != null && Object.hasOwnProperty.call(message, "countryName")) + writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.countryName); + if (message.organizationName != null && Object.hasOwnProperty.call(message, "organizationName")) + writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.organizationName); + if (message.commonName != null && Object.hasOwnProperty.call(message, "commonName")) + writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.commonName); + return writer; + }; + /** + * Encodes the specified CertIssuer message, length delimited. Does not implicitly {@link vereign.protobuf.qrcode_data.CertIssuer.verify|verify} messages. + * @function encodeDelimited + * @memberof vereign.protobuf.qrcode_data.CertIssuer + * @static + * @param {vereign.protobuf.qrcode_data.ICertIssuer} message CertIssuer message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CertIssuer.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + /** + * Decodes a CertIssuer message from the specified reader or buffer. + * @function decode + * @memberof vereign.protobuf.qrcode_data.CertIssuer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vereign.protobuf.qrcode_data.CertIssuer} CertIssuer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CertIssuer.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vereign.protobuf.qrcode_data.CertIssuer(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.countryName = reader.string(); + break; + case 2: + message.organizationName = reader.string(); + break; + case 3: + message.commonName = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + /** + * Decodes a CertIssuer message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vereign.protobuf.qrcode_data.CertIssuer + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vereign.protobuf.qrcode_data.CertIssuer} CertIssuer + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CertIssuer.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + /** + * Verifies a CertIssuer message. + * @function verify + * @memberof vereign.protobuf.qrcode_data.CertIssuer + * @static + * @param {Object.<string,*>} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CertIssuer.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.countryName != null && message.hasOwnProperty("countryName")) + if (!$util.isString(message.countryName)) + return "countryName: string expected"; + if (message.organizationName != null && message.hasOwnProperty("organizationName")) + if (!$util.isString(message.organizationName)) + return "organizationName: string expected"; + if (message.commonName != null && message.hasOwnProperty("commonName")) + if (!$util.isString(message.commonName)) + return "commonName: string expected"; + return null; + }; + /** + * Creates a CertIssuer message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vereign.protobuf.qrcode_data.CertIssuer + * @static + * @param {Object.<string,*>} object Plain object + * @returns {vereign.protobuf.qrcode_data.CertIssuer} CertIssuer + */ + CertIssuer.fromObject = function fromObject(object) { + if (object instanceof $root.vereign.protobuf.qrcode_data.CertIssuer) + return object; + var message = new $root.vereign.protobuf.qrcode_data.CertIssuer(); + if (object.countryName != null) + message.countryName = String(object.countryName); + if (object.organizationName != null) + message.organizationName = String(object.organizationName); + if (object.commonName != null) + message.commonName = String(object.commonName); + return message; + }; + /** + * Creates a plain object from a CertIssuer message. Also converts values to other types if specified. + * @function toObject + * @memberof vereign.protobuf.qrcode_data.CertIssuer + * @static + * @param {vereign.protobuf.qrcode_data.CertIssuer} message CertIssuer + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.<string,*>} Plain object + */ + CertIssuer.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.countryName = ""; + object.organizationName = ""; + object.commonName = ""; + } + if (message.countryName != null && message.hasOwnProperty("countryName")) + object.countryName = message.countryName; + if (message.organizationName != null && message.hasOwnProperty("organizationName")) + object.organizationName = message.organizationName; + if (message.commonName != null && message.hasOwnProperty("commonName")) + object.commonName = message.commonName; + return object; + }; + /** + * Converts this CertIssuer to JSON. + * @function toJSON + * @memberof vereign.protobuf.qrcode_data.CertIssuer + * @instance + * @returns {Object.<string,*>} JSON object + */ + CertIssuer.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + return CertIssuer; + })(); + qrcode_data.CertIssedTo = (function () { + /** + * Properties of a CertIssedTo. + * @memberof vereign.protobuf.qrcode_data + * @interface ICertIssedTo + * @property {string|null} [countryName] CertIssedTo countryName + * @property {string|null} [organizationalUnitName] CertIssedTo organizationalUnitName + * @property {string|null} [organizationName] CertIssedTo organizationName + * @property {string|null} [commonName] CertIssedTo commonName + */ + /** + * Constructs a new CertIssedTo. + * @memberof vereign.protobuf.qrcode_data + * @classdesc Represents a CertIssedTo. + * @implements ICertIssedTo + * @constructor + * @param {vereign.protobuf.qrcode_data.ICertIssedTo=} [properties] Properties to set + */ + function CertIssedTo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + /** + * CertIssedTo countryName. + * @member {string} countryName + * @memberof vereign.protobuf.qrcode_data.CertIssedTo + * @instance + */ + CertIssedTo.prototype.countryName = ""; + /** + * CertIssedTo organizationalUnitName. + * @member {string} organizationalUnitName + * @memberof vereign.protobuf.qrcode_data.CertIssedTo + * @instance + */ + CertIssedTo.prototype.organizationalUnitName = ""; + /** + * CertIssedTo organizationName. + * @member {string} organizationName + * @memberof vereign.protobuf.qrcode_data.CertIssedTo + * @instance + */ + CertIssedTo.prototype.organizationName = ""; + /** + * CertIssedTo commonName. + * @member {string} commonName + * @memberof vereign.protobuf.qrcode_data.CertIssedTo + * @instance + */ + CertIssedTo.prototype.commonName = ""; + /** + * Creates a new CertIssedTo instance using the specified properties. + * @function create + * @memberof vereign.protobuf.qrcode_data.CertIssedTo + * @static + * @param {vereign.protobuf.qrcode_data.ICertIssedTo=} [properties] Properties to set + * @returns {vereign.protobuf.qrcode_data.CertIssedTo} CertIssedTo instance + */ + CertIssedTo.create = function create(properties) { + return new CertIssedTo(properties); + }; + /** + * Encodes the specified CertIssedTo message. Does not implicitly {@link vereign.protobuf.qrcode_data.CertIssedTo.verify|verify} messages. + * @function encode + * @memberof vereign.protobuf.qrcode_data.CertIssedTo + * @static + * @param {vereign.protobuf.qrcode_data.ICertIssedTo} message CertIssedTo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CertIssedTo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.countryName != null && Object.hasOwnProperty.call(message, "countryName")) + writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.countryName); + if (message.organizationalUnitName != null && Object.hasOwnProperty.call(message, "organizationalUnitName")) + writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.organizationalUnitName); + if (message.organizationName != null && Object.hasOwnProperty.call(message, "organizationName")) + writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.organizationName); + if (message.commonName != null && Object.hasOwnProperty.call(message, "commonName")) + writer.uint32(/* id 4, wireType 2 =*/ 34).string(message.commonName); + return writer; + }; + /** + * Encodes the specified CertIssedTo message, length delimited. Does not implicitly {@link vereign.protobuf.qrcode_data.CertIssedTo.verify|verify} messages. + * @function encodeDelimited + * @memberof vereign.protobuf.qrcode_data.CertIssedTo + * @static + * @param {vereign.protobuf.qrcode_data.ICertIssedTo} message CertIssedTo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CertIssedTo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + /** + * Decodes a CertIssedTo message from the specified reader or buffer. + * @function decode + * @memberof vereign.protobuf.qrcode_data.CertIssedTo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vereign.protobuf.qrcode_data.CertIssedTo} CertIssedTo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CertIssedTo.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vereign.protobuf.qrcode_data.CertIssedTo(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.countryName = reader.string(); + break; + case 2: + message.organizationalUnitName = reader.string(); + break; + case 3: + message.organizationName = reader.string(); + break; + case 4: + message.commonName = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + /** + * Decodes a CertIssedTo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vereign.protobuf.qrcode_data.CertIssedTo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vereign.protobuf.qrcode_data.CertIssedTo} CertIssedTo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CertIssedTo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + /** + * Verifies a CertIssedTo message. + * @function verify + * @memberof vereign.protobuf.qrcode_data.CertIssedTo + * @static + * @param {Object.<string,*>} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CertIssedTo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.countryName != null && message.hasOwnProperty("countryName")) + if (!$util.isString(message.countryName)) + return "countryName: string expected"; + if (message.organizationalUnitName != null && message.hasOwnProperty("organizationalUnitName")) + if (!$util.isString(message.organizationalUnitName)) + return "organizationalUnitName: string expected"; + if (message.organizationName != null && message.hasOwnProperty("organizationName")) + if (!$util.isString(message.organizationName)) + return "organizationName: string expected"; + if (message.commonName != null && message.hasOwnProperty("commonName")) + if (!$util.isString(message.commonName)) + return "commonName: string expected"; + return null; + }; + /** + * Creates a CertIssedTo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vereign.protobuf.qrcode_data.CertIssedTo + * @static + * @param {Object.<string,*>} object Plain object + * @returns {vereign.protobuf.qrcode_data.CertIssedTo} CertIssedTo + */ + CertIssedTo.fromObject = function fromObject(object) { + if (object instanceof $root.vereign.protobuf.qrcode_data.CertIssedTo) + return object; + var message = new $root.vereign.protobuf.qrcode_data.CertIssedTo(); + if (object.countryName != null) + message.countryName = String(object.countryName); + if (object.organizationalUnitName != null) + message.organizationalUnitName = String(object.organizationalUnitName); + if (object.organizationName != null) + message.organizationName = String(object.organizationName); + if (object.commonName != null) + message.commonName = String(object.commonName); + return message; + }; + /** + * Creates a plain object from a CertIssedTo message. Also converts values to other types if specified. + * @function toObject + * @memberof vereign.protobuf.qrcode_data.CertIssedTo + * @static + * @param {vereign.protobuf.qrcode_data.CertIssedTo} message CertIssedTo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.<string,*>} Plain object + */ + CertIssedTo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.countryName = ""; + object.organizationalUnitName = ""; + object.organizationName = ""; + object.commonName = ""; + } + if (message.countryName != null && message.hasOwnProperty("countryName")) + object.countryName = message.countryName; + if (message.organizationalUnitName != null && message.hasOwnProperty("organizationalUnitName")) + object.organizationalUnitName = message.organizationalUnitName; + if (message.organizationName != null && message.hasOwnProperty("organizationName")) + object.organizationName = message.organizationName; + if (message.commonName != null && message.hasOwnProperty("commonName")) + object.commonName = message.commonName; + return object; + }; + /** + * Converts this CertIssedTo to JSON. + * @function toJSON + * @memberof vereign.protobuf.qrcode_data.CertIssedTo + * @instance + * @returns {Object.<string,*>} JSON object + */ + CertIssedTo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + return CertIssedTo; + })(); + qrcode_data.CertValidity = (function () { + /** + * Properties of a CertValidity. + * @memberof vereign.protobuf.qrcode_data + * @interface ICertValidity + * @property {string|null} [notBefore] CertValidity notBefore + * @property {string|null} [notAfter] CertValidity notAfter + */ + /** + * Constructs a new CertValidity. + * @memberof vereign.protobuf.qrcode_data + * @classdesc Represents a CertValidity. + * @implements ICertValidity + * @constructor + * @param {vereign.protobuf.qrcode_data.ICertValidity=} [properties] Properties to set + */ + function CertValidity(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + /** + * CertValidity notBefore. + * @member {string} notBefore + * @memberof vereign.protobuf.qrcode_data.CertValidity + * @instance + */ + CertValidity.prototype.notBefore = ""; + /** + * CertValidity notAfter. + * @member {string} notAfter + * @memberof vereign.protobuf.qrcode_data.CertValidity + * @instance + */ + CertValidity.prototype.notAfter = ""; + /** + * Creates a new CertValidity instance using the specified properties. + * @function create + * @memberof vereign.protobuf.qrcode_data.CertValidity + * @static + * @param {vereign.protobuf.qrcode_data.ICertValidity=} [properties] Properties to set + * @returns {vereign.protobuf.qrcode_data.CertValidity} CertValidity instance + */ + CertValidity.create = function create(properties) { + return new CertValidity(properties); + }; + /** + * Encodes the specified CertValidity message. Does not implicitly {@link vereign.protobuf.qrcode_data.CertValidity.verify|verify} messages. + * @function encode + * @memberof vereign.protobuf.qrcode_data.CertValidity + * @static + * @param {vereign.protobuf.qrcode_data.ICertValidity} message CertValidity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CertValidity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.notBefore != null && Object.hasOwnProperty.call(message, "notBefore")) + writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.notBefore); + if (message.notAfter != null && Object.hasOwnProperty.call(message, "notAfter")) + writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.notAfter); + return writer; + }; + /** + * Encodes the specified CertValidity message, length delimited. Does not implicitly {@link vereign.protobuf.qrcode_data.CertValidity.verify|verify} messages. + * @function encodeDelimited + * @memberof vereign.protobuf.qrcode_data.CertValidity + * @static + * @param {vereign.protobuf.qrcode_data.ICertValidity} message CertValidity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CertValidity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + /** + * Decodes a CertValidity message from the specified reader or buffer. + * @function decode + * @memberof vereign.protobuf.qrcode_data.CertValidity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vereign.protobuf.qrcode_data.CertValidity} CertValidity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CertValidity.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vereign.protobuf.qrcode_data.CertValidity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.notBefore = reader.string(); + break; + case 2: + message.notAfter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + /** + * Decodes a CertValidity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vereign.protobuf.qrcode_data.CertValidity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vereign.protobuf.qrcode_data.CertValidity} CertValidity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CertValidity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + /** + * Verifies a CertValidity message. + * @function verify + * @memberof vereign.protobuf.qrcode_data.CertValidity + * @static + * @param {Object.<string,*>} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CertValidity.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.notBefore != null && message.hasOwnProperty("notBefore")) + if (!$util.isString(message.notBefore)) + return "notBefore: string expected"; + if (message.notAfter != null && message.hasOwnProperty("notAfter")) + if (!$util.isString(message.notAfter)) + return "notAfter: string expected"; + return null; + }; + /** + * Creates a CertValidity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vereign.protobuf.qrcode_data.CertValidity + * @static + * @param {Object.<string,*>} object Plain object + * @returns {vereign.protobuf.qrcode_data.CertValidity} CertValidity + */ + CertValidity.fromObject = function fromObject(object) { + if (object instanceof $root.vereign.protobuf.qrcode_data.CertValidity) + return object; + var message = new $root.vereign.protobuf.qrcode_data.CertValidity(); + if (object.notBefore != null) + message.notBefore = String(object.notBefore); + if (object.notAfter != null) + message.notAfter = String(object.notAfter); + return message; + }; + /** + * Creates a plain object from a CertValidity message. Also converts values to other types if specified. + * @function toObject + * @memberof vereign.protobuf.qrcode_data.CertValidity + * @static + * @param {vereign.protobuf.qrcode_data.CertValidity} message CertValidity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.<string,*>} Plain object + */ + CertValidity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.notBefore = ""; + object.notAfter = ""; + } + if (message.notBefore != null && message.hasOwnProperty("notBefore")) + object.notBefore = message.notBefore; + if (message.notAfter != null && message.hasOwnProperty("notAfter")) + object.notAfter = message.notAfter; + return object; + }; + /** + * Converts this CertValidity to JSON. + * @function toJSON + * @memberof vereign.protobuf.qrcode_data.CertValidity + * @instance + * @returns {Object.<string,*>} JSON object + */ + CertValidity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + return CertValidity; + })(); + qrcode_data.Cert_V1 = (function () { + /** + * Properties of a Cert_V1. + * @memberof vereign.protobuf.qrcode_data + * @interface ICert_V1 + * @property {boolean|null} [clientCertificate] Cert_V1 clientCertificate + * @property {vereign.protobuf.qrcode_data.ICertIssuer|null} [issuedBy] Cert_V1 issuedBy + * @property {vereign.protobuf.qrcode_data.ICertIssedTo|null} [issuedTo] Cert_V1 issuedTo + * @property {vereign.protobuf.qrcode_data.ICertValidity|null} [validityPeriod] Cert_V1 validityPeriod + * @property {string|null} [pemCertificate] Cert_V1 pemCertificate + */ + /** + * Constructs a new Cert_V1. + * @memberof vereign.protobuf.qrcode_data + * @classdesc Represents a Cert_V1. + * @implements ICert_V1 + * @constructor + * @param {vereign.protobuf.qrcode_data.ICert_V1=} [properties] Properties to set + */ + function Cert_V1(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + /** + * Cert_V1 clientCertificate. + * @member {boolean} clientCertificate + * @memberof vereign.protobuf.qrcode_data.Cert_V1 + * @instance + */ + Cert_V1.prototype.clientCertificate = false; + /** + * Cert_V1 issuedBy. + * @member {vereign.protobuf.qrcode_data.ICertIssuer|null|undefined} issuedBy + * @memberof vereign.protobuf.qrcode_data.Cert_V1 + * @instance + */ + Cert_V1.prototype.issuedBy = null; + /** + * Cert_V1 issuedTo. + * @member {vereign.protobuf.qrcode_data.ICertIssedTo|null|undefined} issuedTo + * @memberof vereign.protobuf.qrcode_data.Cert_V1 + * @instance + */ + Cert_V1.prototype.issuedTo = null; + /** + * Cert_V1 validityPeriod. + * @member {vereign.protobuf.qrcode_data.ICertValidity|null|undefined} validityPeriod + * @memberof vereign.protobuf.qrcode_data.Cert_V1 + * @instance + */ + Cert_V1.prototype.validityPeriod = null; + /** + * Cert_V1 pemCertificate. + * @member {string} pemCertificate + * @memberof vereign.protobuf.qrcode_data.Cert_V1 + * @instance + */ + Cert_V1.prototype.pemCertificate = ""; + /** + * Creates a new Cert_V1 instance using the specified properties. + * @function create + * @memberof vereign.protobuf.qrcode_data.Cert_V1 + * @static + * @param {vereign.protobuf.qrcode_data.ICert_V1=} [properties] Properties to set + * @returns {vereign.protobuf.qrcode_data.Cert_V1} Cert_V1 instance + */ + Cert_V1.create = function create(properties) { + return new Cert_V1(properties); + }; + /** + * Encodes the specified Cert_V1 message. Does not implicitly {@link vereign.protobuf.qrcode_data.Cert_V1.verify|verify} messages. + * @function encode + * @memberof vereign.protobuf.qrcode_data.Cert_V1 + * @static + * @param {vereign.protobuf.qrcode_data.ICert_V1} message Cert_V1 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Cert_V1.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.clientCertificate != null && Object.hasOwnProperty.call(message, "clientCertificate")) + writer.uint32(/* id 1, wireType 0 =*/ 8).bool(message.clientCertificate); + if (message.issuedBy != null && Object.hasOwnProperty.call(message, "issuedBy")) + $root.vereign.protobuf.qrcode_data.CertIssuer.encode(message.issuedBy, writer.uint32(/* id 2, wireType 2 =*/ 18).fork()).ldelim(); + if (message.issuedTo != null && Object.hasOwnProperty.call(message, "issuedTo")) + $root.vereign.protobuf.qrcode_data.CertIssedTo.encode(message.issuedTo, writer.uint32(/* id 3, wireType 2 =*/ 26).fork()).ldelim(); + if (message.validityPeriod != null && Object.hasOwnProperty.call(message, "validityPeriod")) + $root.vereign.protobuf.qrcode_data.CertValidity.encode(message.validityPeriod, writer.uint32(/* id 4, wireType 2 =*/ 34).fork()).ldelim(); + if (message.pemCertificate != null && Object.hasOwnProperty.call(message, "pemCertificate")) + writer.uint32(/* id 5, wireType 2 =*/ 42).string(message.pemCertificate); + return writer; + }; + /** + * Encodes the specified Cert_V1 message, length delimited. Does not implicitly {@link vereign.protobuf.qrcode_data.Cert_V1.verify|verify} messages. + * @function encodeDelimited + * @memberof vereign.protobuf.qrcode_data.Cert_V1 + * @static + * @param {vereign.protobuf.qrcode_data.ICert_V1} message Cert_V1 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Cert_V1.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + /** + * Decodes a Cert_V1 message from the specified reader or buffer. + * @function decode + * @memberof vereign.protobuf.qrcode_data.Cert_V1 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vereign.protobuf.qrcode_data.Cert_V1} Cert_V1 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Cert_V1.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vereign.protobuf.qrcode_data.Cert_V1(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientCertificate = reader.bool(); + break; + case 2: + message.issuedBy = $root.vereign.protobuf.qrcode_data.CertIssuer.decode(reader, reader.uint32()); + break; + case 3: + message.issuedTo = $root.vereign.protobuf.qrcode_data.CertIssedTo.decode(reader, reader.uint32()); + break; + case 4: + message.validityPeriod = $root.vereign.protobuf.qrcode_data.CertValidity.decode(reader, reader.uint32()); + break; + case 5: + message.pemCertificate = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + /** + * Decodes a Cert_V1 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vereign.protobuf.qrcode_data.Cert_V1 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vereign.protobuf.qrcode_data.Cert_V1} Cert_V1 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Cert_V1.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + /** + * Verifies a Cert_V1 message. + * @function verify + * @memberof vereign.protobuf.qrcode_data.Cert_V1 + * @static + * @param {Object.<string,*>} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Cert_V1.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) + if (typeof message.clientCertificate !== "boolean") + return "clientCertificate: boolean expected"; + if (message.issuedBy != null && message.hasOwnProperty("issuedBy")) { + var error = $root.vereign.protobuf.qrcode_data.CertIssuer.verify(message.issuedBy); + if (error) + return "issuedBy." + error; + } + if (message.issuedTo != null && message.hasOwnProperty("issuedTo")) { + var error = $root.vereign.protobuf.qrcode_data.CertIssedTo.verify(message.issuedTo); + if (error) + return "issuedTo." + error; + } + if (message.validityPeriod != null && message.hasOwnProperty("validityPeriod")) { + var error = $root.vereign.protobuf.qrcode_data.CertValidity.verify(message.validityPeriod); + if (error) + return "validityPeriod." + error; + } + if (message.pemCertificate != null && message.hasOwnProperty("pemCertificate")) + if (!$util.isString(message.pemCertificate)) + return "pemCertificate: string expected"; + return null; + }; + /** + * Creates a Cert_V1 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vereign.protobuf.qrcode_data.Cert_V1 + * @static + * @param {Object.<string,*>} object Plain object + * @returns {vereign.protobuf.qrcode_data.Cert_V1} Cert_V1 + */ + Cert_V1.fromObject = function fromObject(object) { + if (object instanceof $root.vereign.protobuf.qrcode_data.Cert_V1) + return object; + var message = new $root.vereign.protobuf.qrcode_data.Cert_V1(); + if (object.clientCertificate != null) + message.clientCertificate = Boolean(object.clientCertificate); + if (object.issuedBy != null) { + if (typeof object.issuedBy !== "object") + throw TypeError(".vereign.protobuf.qrcode_data.Cert_V1.issuedBy: object expected"); + message.issuedBy = $root.vereign.protobuf.qrcode_data.CertIssuer.fromObject(object.issuedBy); + } + if (object.issuedTo != null) { + if (typeof object.issuedTo !== "object") + throw TypeError(".vereign.protobuf.qrcode_data.Cert_V1.issuedTo: object expected"); + message.issuedTo = $root.vereign.protobuf.qrcode_data.CertIssedTo.fromObject(object.issuedTo); + } + if (object.validityPeriod != null) { + if (typeof object.validityPeriod !== "object") + throw TypeError(".vereign.protobuf.qrcode_data.Cert_V1.validityPeriod: object expected"); + message.validityPeriod = $root.vereign.protobuf.qrcode_data.CertValidity.fromObject(object.validityPeriod); + } + if (object.pemCertificate != null) + message.pemCertificate = String(object.pemCertificate); + return message; + }; + /** + * Creates a plain object from a Cert_V1 message. Also converts values to other types if specified. + * @function toObject + * @memberof vereign.protobuf.qrcode_data.Cert_V1 + * @static + * @param {vereign.protobuf.qrcode_data.Cert_V1} message Cert_V1 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.<string,*>} Plain object + */ + Cert_V1.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.clientCertificate = false; + object.issuedBy = null; + object.issuedTo = null; + object.validityPeriod = null; + object.pemCertificate = ""; + } + if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) + object.clientCertificate = message.clientCertificate; + if (message.issuedBy != null && message.hasOwnProperty("issuedBy")) + object.issuedBy = $root.vereign.protobuf.qrcode_data.CertIssuer.toObject(message.issuedBy, options); + if (message.issuedTo != null && message.hasOwnProperty("issuedTo")) + object.issuedTo = $root.vereign.protobuf.qrcode_data.CertIssedTo.toObject(message.issuedTo, options); + if (message.validityPeriod != null && message.hasOwnProperty("validityPeriod")) + object.validityPeriod = $root.vereign.protobuf.qrcode_data.CertValidity.toObject(message.validityPeriod, options); + if (message.pemCertificate != null && message.hasOwnProperty("pemCertificate")) + object.pemCertificate = message.pemCertificate; + return object; + }; + /** + * Converts this Cert_V1 to JSON. + * @function toJSON + * @memberof vereign.protobuf.qrcode_data.Cert_V1 + * @instance + * @returns {Object.<string,*>} JSON object + */ + Cert_V1.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + return Cert_V1; + })(); + qrcode_data.SignatureMeta_V1 = (function () { + /** + * Properties of a SignatureMeta_V1. + * @memberof vereign.protobuf.qrcode_data + * @interface ISignatureMeta_V1 + * @property {Array.<vereign.protobuf.qrcode_data.ICert_V1>|null} [cert] SignatureMeta_V1 cert + * @property {string|null} [reason] SignatureMeta_V1 reason + * @property {string|null} [contactInfo] SignatureMeta_V1 contactInfo + * @property {string|null} [location] SignatureMeta_V1 location + * @property {string|null} [signDate] SignatureMeta_V1 signDate + */ + /** + * Constructs a new SignatureMeta_V1. + * @memberof vereign.protobuf.qrcode_data + * @classdesc Represents a SignatureMeta_V1. + * @implements ISignatureMeta_V1 + * @constructor + * @param {vereign.protobuf.qrcode_data.ISignatureMeta_V1=} [properties] Properties to set + */ + function SignatureMeta_V1(properties) { + this.cert = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + /** + * SignatureMeta_V1 cert. + * @member {Array.<vereign.protobuf.qrcode_data.ICert_V1>} cert + * @memberof vereign.protobuf.qrcode_data.SignatureMeta_V1 + * @instance + */ + SignatureMeta_V1.prototype.cert = $util.emptyArray; + /** + * SignatureMeta_V1 reason. + * @member {string} reason + * @memberof vereign.protobuf.qrcode_data.SignatureMeta_V1 + * @instance + */ + SignatureMeta_V1.prototype.reason = ""; + /** + * SignatureMeta_V1 contactInfo. + * @member {string} contactInfo + * @memberof vereign.protobuf.qrcode_data.SignatureMeta_V1 + * @instance + */ + SignatureMeta_V1.prototype.contactInfo = ""; + /** + * SignatureMeta_V1 location. + * @member {string} location + * @memberof vereign.protobuf.qrcode_data.SignatureMeta_V1 + * @instance + */ + SignatureMeta_V1.prototype.location = ""; + /** + * SignatureMeta_V1 signDate. + * @member {string} signDate + * @memberof vereign.protobuf.qrcode_data.SignatureMeta_V1 + * @instance + */ + SignatureMeta_V1.prototype.signDate = ""; + /** + * Creates a new SignatureMeta_V1 instance using the specified properties. + * @function create + * @memberof vereign.protobuf.qrcode_data.SignatureMeta_V1 + * @static + * @param {vereign.protobuf.qrcode_data.ISignatureMeta_V1=} [properties] Properties to set + * @returns {vereign.protobuf.qrcode_data.SignatureMeta_V1} SignatureMeta_V1 instance + */ + SignatureMeta_V1.create = function create(properties) { + return new SignatureMeta_V1(properties); + }; + /** + * Encodes the specified SignatureMeta_V1 message. Does not implicitly {@link vereign.protobuf.qrcode_data.SignatureMeta_V1.verify|verify} messages. + * @function encode + * @memberof vereign.protobuf.qrcode_data.SignatureMeta_V1 + * @static + * @param {vereign.protobuf.qrcode_data.ISignatureMeta_V1} message SignatureMeta_V1 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignatureMeta_V1.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cert != null && message.cert.length) + for (var i = 0; i < message.cert.length; ++i) + $root.vereign.protobuf.qrcode_data.Cert_V1.encode(message.cert[i], writer.uint32(/* id 1, wireType 2 =*/ 10).fork()).ldelim(); + if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) + writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.reason); + if (message.contactInfo != null && Object.hasOwnProperty.call(message, "contactInfo")) + writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.contactInfo); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 4, wireType 2 =*/ 34).string(message.location); + if (message.signDate != null && Object.hasOwnProperty.call(message, "signDate")) + writer.uint32(/* id 5, wireType 2 =*/ 42).string(message.signDate); + return writer; + }; + /** + * Encodes the specified SignatureMeta_V1 message, length delimited. Does not implicitly {@link vereign.protobuf.qrcode_data.SignatureMeta_V1.verify|verify} messages. + * @function encodeDelimited + * @memberof vereign.protobuf.qrcode_data.SignatureMeta_V1 + * @static + * @param {vereign.protobuf.qrcode_data.ISignatureMeta_V1} message SignatureMeta_V1 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SignatureMeta_V1.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + /** + * Decodes a SignatureMeta_V1 message from the specified reader or buffer. + * @function decode + * @memberof vereign.protobuf.qrcode_data.SignatureMeta_V1 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vereign.protobuf.qrcode_data.SignatureMeta_V1} SignatureMeta_V1 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignatureMeta_V1.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vereign.protobuf.qrcode_data.SignatureMeta_V1(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (!(message.cert && message.cert.length)) + message.cert = []; + message.cert.push($root.vereign.protobuf.qrcode_data.Cert_V1.decode(reader, reader.uint32())); + break; + case 2: + message.reason = reader.string(); + break; + case 3: + message.contactInfo = reader.string(); + break; + case 4: + message.location = reader.string(); + break; + case 5: + message.signDate = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + /** + * Decodes a SignatureMeta_V1 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vereign.protobuf.qrcode_data.SignatureMeta_V1 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vereign.protobuf.qrcode_data.SignatureMeta_V1} SignatureMeta_V1 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SignatureMeta_V1.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + /** + * Verifies a SignatureMeta_V1 message. + * @function verify + * @memberof vereign.protobuf.qrcode_data.SignatureMeta_V1 + * @static + * @param {Object.<string,*>} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SignatureMeta_V1.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cert != null && message.hasOwnProperty("cert")) { + if (!Array.isArray(message.cert)) + return "cert: array expected"; + for (var i = 0; i < message.cert.length; ++i) { + var error = $root.vereign.protobuf.qrcode_data.Cert_V1.verify(message.cert[i]); + if (error) + return "cert." + error; + } + } + if (message.reason != null && message.hasOwnProperty("reason")) + if (!$util.isString(message.reason)) + return "reason: string expected"; + if (message.contactInfo != null && message.hasOwnProperty("contactInfo")) + if (!$util.isString(message.contactInfo)) + return "contactInfo: string expected"; + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + if (message.signDate != null && message.hasOwnProperty("signDate")) + if (!$util.isString(message.signDate)) + return "signDate: string expected"; + return null; + }; + /** + * Creates a SignatureMeta_V1 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vereign.protobuf.qrcode_data.SignatureMeta_V1 + * @static + * @param {Object.<string,*>} object Plain object + * @returns {vereign.protobuf.qrcode_data.SignatureMeta_V1} SignatureMeta_V1 + */ + SignatureMeta_V1.fromObject = function fromObject(object) { + if (object instanceof $root.vereign.protobuf.qrcode_data.SignatureMeta_V1) + return object; + var message = new $root.vereign.protobuf.qrcode_data.SignatureMeta_V1(); + if (object.cert) { + if (!Array.isArray(object.cert)) + throw TypeError(".vereign.protobuf.qrcode_data.SignatureMeta_V1.cert: array expected"); + message.cert = []; + for (var i = 0; i < object.cert.length; ++i) { + if (typeof object.cert[i] !== "object") + throw TypeError(".vereign.protobuf.qrcode_data.SignatureMeta_V1.cert: object expected"); + message.cert[i] = $root.vereign.protobuf.qrcode_data.Cert_V1.fromObject(object.cert[i]); + } + } + if (object.reason != null) + message.reason = String(object.reason); + if (object.contactInfo != null) + message.contactInfo = String(object.contactInfo); + if (object.location != null) + message.location = String(object.location); + if (object.signDate != null) + message.signDate = String(object.signDate); + return message; + }; + /** + * Creates a plain object from a SignatureMeta_V1 message. Also converts values to other types if specified. + * @function toObject + * @memberof vereign.protobuf.qrcode_data.SignatureMeta_V1 + * @static + * @param {vereign.protobuf.qrcode_data.SignatureMeta_V1} message SignatureMeta_V1 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.<string,*>} Plain object + */ + SignatureMeta_V1.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.cert = []; + if (options.defaults) { + object.reason = ""; + object.contactInfo = ""; + object.location = ""; + object.signDate = ""; + } + if (message.cert && message.cert.length) { + object.cert = []; + for (var j = 0; j < message.cert.length; ++j) + object.cert[j] = $root.vereign.protobuf.qrcode_data.Cert_V1.toObject(message.cert[j], options); + } + if (message.reason != null && message.hasOwnProperty("reason")) + object.reason = message.reason; + if (message.contactInfo != null && message.hasOwnProperty("contactInfo")) + object.contactInfo = message.contactInfo; + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + if (message.signDate != null && message.hasOwnProperty("signDate")) + object.signDate = message.signDate; + return object; + }; + /** + * Converts this SignatureMeta_V1 to JSON. + * @function toJSON + * @memberof vereign.protobuf.qrcode_data.SignatureMeta_V1 + * @instance + * @returns {Object.<string,*>} JSON object + */ + SignatureMeta_V1.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + return SignatureMeta_V1; + })(); + qrcode_data.Signature_V1 = (function () { + /** + * Properties of a Signature_V1. + * @memberof vereign.protobuf.qrcode_data + * @interface ISignature_V1 + * @property {boolean|null} [isExpired] Signature_V1 isExpired + * @property {vereign.protobuf.qrcode_data.ISignatureMeta_V1|null} [meta] Signature_V1 meta + */ + /** + * Constructs a new Signature_V1. + * @memberof vereign.protobuf.qrcode_data + * @classdesc Represents a Signature_V1. + * @implements ISignature_V1 + * @constructor + * @param {vereign.protobuf.qrcode_data.ISignature_V1=} [properties] Properties to set + */ + function Signature_V1(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + /** + * Signature_V1 isExpired. + * @member {boolean} isExpired + * @memberof vereign.protobuf.qrcode_data.Signature_V1 + * @instance + */ + Signature_V1.prototype.isExpired = false; + /** + * Signature_V1 meta. + * @member {vereign.protobuf.qrcode_data.ISignatureMeta_V1|null|undefined} meta + * @memberof vereign.protobuf.qrcode_data.Signature_V1 + * @instance + */ + Signature_V1.prototype.meta = null; + /** + * Creates a new Signature_V1 instance using the specified properties. + * @function create + * @memberof vereign.protobuf.qrcode_data.Signature_V1 + * @static + * @param {vereign.protobuf.qrcode_data.ISignature_V1=} [properties] Properties to set + * @returns {vereign.protobuf.qrcode_data.Signature_V1} Signature_V1 instance + */ + Signature_V1.create = function create(properties) { + return new Signature_V1(properties); + }; + /** + * Encodes the specified Signature_V1 message. Does not implicitly {@link vereign.protobuf.qrcode_data.Signature_V1.verify|verify} messages. + * @function encode + * @memberof vereign.protobuf.qrcode_data.Signature_V1 + * @static + * @param {vereign.protobuf.qrcode_data.ISignature_V1} message Signature_V1 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Signature_V1.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.isExpired != null && Object.hasOwnProperty.call(message, "isExpired")) + writer.uint32(/* id 1, wireType 0 =*/ 8).bool(message.isExpired); + if (message.meta != null && Object.hasOwnProperty.call(message, "meta")) + $root.vereign.protobuf.qrcode_data.SignatureMeta_V1.encode(message.meta, writer.uint32(/* id 2, wireType 2 =*/ 18).fork()).ldelim(); + return writer; + }; + /** + * Encodes the specified Signature_V1 message, length delimited. Does not implicitly {@link vereign.protobuf.qrcode_data.Signature_V1.verify|verify} messages. + * @function encodeDelimited + * @memberof vereign.protobuf.qrcode_data.Signature_V1 + * @static + * @param {vereign.protobuf.qrcode_data.ISignature_V1} message Signature_V1 message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Signature_V1.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + /** + * Decodes a Signature_V1 message from the specified reader or buffer. + * @function decode + * @memberof vereign.protobuf.qrcode_data.Signature_V1 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {vereign.protobuf.qrcode_data.Signature_V1} Signature_V1 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Signature_V1.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.vereign.protobuf.qrcode_data.Signature_V1(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.isExpired = reader.bool(); + break; + case 2: + message.meta = $root.vereign.protobuf.qrcode_data.SignatureMeta_V1.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + /** + * Decodes a Signature_V1 message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof vereign.protobuf.qrcode_data.Signature_V1 + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {vereign.protobuf.qrcode_data.Signature_V1} Signature_V1 + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Signature_V1.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + /** + * Verifies a Signature_V1 message. + * @function verify + * @memberof vereign.protobuf.qrcode_data.Signature_V1 + * @static + * @param {Object.<string,*>} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Signature_V1.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.isExpired != null && message.hasOwnProperty("isExpired")) + if (typeof message.isExpired !== "boolean") + return "isExpired: boolean expected"; + if (message.meta != null && message.hasOwnProperty("meta")) { + var error = $root.vereign.protobuf.qrcode_data.SignatureMeta_V1.verify(message.meta); + if (error) + return "meta." + error; + } + return null; + }; + /** + * Creates a Signature_V1 message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof vereign.protobuf.qrcode_data.Signature_V1 + * @static + * @param {Object.<string,*>} object Plain object + * @returns {vereign.protobuf.qrcode_data.Signature_V1} Signature_V1 + */ + Signature_V1.fromObject = function fromObject(object) { + if (object instanceof $root.vereign.protobuf.qrcode_data.Signature_V1) + return object; + var message = new $root.vereign.protobuf.qrcode_data.Signature_V1(); + if (object.isExpired != null) + message.isExpired = Boolean(object.isExpired); + if (object.meta != null) { + if (typeof object.meta !== "object") + throw TypeError(".vereign.protobuf.qrcode_data.Signature_V1.meta: object expected"); + message.meta = $root.vereign.protobuf.qrcode_data.SignatureMeta_V1.fromObject(object.meta); + } + return message; + }; + /** + * Creates a plain object from a Signature_V1 message. Also converts values to other types if specified. + * @function toObject + * @memberof vereign.protobuf.qrcode_data.Signature_V1 + * @static + * @param {vereign.protobuf.qrcode_data.Signature_V1} message Signature_V1 + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.<string,*>} Plain object + */ + Signature_V1.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.isExpired = false; + object.meta = null; + } + if (message.isExpired != null && message.hasOwnProperty("isExpired")) + object.isExpired = message.isExpired; + if (message.meta != null && message.hasOwnProperty("meta")) + object.meta = $root.vereign.protobuf.qrcode_data.SignatureMeta_V1.toObject(message.meta, options); + return object; + }; + /** + * Converts this Signature_V1 to JSON. + * @function toJSON + * @memberof vereign.protobuf.qrcode_data.Signature_V1 + * @instance + * @returns {Object.<string,*>} JSON object + */ + Signature_V1.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + return Signature_V1; + })(); qrcode_data.DocumentData_V1 = (function () { /** * Properties of a DocumentData_V1. @@ -2301,9 +3702,11 @@ $root.vereign = (function () { * @interface IDocumentData_V1 * @property {string|null} [author] DocumentData_V1 author * @property {string|null} [documentTitle] DocumentData_V1 documentTitle - * @property {string|null} [documentDescription] DocumentData_V1 documentDescription * @property {string|null} [creationDate] DocumentData_V1 creationDate + * @property {string|null} [lastModDate] DocumentData_V1 lastModDate * @property {number|null} [documentPages] DocumentData_V1 documentPages + * @property {boolean|null} [expired] DocumentData_V1 expired + * @property {Array.<vereign.protobuf.qrcode_data.ISignature_V1>|null} [signatures] DocumentData_V1 signatures * @property {vereign.protobuf.qrcode_data.IIpfsContentData_V1|null} [ipfs] DocumentData_V1 ipfs */ /** @@ -2315,6 +3718,7 @@ $root.vereign = (function () { * @param {vereign.protobuf.qrcode_data.IDocumentData_V1=} [properties] Properties to set */ function DocumentData_V1(properties) { + this.signatures = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -2335,19 +3739,19 @@ $root.vereign = (function () { */ DocumentData_V1.prototype.documentTitle = ""; /** - * DocumentData_V1 documentDescription. - * @member {string} documentDescription + * DocumentData_V1 creationDate. + * @member {string} creationDate * @memberof vereign.protobuf.qrcode_data.DocumentData_V1 * @instance */ - DocumentData_V1.prototype.documentDescription = ""; + DocumentData_V1.prototype.creationDate = ""; /** - * DocumentData_V1 creationDate. - * @member {string} creationDate + * DocumentData_V1 lastModDate. + * @member {string} lastModDate * @memberof vereign.protobuf.qrcode_data.DocumentData_V1 * @instance */ - DocumentData_V1.prototype.creationDate = ""; + DocumentData_V1.prototype.lastModDate = ""; /** * DocumentData_V1 documentPages. * @member {number} documentPages @@ -2355,6 +3759,20 @@ $root.vereign = (function () { * @instance */ DocumentData_V1.prototype.documentPages = 0; + /** + * DocumentData_V1 expired. + * @member {boolean} expired + * @memberof vereign.protobuf.qrcode_data.DocumentData_V1 + * @instance + */ + DocumentData_V1.prototype.expired = false; + /** + * DocumentData_V1 signatures. + * @member {Array.<vereign.protobuf.qrcode_data.ISignature_V1>} signatures + * @memberof vereign.protobuf.qrcode_data.DocumentData_V1 + * @instance + */ + DocumentData_V1.prototype.signatures = $util.emptyArray; /** * DocumentData_V1 ipfs. * @member {vereign.protobuf.qrcode_data.IIpfsContentData_V1|null|undefined} ipfs @@ -2389,14 +3807,19 @@ $root.vereign = (function () { writer.uint32(/* id 1, wireType 2 =*/ 10).string(message.author); if (message.documentTitle != null && Object.hasOwnProperty.call(message, "documentTitle")) writer.uint32(/* id 2, wireType 2 =*/ 18).string(message.documentTitle); - if (message.documentDescription != null && Object.hasOwnProperty.call(message, "documentDescription")) - writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.documentDescription); if (message.creationDate != null && Object.hasOwnProperty.call(message, "creationDate")) - writer.uint32(/* id 4, wireType 2 =*/ 34).string(message.creationDate); + writer.uint32(/* id 3, wireType 2 =*/ 26).string(message.creationDate); + if (message.lastModDate != null && Object.hasOwnProperty.call(message, "lastModDate")) + writer.uint32(/* id 4, wireType 2 =*/ 34).string(message.lastModDate); if (message.documentPages != null && Object.hasOwnProperty.call(message, "documentPages")) writer.uint32(/* id 5, wireType 0 =*/ 40).int32(message.documentPages); + if (message.expired != null && Object.hasOwnProperty.call(message, "expired")) + writer.uint32(/* id 6, wireType 0 =*/ 48).bool(message.expired); + if (message.signatures != null && message.signatures.length) + for (var i = 0; i < message.signatures.length; ++i) + $root.vereign.protobuf.qrcode_data.Signature_V1.encode(message.signatures[i], writer.uint32(/* id 7, wireType 2 =*/ 58).fork()).ldelim(); if (message.ipfs != null && Object.hasOwnProperty.call(message, "ipfs")) - $root.vereign.protobuf.qrcode_data.IpfsContentData_V1.encode(message.ipfs, writer.uint32(/* id 6, wireType 2 =*/ 50).fork()).ldelim(); + $root.vereign.protobuf.qrcode_data.IpfsContentData_V1.encode(message.ipfs, writer.uint32(/* id 8, wireType 2 =*/ 66).fork()).ldelim(); return writer; }; /** @@ -2436,15 +3859,23 @@ $root.vereign = (function () { message.documentTitle = reader.string(); break; case 3: - message.documentDescription = reader.string(); + message.creationDate = reader.string(); break; case 4: - message.creationDate = reader.string(); + message.lastModDate = reader.string(); break; case 5: message.documentPages = reader.int32(); break; case 6: + message.expired = reader.bool(); + break; + case 7: + if (!(message.signatures && message.signatures.length)) + message.signatures = []; + message.signatures.push($root.vereign.protobuf.qrcode_data.Signature_V1.decode(reader, reader.uint32())); + break; + case 8: message.ipfs = $root.vereign.protobuf.qrcode_data.IpfsContentData_V1.decode(reader, reader.uint32()); break; default: @@ -2486,15 +3917,27 @@ $root.vereign = (function () { if (message.documentTitle != null && message.hasOwnProperty("documentTitle")) if (!$util.isString(message.documentTitle)) return "documentTitle: string expected"; - if (message.documentDescription != null && message.hasOwnProperty("documentDescription")) - if (!$util.isString(message.documentDescription)) - return "documentDescription: string expected"; if (message.creationDate != null && message.hasOwnProperty("creationDate")) if (!$util.isString(message.creationDate)) return "creationDate: string expected"; + if (message.lastModDate != null && message.hasOwnProperty("lastModDate")) + if (!$util.isString(message.lastModDate)) + return "lastModDate: string expected"; if (message.documentPages != null && message.hasOwnProperty("documentPages")) if (!$util.isInteger(message.documentPages)) return "documentPages: integer expected"; + if (message.expired != null && message.hasOwnProperty("expired")) + if (typeof message.expired !== "boolean") + return "expired: boolean expected"; + if (message.signatures != null && message.hasOwnProperty("signatures")) { + if (!Array.isArray(message.signatures)) + return "signatures: array expected"; + for (var i = 0; i < message.signatures.length; ++i) { + var error = $root.vereign.protobuf.qrcode_data.Signature_V1.verify(message.signatures[i]); + if (error) + return "signatures." + error; + } + } if (message.ipfs != null && message.hasOwnProperty("ipfs")) { var error = $root.vereign.protobuf.qrcode_data.IpfsContentData_V1.verify(message.ipfs); if (error) @@ -2518,12 +3961,24 @@ $root.vereign = (function () { message.author = String(object.author); if (object.documentTitle != null) message.documentTitle = String(object.documentTitle); - if (object.documentDescription != null) - message.documentDescription = String(object.documentDescription); if (object.creationDate != null) message.creationDate = String(object.creationDate); + if (object.lastModDate != null) + message.lastModDate = String(object.lastModDate); if (object.documentPages != null) message.documentPages = object.documentPages | 0; + if (object.expired != null) + message.expired = Boolean(object.expired); + if (object.signatures) { + if (!Array.isArray(object.signatures)) + throw TypeError(".vereign.protobuf.qrcode_data.DocumentData_V1.signatures: array expected"); + message.signatures = []; + for (var i = 0; i < object.signatures.length; ++i) { + if (typeof object.signatures[i] !== "object") + throw TypeError(".vereign.protobuf.qrcode_data.DocumentData_V1.signatures: object expected"); + message.signatures[i] = $root.vereign.protobuf.qrcode_data.Signature_V1.fromObject(object.signatures[i]); + } + } if (object.ipfs != null) { if (typeof object.ipfs !== "object") throw TypeError(".vereign.protobuf.qrcode_data.DocumentData_V1.ipfs: object expected"); @@ -2544,24 +3999,34 @@ $root.vereign = (function () { if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.signatures = []; if (options.defaults) { object.author = ""; object.documentTitle = ""; - object.documentDescription = ""; object.creationDate = ""; + object.lastModDate = ""; object.documentPages = 0; + object.expired = false; object.ipfs = null; } if (message.author != null && message.hasOwnProperty("author")) object.author = message.author; if (message.documentTitle != null && message.hasOwnProperty("documentTitle")) object.documentTitle = message.documentTitle; - if (message.documentDescription != null && message.hasOwnProperty("documentDescription")) - object.documentDescription = message.documentDescription; if (message.creationDate != null && message.hasOwnProperty("creationDate")) object.creationDate = message.creationDate; + if (message.lastModDate != null && message.hasOwnProperty("lastModDate")) + object.lastModDate = message.lastModDate; if (message.documentPages != null && message.hasOwnProperty("documentPages")) object.documentPages = message.documentPages; + if (message.expired != null && message.hasOwnProperty("expired")) + object.expired = message.expired; + if (message.signatures && message.signatures.length) { + object.signatures = []; + for (var j = 0; j < message.signatures.length; ++j) + object.signatures[j] = $root.vereign.protobuf.qrcode_data.Signature_V1.toObject(message.signatures[j], options); + } if (message.ipfs != null && message.hasOwnProperty("ipfs")) object.ipfs = $root.vereign.protobuf.qrcode_data.IpfsContentData_V1.toObject(message.ipfs, options); return object; diff --git a/dist/services/CryptoService/CryptoServiceNode.js b/dist/services/CryptoService/CryptoServiceNode.js index c75b35b0feedd6a996b00a12fa906e8e6dd33c47..ce4a0759403d821a8b1cab735018270232f73e0f 100644 --- a/dist/services/CryptoService/CryptoServiceNode.js +++ b/dist/services/CryptoService/CryptoServiceNode.js @@ -62,9 +62,6 @@ class CryptoServiceNode { } cipher.final(); const authTag = cipher.getAuthTag(); - console.log('auth tag', (0, common_1.arrayBufferToBase64)(authTag)); - console.log('iv', (0, common_1.arrayBufferToBase64)(iv)); - console.log('key', (0, common_1.arrayBufferToBase64)(key)); const encryptedWithTag = Buffer.concat([ Buffer.from(encrypted), Buffer.from(authTag), @@ -80,9 +77,6 @@ class CryptoServiceNode { return __awaiter(this, void 0, void 0, function* () { const decipher = crypto.createDecipheriv(AES_GCM_ALGO, Buffer.from(key), Buffer.from(iv)); const authTag = data.slice(data.byteLength - 16, data.byteLength); - console.log('auth tag', (0, common_1.arrayBufferToBase64)(authTag)); - console.log('iv', (0, common_1.arrayBufferToBase64)(iv)); - console.log('key', (0, common_1.arrayBufferToBase64)(key)); const encrypted = data.slice(0, data.byteLength - 16); if (returnBuffer) { const decrypted = decipher.update((0, common_1.ensureUint8Array)(encrypted)); diff --git a/dist/services/QrCodeDataService.js b/dist/services/QrCodeDataService.js index ce102d4dab66909348be5a23c1d791ad6fdf67cf..e455fdbffe0ab5e27d5ced6bb60873a6943bfd4d 100644 --- a/dist/services/QrCodeDataService.js +++ b/dist/services/QrCodeDataService.js @@ -94,8 +94,6 @@ const decodeDocumentData = (binary) => { const documentDataMessage = DocumentDataMessageV1.decode((0, common_1.ensureUint8Array)(wrappedData.data)); const messageData = DocumentDataMessageV1.toObject(documentDataMessage, { bytes: String, - arrays: true, - objects: true, // populates empty objects (map fields) even if defaults=false }); return messageData; } diff --git a/dist/types.d.ts b/dist/types.d.ts index 3d93da6f5e571838365c100760584174d99ee32d..9556ffdc0a6817d5c394086807263d1d1d8a9735 100644 --- a/dist/types.d.ts +++ b/dist/types.d.ts @@ -135,13 +135,44 @@ export interface KeyDataPair { key: string; data: string; } +export interface ICert { + clientCertificate: boolean; + issuedBy: { + countryName: string; + organizationName: string; + commonName: string; + }; + issuedTo: { + countryName: string; + organizationalUnitName: string; + organizationName: string; + commonName: string; + }; + validityPeriod: { + notBefore: string; + notAfter: string; + }; + pemCertificate: string; +} +export interface ISignature { + isExpired: boolean; + meta: { + certs: Array<ICert>; + reason: string; + contactInfo: string; + location: string; + signDate: string; + }; +} export interface DocumentData { author: string; documentTitle: string; - documentDescription: string; creationDate: string; + lastModDate: string; documentPages: number; - ipfs: IpfsContentData; + expired?: boolean; + signatures?: Array<ISignature>; + ipfs?: IpfsContentData; } export interface DocumentStatusObject { timestamp: number; diff --git a/src/services/CryptoService/CryptoServiceNode.ts b/src/services/CryptoService/CryptoServiceNode.ts index 37ed0cfc853d6eed816638efaef37825e2afd244..6ac86277ca9bf332b389e55ad2eaa45b233489d2 100644 --- a/src/services/CryptoService/CryptoServiceNode.ts +++ b/src/services/CryptoService/CryptoServiceNode.ts @@ -42,10 +42,6 @@ class CryptoServiceNode implements ICryptoService { const authTag = cipher.getAuthTag(); - console.log("auth tag", arrayBufferToBase64(authTag)); - console.log("iv", arrayBufferToBase64(iv)); - console.log("key", arrayBufferToBase64(key)); - const encryptedWithTag = Buffer.concat([ Buffer.from(encrypted), Buffer.from(authTag), @@ -83,10 +79,6 @@ class CryptoServiceNode implements ICryptoService { const authTag = data.slice(data.byteLength - 16, data.byteLength); - console.log("auth tag", arrayBufferToBase64(authTag)); - console.log("iv", arrayBufferToBase64(iv)); - console.log("key", arrayBufferToBase64(key)); - const encrypted = data.slice(0, data.byteLength - 16); if (returnBuffer) { const decrypted: Buffer = decipher.update(ensureUint8Array(encrypted)); diff --git a/src/services/QrCodeDataService.ts b/src/services/QrCodeDataService.ts index 0b441156907a594537e6ac2ad19653d88ece8821..61671350bd2355f51ad5ae6a9f0d94967333da42 100644 --- a/src/services/QrCodeDataService.ts +++ b/src/services/QrCodeDataService.ts @@ -161,8 +161,6 @@ const decodeDocumentData = ( const messageData = DocumentDataMessageV1.toObject(documentDataMessage, { bytes: String, - arrays: true, // populates empty arrays (repeated fields) even if defaults=false - objects: true, // populates empty objects (map fields) even if defaults=false }) as DocumentData; return messageData; diff --git a/src/types.ts b/src/types.ts index 6b0fdc1c9636b639415a48996097f04a0f57544f..25f7d0b9df6d07ee83ae44ca4330bf21691f7bd0 100644 --- a/src/types.ts +++ b/src/types.ts @@ -153,19 +153,46 @@ export interface KeyDataPair { data: string; } +export interface ICert { + clientCertificate: boolean; + issuedBy: { + countryName: string; + organizationName: string; + commonName: string; + }; + issuedTo: { + countryName: string; + organizationalUnitName: string; + organizationName: string; + commonName: string; + }; + validityPeriod: { + notBefore: string; + notAfter: string; + }; + pemCertificate: string; +} + +export interface ISignature { + isExpired: boolean; + meta: { + certs: Array<ICert>; + reason: string; + contactInfo: string; + location: string; + signDate: string; + }; +} + export interface DocumentData { author: string; documentTitle: string; - documentDescription: string; creationDate: string; + lastModDate: string; documentPages: number; - ipfs: IpfsContentData; - // head of document //after ipfs impl - // cid of tail of document - // key - // Add the two below for UX optimization - // png of the first page - // sign info + expired?: boolean; + signatures?: Array<ISignature>; + ipfs?: IpfsContentData; } export interface DocumentStatusObject { diff --git a/vereign/protobuf/qrcode_data.proto b/vereign/protobuf/qrcode_data.proto index e28fed78b4fe69dc70dcc7ba108f1ed94a4463c9..ba7dbf6153d908daaa8d95086e8a808e9bdf9757 100644 --- a/vereign/protobuf/qrcode_data.proto +++ b/vereign/protobuf/qrcode_data.proto @@ -65,13 +65,54 @@ message WrapperData { string className = 3; } +message CertIssuer { + string countryName = 1 ; + string organizationName = 2; + string commonName = 3; +} + +message CertIssedTo { + string countryName = 1; + string organizationalUnitName = 2; + string organizationName = 3; + string commonName = 4; +} + +message CertValidity { + string notBefore = 1; + string notAfter = 2; +} + +message Cert_V1 { + bool clientCertificate = 1; + CertIssuer issuedBy = 2; + CertIssedTo issuedTo = 3; + CertValidity validityPeriod = 4; + string pemCertificate = 5; +} + +message SignatureMeta_V1 { + repeated Cert_V1 cert = 1; + string reason = 2; + string contactInfo = 3; + string location = 4; + string signDate = 5; +} + +message Signature_V1 { + bool isExpired = 1; + SignatureMeta_V1 meta = 2; +}; + message DocumentData_V1 { string author = 1; string documentTitle = 2; - string documentDescription = 3; - string creationDate = 4; + string creationDate = 3; + string lastModDate = 4; int32 documentPages = 5; - IpfsContentData_V1 ipfs = 6; + bool expired = 6; + repeated Signature_V1 signatures = 7; + IpfsContentData_V1 ipfs = 8; } /**