diff --git a/keyserver/package.json b/keyserver/package.json --- a/keyserver/package.json +++ b/keyserver/package.json @@ -40,8 +40,6 @@ }, "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 deleted file mode 100644 --- a/keyserver/src/grpc/grpc-client.js +++ /dev/null @@ -1,22 +0,0 @@ -// @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/lib/types/grpc-types.js b/lib/types/grpc-types.js deleted file mode 100644 --- a/lib/types/grpc-types.js +++ /dev/null @@ -1,141 +0,0 @@ -// @flow - -export type GetUserPublicKeyRequest = { - +userID?: string, - +deviceID?: string, -}; - -export type GetUserPublicKeyResponse__Output = { - +publicKey: string, -}; - -export type MetadataValue = string | Buffer; - -export type MetadataOptions = { - +idempotentRequest?: boolean, - +waitForReady?: boolean, - +cacheableRequest?: boolean, - +corked?: boolean, -}; -export type MetadataObject = Map; - -declare export class Metadata { - internalRepr: MetadataObject; - constructor(options: MetadataOptions): this; - - set(key: string, value: MetadataValue): void; - - add(key: string, value: MetadataValue): void; - - remove(key: string): void; - - get(key: string): MetadataValue[]; - - getMap(): { - [key: string]: MetadataValue, - ... - }; - - clone(): Metadata; - - merge(other: Metadata): void; - setOptions(options: MetadataOptions): void; - getOptions(): MetadataOptions; - - toHttp2Headers(): mixed; - - toJSON(): { [key: string]: MetadataValue[] }; - - static fromHttp2Headers(headers: mixed): Metadata; -} - -declare export var Status: { - +OK: 0, // 0 - +CANCELLED: 1, // 1 - +UNKNOWN: 2, // 2 - +INVALID_ARGUMENT: 3, // 3 - +DEADLINE_EXCEEDED: 4, // 4 - +NOT_FOUND: 5, // 5 - +ALREADY_EXISTS: 6, // 6 - +PERMISSION_DENIED: 7, // 7 - +RESOURCE_EXHAUSTED: 8, // 8 - +FAILED_PRECONDITION: 9, // 9 - +ABORTED: 10, // 10 - +OUT_OF_RANGE: 11, // 11 - +UNIMPLEMENTED: 12, // 12 - +INTERNAL: 13, // 13 - +UNAVAILABLE: 14, // 14 - +DATA_LOSS: 15, // 15 - +UNAUTHENTICATED: 16, // 16 -}; - -export type WriteCallback = (error?: Error | null) => void; -export type MessageContext = { - +callback?: WriteCallback, - +flags?: number, -}; - -export type StatusObject = { - +code: typeof Status, - +details: string, - +metadata: Metadata, -}; - -export type InterceptingListener = { - +onReceiveMetadata: (metadata: Metadata) => void, - +onReceiveMessage: (message: mixed) => void, - +onReceiveStatus: (status: StatusObject) => void, -}; - -export type InterceptingCallInterface = { - +cancelWithStatus: (status: typeof Status, details: string) => void, - +getPeer: () => string, - +start: (metadata: Metadata, listener?: $Exact) => void, - +sendMessageWithContext: (context: MessageContext, message: mixed) => void, - +sendMessage: (message: mixed) => void, - +startRead: () => void, - +halfClose: () => void, -}; - -export type EmitterAugmentation1 = { - +addListener: (event: Name, listener: (arg1: Arg) => void) => ClientUnaryCall, - +emit: (event: Name, arg1: Arg) => boolean, - +on: (event: Name, listener: (arg1: Arg) => void) => ClientUnaryCall, - +once: (event: Name, listener: (arg1: Arg) => void) => ClientUnaryCall, - +prependListener: ( - event: Name, - listener: (arg1: Arg) => void, - ) => ClientUnaryCall, - +prependOnceListener: ( - event: Name, - listener: (arg1: Arg) => void, - ) => ClientUnaryCall, - +removeListener: ( - event: Name, - listener: (arg1: Arg) => void, - ) => ClientUnaryCall, -}; - -export type ClientUnaryCall = { - ...{ - +call?: InterceptingCallInterface, - +cancel: () => void, - +getPeer: () => string, - }, - ...EmitterAugmentation1<'metadata', Metadata>, - ...EmitterAugmentation1<'status', StatusObject>, - ... -} & events$EventEmitter; - -export type RequestCallback = ( - err: Error | null, - value?: ResponseType, -) => void; - -export type IdentityServiceClient = { - getUserPublicKey( - argument: GetUserPublicKeyRequest, - callback: RequestCallback, - ): ClientUnaryCall, - ... -}; diff --git a/yarn.lock b/yarn.lock --- a/yarn.lock +++ b/yarn.lock @@ -3068,14 +3068,6 @@ resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.1.1.tgz#076d78ce99822258cf813ecc1e7fa460fa74d052" integrity sha512-NQ17ii0rK1b34VZonlmT2QMJFI70m0TRwbknO/ihlbatXyaktDhN/98vBiUU6kNBPljqGqyIrl2T4nY2RpFANg== -"@grpc/grpc-js@^1.7.1": - version "1.7.1" - resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.7.1.tgz#cfac092e61eac6fe0f80d22943f98e1ba45f02a2" - integrity sha512-GVtMU4oh/TeKkWGzXUEsyZtyvSUIT1z49RtGH1UnEGeL+sLuxKl8QH3KZTlSB329R1sWJmesm5hQ5CxXdYH9dg== - dependencies: - "@grpc/proto-loader" "^0.7.0" - "@types/node" ">=12.12.47" - "@grpc/grpc-js@~1.6.0": version "1.6.7" resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.6.7.tgz#4c4fa998ff719fe859ac19fe977fdef097bb99aa" @@ -3095,17 +3087,6 @@ protobufjs "^6.10.0" yargs "^16.2.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== - dependencies: - "@types/long" "^4.0.1" - lodash.camelcase "^4.3.0" - long "^4.0.0" - protobufjs "^7.0.0" - yargs "^16.2.0" - "@hapi/hoek@^9.0.0": version "9.2.0" resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.2.0.tgz#f3933a44e365864f4dad5db94158106d511e8131" @@ -15404,11 +15385,6 @@ resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== -long@^5.0.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/long/-/long-5.2.0.tgz#2696dadf4b4da2ce3f6f6b89186085d94d52fd61" - integrity sha512-9RTUNjK60eJbx3uz+TEGF7fUr29ZDxR5QzXcyDpeSfeH28S9ycINflOgOlppit5U+4kNTe83KQnMEerw7GmE8w== - loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" @@ -18410,24 +18386,6 @@ "@types/node" ">=13.7.0" long "^4.0.0" -protobufjs@^7.0.0: - version "7.1.2" - resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.1.2.tgz#a0cf6aeaf82f5625bffcf5a38b7cd2a7de05890c" - integrity sha512-4ZPTPkXCdel3+L81yw3dG6+Kq3umdWKh7Dc7GW/CpNk4SX3hK58iPCWeCyhVTDrbkNeKrYNZ7EojM5WDaEWTLQ== - dependencies: - "@protobufjs/aspromise" "^1.1.2" - "@protobufjs/base64" "^1.1.2" - "@protobufjs/codegen" "^2.0.4" - "@protobufjs/eventemitter" "^1.1.0" - "@protobufjs/fetch" "^1.1.0" - "@protobufjs/float" "^1.0.2" - "@protobufjs/inquire" "^1.1.0" - "@protobufjs/path" "^1.1.2" - "@protobufjs/pool" "^1.1.0" - "@protobufjs/utf8" "^1.1.0" - "@types/node" ">=13.7.0" - long "^5.0.0" - proxy-addr@~2.0.7: version "2.0.7" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025"