jstink
Version:
A simple, easy-to-use Javascript crytopgraphy library.
1,615 lines (1,402 loc) • 51.7 kB
JavaScript
// source: tink.proto
/**
* @fileoverview
* @enhanceable
* @suppress {missingRequire} reports error on implicit type usages.
* @suppress {messageConventions} JS Compiler reports an error if a variable or
* field starts with 'MSG_' and isn't a translatable message.
* @public
*/
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck
var jspb = require('google-protobuf');
var goog = jspb;
var global =
(typeof globalThis !== 'undefined' && globalThis) ||
(typeof window !== 'undefined' && window) ||
(typeof global !== 'undefined' && global) ||
(typeof self !== 'undefined' && self) ||
(function () { return this; }).call(null) ||
Function('return this')();
goog.exportSymbol('proto.google.crypto.tink.EncryptedKeyset', null, global);
goog.exportSymbol('proto.google.crypto.tink.KeyData', null, global);
goog.exportSymbol('proto.google.crypto.tink.KeyData.KeyMaterialType', null, global);
goog.exportSymbol('proto.google.crypto.tink.KeyStatusType', null, global);
goog.exportSymbol('proto.google.crypto.tink.KeyTemplate', null, global);
goog.exportSymbol('proto.google.crypto.tink.Keyset', null, global);
goog.exportSymbol('proto.google.crypto.tink.Keyset.Key', null, global);
goog.exportSymbol('proto.google.crypto.tink.KeysetInfo', null, global);
goog.exportSymbol('proto.google.crypto.tink.KeysetInfo.KeyInfo', null, global);
goog.exportSymbol('proto.google.crypto.tink.OutputPrefixType', null, global);
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.google.crypto.tink.KeyTemplate = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.google.crypto.tink.KeyTemplate, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.google.crypto.tink.KeyTemplate.displayName = 'proto.google.crypto.tink.KeyTemplate';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.google.crypto.tink.KeyData = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.google.crypto.tink.KeyData, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.google.crypto.tink.KeyData.displayName = 'proto.google.crypto.tink.KeyData';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.google.crypto.tink.Keyset = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.google.crypto.tink.Keyset.repeatedFields_, null);
};
goog.inherits(proto.google.crypto.tink.Keyset, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.google.crypto.tink.Keyset.displayName = 'proto.google.crypto.tink.Keyset';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.google.crypto.tink.Keyset.Key = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.google.crypto.tink.Keyset.Key, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.google.crypto.tink.Keyset.Key.displayName = 'proto.google.crypto.tink.Keyset.Key';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.google.crypto.tink.KeysetInfo = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.google.crypto.tink.KeysetInfo.repeatedFields_, null);
};
goog.inherits(proto.google.crypto.tink.KeysetInfo, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.google.crypto.tink.KeysetInfo.displayName = 'proto.google.crypto.tink.KeysetInfo';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.google.crypto.tink.KeysetInfo.KeyInfo, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.displayName = 'proto.google.crypto.tink.KeysetInfo.KeyInfo';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.google.crypto.tink.EncryptedKeyset = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.google.crypto.tink.EncryptedKeyset, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.google.crypto.tink.EncryptedKeyset.displayName = 'proto.google.crypto.tink.EncryptedKeyset';
}
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.google.crypto.tink.KeyTemplate.prototype.toObject = function(opt_includeInstance) {
return proto.google.crypto.tink.KeyTemplate.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.google.crypto.tink.KeyTemplate} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.KeyTemplate.toObject = function(includeInstance, msg) {
var f, obj = {
typeUrl: jspb.Message.getFieldWithDefault(msg, 1, ""),
value: msg.getValue_asB64(),
outputPrefixType: jspb.Message.getFieldWithDefault(msg, 3, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.google.crypto.tink.KeyTemplate}
*/
proto.google.crypto.tink.KeyTemplate.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.google.crypto.tink.KeyTemplate;
return proto.google.crypto.tink.KeyTemplate.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.google.crypto.tink.KeyTemplate} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.google.crypto.tink.KeyTemplate}
*/
proto.google.crypto.tink.KeyTemplate.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setTypeUrl(value);
break;
case 2:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setValue(value);
break;
case 3:
var value = /** @type {!proto.google.crypto.tink.OutputPrefixType} */ (reader.readEnum());
msg.setOutputPrefixType(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.google.crypto.tink.KeyTemplate.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.google.crypto.tink.KeyTemplate.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.google.crypto.tink.KeyTemplate} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.KeyTemplate.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getTypeUrl();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getValue_asU8();
if (f.length > 0) {
writer.writeBytes(
2,
f
);
}
f = message.getOutputPrefixType();
if (f !== 0.0) {
writer.writeEnum(
3,
f
);
}
};
/**
* optional string type_url = 1;
* @return {string}
*/
proto.google.crypto.tink.KeyTemplate.prototype.getTypeUrl = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.google.crypto.tink.KeyTemplate} returns this
*/
proto.google.crypto.tink.KeyTemplate.prototype.setTypeUrl = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional bytes value = 2;
* @return {!(string|Uint8Array)}
*/
proto.google.crypto.tink.KeyTemplate.prototype.getValue = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* optional bytes value = 2;
* This is a type-conversion wrapper around `getValue()`
* @return {string}
*/
proto.google.crypto.tink.KeyTemplate.prototype.getValue_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getValue()));
};
/**
* optional bytes value = 2;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getValue()`
* @return {!Uint8Array}
*/
proto.google.crypto.tink.KeyTemplate.prototype.getValue_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getValue()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.google.crypto.tink.KeyTemplate} returns this
*/
proto.google.crypto.tink.KeyTemplate.prototype.setValue = function(value) {
return jspb.Message.setProto3BytesField(this, 2, value);
};
/**
* optional OutputPrefixType output_prefix_type = 3;
* @return {!proto.google.crypto.tink.OutputPrefixType}
*/
proto.google.crypto.tink.KeyTemplate.prototype.getOutputPrefixType = function() {
return /** @type {!proto.google.crypto.tink.OutputPrefixType} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};
/**
* @param {!proto.google.crypto.tink.OutputPrefixType} value
* @return {!proto.google.crypto.tink.KeyTemplate} returns this
*/
proto.google.crypto.tink.KeyTemplate.prototype.setOutputPrefixType = function(value) {
return jspb.Message.setProto3EnumField(this, 3, value);
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.google.crypto.tink.KeyData.prototype.toObject = function(opt_includeInstance) {
return proto.google.crypto.tink.KeyData.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.google.crypto.tink.KeyData} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.KeyData.toObject = function(includeInstance, msg) {
var f, obj = {
typeUrl: jspb.Message.getFieldWithDefault(msg, 1, ""),
value: msg.getValue_asB64(),
keyMaterialType: jspb.Message.getFieldWithDefault(msg, 3, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.google.crypto.tink.KeyData}
*/
proto.google.crypto.tink.KeyData.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.google.crypto.tink.KeyData;
return proto.google.crypto.tink.KeyData.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.google.crypto.tink.KeyData} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.google.crypto.tink.KeyData}
*/
proto.google.crypto.tink.KeyData.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setTypeUrl(value);
break;
case 2:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setValue(value);
break;
case 3:
var value = /** @type {!proto.google.crypto.tink.KeyData.KeyMaterialType} */ (reader.readEnum());
msg.setKeyMaterialType(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.google.crypto.tink.KeyData.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.google.crypto.tink.KeyData.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.google.crypto.tink.KeyData} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.KeyData.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getTypeUrl();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getValue_asU8();
if (f.length > 0) {
writer.writeBytes(
2,
f
);
}
f = message.getKeyMaterialType();
if (f !== 0.0) {
writer.writeEnum(
3,
f
);
}
};
/**
* @enum {number}
*/
proto.google.crypto.tink.KeyData.KeyMaterialType = {
UNKNOWN_KEYMATERIAL: 0,
SYMMETRIC: 1,
ASYMMETRIC_PRIVATE: 2,
ASYMMETRIC_PUBLIC: 3,
REMOTE: 4
};
/**
* optional string type_url = 1;
* @return {string}
*/
proto.google.crypto.tink.KeyData.prototype.getTypeUrl = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.google.crypto.tink.KeyData} returns this
*/
proto.google.crypto.tink.KeyData.prototype.setTypeUrl = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional bytes value = 2;
* @return {!(string|Uint8Array)}
*/
proto.google.crypto.tink.KeyData.prototype.getValue = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* optional bytes value = 2;
* This is a type-conversion wrapper around `getValue()`
* @return {string}
*/
proto.google.crypto.tink.KeyData.prototype.getValue_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getValue()));
};
/**
* optional bytes value = 2;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getValue()`
* @return {!Uint8Array}
*/
proto.google.crypto.tink.KeyData.prototype.getValue_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getValue()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.google.crypto.tink.KeyData} returns this
*/
proto.google.crypto.tink.KeyData.prototype.setValue = function(value) {
return jspb.Message.setProto3BytesField(this, 2, value);
};
/**
* optional KeyMaterialType key_material_type = 3;
* @return {!proto.google.crypto.tink.KeyData.KeyMaterialType}
*/
proto.google.crypto.tink.KeyData.prototype.getKeyMaterialType = function() {
return /** @type {!proto.google.crypto.tink.KeyData.KeyMaterialType} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};
/**
* @param {!proto.google.crypto.tink.KeyData.KeyMaterialType} value
* @return {!proto.google.crypto.tink.KeyData} returns this
*/
proto.google.crypto.tink.KeyData.prototype.setKeyMaterialType = function(value) {
return jspb.Message.setProto3EnumField(this, 3, value);
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.google.crypto.tink.Keyset.repeatedFields_ = [2];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.google.crypto.tink.Keyset.prototype.toObject = function(opt_includeInstance) {
return proto.google.crypto.tink.Keyset.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.google.crypto.tink.Keyset} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.Keyset.toObject = function(includeInstance, msg) {
var f, obj = {
primaryKeyId: jspb.Message.getFieldWithDefault(msg, 1, 0),
keyList: jspb.Message.toObjectList(msg.getKeyList(),
proto.google.crypto.tink.Keyset.Key.toObject, includeInstance)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.google.crypto.tink.Keyset}
*/
proto.google.crypto.tink.Keyset.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.google.crypto.tink.Keyset;
return proto.google.crypto.tink.Keyset.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.google.crypto.tink.Keyset} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.google.crypto.tink.Keyset}
*/
proto.google.crypto.tink.Keyset.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint32());
msg.setPrimaryKeyId(value);
break;
case 2:
var value = new proto.google.crypto.tink.Keyset.Key;
reader.readMessage(value,proto.google.crypto.tink.Keyset.Key.deserializeBinaryFromReader);
msg.addKey(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.google.crypto.tink.Keyset.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.google.crypto.tink.Keyset.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.google.crypto.tink.Keyset} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.Keyset.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getPrimaryKeyId();
if (f !== 0) {
writer.writeUint32(
1,
f
);
}
f = message.getKeyList();
if (f.length > 0) {
writer.writeRepeatedMessage(
2,
f,
proto.google.crypto.tink.Keyset.Key.serializeBinaryToWriter
);
}
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.google.crypto.tink.Keyset.Key.prototype.toObject = function(opt_includeInstance) {
return proto.google.crypto.tink.Keyset.Key.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.google.crypto.tink.Keyset.Key} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.Keyset.Key.toObject = function(includeInstance, msg) {
var f, obj = {
keyData: (f = msg.getKeyData()) && proto.google.crypto.tink.KeyData.toObject(includeInstance, f),
status: jspb.Message.getFieldWithDefault(msg, 2, 0),
keyId: jspb.Message.getFieldWithDefault(msg, 3, 0),
outputPrefixType: jspb.Message.getFieldWithDefault(msg, 4, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.google.crypto.tink.Keyset.Key}
*/
proto.google.crypto.tink.Keyset.Key.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.google.crypto.tink.Keyset.Key;
return proto.google.crypto.tink.Keyset.Key.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.google.crypto.tink.Keyset.Key} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.google.crypto.tink.Keyset.Key}
*/
proto.google.crypto.tink.Keyset.Key.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.google.crypto.tink.KeyData;
reader.readMessage(value,proto.google.crypto.tink.KeyData.deserializeBinaryFromReader);
msg.setKeyData(value);
break;
case 2:
var value = /** @type {!proto.google.crypto.tink.KeyStatusType} */ (reader.readEnum());
msg.setStatus(value);
break;
case 3:
var value = /** @type {number} */ (reader.readUint32());
msg.setKeyId(value);
break;
case 4:
var value = /** @type {!proto.google.crypto.tink.OutputPrefixType} */ (reader.readEnum());
msg.setOutputPrefixType(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.google.crypto.tink.Keyset.Key.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.google.crypto.tink.Keyset.Key.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.google.crypto.tink.Keyset.Key} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.Keyset.Key.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getKeyData();
if (f != null) {
writer.writeMessage(
1,
f,
proto.google.crypto.tink.KeyData.serializeBinaryToWriter
);
}
f = message.getStatus();
if (f !== 0.0) {
writer.writeEnum(
2,
f
);
}
f = message.getKeyId();
if (f !== 0) {
writer.writeUint32(
3,
f
);
}
f = message.getOutputPrefixType();
if (f !== 0.0) {
writer.writeEnum(
4,
f
);
}
};
/**
* optional KeyData key_data = 1;
* @return {?proto.google.crypto.tink.KeyData}
*/
proto.google.crypto.tink.Keyset.Key.prototype.getKeyData = function() {
return /** @type{?proto.google.crypto.tink.KeyData} */ (
jspb.Message.getWrapperField(this, proto.google.crypto.tink.KeyData, 1));
};
/**
* @param {?proto.google.crypto.tink.KeyData|undefined} value
* @return {!proto.google.crypto.tink.Keyset.Key} returns this
*/
proto.google.crypto.tink.Keyset.Key.prototype.setKeyData = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.google.crypto.tink.Keyset.Key} returns this
*/
proto.google.crypto.tink.Keyset.Key.prototype.clearKeyData = function() {
return this.setKeyData(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.google.crypto.tink.Keyset.Key.prototype.hasKeyData = function() {
return jspb.Message.getField(this, 1) != null;
};
/**
* optional KeyStatusType status = 2;
* @return {!proto.google.crypto.tink.KeyStatusType}
*/
proto.google.crypto.tink.Keyset.Key.prototype.getStatus = function() {
return /** @type {!proto.google.crypto.tink.KeyStatusType} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/**
* @param {!proto.google.crypto.tink.KeyStatusType} value
* @return {!proto.google.crypto.tink.Keyset.Key} returns this
*/
proto.google.crypto.tink.Keyset.Key.prototype.setStatus = function(value) {
return jspb.Message.setProto3EnumField(this, 2, value);
};
/**
* optional uint32 key_id = 3;
* @return {number}
*/
proto.google.crypto.tink.Keyset.Key.prototype.getKeyId = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};
/**
* @param {number} value
* @return {!proto.google.crypto.tink.Keyset.Key} returns this
*/
proto.google.crypto.tink.Keyset.Key.prototype.setKeyId = function(value) {
return jspb.Message.setProto3IntField(this, 3, value);
};
/**
* optional OutputPrefixType output_prefix_type = 4;
* @return {!proto.google.crypto.tink.OutputPrefixType}
*/
proto.google.crypto.tink.Keyset.Key.prototype.getOutputPrefixType = function() {
return /** @type {!proto.google.crypto.tink.OutputPrefixType} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
};
/**
* @param {!proto.google.crypto.tink.OutputPrefixType} value
* @return {!proto.google.crypto.tink.Keyset.Key} returns this
*/
proto.google.crypto.tink.Keyset.Key.prototype.setOutputPrefixType = function(value) {
return jspb.Message.setProto3EnumField(this, 4, value);
};
/**
* optional uint32 primary_key_id = 1;
* @return {number}
*/
proto.google.crypto.tink.Keyset.prototype.getPrimaryKeyId = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {number} value
* @return {!proto.google.crypto.tink.Keyset} returns this
*/
proto.google.crypto.tink.Keyset.prototype.setPrimaryKeyId = function(value) {
return jspb.Message.setProto3IntField(this, 1, value);
};
/**
* repeated Key key = 2;
* @return {!Array<!proto.google.crypto.tink.Keyset.Key>}
*/
proto.google.crypto.tink.Keyset.prototype.getKeyList = function() {
return /** @type{!Array<!proto.google.crypto.tink.Keyset.Key>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.google.crypto.tink.Keyset.Key, 2));
};
/**
* @param {!Array<!proto.google.crypto.tink.Keyset.Key>} value
* @return {!proto.google.crypto.tink.Keyset} returns this
*/
proto.google.crypto.tink.Keyset.prototype.setKeyList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 2, value);
};
/**
* @param {!proto.google.crypto.tink.Keyset.Key=} opt_value
* @param {number=} opt_index
* @return {!proto.google.crypto.tink.Keyset.Key}
*/
proto.google.crypto.tink.Keyset.prototype.addKey = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.google.crypto.tink.Keyset.Key, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.google.crypto.tink.Keyset} returns this
*/
proto.google.crypto.tink.Keyset.prototype.clearKeyList = function() {
return this.setKeyList([]);
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.google.crypto.tink.KeysetInfo.repeatedFields_ = [2];
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.google.crypto.tink.KeysetInfo.prototype.toObject = function(opt_includeInstance) {
return proto.google.crypto.tink.KeysetInfo.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.google.crypto.tink.KeysetInfo} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.KeysetInfo.toObject = function(includeInstance, msg) {
var f, obj = {
primaryKeyId: jspb.Message.getFieldWithDefault(msg, 1, 0),
keyInfoList: jspb.Message.toObjectList(msg.getKeyInfoList(),
proto.google.crypto.tink.KeysetInfo.KeyInfo.toObject, includeInstance)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.google.crypto.tink.KeysetInfo}
*/
proto.google.crypto.tink.KeysetInfo.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.google.crypto.tink.KeysetInfo;
return proto.google.crypto.tink.KeysetInfo.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.google.crypto.tink.KeysetInfo} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.google.crypto.tink.KeysetInfo}
*/
proto.google.crypto.tink.KeysetInfo.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {number} */ (reader.readUint32());
msg.setPrimaryKeyId(value);
break;
case 2:
var value = new proto.google.crypto.tink.KeysetInfo.KeyInfo;
reader.readMessage(value,proto.google.crypto.tink.KeysetInfo.KeyInfo.deserializeBinaryFromReader);
msg.addKeyInfo(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.google.crypto.tink.KeysetInfo.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.google.crypto.tink.KeysetInfo.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.google.crypto.tink.KeysetInfo} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.KeysetInfo.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getPrimaryKeyId();
if (f !== 0) {
writer.writeUint32(
1,
f
);
}
f = message.getKeyInfoList();
if (f.length > 0) {
writer.writeRepeatedMessage(
2,
f,
proto.google.crypto.tink.KeysetInfo.KeyInfo.serializeBinaryToWriter
);
}
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.prototype.toObject = function(opt_includeInstance) {
return proto.google.crypto.tink.KeysetInfo.KeyInfo.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.google.crypto.tink.KeysetInfo.KeyInfo} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.toObject = function(includeInstance, msg) {
var f, obj = {
typeUrl: jspb.Message.getFieldWithDefault(msg, 1, ""),
status: jspb.Message.getFieldWithDefault(msg, 2, 0),
keyId: jspb.Message.getFieldWithDefault(msg, 3, 0),
outputPrefixType: jspb.Message.getFieldWithDefault(msg, 4, 0)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.google.crypto.tink.KeysetInfo.KeyInfo}
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.google.crypto.tink.KeysetInfo.KeyInfo;
return proto.google.crypto.tink.KeysetInfo.KeyInfo.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.google.crypto.tink.KeysetInfo.KeyInfo} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.google.crypto.tink.KeysetInfo.KeyInfo}
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = /** @type {string} */ (reader.readString());
msg.setTypeUrl(value);
break;
case 2:
var value = /** @type {!proto.google.crypto.tink.KeyStatusType} */ (reader.readEnum());
msg.setStatus(value);
break;
case 3:
var value = /** @type {number} */ (reader.readUint32());
msg.setKeyId(value);
break;
case 4:
var value = /** @type {!proto.google.crypto.tink.OutputPrefixType} */ (reader.readEnum());
msg.setOutputPrefixType(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.google.crypto.tink.KeysetInfo.KeyInfo.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.google.crypto.tink.KeysetInfo.KeyInfo} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getTypeUrl();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getStatus();
if (f !== 0.0) {
writer.writeEnum(
2,
f
);
}
f = message.getKeyId();
if (f !== 0) {
writer.writeUint32(
3,
f
);
}
f = message.getOutputPrefixType();
if (f !== 0.0) {
writer.writeEnum(
4,
f
);
}
};
/**
* optional string type_url = 1;
* @return {string}
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.prototype.getTypeUrl = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.google.crypto.tink.KeysetInfo.KeyInfo} returns this
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.prototype.setTypeUrl = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional KeyStatusType status = 2;
* @return {!proto.google.crypto.tink.KeyStatusType}
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.prototype.getStatus = function() {
return /** @type {!proto.google.crypto.tink.KeyStatusType} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/**
* @param {!proto.google.crypto.tink.KeyStatusType} value
* @return {!proto.google.crypto.tink.KeysetInfo.KeyInfo} returns this
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.prototype.setStatus = function(value) {
return jspb.Message.setProto3EnumField(this, 2, value);
};
/**
* optional uint32 key_id = 3;
* @return {number}
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.prototype.getKeyId = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};
/**
* @param {number} value
* @return {!proto.google.crypto.tink.KeysetInfo.KeyInfo} returns this
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.prototype.setKeyId = function(value) {
return jspb.Message.setProto3IntField(this, 3, value);
};
/**
* optional OutputPrefixType output_prefix_type = 4;
* @return {!proto.google.crypto.tink.OutputPrefixType}
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.prototype.getOutputPrefixType = function() {
return /** @type {!proto.google.crypto.tink.OutputPrefixType} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
};
/**
* @param {!proto.google.crypto.tink.OutputPrefixType} value
* @return {!proto.google.crypto.tink.KeysetInfo.KeyInfo} returns this
*/
proto.google.crypto.tink.KeysetInfo.KeyInfo.prototype.setOutputPrefixType = function(value) {
return jspb.Message.setProto3EnumField(this, 4, value);
};
/**
* optional uint32 primary_key_id = 1;
* @return {number}
*/
proto.google.crypto.tink.KeysetInfo.prototype.getPrimaryKeyId = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {number} value
* @return {!proto.google.crypto.tink.KeysetInfo} returns this
*/
proto.google.crypto.tink.KeysetInfo.prototype.setPrimaryKeyId = function(value) {
return jspb.Message.setProto3IntField(this, 1, value);
};
/**
* repeated KeyInfo key_info = 2;
* @return {!Array<!proto.google.crypto.tink.KeysetInfo.KeyInfo>}
*/
proto.google.crypto.tink.KeysetInfo.prototype.getKeyInfoList = function() {
return /** @type{!Array<!proto.google.crypto.tink.KeysetInfo.KeyInfo>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.google.crypto.tink.KeysetInfo.KeyInfo, 2));
};
/**
* @param {!Array<!proto.google.crypto.tink.KeysetInfo.KeyInfo>} value
* @return {!proto.google.crypto.tink.KeysetInfo} returns this
*/
proto.google.crypto.tink.KeysetInfo.prototype.setKeyInfoList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 2, value);
};
/**
* @param {!proto.google.crypto.tink.KeysetInfo.KeyInfo=} opt_value
* @param {number=} opt_index
* @return {!proto.google.crypto.tink.KeysetInfo.KeyInfo}
*/
proto.google.crypto.tink.KeysetInfo.prototype.addKeyInfo = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.google.crypto.tink.KeysetInfo.KeyInfo, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.google.crypto.tink.KeysetInfo} returns this
*/
proto.google.crypto.tink.KeysetInfo.prototype.clearKeyInfoList = function() {
return this.setKeyInfoList([]);
};
if (jspb.Message.GENERATE_TO_OBJECT) {
/**
* Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
proto.google.crypto.tink.EncryptedKeyset.prototype.toObject = function(opt_includeInstance) {
return proto.google.crypto.tink.EncryptedKeyset.toObject(opt_includeInstance, this);
};
/**
* Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.google.crypto.tink.EncryptedKeyset} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.EncryptedKeyset.toObject = function(includeInstance, msg) {
var f, obj = {
encryptedKeyset: msg.getEncryptedKeyset_asB64(),
keysetInfo: (f = msg.getKeysetInfo()) && proto.google.crypto.tink.KeysetInfo.toObject(includeInstance, f)
};
if (includeInstance) {
obj.$jspbMessageInstance = msg;
}
return obj;
};
}
/**
* Deserializes binary data (in protobuf wire format).
* @param {jspb.ByteSource} bytes The bytes to deserialize.
* @return {!proto.google.crypto.tink.EncryptedKeyset}
*/
proto.google.crypto.tink.EncryptedKeyset.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.google.crypto.tink.EncryptedKeyset;
return proto.google.crypto.tink.EncryptedKeyset.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.google.crypto.tink.EncryptedKeyset} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.google.crypto.tink.EncryptedKeyset}
*/
proto.google.crypto.tink.EncryptedKeyset.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 2:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setEncryptedKeyset(value);
break;
case 3:
var value = new proto.google.crypto.tink.KeysetInfo;
reader.readMessage(value,proto.google.crypto.tink.KeysetInfo.deserializeBinaryFromReader);
msg.setKeysetInfo(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.google.crypto.tink.EncryptedKeyset.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.google.crypto.tink.EncryptedKeyset.serializeBinaryToWriter(this, writer);
return writer.getResultBuffer();
};
/**
* Serializes the given message to binary data (in protobuf wire
* format), writing to the given BinaryWriter.
* @param {!proto.google.crypto.tink.EncryptedKeyset} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.EncryptedKeyset.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getEncryptedKeyset_asU8();
if (f.length > 0) {
writer.writeBytes(
2,
f
);
}
f = message.getKeysetInfo();
if (f != null) {
writer.writeMessage(
3,
f,
proto.google.crypto.tink.KeysetInfo.serializeBinaryToWriter
);
}
};
/**
* optional bytes encrypted_keyset = 2;
* @return {!(string|Uint8Array)}
*/
proto.google.crypto.tink.EncryptedKeyset.prototype.getEncryptedKeyset = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* optional bytes encrypted_keyset = 2;
* This is a type-conversion wrapper around `getEncryptedKeyset()`
* @return {string}
*/
proto.google.crypto.tink.EncryptedKeyset.prototype.getEncryptedKeyset_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getEncryptedKeyset()));
};
/**
* optional bytes encrypted_keyset = 2;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getEncryptedKeyset()`
* @return {!Uint8Array}
*/
proto.google.crypto.tink.EncryptedKeyset.prototype.getEncryptedKeyset_asU8 = function() {
return /** @type {!Ui