-
-
Notifications
You must be signed in to change notification settings - Fork 425
/
Copy pathencryption-keybase.qml
31 lines (29 loc) · 990 Bytes
/
encryption-keybase.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import QtQml 2.0
/**
* This script will encrypt and decrypt notes with https://keybase.io
*
* You have to use your keybase user instead of "pbek"
*/
QtObject {
/**
* This is called when the script is loaded by QOwnNotes
*/
function init() {
// disable the password dialog
script.encryptionDisablePassword();
}
/**
* This function is called when text has to be encrypted or decrypted
*
* @param text string the text to encrypt or decrypt
* @param password string the password
* @param decrypt bool if false encryption is demanded, if true decryption is demanded
* @return the encrypted decrypted text
*/
function encryptionHook(text, password, decrypt) {
// encrypt or decrypt text with keybase.io for user pbek
var param = decrypt ? ["decrypt"] : ["encrypt", "pbek"];
var result = script.startSynchronousProcess("/usr/bin/keybase", param, text);
return result;
}
}