removed obsolete code

This commit is contained in:
antelle 2019-04-13 11:04:31 +02:00
parent c795784417
commit 6f203f0a3e
1 changed files with 3 additions and 26 deletions

View File

@ -15,16 +15,9 @@ const SignatureVerifier = {
pk = this.getPublicKey();
}
signature = kdbxweb.ByteUtils.base64ToBytes(signature);
let subtle = window.crypto.subtle;
let keyFormat = 'spki';
if (subtle) {
pk = kdbxweb.ByteUtils.base64ToBytes(pk);
} else {
// TODO: remove this shit after Safari 10.2 with spki support goes live
subtle = window.crypto.webkitSubtle;
keyFormat = 'jwk';
pk = this.spkiToJwk(pk);
}
const subtle = window.crypto.subtle;
const keyFormat = 'spki';
pk = kdbxweb.ByteUtils.base64ToBytes(pk);
subtle.importKey(
keyFormat, pk,
algo,
@ -55,22 +48,6 @@ const SignatureVerifier = {
});
},
spkiToJwk(key) {
// This is terribly wrong but we don't want to handle complete ASN1 format here
const n = key
.replace('MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA', '')
.replace('IDAQAB', '')
.replace(/\+/g, '-')
.replace(/\//g, '_');
return kdbxweb.ByteUtils.stringToBytes(JSON.stringify({
kty: 'RSA',
alg: 'RS256',
e: 'AQAB',
n: n,
ext: true
}));
},
getPublicKey() {
if (!this.publicKey) {
this.publicKey = publicKey