Skip to main content

webfinger package for NodeJS

About 14 years ago, I created a webfinger package for NodeJS. At the time, NodeJS was only a few years old. I had created pump.io as a new social networking engine and the successor to StatusNet. I needed a client for webfinger lookup -- the process of converting a user@domain.tld handle to a API endpoint for processing messages -- and there wasn't one for NodeJS, so I made it. It is kind of an antique -- very old callback-style code that has its own HTTP processing system. It supported the […]
Evan Prodromou

About 14 years ago, I created a webfinger package for NodeJS. At the time, NodeJS was only a few years old. I had created pump.io as a new social networking engine and the successor to StatusNet. I needed a client for webfinger lookup — the process of converting a user@domain.tld handle to a API endpoint for processing messages — and there wasn’t one for NodeJS, so I made it.

It is kind of an antique — very old callback-style code that has its own HTTP processing system. It supported the older version of Webfinger, RFC 6415, using XML for the data format. It also supported the (at that time) new Webfinger specification, RFC 7033.

Since its last release in 2013, version 0.4.2, I hadn’t touched the project. It’s just been languishing in the npm repository, squatting on the “webfinger” package name, and collecting dust. The Webfinger RFC was published, ActivityPub was standardized, and the Fediverse grew and grew, without a single change to the package.

I realized I was sitting on this package a couple of years, ago, and I’ve been wanting to get a new version out. This week, I just did it. I ripped out all the legacy support for RFC 6415, upgraded the tests to use the Node test runner, switched from callback style to async/await, changed to ESM modules, and changed the format to StandardJS.

I also added a little utility method, so it’s easier to look up links in the JRD file that is returned. Now, to get an ActivityPub actor, you just do this:

const types = [ 'application/activity+json', 'application/ld+json; profile="w3.org/ns/activitystreams"&apo;]const actorId = (await webfinger('user1@foo.example')).link('self', types)?.href

I think the dependencies are low enough that you can use this version of the library from browser apps, although I haven’t tried it yet.

Anyway, I published version 0.5.1 today. I hope it provides some value to other people working on Fediverse software.

3 Boosts
0 Likes