mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 12:40:08 +08:00
16 lines
484 B
CoffeeScript
16 lines
484 B
CoffeeScript
|
{MessageViewExtension, Actions} = require 'nylas-exports'
|
||
|
PGPKeyStore = require './pgp-key-store'
|
||
|
|
||
|
class DecryptPGPExtension extends MessageViewExtension
|
||
|
@formatMessageBody: ({message}) =>
|
||
|
if not PGPKeyStore.hasEncryptedComponent(message)
|
||
|
return message
|
||
|
if PGPKeyStore.isDecrypted(message)
|
||
|
message.body = PGPKeyStore.getDecrypted(message)
|
||
|
else
|
||
|
# trigger a decryption
|
||
|
PGPKeyStore.decrypt(message)
|
||
|
message
|
||
|
|
||
|
module.exports = DecryptPGPExtension
|