jstink
Version:
A simple, easy-to-use Javascript crytopgraphy library.
413 lines (358 loc) • 12.5 kB
JavaScript
// source: aes_gcm.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.AesGcmKey', null, global);
goog.exportSymbol('proto.google.crypto.tink.AesGcmKeyFormat', 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.AesGcmKeyFormat = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.google.crypto.tink.AesGcmKeyFormat, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.google.crypto.tink.AesGcmKeyFormat.displayName = 'proto.google.crypto.tink.AesGcmKeyFormat';
}
/**
* 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.AesGcmKey = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.google.crypto.tink.AesGcmKey, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.google.crypto.tink.AesGcmKey.displayName = 'proto.google.crypto.tink.AesGcmKey';
}
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.AesGcmKeyFormat.prototype.toObject = function(opt_includeInstance) {
return proto.google.crypto.tink.AesGcmKeyFormat.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.AesGcmKeyFormat} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.AesGcmKeyFormat.toObject = function(includeInstance, msg) {
var f, obj = {
keySize: jspb.Message.getFieldWithDefault(msg, 2, 0),
version: 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.AesGcmKeyFormat}
*/
proto.google.crypto.tink.AesGcmKeyFormat.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.google.crypto.tink.AesGcmKeyFormat;
return proto.google.crypto.tink.AesGcmKeyFormat.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.google.crypto.tink.AesGcmKeyFormat} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.google.crypto.tink.AesGcmKeyFormat}
*/
proto.google.crypto.tink.AesGcmKeyFormat.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 2:
var value = /** @type {number} */ (reader.readUint32());
msg.setKeySize(value);
break;
case 3:
var value = /** @type {number} */ (reader.readUint32());
msg.setVersion(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.google.crypto.tink.AesGcmKeyFormat.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.google.crypto.tink.AesGcmKeyFormat.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.AesGcmKeyFormat} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.AesGcmKeyFormat.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getKeySize();
if (f !== 0) {
writer.writeUint32(
2,
f
);
}
f = message.getVersion();
if (f !== 0) {
writer.writeUint32(
3,
f
);
}
};
/**
* optional uint32 key_size = 2;
* @return {number}
*/
proto.google.crypto.tink.AesGcmKeyFormat.prototype.getKeySize = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
};
/**
* @param {number} value
* @return {!proto.google.crypto.tink.AesGcmKeyFormat} returns this
*/
proto.google.crypto.tink.AesGcmKeyFormat.prototype.setKeySize = function(value) {
return jspb.Message.setProto3IntField(this, 2, value);
};
/**
* optional uint32 version = 3;
* @return {number}
*/
proto.google.crypto.tink.AesGcmKeyFormat.prototype.getVersion = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
};
/**
* @param {number} value
* @return {!proto.google.crypto.tink.AesGcmKeyFormat} returns this
*/
proto.google.crypto.tink.AesGcmKeyFormat.prototype.setVersion = function(value) {
return jspb.Message.setProto3IntField(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.AesGcmKey.prototype.toObject = function(opt_includeInstance) {
return proto.google.crypto.tink.AesGcmKey.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.AesGcmKey} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.AesGcmKey.toObject = function(includeInstance, msg) {
var f, obj = {
version: jspb.Message.getFieldWithDefault(msg, 1, 0),
keyValue: msg.getKeyValue_asB64()
};
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.AesGcmKey}
*/
proto.google.crypto.tink.AesGcmKey.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.google.crypto.tink.AesGcmKey;
return proto.google.crypto.tink.AesGcmKey.deserializeBinaryFromReader(msg, reader);
};
/**
* Deserializes binary data (in protobuf wire format) from the
* given reader into the given message object.
* @param {!proto.google.crypto.tink.AesGcmKey} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.google.crypto.tink.AesGcmKey}
*/
proto.google.crypto.tink.AesGcmKey.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.setVersion(value);
break;
case 3:
var value = /** @type {!Uint8Array} */ (reader.readBytes());
msg.setKeyValue(value);
break;
default:
reader.skipField();
break;
}
}
return msg;
};
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.google.crypto.tink.AesGcmKey.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.google.crypto.tink.AesGcmKey.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.AesGcmKey} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.google.crypto.tink.AesGcmKey.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getVersion();
if (f !== 0) {
writer.writeUint32(
1,
f
);
}
f = message.getKeyValue_asU8();
if (f.length > 0) {
writer.writeBytes(
3,
f
);
}
};
/**
* optional uint32 version = 1;
* @return {number}
*/
proto.google.crypto.tink.AesGcmKey.prototype.getVersion = function() {
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
};
/**
* @param {number} value
* @return {!proto.google.crypto.tink.AesGcmKey} returns this
*/
proto.google.crypto.tink.AesGcmKey.prototype.setVersion = function(value) {
return jspb.Message.setProto3IntField(this, 1, value);
};
/**
* optional bytes key_value = 3;
* @return {!(string|Uint8Array)}
*/
proto.google.crypto.tink.AesGcmKey.prototype.getKeyValue = function() {
return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* optional bytes key_value = 3;
* This is a type-conversion wrapper around `getKeyValue()`
* @return {string}
*/
proto.google.crypto.tink.AesGcmKey.prototype.getKeyValue_asB64 = function() {
return /** @type {string} */ (jspb.Message.bytesAsB64(
this.getKeyValue()));
};
/**
* optional bytes key_value = 3;
* Note that Uint8Array is not supported on all browsers.
* @see http://caniuse.com/Uint8Array
* This is a type-conversion wrapper around `getKeyValue()`
* @return {!Uint8Array}
*/
proto.google.crypto.tink.AesGcmKey.prototype.getKeyValue_asU8 = function() {
return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
this.getKeyValue()));
};
/**
* @param {!(string|Uint8Array)} value
* @return {!proto.google.crypto.tink.AesGcmKey} returns this
*/
proto.google.crypto.tink.AesGcmKey.prototype.setKeyValue = function(value) {
return jspb.Message.setProto3BytesField(this, 3, value);
};
goog.object.extend(exports, proto.google.crypto.tink);