Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Webfinger

eschnou edited this page · 3 revisions

Webfinger is an HTTP based protocol whose aim is to discover information on resources represented by an email like identifier.

Spec: http://code.google.com/p/webfinger/wiki/WebFingerProtocol.

lookup(identifier, callback);

Perform a lookup on an acct: uri identifier and return a JSON representation of the resource XRD.

Example:

var Ostatus = require('ostatus');
Ostatus.webfinger.lookup("acct:eschnou@identi.ca", function(err, result) {
  console.log(util.inspect(result));
});

Will output:

{ 
  subject: 'acct:eschnou@identi.ca',
  alias: 
   [ 'http://identi.ca/user/16106',
     'http://identi.ca/eschnou' ],
  links: 
   [ { href: 'http://identi.ca/eschnou',
       type: 'text/html',
       rel: 'http://webfinger.net/rel/profile-page' },
     { href: 'http://identi.ca/eschnou/hcard',
       type: 'text/html',
       rel: 'http://microformats.org/profile/hcard' }
   ]
}

hostXrd(host, callback)

Render the domain's host-meta XRD. In practice, it just render this template and replace the {{host}} variable with the argument.

this could definitively be improved

Example:

var Ostatus = require('ostatus');
Ostatus.webfinger.hostXrd("example.com", function(err, result) {
  console.log(result);
});

userXrd(subject, alias, links, callback)

Render the user's XRD with the provided Subject, Alias and Links. In practice, it just render this template.

Example:

var Ostatus = require('ostatus');
var links = [
     {
         rel:  "http://microformats.org/profile/hcard",
         href: "http://example.com/hcard/user"
     },
     {
         rel:  "salmon",
         href: "http://example.com/salmon/user"
     }
]

Ostatus.webfinger.userXrd("acct:user@example.com", "http://example.com/user", links, function(err, result) {
  console.log(result);
});
Something went wrong with that request. Please try again.