Neil Patrick's Mansion

    webextension-indieauth

    0.0.8 • Public • Published

    WebExtension-IndieAuth

    This package leverages the WebExtensions identity API and IndieAuth to sign the user in to a browser extension and optionally acquire an access token for future Micropub and Microsub requests.

    npm install webextension-indieauth
    

    Usage

    You must include the following in a background context:

    require("webextension-indieauth")
    

    Call the following from any context (eg. popup, sidebar, ..):

    const indieauth = requires("webextension-indieauth")
    indieauth.signIn("exampleuser.com", "exampleclient.com")
    indieauth.signOut()
    

    Access user data from any context:

    const userData = await indieauth.getUser()
    

    It is stored in the following format:

    {
      me: "https://exampleuser.com",
      profile: {
        name: "Example User",
        email: "example@exampleuser.com"
      },
      endpoints: {
        authorization: "https://exampleuser.com/auth",
        token: "https://exampleuser.com/auth/tokens",
        ticket: "https://exampleuser.com/auth/tickets",
        micropub: "https://exampleuser.com/pub",
        microsub: "https://exampleuser.com/sub",
        webmention: "https://exampleuser.com/mentions"
      },
      code: "hf904hkfx049fkhx943ufh3094ux09ufhnhfhf",
      accessToken: "secret-token:c9q8jif4l34h",
      refreshToken: "secret-token:er8j3cj49f4e"
    }
    

    Install

    npm i webextension-indieauth

    DownloadsWeekly Downloads

    4

    Version

    0.0.8

    License

    CC0-1.0

    Unpacked Size

    16.2 kB

    Total Files

    7

    Last publish

    Collaborators

    • angelogladding