@google-cloud/confidentialcomputing
Version:
Confidential Computing API client for Node.js
818 lines (747 loc) • 1.46 MB
JavaScript
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
(function(global, factory) { /* global define, require, module */
/* AMD */ if (typeof define === 'function' && define.amd)
define(["protobufjs/minimal"], factory);
/* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
module.exports = factory(require("google-gax/build/src/protobuf").protobufMinimal);
})(this, function($protobuf) {
"use strict";
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
var $root = $protobuf.roots._google_cloud_confidentialcomputing_protos || ($protobuf.roots._google_cloud_confidentialcomputing_protos = {});
$root.google = (function() {
/**
* Namespace google.
* @exports google
* @namespace
*/
var google = {};
google.cloud = (function() {
/**
* Namespace cloud.
* @memberof google
* @namespace
*/
var cloud = {};
cloud.confidentialcomputing = (function() {
/**
* Namespace confidentialcomputing.
* @memberof google.cloud
* @namespace
*/
var confidentialcomputing = {};
confidentialcomputing.v1 = (function() {
/**
* Namespace v1.
* @memberof google.cloud.confidentialcomputing
* @namespace
*/
var v1 = {};
v1.ConfidentialComputing = (function() {
/**
* Constructs a new ConfidentialComputing service.
* @memberof google.cloud.confidentialcomputing.v1
* @classdesc Represents a ConfidentialComputing
* @extends $protobuf.rpc.Service
* @constructor
* @param {$protobuf.RPCImpl} rpcImpl RPC implementation
* @param {boolean} [requestDelimited=false] Whether requests are length-delimited
* @param {boolean} [responseDelimited=false] Whether responses are length-delimited
*/
function ConfidentialComputing(rpcImpl, requestDelimited, responseDelimited) {
$protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited);
}
(ConfidentialComputing.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ConfidentialComputing;
/**
* Creates new ConfidentialComputing service using the specified rpc implementation.
* @function create
* @memberof google.cloud.confidentialcomputing.v1.ConfidentialComputing
* @static
* @param {$protobuf.RPCImpl} rpcImpl RPC implementation
* @param {boolean} [requestDelimited=false] Whether requests are length-delimited
* @param {boolean} [responseDelimited=false] Whether responses are length-delimited
* @returns {ConfidentialComputing} RPC service. Useful where requests and/or responses are streamed.
*/
ConfidentialComputing.create = function create(rpcImpl, requestDelimited, responseDelimited) {
return new this(rpcImpl, requestDelimited, responseDelimited);
};
/**
* Callback as used by {@link google.cloud.confidentialcomputing.v1.ConfidentialComputing|createChallenge}.
* @memberof google.cloud.confidentialcomputing.v1.ConfidentialComputing
* @typedef CreateChallengeCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.cloud.confidentialcomputing.v1.Challenge} [response] Challenge
*/
/**
* Calls CreateChallenge.
* @function createChallenge
* @memberof google.cloud.confidentialcomputing.v1.ConfidentialComputing
* @instance
* @param {google.cloud.confidentialcomputing.v1.ICreateChallengeRequest} request CreateChallengeRequest message or plain object
* @param {google.cloud.confidentialcomputing.v1.ConfidentialComputing.CreateChallengeCallback} callback Node-style callback called with the error, if any, and Challenge
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(ConfidentialComputing.prototype.createChallenge = function createChallenge(request, callback) {
return this.rpcCall(createChallenge, $root.google.cloud.confidentialcomputing.v1.CreateChallengeRequest, $root.google.cloud.confidentialcomputing.v1.Challenge, request, callback);
}, "name", { value: "CreateChallenge" });
/**
* Calls CreateChallenge.
* @function createChallenge
* @memberof google.cloud.confidentialcomputing.v1.ConfidentialComputing
* @instance
* @param {google.cloud.confidentialcomputing.v1.ICreateChallengeRequest} request CreateChallengeRequest message or plain object
* @returns {Promise<google.cloud.confidentialcomputing.v1.Challenge>} Promise
* @variation 2
*/
/**
* Callback as used by {@link google.cloud.confidentialcomputing.v1.ConfidentialComputing|verifyAttestation}.
* @memberof google.cloud.confidentialcomputing.v1.ConfidentialComputing
* @typedef VerifyAttestationCallback
* @type {function}
* @param {Error|null} error Error, if any
* @param {google.cloud.confidentialcomputing.v1.VerifyAttestationResponse} [response] VerifyAttestationResponse
*/
/**
* Calls VerifyAttestation.
* @function verifyAttestation
* @memberof google.cloud.confidentialcomputing.v1.ConfidentialComputing
* @instance
* @param {google.cloud.confidentialcomputing.v1.IVerifyAttestationRequest} request VerifyAttestationRequest message or plain object
* @param {google.cloud.confidentialcomputing.v1.ConfidentialComputing.VerifyAttestationCallback} callback Node-style callback called with the error, if any, and VerifyAttestationResponse
* @returns {undefined}
* @variation 1
*/
Object.defineProperty(ConfidentialComputing.prototype.verifyAttestation = function verifyAttestation(request, callback) {
return this.rpcCall(verifyAttestation, $root.google.cloud.confidentialcomputing.v1.VerifyAttestationRequest, $root.google.cloud.confidentialcomputing.v1.VerifyAttestationResponse, request, callback);
}, "name", { value: "VerifyAttestation" });
/**
* Calls VerifyAttestation.
* @function verifyAttestation
* @memberof google.cloud.confidentialcomputing.v1.ConfidentialComputing
* @instance
* @param {google.cloud.confidentialcomputing.v1.IVerifyAttestationRequest} request VerifyAttestationRequest message or plain object
* @returns {Promise<google.cloud.confidentialcomputing.v1.VerifyAttestationResponse>} Promise
* @variation 2
*/
return ConfidentialComputing;
})();
/**
* SigningAlgorithm enum.
* @name google.cloud.confidentialcomputing.v1.SigningAlgorithm
* @enum {number}
* @property {number} SIGNING_ALGORITHM_UNSPECIFIED=0 SIGNING_ALGORITHM_UNSPECIFIED value
* @property {number} RSASSA_PSS_SHA256=1 RSASSA_PSS_SHA256 value
* @property {number} RSASSA_PKCS1V15_SHA256=2 RSASSA_PKCS1V15_SHA256 value
* @property {number} ECDSA_P256_SHA256=3 ECDSA_P256_SHA256 value
*/
v1.SigningAlgorithm = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "SIGNING_ALGORITHM_UNSPECIFIED"] = 0;
values[valuesById[1] = "RSASSA_PSS_SHA256"] = 1;
values[valuesById[2] = "RSASSA_PKCS1V15_SHA256"] = 2;
values[valuesById[3] = "ECDSA_P256_SHA256"] = 3;
return values;
})();
/**
* TokenType enum.
* @name google.cloud.confidentialcomputing.v1.TokenType
* @enum {number}
* @property {number} TOKEN_TYPE_UNSPECIFIED=0 TOKEN_TYPE_UNSPECIFIED value
* @property {number} TOKEN_TYPE_OIDC=1 TOKEN_TYPE_OIDC value
* @property {number} TOKEN_TYPE_PKI=2 TOKEN_TYPE_PKI value
* @property {number} TOKEN_TYPE_LIMITED_AWS=3 TOKEN_TYPE_LIMITED_AWS value
* @property {number} TOKEN_TYPE_AWS_PRINCIPALTAGS=4 TOKEN_TYPE_AWS_PRINCIPALTAGS value
*/
v1.TokenType = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "TOKEN_TYPE_UNSPECIFIED"] = 0;
values[valuesById[1] = "TOKEN_TYPE_OIDC"] = 1;
values[valuesById[2] = "TOKEN_TYPE_PKI"] = 2;
values[valuesById[3] = "TOKEN_TYPE_LIMITED_AWS"] = 3;
values[valuesById[4] = "TOKEN_TYPE_AWS_PRINCIPALTAGS"] = 4;
return values;
})();
v1.Challenge = (function() {
/**
* Properties of a Challenge.
* @memberof google.cloud.confidentialcomputing.v1
* @interface IChallenge
* @property {string|null} [name] Challenge name
* @property {google.protobuf.ITimestamp|null} [createTime] Challenge createTime
* @property {google.protobuf.ITimestamp|null} [expireTime] Challenge expireTime
* @property {boolean|null} [used] Challenge used
* @property {string|null} [tpmNonce] Challenge tpmNonce
*/
/**
* Constructs a new Challenge.
* @memberof google.cloud.confidentialcomputing.v1
* @classdesc Represents a Challenge.
* @implements IChallenge
* @constructor
* @param {google.cloud.confidentialcomputing.v1.IChallenge=} [properties] Properties to set
*/
function Challenge(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]];
}
/**
* Challenge name.
* @member {string} name
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @instance
*/
Challenge.prototype.name = "";
/**
* Challenge createTime.
* @member {google.protobuf.ITimestamp|null|undefined} createTime
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @instance
*/
Challenge.prototype.createTime = null;
/**
* Challenge expireTime.
* @member {google.protobuf.ITimestamp|null|undefined} expireTime
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @instance
*/
Challenge.prototype.expireTime = null;
/**
* Challenge used.
* @member {boolean} used
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @instance
*/
Challenge.prototype.used = false;
/**
* Challenge tpmNonce.
* @member {string} tpmNonce
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @instance
*/
Challenge.prototype.tpmNonce = "";
/**
* Creates a new Challenge instance using the specified properties.
* @function create
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @static
* @param {google.cloud.confidentialcomputing.v1.IChallenge=} [properties] Properties to set
* @returns {google.cloud.confidentialcomputing.v1.Challenge} Challenge instance
*/
Challenge.create = function create(properties) {
return new Challenge(properties);
};
/**
* Encodes the specified Challenge message. Does not implicitly {@link google.cloud.confidentialcomputing.v1.Challenge.verify|verify} messages.
* @function encode
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @static
* @param {google.cloud.confidentialcomputing.v1.IChallenge} message Challenge message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Challenge.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.name != null && Object.hasOwnProperty.call(message, "name"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime"))
$root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
if (message.expireTime != null && Object.hasOwnProperty.call(message, "expireTime"))
$root.google.protobuf.Timestamp.encode(message.expireTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
if (message.used != null && Object.hasOwnProperty.call(message, "used"))
writer.uint32(/* id 4, wireType 0 =*/32).bool(message.used);
if (message.tpmNonce != null && Object.hasOwnProperty.call(message, "tpmNonce"))
writer.uint32(/* id 6, wireType 2 =*/50).string(message.tpmNonce);
return writer;
};
/**
* Encodes the specified Challenge message, length delimited. Does not implicitly {@link google.cloud.confidentialcomputing.v1.Challenge.verify|verify} messages.
* @function encodeDelimited
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @static
* @param {google.cloud.confidentialcomputing.v1.IChallenge} message Challenge message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Challenge.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a Challenge message from the specified reader or buffer.
* @function decode
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {google.cloud.confidentialcomputing.v1.Challenge} Challenge
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Challenge.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.google.cloud.confidentialcomputing.v1.Challenge();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
message.name = reader.string();
break;
}
case 2: {
message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
break;
}
case 3: {
message.expireTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32());
break;
}
case 4: {
message.used = reader.bool();
break;
}
case 6: {
message.tpmNonce = reader.string();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a Challenge message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {google.cloud.confidentialcomputing.v1.Challenge} Challenge
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Challenge.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a Challenge message.
* @function verify
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
Challenge.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.name != null && message.hasOwnProperty("name"))
if (!$util.isString(message.name))
return "name: string expected";
if (message.createTime != null && message.hasOwnProperty("createTime")) {
var error = $root.google.protobuf.Timestamp.verify(message.createTime);
if (error)
return "createTime." + error;
}
if (message.expireTime != null && message.hasOwnProperty("expireTime")) {
var error = $root.google.protobuf.Timestamp.verify(message.expireTime);
if (error)
return "expireTime." + error;
}
if (message.used != null && message.hasOwnProperty("used"))
if (typeof message.used !== "boolean")
return "used: boolean expected";
if (message.tpmNonce != null && message.hasOwnProperty("tpmNonce"))
if (!$util.isString(message.tpmNonce))
return "tpmNonce: string expected";
return null;
};
/**
* Creates a Challenge message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @static
* @param {Object.<string,*>} object Plain object
* @returns {google.cloud.confidentialcomputing.v1.Challenge} Challenge
*/
Challenge.fromObject = function fromObject(object) {
if (object instanceof $root.google.cloud.confidentialcomputing.v1.Challenge)
return object;
var message = new $root.google.cloud.confidentialcomputing.v1.Challenge();
if (object.name != null)
message.name = String(object.name);
if (object.createTime != null) {
if (typeof object.createTime !== "object")
throw TypeError(".google.cloud.confidentialcomputing.v1.Challenge.createTime: object expected");
message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime);
}
if (object.expireTime != null) {
if (typeof object.expireTime !== "object")
throw TypeError(".google.cloud.confidentialcomputing.v1.Challenge.expireTime: object expected");
message.expireTime = $root.google.protobuf.Timestamp.fromObject(object.expireTime);
}
if (object.used != null)
message.used = Boolean(object.used);
if (object.tpmNonce != null)
message.tpmNonce = String(object.tpmNonce);
return message;
};
/**
* Creates a plain object from a Challenge message. Also converts values to other types if specified.
* @function toObject
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @static
* @param {google.cloud.confidentialcomputing.v1.Challenge} message Challenge
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
Challenge.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.name = "";
object.createTime = null;
object.expireTime = null;
object.used = false;
object.tpmNonce = "";
}
if (message.name != null && message.hasOwnProperty("name"))
object.name = message.name;
if (message.createTime != null && message.hasOwnProperty("createTime"))
object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options);
if (message.expireTime != null && message.hasOwnProperty("expireTime"))
object.expireTime = $root.google.protobuf.Timestamp.toObject(message.expireTime, options);
if (message.used != null && message.hasOwnProperty("used"))
object.used = message.used;
if (message.tpmNonce != null && message.hasOwnProperty("tpmNonce"))
object.tpmNonce = message.tpmNonce;
return object;
};
/**
* Converts this Challenge to JSON.
* @function toJSON
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @instance
* @returns {Object.<string,*>} JSON object
*/
Challenge.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for Challenge
* @function getTypeUrl
* @memberof google.cloud.confidentialcomputing.v1.Challenge
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
Challenge.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/google.cloud.confidentialcomputing.v1.Challenge";
};
return Challenge;
})();
v1.CreateChallengeRequest = (function() {
/**
* Properties of a CreateChallengeRequest.
* @memberof google.cloud.confidentialcomputing.v1
* @interface ICreateChallengeRequest
* @property {string|null} [parent] CreateChallengeRequest parent
* @property {google.cloud.confidentialcomputing.v1.IChallenge|null} [challenge] CreateChallengeRequest challenge
*/
/**
* Constructs a new CreateChallengeRequest.
* @memberof google.cloud.confidentialcomputing.v1
* @classdesc Represents a CreateChallengeRequest.
* @implements ICreateChallengeRequest
* @constructor
* @param {google.cloud.confidentialcomputing.v1.ICreateChallengeRequest=} [properties] Properties to set
*/
function CreateChallengeRequest(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]];
}
/**
* CreateChallengeRequest parent.
* @member {string} parent
* @memberof google.cloud.confidentialcomputing.v1.CreateChallengeRequest
* @instance
*/
CreateChallengeRequest.prototype.parent = "";
/**
* CreateChallengeRequest challenge.
* @member {google.cloud.confidentialcomputing.v1.IChallenge|null|undefined} challenge
* @memberof google.cloud.confidentialcomputing.v1.CreateChallengeRequest
* @instance
*/
CreateChallengeRequest.prototype.challenge = null;
/**
* Creates a new CreateChallengeRequest instance using the specified properties.
* @function create
* @memberof google.cloud.confidentialcomputing.v1.CreateChallengeRequest
* @static
* @param {google.cloud.confidentialcomputing.v1.ICreateChallengeRequest=} [properties] Properties to set
* @returns {google.cloud.confidentialcomputing.v1.CreateChallengeRequest} CreateChallengeRequest instance
*/
CreateChallengeRequest.create = function create(properties) {
return new CreateChallengeRequest(properties);
};
/**
* Encodes the specified CreateChallengeRequest message. Does not implicitly {@link google.cloud.confidentialcomputing.v1.CreateChallengeRequest.verify|verify} messages.
* @function encode
* @memberof google.cloud.confidentialcomputing.v1.CreateChallengeRequest
* @static
* @param {google.cloud.confidentialcomputing.v1.ICreateChallengeRequest} message CreateChallengeRequest message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CreateChallengeRequest.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.parent != null && Object.hasOwnProperty.call(message, "parent"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent);
if (message.challenge != null && Object.hasOwnProperty.call(message, "challenge"))
$root.google.cloud.confidentialcomputing.v1.Challenge.encode(message.challenge, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
return writer;
};
/**
* Encodes the specified CreateChallengeRequest message, length delimited. Does not implicitly {@link google.cloud.confidentialcomputing.v1.CreateChallengeRequest.verify|verify} messages.
* @function encodeDelimited
* @memberof google.cloud.confidentialcomputing.v1.CreateChallengeRequest
* @static
* @param {google.cloud.confidentialcomputing.v1.ICreateChallengeRequest} message CreateChallengeRequest message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CreateChallengeRequest.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CreateChallengeRequest message from the specified reader or buffer.
* @function decode
* @memberof google.cloud.confidentialcomputing.v1.CreateChallengeRequest
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {google.cloud.confidentialcomputing.v1.CreateChallengeRequest} CreateChallengeRequest
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CreateChallengeRequest.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.google.cloud.confidentialcomputing.v1.CreateChallengeRequest();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
message.parent = reader.string();
break;
}
case 2: {
message.challenge = $root.google.cloud.confidentialcomputing.v1.Challenge.decode(reader, reader.uint32());
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CreateChallengeRequest message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof google.cloud.confidentialcomputing.v1.CreateChallengeRequest
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {google.cloud.confidentialcomputing.v1.CreateChallengeRequest} CreateChallengeRequest
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CreateChallengeRequest.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CreateChallengeRequest message.
* @function verify
* @memberof google.cloud.confidentialcomputing.v1.CreateChallengeRequest
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CreateChallengeRequest.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.parent != null && message.hasOwnProperty("parent"))
if (!$util.isString(message.parent))
return "parent: string expected";
if (message.challenge != null && message.hasOwnProperty("challenge")) {
var error = $root.google.cloud.confidentialcomputing.v1.Challenge.verify(message.challenge);
if (error)
return "challenge." + error;
}
return null;
};
/**
* Creates a CreateChallengeRequest message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof google.cloud.confidentialcomputing.v1.CreateChallengeRequest
* @static
* @param {Object.<string,*>} object Plain object
* @returns {google.cloud.confidentialcomputing.v1.CreateChallengeRequest} CreateChallengeRequest
*/
CreateChallengeRequest.fromObject = function fromObject(object) {
if (object instanceof $root.google.cloud.confidentialcomputing.v1.CreateChallengeRequest)
return object;
var message = new $root.google.cloud.confidentialcomputing.v1.CreateChallengeRequest();
if (object.parent != null)
message.parent = String(object.parent);
if (object.challenge != null) {
if (typeof object.challenge !== "object")
throw TypeError(".google.cloud.confidentialcomputing.v1.CreateChallengeRequest.challenge: object expected");
message.challenge = $root.google.cloud.confidentialcomputing.v1.Challenge.fromObject(object.challenge);
}
return message;
};
/**
* Creates a plain object from a CreateChallengeRequest message. Also converts values to other types if specified.
* @function toObject
* @memberof google.cloud.confidentialcomputing.v1.CreateChallengeRequest
* @static
* @param {google.cloud.confidentialcomputing.v1.CreateChallengeRequest} message CreateChallengeRequest
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CreateChallengeRequest.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.parent = "";
object.challenge = null;
}
if (message.parent != null && message.hasOwnProperty("parent"))
object.parent = message.parent;
if (message.challenge != null && message.hasOwnProperty("challenge"))
object.challenge = $root.google.cloud.confidentialcomputing.v1.Challenge.toObject(message.challenge, options);
return object;
};
/**
* Converts this CreateChallengeRequest to JSON.
* @function toJSON
* @memberof google.cloud.confidentialcomputing.v1.CreateChallengeRequest
* @instance
* @returns {Object.<string,*>} JSON object
*/
CreateChallengeRequest.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CreateChallengeRequest
* @function getTypeUrl
* @memberof google.cloud.confidentialcomputing.v1.CreateChallengeRequest
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CreateChallengeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/google.cloud.confidentialcomputing.v1.CreateChallengeRequest";
};
return CreateChallengeRequest;
})();
v1.VerifyAttestationRequest = (function() {
/**
* Properties of a VerifyAttestationRequest.
* @memberof google.cloud.confidentialcomputing.v1
* @interface IVerifyAttestationRequest
* @property {google.cloud.confidentialcomputing.v1.ITdxCcelAttestation|null} [tdCcel] VerifyAttestationRequest tdCcel
* @property {google.cloud.confidentialcomputing.v1.ISevSnpAttestation|null} [sevSnpAttestation] VerifyAttestationRequest sevSnpAttestation
* @property {string|null} [challenge] VerifyAttestationRequest challenge
* @property {google.cloud.confidentialcomputing.v1.IGcpCredentials|null} [gcpCredentials] VerifyAttestationRequest gcpCredentials
* @property {google.cloud.confidentialcomputing.v1.ITpmAttestation|null} [tpmAttestation] VerifyAttestationRequest tpmAttestation
* @property {google.cloud.confidentialcomputing.v1.IConfidentialSpaceInfo|null} [confidentialSpaceInfo] VerifyAttestationRequest confidentialSpaceInfo
* @property {google.cloud.confidentialcomputing.v1.ITokenOptions|null} [tokenOptions] VerifyAttestationRequest tokenOptions
* @property {string|null} [attester] VerifyAttestationRequest attester
*/
/**
* Constructs a new VerifyAttestationRequest.
* @memberof google.cloud.confidentialcomputing.v1
* @classdesc Represents a VerifyAttestationRequest.
* @implements IVerifyAttestationRequest
* @constructor
* @param {google.cloud.confidentialcomputing.v1.IVerifyAttestationRequest=} [properties] Properties to set
*/
function VerifyAttestationRequest(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]];
}
/**
* VerifyAttestationRequest tdCcel.
* @member {google.cloud.confidentialcomputing.v1.ITdxCcelAttestation|null|undefined} tdCcel
* @memberof google.cloud.confidentialcomputing.v1.VerifyAttestationRequest
* @instance
*/
VerifyAttestationRequest.prototype.tdCcel = null;
/**
* VerifyAttestationRequest sevSnpAttestation.
* @member {google.cloud.confidentialcomputing.v1.ISevSnpAttestation|null|undefined} sevSnpAttestation
* @memberof google.cloud.confidentialcomputing.v1.VerifyAttestationRequest
* @instance
*/
VerifyAttestationRequest.prototype.sevSnpAttestation = null;
/**
* VerifyAttestationRequest challenge.
* @member {string} challenge
* @memberof google.cloud.confidentialcomputing.v1.VerifyAttestationRequest
* @instance
*/
VerifyAttestationRequest.prototype.challenge = "";
/**
* VerifyAttestationRequest gcpCredentials.
* @member {google.cloud.confidentialcomputing.v1.IGcpCredentials|null|undefined} gcpCredentials
* @memberof google.cloud.confidentialcomputing.v1.VerifyAttestationRequest
* @instance
*/
VerifyAttestationRequest.prototype.gcpCredentials = null;
/**
* VerifyAttestationRequest tpmAttestation.
* @member {google.cloud.confidentialcomputing.v1.ITpmAttestation|null|undefined} tpmAttestation
* @memberof google.cloud.confidentialcomputing.v1.VerifyAttestationRequest
* @instance
*/
VerifyAttestationRequest.prototype.tpmAttestation = null;
/**
* VerifyAttestationRe