Alby Developer Guide
User GuideDeveloper Portal
Alby Browser Extension APIs
Alby Browser Extension APIs
  • 📚Overview
  • window.webln
    • 👀See Webln.guide
  • window.liquid
    • enable
    • 🆕isEnabled
    • getAddress
    • signPset
    • 🆕on
    • 🆕off
  • window.nostr
    • getPublicKey
    • signEvent
    • nip04.encrypt
    • nip04.decrypt
    • signSchnorr
    • 🆕on
    • 🆕off
  • window.webbtc
    • enable
    • 🆕isEnabled
    • getAddress
    • signPsbt
    • 🆕on
    • 🆕off
  • window.alby
    • enable
    • 🆕isEnabled
    • ➕Adding accounts
Powered by GitBook
LogoLogo

Our content

  • Website
  • Blog
  • GitHub

Follow us

  • Nostr
  • Twitter / X
  • Youtube

Contact us

  • E-mail
  • Community Chat
  • Open Hours

Your bitcoin & nostr companion / from 🐝 with 🧡

On this page
  • API
  • Code Example
  • Screenshots
  • Demo

Was this helpful?

  1. window.alby

Adding accounts

Programmatically add new wallet connections and allow users to connect their account to Alby with a click of a button.

Last updated 1 year ago

Was this helpful?

Albys extension APIs are provided via the window.alby object (very much like ). You don't need to add any dependencies or packages to your project.

API

async function addAccount(request: AddAccountRequest) : AddAccountResponse;

interface AddAccountRequest = {
    name: string;
    connector: string;
    config: object;
}

interface AddAccountResponse = {
    success: boolean;
    error: string?;
}

Name

The display name for the account you want to add to Alby. (this can be changed by users later on, but make sure to provide some recognizable name)

Connector

The parameters vary depending on the type of account you want to add. The following types are available:

  • citadel *

  • commando (Core Lightning)

  • eclair

  • galoy

  • kollider

  • lnbits *

  • lnc (Lightning Node Connect)

  • lnd *

  • lndhub *

* Prefix the type with native if you want to connect via TOR (e.g. nativelnd)

Config

The config contains credentials to connect to the users wallet, they differ by the connector you are trying to connect. Take a look into our repository, choose the connector you are about to add and look for the config object:

This should give you an idea of what parameters need to be provided. Feel free to reach out to us at support@getalby.com in case of any questions, we're happy to help!

Code Example

await window.alby.enable();
const result = await window.alby.addAccount({
  name: "⚡️ LNbits (legend.lnbits.com)", 
  connector: "lnbits", 
  config: {
    "adminkey": "...",
    "url": "https://legend.lnbits.com"
  }
});

Screenshots

Demo

➕
WebLN
https://github.com/getAlby/lightning-browser-extension/tree/master/src/app/screens/connectors