Class v1.ConfidentialComputingClient (1.2.0)

Service describing handlers for resources v1

Package

@google-cloud/confidentialcomputing

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of ConfidentialComputingClient.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new ConfidentialComputingClient({fallback: true}, gax); ```

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

auth

auth: gax.GoogleAuth;

confidentialComputingStub

confidentialComputingStub?: Promise<{
        [name: string]: Function;
    }>;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

locationsClient

locationsClient: LocationsClient;

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

port

static get port(): number;

The port for this API service.

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

challengePath(project, location, uuid)

challengePath(project: string, location: string, uuid: string): string;

Return a fully-qualified challenge resource name string.

Parameters
NameDescription
project string
location string
uuid string
Returns
TypeDescription
string

{string} Resource name string.

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

createChallenge(request, options)

createChallenge(request?: protos.google.cloud.confidentialcomputing.v1.ICreateChallengeRequest, options?: CallOptions): Promise<[
        protos.google.cloud.confidentialcomputing.v1.IChallenge,
        (protos.google.cloud.confidentialcomputing.v1.ICreateChallengeRequest | undefined),
        {} | undefined
    ]>;

Creates a new Challenge in a given project and location.

Parameters
NameDescription
request ICreateChallengeRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.confidentialcomputing.v1.IChallenge, (protos.google.cloud.confidentialcomputing.v1.ICreateChallengeRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Challenge. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the location where the Challenge will be
   *  used, in the format `projects/* /locations/*`.
   */
  // const parent = 'abc123'
  /**
   *  Required. The Challenge to be created. Currently this field can be empty as
   *  all the Challenge fields are set by the server.
   */
  // const challenge = {}

  // Imports the Confidentialcomputing library
  const {ConfidentialComputingClient} = require('@google-cloud/confidentialcomputing').v1;

  // Instantiates a client
  const confidentialcomputingClient = new ConfidentialComputingClient();

  async function callCreateChallenge() {
    // Construct request
    const request = {
      parent,
      challenge,
    };

    // Run request
    const response = await confidentialcomputingClient.createChallenge(request);
    console.log(response);
  }

  callCreateChallenge();

createChallenge(request, options, callback)

createChallenge(request: protos.google.cloud.confidentialcomputing.v1.ICreateChallengeRequest, options: CallOptions, callback: Callback<protos.google.cloud.confidentialcomputing.v1.IChallenge, protos.google.cloud.confidentialcomputing.v1.ICreateChallengeRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateChallengeRequest
options CallOptions
callback Callback<protos.google.cloud.confidentialcomputing.v1.IChallenge, protos.google.cloud.confidentialcomputing.v1.ICreateChallengeRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

createChallenge(request, callback)

createChallenge(request: protos.google.cloud.confidentialcomputing.v1.ICreateChallengeRequest, callback: Callback<protos.google.cloud.confidentialcomputing.v1.IChallenge, protos.google.cloud.confidentialcomputing.v1.ICreateChallengeRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request ICreateChallengeRequest
callback Callback<protos.google.cloud.confidentialcomputing.v1.IChallenge, protos.google.cloud.confidentialcomputing.v1.ICreateChallengeRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getLocation(request, options, callback)

getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;

Gets information about a location.

Parameters
NameDescription
request LocationProtos.google.cloud.location.IGetLocationRequest

The request object that will be sent.

options CallOptions | Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>

Call options. See CallOptions for more details.

callback Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
Promise<google.cloud.location.ILocation>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

const [response] = await client.getLocation(request);

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

listLocationsAsync(request, options)

listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;

Lists information about the supported locations for this service. Returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request LocationProtos.google.cloud.location.IListLocationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<google.cloud.location.ILocation>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
  // process response
}

locationPath(project, location)

locationPath(project: string, location: string): string;

Return a fully-qualified location resource name string.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
string

{string} Resource name string.

matchLocationFromChallengeName(challengeName)

matchLocationFromChallengeName(challengeName: string): string | number;

Parse the location from Challenge resource.

Parameter
NameDescription
challengeName string

A fully-qualified path representing Challenge resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchProjectFromChallengeName(challengeName)

matchProjectFromChallengeName(challengeName: string): string | number;

Parse the project from Challenge resource.

Parameter
NameDescription
challengeName string

A fully-qualified path representing Challenge resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
NameDescription
locationName string

A fully-qualified path representing Location resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchUuidFromChallengeName(challengeName)

matchUuidFromChallengeName(challengeName: string): string | number;

Parse the uuid from Challenge resource.

Parameter
NameDescription
challengeName string

A fully-qualified path representing Challenge resource.

Returns
TypeDescription
string | number

{string} A string representing the uuid.

verifyAttestation(request, options)

verifyAttestation(request?: protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationRequest, options?: CallOptions): Promise<[
        protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationResponse,
        (protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationRequest | undefined),
        {} | undefined
    ]>;

Verifies the provided attestation info, returning a signed OIDC token.

Parameters
NameDescription
request IVerifyAttestationRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationResponse, (protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing VerifyAttestationResponse. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The name of the Challenge whose nonce was used to generate the
   *  attestation, in the format `projects/* /locations/* /challenges/*`. The
   *  provided Challenge will be consumed, and cannot be used again.
   */
  // const challenge = 'abc123'
  /**
   *  Optional. Credentials used to populate the "emails" claim in the
   *  claims_token.
   */
  // const gcpCredentials = {}
  /**
   *  Required. The TPM-specific data provided by the attesting platform, used to
   *  populate any of the claims regarding platform state.
   */
  // const tpmAttestation = {}
  /**
   *  Optional. Optional information related to the Confidential Space TEE.
   */
  // const confidentialSpaceInfo = {}
  /**
   *  Optional. A collection of optional, workload-specified claims that modify
   *  the token output.
   */
  // const tokenOptions = {}

  // Imports the Confidentialcomputing library
  const {ConfidentialComputingClient} = require('@google-cloud/confidentialcomputing').v1;

  // Instantiates a client
  const confidentialcomputingClient = new ConfidentialComputingClient();

  async function callVerifyAttestation() {
    // Construct request
    const request = {
      challenge,
      tpmAttestation,
    };

    // Run request
    const response = await confidentialcomputingClient.verifyAttestation(request);
    console.log(response);
  }

  callVerifyAttestation();

verifyAttestation(request, options, callback)

verifyAttestation(request: protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationRequest, options: CallOptions, callback: Callback<protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationResponse, protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IVerifyAttestationRequest
options CallOptions
callback Callback<protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationResponse, protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

verifyAttestation(request, callback)

verifyAttestation(request: protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationRequest, callback: Callback<protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationResponse, protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request IVerifyAttestationRequest
callback Callback<protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationResponse, protos.google.cloud.confidentialcomputing.v1.IVerifyAttestationRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void