mirror of
https://github.com/pbek/QOwnNotes.git
synced 2025-06-29 05:19:55 +00:00
32 lines
987 B
QML
32 lines
987 B
QML
|
import QtQml 2.0
|
||
|
|
||
|
/**
|
||
|
* This script will encrypt and decrypt notes with 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 descrypt
|
||
|
* @param password string the password
|
||
|
* @param decrypt bool if false encryption is demanded, if true decryption is demanded
|
||
|
* @return the exncrypted or 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;
|
||
|
}
|
||
|
}
|