Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3277776
D5585.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D5585.diff
View Options
diff --git a/keyserver/package.json b/keyserver/package.json
--- a/keyserver/package.json
+++ b/keyserver/package.json
@@ -41,6 +41,7 @@
"dependencies": {
"@babel/runtime": "^7.13.10",
"@grpc/grpc-js": "^1.7.1",
+ "@grpc/proto-loader": "^0.7.3",
"@matrix-org/olm": "3.2.4",
"@parse/node-apn": "^3.2.0",
"@vingle/bmp-js": "^0.2.5",
diff --git a/keyserver/src/grpc/grpc-client.js b/keyserver/src/grpc/grpc-client.js
new file mode 100644
--- /dev/null
+++ b/keyserver/src/grpc/grpc-client.js
@@ -0,0 +1,22 @@
+// @flow
+
+import * as grpc from '@grpc/grpc-js';
+import * as protoLoader from '@grpc/proto-loader';
+
+import type { IdentityServiceClient } from 'lib/types/grpc-types';
+
+const PROTO_PATH = '../shared/protos/identity.proto';
+const packageDefinition = protoLoader.loadSync(PROTO_PATH, {
+ keepCase: true,
+ longs: String,
+ enums: String,
+ defaults: true,
+ oneofs: true,
+});
+const identity = grpc.loadPackageDefinition(packageDefinition).identity;
+const identityClient: IdentityServiceClient = new identity.IdentityService(
+ 'localhost:50051',
+ grpc.credentials.createInsecure(),
+);
+
+export { identityClient };
diff --git a/yarn.lock b/yarn.lock
--- a/yarn.lock
+++ b/yarn.lock
@@ -2477,7 +2477,7 @@
protobufjs "^6.10.0"
yargs "^16.2.0"
-"@grpc/proto-loader@^0.7.0":
+"@grpc/proto-loader@^0.7.0", "@grpc/proto-loader@^0.7.3":
version "0.7.3"
resolved "https://registry.yarnpkg.com/@grpc/proto-loader/-/proto-loader-0.7.3.tgz#75a6f95b51b85c5078ac7394da93850c32d36bb8"
integrity sha512-5dAvoZwna2Py3Ef96Ux9jIkp3iZ62TUsV00p3wVBPNX5K178UbNi8Q7gQVqwXT1Yq9RejIGG9G2IPEo93T6RcA==
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 8:00 AM (21 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2519404
Default Alt Text
D5585.diff (1 KB)
Attached To
Mode
D5585: [keyserver] add gRPC client module to keyserver
Attached
Detach File
Event Timeline
Log In to Comment