Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3353060
D10403.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10403.diff
View Options
diff --git a/web/grpc/identity-service-client-wrapper.js b/web/grpc/identity-service-client-wrapper.js
--- a/web/grpc/identity-service-client-wrapper.js
+++ b/web/grpc/identity-service-client-wrapper.js
@@ -1,10 +1,14 @@
// @flow
import identityServiceConfig from 'lib/facts/identity-service.js';
-import type { IdentityServiceAuthLayer } from 'lib/types/identity-service-types.js';
+import type {
+ IdentityServiceAuthLayer,
+ OutboundKeyInfoResponse,
+} from 'lib/types/identity-service-types.js';
import { VersionInterceptor, AuthInterceptor } from './interceptor.js';
import * as IdentityAuthClient from '../protobufs/identity-auth-client.cjs';
+import * as IdentityAuthStructs from '../protobufs/identity-auth-structs.cjs';
import { Empty } from '../protobufs/identity-unauth-structs.cjs';
import * as IdentityClient from '../protobufs/identity-unauth.cjs';
@@ -85,6 +89,55 @@
throw new Error('Identity service client is not initialized');
}
};
+
+ async getKeyserverKeys(
+ userID: string,
+ deviceID: string,
+ accessToken: string,
+ keyserverID: string,
+ ): Promise<?OutboundKeyInfoResponse> {
+ if (!this.authClient) {
+ const authLayer: IdentityServiceAuthLayer = {
+ userID,
+ deviceID,
+ commServicesAccessToken: accessToken,
+ };
+ await this.initAuthClient(authLayer);
+ }
+
+ const client = this.authClient;
+ if (!client) {
+ throw new Error('Identity service client is not initialized');
+ }
+
+ const request = new IdentityAuthStructs.OutboundKeysForUserRequest();
+ request.setUserId(keyserverID);
+ const response = await client.getKeyserverKeys(request);
+ const keyserverInfo = response.getKeyserverInfo();
+ if (!response.hasKeyserverInfo() || !keyserverInfo) {
+ return null;
+ }
+
+ const identityInfo = keyserverInfo.getIdentityInfo();
+ const contentPreKey = keyserverInfo.getContentPrekey();
+ const notifPreKey = keyserverInfo.getNotifPrekey();
+
+ if (!identityInfo || !contentPreKey || !notifPreKey) {
+ return null;
+ }
+
+ return {
+ payload: identityInfo.getPayload(),
+ payloadSignature: identityInfo.getPayloadSignature(),
+ socialProof: identityInfo.getSocialProof(),
+ contentPrekey: contentPreKey.getPrekey(),
+ contentPrekeySignature: contentPreKey.getPrekeySignature(),
+ notifPrekey: notifPreKey.getPrekey(),
+ notifPrekeySignature: notifPreKey.getPrekeySignature(),
+ oneTimeContentPrekey: keyserverInfo.getOneTimeContentPrekey(),
+ oneTimeNotifPrekey: keyserverInfo.getOneTimeNotifPrekey(),
+ };
+ }
}
export { IdentityServiceClientWrapper };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 7:54 AM (20 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574632
Default Alt Text
D10403.diff (2 KB)
Attached To
Mode
D10403: [web] Expose get keyserver keys Identity RPC
Attached
Detach File
Event Timeline
Log In to Comment