mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 14:59:29 -07:00
Improve fetchKeys function
This commit is contained in:
parent
51110408b1
commit
ae89964feb
1 changed files with 4 additions and 1 deletions
|
@ -133,6 +133,7 @@ async function encryptMessage(opts) {
|
||||||
};
|
};
|
||||||
|
|
||||||
async function fetchKeys(opts) {
|
async function fetchKeys(opts) {
|
||||||
|
// Init
|
||||||
let lookupOpts, wkd, hkd, sig, lastPrimarySig;
|
let lookupOpts, wkd, hkd, sig, lastPrimarySig;
|
||||||
let output = {
|
let output = {
|
||||||
publicKey: null,
|
publicKey: null,
|
||||||
|
@ -143,6 +144,7 @@ async function fetchKeys(opts) {
|
||||||
sigContent: null
|
sigContent: null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Fetch keys depending on the input mode
|
||||||
switch (opts.mode) {
|
switch (opts.mode) {
|
||||||
case "plaintext":
|
case "plaintext":
|
||||||
output.publicKey = (await openpgp.key.readArmored(opts.input)).keys[0];
|
output.publicKey = (await openpgp.key.readArmored(opts.input)).keys[0];
|
||||||
|
@ -201,7 +203,8 @@ async function fetchKeys(opts) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
output.fingerprint = output.publicKey.primaryKey.getFingerprint();
|
// Gather more data about the primary key and user
|
||||||
|
output.fingerprint = await output.publicKey.primaryKey.getFingerprint();
|
||||||
output.user = await output.publicKey.getPrimaryUser();
|
output.user = await output.publicKey.getPrimaryUser();
|
||||||
lastPrimarySig = output.user.selfCertification;
|
lastPrimarySig = output.user.selfCertification;
|
||||||
output.notations = lastPrimarySig.notations || [];
|
output.notations = lastPrimarySig.notations || [];
|
||||||
|
|
Loading…
Reference in a new issue