Socket
Socket
Sign inDemoInstall

webfinger.js

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webfinger.js

a simple webfinger record lookup library


Version published
Maintainers
1
Created
Source

webfinger.js

A webfinger client that runs both in the browser and in node.js.

Build Status license downloads release

Features

  • defaults to TLS only

  • optional URI fallback (for older services which use host-meta or host-meta.json URI endpoints)

  • optional support for WebFist

Initialize

node.js

In node.js you should first require the module:

  var WebFinger = require('webfinger.js');

Browser

When you include the src/webfinger.js script, a WebFinger object will be exposed.

Use

  var webfinger = new WebFinger({
    webfist_fallback: true,  // defaults to false
    tls_only: true,          // defaults to true
    uri_fallback: false,     // defaults to false
    request_timeout: 10000,  // defaults to 10000
  });

  webfinger.lookup('nick@silverbucket.net', function (err, p) {
    if (err) {
      console.log('error: ', err.message);
    } else {
      console.log(p);
    }
  });


// example output:
// {
//   idx: {
//     properties: {
//       name: "Nick Jennings"
//     },
//     links: {
//       avatar: [{ href: '<url>' }],
//       blog: [{ href: '<url>' }],
//       vcard: [href: '<url' }]
//       ... etc.
//     },
//   }
//   json: { ... raw json output ... }
//   object: { ... unformatted but parsed into native javascript object ... }
// }

  webfinger.lookupLink('nick@silverbucket.net', 'remotestorage' function (err, p) {
    if (err) {
      console.log('error: ', err.message);
    } else {
      console.log(p);
    }
  });

// example output (if at least one link with rel="remotestorage" exists):
// {
//   href: 'https://storage.5apps.com/nick',
//   rel : 'remotestorage',
//   properties: {
//     'http://remotestorage.io/spec/version': 'draft-dejong-remotestorage-02',
//     'http://tools.ietf.org/html/rfc6749#section-4.2': 'https://5apps.com/rs/oauth/nick',
//     'http://tools.ietf.org/html/rfc6750#section-2.3': false,
//     'http://tools.ietf.org/html/rfc2616#section-14.16': false
//   }
// }

Demo

See a working demo here

License

webfinger.js is released under the LGPL. See LICENSE

Keywords

FAQs

Package last updated on 12 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc