npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wd-siww

v1.0.3

Published

Sign in with Ethereum and Cardano Wallets by siww

Downloads

6

Readme

siww

Sign-In With Wallet

This JS package implements a generic connection to Crypto wallets, and a specific implementation per wallet and/or Blockchain. This package is production-ready and is used for user authentication via their wallet. The first implementation was made for Cardano, including connecting to wallet, requesting wallet connect authorization, signing message for authorization. The library now also supports Metamask (multi-chain),Keplr (Cosmos chains, ATOM first), Phantom (Solana) wallets. More to come later...

This library was first made, and is maintained, for SignWithWallet.com

Install

This module is installed directly using npm:

$ npm install @incubiq/siww

API

const SIWW = require('@incubiq/siww');      // the generic access to wallet connectors 
let siwc=SIWW.getConnector("SIWC");         // the Cardano wallets connector (multi-wallet support)
let siwm=SIWW.getConnector("SIWM");         // the Metamask wallet connector (multi-chain support, may lack most chain icons for display)
let siwk=SIWW.getConnector("SIWK");         // the Keplr wallet connector (multi-chain support in principle, currently Cosmos)
let siwp=SIWW.getConnector("SIWP");         // the Phantom wallet connector (multi-chain support in principle, currently Solana)

This library allows you to Authenticate via a Cardano compatible wallet, as well as other wallets, such as Metamask (multi-chain), Keplr (cosmos). More wallet support to come...

siwc.async_initialize({onNotifyAccessibleWallets: function(_aWallet){}, onNotifyConnectedWallet: function(_obj){}, onNotifySignedMessage: function(_wallet){}});

Call this function to initialize the Sign-in With Cardano library. The function takes an optional object as parameter, to allow for callback functions to be called when specific events trigger.

  • 'onNotifyAccessibleWallets(_aWallet)' is called at initialization of the library and detection of all available Cardano wallets (browser plugins).
  • 'onNotifyConnectedWallet(_obj)' is called when a wallet gets connected to our host, either because it was connected during an ealier session, or because the user just connected it. It contains entries to determine which case we are in ({didUserAccept: true/false, didUserClick: true/false, didShowWallet: true/false, wallet: ...})
  • 'onNotifyAccessibleWallets(_wallet)' is called at initialization for each accessible Cardano wallet (browser plugins)

SIWW.async_connectWallet(_id)

Call this function to connect to a wallet whose ID is _id. For example, to connect to a nami Cardano wallet, call 'SIWW.async_connectWallet("nami")' If siwc was first initialized with a callback (onNotifyConnectedWallet), it will be called upon sucessful (or failed) connection. Note that you can call directly siwc.async_connectWallet("nami") or otherwise the more generic SIWW.async_connectWallet("nami") which will recognise "nami" as a cardano wallet and therefore redirect the call to "siwc".

SIWW.async_createMessage(_id, {message: "sample message...", version: "1.0", valid_for: 300})

Call this function to create a message that will be ready for processing by async_signMessage(...)

SIWW.async_signMessage(_id, objSiwcMsg, "authentication");

Call this function to request the wallet to present the end-user with a Sign Message dialog, containing the requested message and some additional info for certified validity of caller. This function will return the message signature as well as a few additional params for server verification of the signature.

License

MIT