1
0
mirror of https://github.com/keeweb/keeweb.git synced 2024-06-25 07:37:46 +02:00

removed obsolete code

This commit is contained in:
antelle 2019-04-13 11:04:31 +02:00
parent c795784417
commit 6f203f0a3e

View File

@ -15,16 +15,9 @@ const SignatureVerifier = {
pk = this.getPublicKey(); pk = this.getPublicKey();
} }
signature = kdbxweb.ByteUtils.base64ToBytes(signature); signature = kdbxweb.ByteUtils.base64ToBytes(signature);
let subtle = window.crypto.subtle; const subtle = window.crypto.subtle;
let keyFormat = 'spki'; const keyFormat = 'spki';
if (subtle) { pk = kdbxweb.ByteUtils.base64ToBytes(pk);
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);
}
subtle.importKey( subtle.importKey(
keyFormat, pk, keyFormat, pk,
algo, 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() { getPublicKey() {
if (!this.publicKey) { if (!this.publicKey) {
this.publicKey = publicKey this.publicKey = publicKey