Working v0

This commit is contained in:
2024-09-27 18:09:38 +02:00
parent f3116a6876
commit 8dfafa9404
25 changed files with 740 additions and 389 deletions
@@ -0,0 +1,21 @@
{% load i18n %}
<div>
<div class="card mt-4 pt-2 ps-lg-2">
<h5 class="card-header">{% trans "Encryption testing" %}</h5>
<div class="card-body d-flex flex-column">
<p class="card-text">{% trans "The text will be automatically copied to your clipboard." %}</p>
<textarea class="form-control m-2" cols="50" rows="4" v-model="text" @keyup="encrypt(text)"></textarea>
<textarea class="form-control m-2" cols="50" rows="4" v-model="encrypted" disabled></textarea>
</div>
</div>
<div class="card mt-4 pt-2 ps-lg-2">
<h5 class="card-header">{% trans "Decryption testing" %}</h5>
<div class="card-body d-flex flex-column">
<p class="card-text">{% trans "The text will be automatically copied to your clipboard." %}</p>
<textarea class="form-control m-2" cols="50" rows="4" v-model="encrypted_text" @keyup="decrypt(encrypted_text)"></textarea>
<textarea class="form-control m-2" cols="50" rows="4" v-model="decrypted" disabled></textarea>
</div>
</div>
</div>
@@ -0,0 +1,34 @@
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);
})
},
}
}