mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 23:09:29 -07:00
Fix dynamic key loading
This commit is contained in:
parent
15516c02e6
commit
f8bd9a3685
1 changed files with 10 additions and 8 deletions
|
@ -109,18 +109,20 @@ const fetchProfileKey = async function() {
|
||||||
const rawKeyData = await fetch(window.kx.key.url)
|
const rawKeyData = await fetch(window.kx.key.url)
|
||||||
let key, errorMsg
|
let key, errorMsg
|
||||||
|
|
||||||
// try {
|
|
||||||
// key = (await openpgp.key.read(await rawKeyData.arrayBuffer())).keys[0]
|
|
||||||
// } catch(error) {
|
|
||||||
// errorMsg = error.message
|
|
||||||
// }
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
key = (await openpgp.key.readArmored(await rawKeyData.text())).keys[0]
|
key = (await openpgp.key.read(new Uint8Array(await rawKeyData.clone().arrayBuffer()))).keys[0]
|
||||||
} catch (error) {
|
} catch(error) {
|
||||||
errorMsg = error.message
|
errorMsg = error.message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!key) {
|
||||||
|
try {
|
||||||
|
key = (await openpgp.key.readArmored(await rawKeyData.clone().text())).keys[0]
|
||||||
|
} catch (error) {
|
||||||
|
errorMsg = error.message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
window.kx.key.object = key
|
window.kx.key.object = key
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue