ts-spiffe
Version:
typescript client for spiffe
85 lines (84 loc) • 4.89 kB
JavaScript
// @generated by protobuf-ts 2.9.1 with parameter output_legacy_commonjs,client_grpc1,server_none,output_javascript_es2020
// @generated from protobuf file "workload.proto" (syntax proto3)
// tslint:disable
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SpiffeWorkloadAPIClient = void 0;
// @generated by protobuf-ts 2.9.1 with parameter output_legacy_commonjs,client_grpc1,server_none,output_javascript_es2020
// @generated from protobuf file "workload.proto" (syntax proto3)
// tslint:disable
const workload_1 = require("./workload");
const grpc = require("@grpc/grpc-js");
/**
* ///////////////////////////////////////////////////////////////////////
* X509-SVID Profile
* ///////////////////////////////////////////////////////////////////////
*
* @generated from protobuf service SpiffeWorkloadAPI
*/
class SpiffeWorkloadAPIClient extends grpc.Client {
constructor(address, credentials, options = {}, binaryOptions = {}) {
super(address, credentials, options);
this._binaryOptions = binaryOptions;
}
/**
* Fetch X.509-SVIDs for all SPIFFE identities the workload is entitled to,
* as well as related information like trust bundles and CRLs. As this
* information changes, subsequent messages will be streamed from the
* server.
*
* @generated from protobuf rpc: FetchX509SVID(X509SVIDRequest) returns (stream X509SVIDResponse);
*/
fetchX509SVID(input, metadata, options) {
const method = workload_1.SpiffeWorkloadAPI.methods[0];
return this.makeServerStreamRequest(`/${workload_1.SpiffeWorkloadAPI.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
}
/**
* Fetch trust bundles and CRLs. Useful for clients that only need to
* validate SVIDs without obtaining an SVID for themself. As this
* information changes, subsequent messages will be streamed from the
* server.
*
* @generated from protobuf rpc: FetchX509Bundles(X509BundlesRequest) returns (stream X509BundlesResponse);
*/
fetchX509Bundles(input, metadata, options) {
const method = workload_1.SpiffeWorkloadAPI.methods[1];
return this.makeServerStreamRequest(`/${workload_1.SpiffeWorkloadAPI.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
}
// ///////////////////////////////////////////////////////////////////////
// JWT-SVID Profile
// ///////////////////////////////////////////////////////////////////////
/**
* Fetch JWT-SVIDs for all SPIFFE identities the workload is entitled to,
* for the requested audience. If an optional SPIFFE ID is requested, only
* the JWT-SVID for that SPIFFE ID is returned.
*
* @generated from protobuf rpc: FetchJWTSVID(JWTSVIDRequest) returns (JWTSVIDResponse);
*/
fetchJWTSVID(input, metadata, options, callback) {
const method = workload_1.SpiffeWorkloadAPI.methods[2];
return this.makeUnaryRequest(`/${workload_1.SpiffeWorkloadAPI.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
}
/**
* Fetches the JWT bundles, formatted as JWKS documents, keyed by the
* SPIFFE ID of the trust domain. As this information changes, subsequent
* messages will be streamed from the server.
*
* @generated from protobuf rpc: FetchJWTBundles(JWTBundlesRequest) returns (stream JWTBundlesResponse);
*/
fetchJWTBundles(input, metadata, options) {
const method = workload_1.SpiffeWorkloadAPI.methods[3];
return this.makeServerStreamRequest(`/${workload_1.SpiffeWorkloadAPI.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options);
}
/**
* Validates a JWT-SVID against the requested audience. Returns the SPIFFE
* ID of the JWT-SVID and JWT claims.
*
* @generated from protobuf rpc: ValidateJWTSVID(ValidateJWTSVIDRequest) returns (ValidateJWTSVIDResponse);
*/
validateJWTSVID(input, metadata, options, callback) {
const method = workload_1.SpiffeWorkloadAPI.methods[4];
return this.makeUnaryRequest(`/${workload_1.SpiffeWorkloadAPI.typeName}/${method.name}`, (value) => Buffer.from(method.I.toBinary(value, this._binaryOptions)), (value) => method.O.fromBinary(value, this._binaryOptions), input, metadata, options, callback);
}
}
exports.SpiffeWorkloadAPIClient = SpiffeWorkloadAPIClient;