2.7.1 • Published 3 years ago

webfinger.js v2.7.1

Weekly downloads
2,356
License
AGPL
Repository
github
Last release
3 years ago

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

2.7.1

3 years ago

2.7.0

5 years ago

2.6.6

7 years ago

2.6.5

7 years ago

2.6.4

7 years ago

2.6.3

7 years ago

2.6.2

7 years ago

2.6.1

7 years ago

2.6.0

7 years ago

2.5.0

8 years ago

2.4.2

8 years ago

2.4.1

8 years ago

2.4.0

8 years ago

2.3.2

8 years ago

2.3.1

8 years ago

2.3.0

8 years ago

2.2.1

9 years ago

2.2.0

9 years ago

2.1.4

9 years ago

2.1.3

9 years ago

2.1.2

10 years ago

2.1.1

10 years ago

2.1.0

10 years ago

2.0.5

10 years ago

2.0.4

10 years ago

2.0.3

10 years ago

2.0.2

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago