K356/k356/main/templates/components/encryption-testing/vue.js
2024-09-26 23:59:03 +02:00

35 lines
781 B
JavaScript

encryption_testing = {
template: "#encryption-testing",
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);
})
},
}
}