mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2025-04-22 06:11:32 -06:00
Add support for verifying OFTC IRC accounts
OFTC IRC server does not support `TAXONOMY` feature that is used by Libera Chat. As a fallback this patch introduces checking the `URL` INFO field that can be set with `SET URL ...` message to `NickServ`. Tested using the following code: ```js doip = require('.') doip.fetcher.irc.fn({nick: 'wiktor', domain: 'irc.oftc.net'}, { claims: { irc: { nick: 'fgafbyuaer' }}}).then(console.log.bind(console), console.error.bind(console)) ``` which prints: ```json [ 'aspe:metacode.biz:CK7LM6VO32K2AGIDXC7LYFRBSA' ] ``` Signed-off-by: Wiktor Kwapisiewicz <wiktor@metacode.biz>
This commit is contained in:
parent
9838d8d33e
commit
0b3a6ef062
1 changed files with 11 additions and 0 deletions
|
@ -68,6 +68,7 @@ export async function fn (data, opts) {
|
|||
})
|
||||
const reKey = /[a-zA-Z0-9\-_]+\s+:\s((?:openpgp4fpr|aspe):.*)/
|
||||
const reEnd = /End\sof\s.*\staxonomy./
|
||||
const reUrl = /[^a-zA-Z0-9\-_]((?:openpgp4fpr|aspe):[a-zA-Z0-9:\-.]+)/
|
||||
const keys = []
|
||||
|
||||
// @ts-ignore
|
||||
|
@ -88,6 +89,16 @@ export async function fn (data, opts) {
|
|||
client.disconnect()
|
||||
resolve(keys)
|
||||
}
|
||||
/// OFTC does not support TAXONOMY but supports URL in INFO
|
||||
if (text.includes('Unknown command') && text.includes('TAXONOMY')) {
|
||||
client.send(`PRIVMSG NickServ INFO ${data.nick}`)
|
||||
} else {
|
||||
const match = text.match(reUrl)
|
||||
if (match) {
|
||||
client.disconnect()
|
||||
resolve([match[1]])
|
||||
}
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
reject(error)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue