K356/k356/main/templates/components/EncryptionTesting/vue.js
2024-09-28 17:37:29 +02:00

37 lines
1010 B
JavaScript

EncryptionTesting = {
template: "#EncryptionTesting",
router_path: "/EncryptionTesting",
delimiters: ["[[", "]]"],
props: [],
data: function() {
return {
text: '',
encrypted: '',
encrypted_text: '',
decrypted: '',
decryption_error: '',
encryption_error: '',
}
},
methods: {
async encrypt_text (data) {
try {
this.encrypted = await this.encrypt(data)
this.encryption_error = ""
} catch (err) {
this.encryption_error = "{{_('Error while encryption of message.') | escapejs}}"
}
},
async decrypt_text (data) {
try {
this.decrypted = await this.decrypt(data)
this.decryption_error = ""
} catch (err) {
this.decryption_error = "{{_('Error while decryption of message.') | escapejs}}"
}
},
}
}