1
0
Fork 1
mirror of https://codeberg.org/keyoxide/doipjs.git synced 2025-04-21 22:01: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:
Wiktor Kwapisiewicz 2025-03-24 14:11:56 +01:00
parent 9838d8d33e
commit 0b3a6ef062
No known key found for this signature in database

View file

@ -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)