Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
grpc-inspect
Advanced tools
gRPC Protocol Buffer utility module that generates a descriptor object representing a friendlier descriptor object with utility methods for protocol buffer inspection.
npm install grpc-inspect
helloworld.proto
syntax = "proto3";
option java_multiple_files = true;
option java_package = "io.grpc.examples.helloworld";
option java_outer_classname = "HelloWorldProto";
option objc_class_prefix = "HLW";
package helloworld;
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
}
Sample usage:
const gi = require('grpc-inspect')
const pbpath = path.resolve(__dirname, './route_guide.proto')
const d = gi(pbpath)
console.dir(d)
Returned utility descriptor:
{ namespaces:
{ helloworld:
{ name: 'helloworld',
messages:
{ HelloRequest:
{ name: 'HelloRequest',
fields:
[ { name: 'name',
type: 'string',
id: 1,
required: false,
repeated: false,
map: false,
defaultValue: '' } ] },
HelloReply:
{ name: 'HelloReply',
fields:
[ { name: 'message',
type: 'string',
id: 1,
required: false,
repeated: false,
map: false,
defaultValue: '' } ] } },
services:
{ Greeter:
{ name: 'Greeter',
methods:
[ { name: 'SayHello',
requestStream: false,
responseStream: false,
requestName: 'HelloRequest',
responseName: 'HelloReply' } ] } } } },
file: '/Users/me/protos/helloworld.proto',
options:
{ java_multiple_files: true,
java_package: 'io.grpc.examples.helloworld',
java_outer_classname: 'HelloWorldProto',
objc_class_prefix: 'HLW' } }
Object
Protocol Buffer utility descriptor represents friendlier descriptor object with utility methods for protocol buffer inspection.
Kind: global class
Access: public
Object
Array
Array
Object
Array
Array
Object
Object
Array
Returns an array of namespace names within the protocol buffer definition
Kind: static method of descriptor
Returns: Array
- array of names
Example
const grpcinstect = require('grpc-inspect')
const pbpath = path.resolve(__dirname, './route_guide.proto')
const d = grpcinstect(pbpath)
console.log(d.namespaceNames()) // ['routeguide']
Array
Returns an array of service names
Kind: static method of descriptor
Returns: Array
- array of names
Param | Type | Description |
---|---|---|
namespace | String | Optional name of namespace to get services. If not present returns service names of all services within the definition. |
Example
const grpcinstect = require('grpc-inspect')
const pbpath = path.resolve(__dirname, './route_guide.proto')
const d = const grpcinstect(pbpath)
console.log(d.serviceNames()) // ['RouteGuide']
Object
Returns the utility descriptor for the service given a servie name. Assumes there are no duplicate service names within the definition.
Kind: static method of descriptor
Returns: Object
- service utility descriptor
Param | Type | Description |
---|---|---|
service | String | name of the service |
Example
const grpcinstect = require('grpc-inspect')
const pbpath = path.resolve(__dirname, './route_guide.proto')
const d = grpcinstect(pbpath)
console.dir(d.service('RouteGuide'))
Array
Returns an array of method names for a service
Kind: static method of descriptor
Returns: Array
- array of names
Param | Type | Description |
---|---|---|
service | String | name of the service |
Example
const grpcinstect = require('grpc-inspect')
const pbpath = path.resolve(__dirname, './route_guide.proto')
const d = grpcinstect(pbpath)
console.log(d.methodNames('RouteGuide')) // [ 'GetFeature', 'ListFeatures', 'RecordRoute', 'RouteChat' ]
Array
Returns an array the utility descriptors for the methods of a service. Assumes there are no duplicate service names within the definition.
Kind: static method of descriptor
Returns: Array
- array of method utility descriptors
Param | Type | Description |
---|---|---|
service | String | name of the service |
Example
const grpcinstect = require('grpc-inspect')
const pbpath = path.resolve(__dirname, './route_guide.proto')
const d = grpcinstect(pbpath)
console.dir(d.methods('RouteGuide'))
Object
Returns the internal proto object
Kind: static method of descriptor
Returns: Object
- the internal proto object
Example
const grpcinstect = require('grpc-inspect')
const pbpath = path.resolve(__dirname, './route_guide.proto')
const d = grpcinstect(pbpath)
console.dir(d.proto())
Object
Gets the gRPC service / client object / function
Kind: static method of descriptor
Returns: Object
- the Client object
Param | Type | Description |
---|---|---|
serviceName | serviceName | The service name |
Example
const grpcinstect = require('grpc-inspect')
const pbpath = path.resolve(__dirname, './route_guide.proto')
const d = grpcinstect(pbpath)
console.dir(d.client('RouteGuide'))
Object
Returns protocol buffer utility descriptor.
Takes a path to proto definition file and loads it using grpc
and generates a
friendlier descriptor object with utility methods.
If object is passed it's assumed to be an already loaded proto.
Kind: global function
Returns: Object
- the utility descriptor
Param | Type | Description |
---|---|---|
input | String | Object | path to proto definition or loaded proto object |
Example
const gi = require('grpc-inspect')
const pbpath = path.resolve(__dirname, './route_guide.proto')
const d = gi(pbpath)
console.dir(d)
Apache 2.0
FAQs
gRPC protocol buffer inspection utility
The npm package grpc-inspect receives a total of 4,125 weekly downloads. As such, grpc-inspect popularity was classified as popular.
We found that grpc-inspect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.