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, Nov 17, 5:23 AM
Unknown Object (File)
Sat, Nov 9, 2:25 AM
Unknown Object (File)
Sat, Nov 9, 12:58 AM
Unknown Object (File)
Fri, Nov 1, 12:40 PM
Unknown Object (File)
Sat, Oct 26, 11:50 AM
Unknown Object (File)
Wed, Oct 23, 8:42 PM
Unknown Object (File)
Tue, Oct 22, 8:57 PM
Unknown Object (File)
Mon, Oct 21, 6:20 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
No Lint Coverage
Unit
No Test Coverage