35 lines
781 B
JavaScript
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);
|
|
})
|
|
},
|
|
}
|
|
}
|