feat: added method to fetch user public keys

pull/3281/head
yougotwill 2 months ago
parent 87f93d7719
commit ff0ecddbdd

@ -10,6 +10,8 @@ const url = require('url');
const _ = require('lodash');
const { setupI18n } = require('./ts/util/i18n/i18n');
const { UserUtils } = require('./ts/session/utils');
const { BlindingActions } = require('./ts/webworker/workers/browser/libsession_worker_interface');
const { crowdinLocale } = ipc.sendSync('locale-data');
@ -36,6 +38,15 @@ window.getNodeVersion = () => configAny.node_version;
window.getOSRelease = () =>
`${os.type()} ${os.release()}, Node.js ${config.node_version} ${os.platform()} ${os.arch()}`;
window.saveLog = additionalText => ipc.send('save-debug-log', additionalText);
window.getUserKeys = async () => {
const pubkey = UserUtils.getOurPubKeyStrFromCache();
const userEd25519SecretKey = (await UserUtils.getUserED25519KeyPairBytes())?.privKeyBytes;
const blindedPkHex = await BlindingActions.blindVersionPubkey({
ed25519SecretKey: userEd25519SecretKey,
});
return { id: pubkey, vbid: blindedPkHex };
};
window.sessionFeatureFlags = {
useOnionRequests: true,

1
ts/window.d.ts vendored

@ -179,5 +179,6 @@ declare global {
setAutoUpdateEnabled: (enabled: boolean) => void;
setZoomFactor: (newZoom: number) => void;
updateZoomFactor: () => void;
getUserKeys: () => Promise<{ id: string; vbid: string }>;
}
}

Loading…
Cancel
Save