mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
#89 OpenPGP.js sign cleartext
This commit is contained in:
parent
66340614b5
commit
f625abe0b2
3 changed files with 52 additions and 26 deletions
|
|
@ -236,4 +236,21 @@ export const OpenPGPUserStore = new class {
|
|||
}
|
||||
}
|
||||
|
||||
async signCleartext(text, privateKey) {
|
||||
const passphrase = prompt('OpenPGP.js Passphrase for ' + privateKey.id + ' ' + privateKey.emails[0]);
|
||||
if (null !== passphrase) {
|
||||
privateKey = await openpgp.decryptKey({
|
||||
privateKey: privateKey.key,
|
||||
passphrase
|
||||
});
|
||||
const unsignedMessage = await openpgp.createCleartextMessage({ text: text });
|
||||
return await openpgp.sign({
|
||||
message: unsignedMessage, // CleartextMessage or Message object
|
||||
signingKeys: privateKey
|
||||
// detached: false
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue