QOwnNotes/docs/scripting/examples/encryption-keybase.qml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
990 B
QML
Raw Permalink Normal View History

2016-10-02 10:16:21 +02:00
import QtQml 2.0
/**
* This script will encrypt and decrypt notes with https://keybase.io
2016-10-02 10:16:21 +02:00
*
* 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
*
2017-06-03 10:08:57 +02:00
* @param text string the text to encrypt or decrypt
2016-10-02 10:16:21 +02:00
* @param password string the password
* @param decrypt bool if false encryption is demanded, if true decryption is demanded
2017-06-03 10:08:57 +02:00
* @return the encrypted decrypted text
2016-10-02 10:16:21 +02:00
*/
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;
}
}