Page MenuHomePhabricator

[rust-node-addon] add rust function and binding type for privilegedDeleteUsers
ClosedPublic

Authored by varun on Oct 7 2024, 8:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 8, 5:49 AM
Unknown Object (File)
Nov 17 2024, 5:23 AM
Unknown Object (File)
Nov 9 2024, 2:25 AM
Unknown Object (File)
Nov 9 2024, 12:58 AM
Unknown Object (File)
Nov 1 2024, 12:40 PM
Unknown Object (File)
Oct 26 2024, 11:50 AM
Unknown Object (File)
Oct 23 2024, 8:42 PM
Unknown Object (File)
Oct 22 2024, 8:57 PM
Subscribers

Details

Summary

we'll call this RPC from a keyserver script, so we need rust bindings

Depends on D13630

Test Plan

created two test users on staging. manually added a token for user ID 256 to staging. then called privileged_delete_users from keyserver.js to delete the two test users. confirmed their data was removed from ddb

diff --git a/keyserver/src/keyserver.js b/keyserver/src/keyserver.js
index 88dcd0b4a2..950680086d 100644
--- a/keyserver/src/keyserver.js
+++ b/keyserver/src/keyserver.js
@@ -11,6 +11,7 @@ import type { $Request, $Response } from 'express';
 import expressWs from 'express-ws';
 import os from 'os';
 import qrcode from 'qrcode';
+import { getRustAPI } from 'rust-node-addon';
 import stoppable from 'stoppable';
 
 import './cron/cron.js';
@@ -76,6 +77,13 @@ void (async () => {
     initFCCache(),
   ]);
 
+  const rustAPI = await getRustAPI();
+  const response = await rustAPI.privilegedDeleteUsers('256', 'asdf', '1234', [
+    'C4E8C417-DD67-4084-8282-4A788DF38F57',
+    '78941137-03DB-4A23-A17F-890A94948493',
+  ]);
+  console.log(response);
+

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable