mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 23:09:29 -07:00
Add simple WKD validation
This commit is contained in:
parent
0195420448
commit
cca12a2237
1 changed files with 7 additions and 0 deletions
|
@ -39,7 +39,14 @@ const fetchWKD = (id) => {
|
|||
fetchURL: null
|
||||
}
|
||||
|
||||
if (!id.includes('@')) {
|
||||
reject(new Error(`The WKD identifier "${id}" is invalid`));
|
||||
}
|
||||
|
||||
const [, localPart, domain] = /([^\@]*)@(.*)/.exec(id)
|
||||
if (!localPart || !domain) {
|
||||
reject(new Error(`The WKD identifier "${id}" is invalid`));
|
||||
}
|
||||
const localEncoded = await utils.computeWKDLocalPart(localPart)
|
||||
const urlAdvanced = `https://openpgpkey.${domain}/.well-known/openpgpkey/${domain}/hu/${localEncoded}`
|
||||
const urlDirect = `https://${domain}/.well-known/openpgpkey/hu/${localEncoded}`
|
||||
|
|
Loading…
Reference in a new issue