K356/k356/main/templates/components/EncryptionTesting/vue.js
2024-09-27 18:09:38 +02:00

35 lines
779 B
JavaScript

EncryptionTesting = {
template: "#EncryptionTesting",
props: ["crypto_key"],
data: function() {
return {
text: '',
encrypted: '',
encrypted_text: '',
decrypted: '',
}
},
methods: {
encrypt: function(data) {
var self = this;
encryptWithKey(this.crypto_key, data).then(e => {
self.encrypted = e;
navigator.clipboard.writeText(self.encrypted);
})
},
decrypt: function(data) {
var self = this;
decryptWithKey(this.crypto_key, data).then(e => {
self.decrypted = e;
navigator.clipboard.writeText(self.encrypted);
})
},
}
}