Public Keys and Secret Keys for Trustees are now Base64 encoded. I've tested this against 1 trustee and multiple trustees.

This commit is contained in:
vince0656 2018-09-04 15:21:31 +01:00
parent 801f6b274f
commit da74180884
5 changed files with 57 additions and 18 deletions

View file

@ -145,7 +145,7 @@ class Event(models.Model):
class TrusteeKey(models.Model):
event = models.ForeignKey(Event, on_delete=models.CASCADE, related_name="trustee_keys")
user = models.ForeignKey(EmailUser, on_delete=models.CASCADE, related_name="trustee_keys")
key = models.CharField(max_length=255, unique=True)
key = models.CharField(max_length=260)
class AccessKey(models.Model):

View file

@ -108,11 +108,21 @@
keypair.PK.toBytes(PKbytes);
keypair.SK.toBytes(SKbytes);
$('input#public-key').val(PKbytes.toString());
$('input#secret-key').val(SKbytes.toString());
var PKB64Encoded = "";
for(let i = 0; i < PKbytes.length; i++) {
PKB64Encoded += btoa(PKbytes[i]);
}
var SKB64Encoded = "";
for(let j = 0; j < SKbytes.length; j++) {
SKB64Encoded += btoa(SKbytes[j]);
}
$('input#public-key').val(PKB64Encoded);
$('input#secret-key').val(SKB64Encoded);
//mostly code from before here
var blob = new Blob([SKbytes.toString()], {type : 'text/plain'});
var blob = new Blob([SKB64Encoded], {type : 'text/plain'});
var dlBtn = $('a#download-btn');
var url = URL.createObjectURL(blob);