MCPcopy
hub / github.com/mailvelope/mailvelope / signMessage

Function signMessage

src/modules/pgpModel.js:327–340  ·  view source on GitHub ↗
({data, keyringId, unlockKey, signingKeyFpr})

Source from the content-addressed store, hash-verified

325 * @return {Promise<String>}
326 */
327export async function signMessage({data, keyringId, unlockKey, signingKeyFpr}) {
328 const keyring = await getKeyringWithPrivKey(signingKeyFpr, keyringId);
329 if (!keyring) {
330 throw new MvError('No private key found', 'NO_PRIVATE_KEY_FOUND');
331 }
332 try {
333 const result = await keyring.getPgpBackend().sign({data, keyring, unlockKey, signingKeyFpr});
334 uiLog.push('security_log_editor', 'security_log_sign_operation', [signingKeyFpr.toUpperCase()], false);
335 return result;
336 } catch (e) {
337 console.log('getPgpBackend().sign() error', e);
338 throw new MvError(l10n.get('sign_error', [e]), 'SIGN_ERROR');
339 }
340}
341
342export async function createPrivateKeyBackup(defaultKey, keyPwd = '') {
343 // create backup code

Callers 1

pgpModel-test.jsFile · 0.90

Calls 4

getKeyringWithPrivKeyFunction · 0.90
getPgpBackendMethod · 0.45
pushMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected