/
var
/
www
/
greso.tech
/
server
/
nsm
/
node_modules
/
@grpc
/
grpc-js
/
src
/
/var/www/greso.tech/server/nsm/node_modules/@grpc/grpc-js/src
mkdir
upload
Name
Size
Mode
Actions
generated/
-
0755
rm
admin.ts
1345
0644
edit
dl
rm
backoff-timeout.ts
4719
0644
edit
dl
rm
call-credentials.ts
6555
0644
edit
dl
rm
call-interface.ts
4982
0644
edit
dl
rm
call-number.ts
694
0644
edit
dl
rm
call.ts
5447
0644
edit
dl
rm
channel-credentials.ts
8753
0644
edit
dl
rm
channel-options.ts
4100
0644
edit
dl
rm
channel.ts
5547
0644
edit
dl
rm
channelz.ts
26226
0644
edit
dl
rm
client-interceptors.ts
17901
0644
edit
dl
rm
client.ts
24828
0644
edit
dl
rm
compression-algorithms.ts
682
0644
edit
dl
rm
compression-filter.ts
10167
0644
edit
dl
rm
connectivity-state.ts
699
0644
edit
dl
rm
constants.ts
1651
0644
edit
dl
rm
control-plane-status.ts
1222
0644
edit
dl
rm
deadline.ts
2935
0644
edit
dl
rm
duration.ts
1096
0644
edit
dl
rm
error.ts
1062
0644
edit
dl
rm
events.ts
1108
0644
edit
dl
rm
experimental.ts
1352
0644
edit
dl
rm
filter-stack.ts
2674
0644
edit
dl
rm
filter.ts
1887
0644
edit
dl
rm
http_proxy.ts
8827
0644
edit
dl
rm
index.ts
7918
0644
edit
dl
rm
internal-channel.ts
21831
0644
edit
dl
rm
load-balancer-child-handler.ts
4868
0644
edit
dl
rm
load-balancer-outlier-detection.ts
25014
0644
edit
dl
rm
load-balancer-pick-first.ts
16073
0644
edit
dl
rm
load-balancer-round-robin.ts
7573
0644
edit
dl
rm
load-balancer.ts
7483
0644
edit
dl
rm
load-balancing-call.ts
10585
0644
edit
dl
rm
logging.ts
3407
0644
edit
dl
rm
make-client.ts
7201
0644
edit
dl
rm
max-message-size-filter.ts
3049
0644
edit
dl
rm
metadata.ts
8988
0644
edit
dl
rm
object-stream.ts
2214
0644
edit
dl
rm
picker.ts
4328
0644
edit
dl
rm
resolver-dns.ts
13169
0644
edit
dl
rm
resolver-ip.ts
3559
0644
edit
dl
rm
resolver-uds.ts
1611
0644
edit
dl
rm
resolver.ts
5805
0644
edit
dl
rm
resolving-call.ts
9856
0644
edit
dl
rm
resolving-load-balancer.ts
11508
0644
edit
dl
rm
retrying-call.ts
23079
0644
edit
dl
rm
server-call.ts
27256
0644
edit
dl
rm
server-credentials.ts
2822
0644
edit
dl
rm
server.ts
37334
0644
edit
dl
rm
service-config.ts
15852
0644
edit
dl
rm
status-builder.ts
1783
0644
edit
dl
rm
stream-decoder.ts
3501
0644
edit
dl
rm
subchannel-address.ts
2307
0644
edit
dl
rm
subchannel-call.ts
18197
0644
edit
dl
rm
subchannel-interface.ts
2831
0644
edit
dl
rm
subchannel-pool.ts
5490
0644
edit
dl
rm
subchannel.ts
13755
0644
edit
dl
rm
tls-helpers.ts
1088
0644
edit
dl
rm
transport.ts
25264
0644
edit
dl
rm
uri-parser.ts
2814
0644
edit
dl
rm
Edit:
/var/www/greso.tech/server/nsm/node_modules/@grpc/grpc-js/src/channel-credentials.ts
(8753B)
/* * Copyright 2019 gRPC authors. * * 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. * */ import { ConnectionOptions, createSecureContext, PeerCertificate, SecureContext } from 'tls'; import { CallCredentials } from './call-credentials'; import { CIPHER_SUITES, getDefaultRootsData } from './tls-helpers'; // eslint-disable-next-line @typescript-eslint/no-explicit-any function verifyIsBufferOrNull(obj: any, friendlyName: string): void { if (obj && !(obj instanceof Buffer)) { throw new TypeError(`${friendlyName}, if provided, must be a Buffer.`); } } /** * A callback that will receive the expected hostname and presented peer * certificate as parameters. The callback should return an error to * indicate that the presented certificate is considered invalid and * otherwise returned undefined. */ export type CheckServerIdentityCallback = ( hostname: string, cert: PeerCertificate ) => Error | undefined; function bufferOrNullEqual(buf1: Buffer | null, buf2: Buffer | null) { if (buf1 === null && buf2 === null) { return true; } else { return buf1 !== null && buf2 !== null && buf1.equals(buf2); } } /** * Additional peer verification options that can be set when creating * SSL credentials. */ export interface VerifyOptions { /** * If set, this callback will be invoked after the usual hostname verification * has been performed on the peer certificate. */ checkServerIdentity?: CheckServerIdentityCallback; } /** * A class that contains credentials for communicating over a channel, as well * as a set of per-call credentials, which are applied to every method call made * over a channel initialized with an instance of this class. */ export abstract class ChannelCredentials { protected callCredentials: CallCredentials; protected constructor(callCredentials?: CallCredentials) { this.callCredentials = callCredentials || CallCredentials.createEmpty(); } /** * Returns a copy of this object with the included set of per-call credentials * expanded to include callCredentials. * @param callCredentials A CallCredentials object to associate with this * instance. */ abstract compose(callCredentials: CallCredentials): ChannelCredentials; /** * Gets the set of per-call credentials associated with this instance. */ _getCallCredentials(): CallCredentials { return this.callCredentials; } /** * Gets a SecureContext object generated from input parameters if this * instance was created with createSsl, or null if this instance was created * with createInsecure. */ abstract _getConnectionOptions(): ConnectionOptions | null; /** * Indicates whether this credentials object creates a secure channel. */ abstract _isSecure(): boolean; /** * Check whether two channel credentials objects are equal. Two secure * credentials are equal if they were constructed with the same parameters. * @param other The other ChannelCredentials Object */ abstract _equals(other: ChannelCredentials): boolean; /** * Return a new ChannelCredentials instance with a given set of credentials. * The resulting instance can be used to construct a Channel that communicates * over TLS. * @param rootCerts The root certificate data. * @param privateKey The client certificate private key, if available. * @param certChain The client certificate key chain, if available. * @param verifyOptions Additional options to modify certificate verification */ static createSsl( rootCerts?: Buffer | null, privateKey?: Buffer | null, certChain?: Buffer | null, verifyOptions?: VerifyOptions ): ChannelCredentials { verifyIsBufferOrNull(rootCerts, 'Root certificate'); verifyIsBufferOrNull(privateKey, 'Private key'); verifyIsBufferOrNull(certChain, 'Certificate chain'); if (privateKey && !certChain) { throw new Error( 'Private key must be given with accompanying certificate chain' ); } if (!privateKey && certChain) { throw new Error( 'Certificate chain must be given with accompanying private key' ); } const secureContext = createSecureContext({ ca: rootCerts ?? getDefaultRootsData() ?? undefined, key: privateKey ?? undefined, cert: certChain ?? undefined, ciphers: CIPHER_SUITES, }); return new SecureChannelCredentialsImpl( secureContext, verifyOptions ?? {} ); } /** * Return a new ChannelCredentials instance with credentials created using * the provided secureContext. The resulting instances can be used to * construct a Channel that communicates over TLS. gRPC will not override * anything in the provided secureContext, so the environment variables * GRPC_SSL_CIPHER_SUITES and GRPC_DEFAULT_SSL_ROOTS_FILE_PATH will * not be applied. * @param secureContext The return value of tls.createSecureContext() * @param verifyOptions Additional options to modify certificate verification */ static createFromSecureContext(secureContext: SecureContext, verifyOptions?: VerifyOptions): ChannelCredentials { return new SecureChannelCredentialsImpl( secureContext, verifyOptions ?? {} ) } /** * Return a new ChannelCredentials instance with no credentials. */ static createInsecure(): ChannelCredentials { return new InsecureChannelCredentialsImpl(); } } class InsecureChannelCredentialsImpl extends ChannelCredentials { constructor(callCredentials?: CallCredentials) { super(callCredentials); } compose(callCredentials: CallCredentials): never { throw new Error('Cannot compose insecure credentials'); } _getConnectionOptions(): ConnectionOptions | null { return null; } _isSecure(): boolean { return false; } _equals(other: ChannelCredentials): boolean { return other instanceof InsecureChannelCredentialsImpl; } } class SecureChannelCredentialsImpl extends ChannelCredentials { connectionOptions: ConnectionOptions; constructor( private secureContext: SecureContext, private verifyOptions: VerifyOptions ) { super(); this.connectionOptions = { secureContext }; // Node asserts that this option is a function, so we cannot pass undefined if (verifyOptions?.checkServerIdentity) { this.connectionOptions.checkServerIdentity = verifyOptions.checkServerIdentity; } } compose(callCredentials: CallCredentials): ChannelCredentials { const combinedCallCredentials = this.callCredentials.compose( callCredentials ); return new ComposedChannelCredentialsImpl(this, combinedCallCredentials); } _getConnectionOptions(): ConnectionOptions | null { // Copy to prevent callers from mutating this.connectionOptions return { ...this.connectionOptions }; } _isSecure(): boolean { return true; } _equals(other: ChannelCredentials): boolean { if (this === other) { return true; } if (other instanceof SecureChannelCredentialsImpl) { return ( this.secureContext === other.secureContext && this.verifyOptions.checkServerIdentity === other.verifyOptions.checkServerIdentity ); } else { return false; } } } class ComposedChannelCredentialsImpl extends ChannelCredentials { constructor( private channelCredentials: SecureChannelCredentialsImpl, callCreds: CallCredentials ) { super(callCreds); } compose(callCredentials: CallCredentials) { const combinedCallCredentials = this.callCredentials.compose( callCredentials ); return new ComposedChannelCredentialsImpl( this.channelCredentials, combinedCallCredentials ); } _getConnectionOptions(): ConnectionOptions | null { return this.channelCredentials._getConnectionOptions(); } _isSecure(): boolean { return true; } _equals(other: ChannelCredentials): boolean { if (this === other) { return true; } if (other instanceof ComposedChannelCredentialsImpl) { return ( this.channelCredentials._equals(other.channelCredentials) && this.callCredentials._equals(other.callCredentials) ); } else { return false; } } }
Save
cmd:
run