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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@projectlibertylabs/siwf-sdk-web

v1.0.1

Published

SIWF SDK for Web

Readme

Sign-In With Frequency (SIWF) Web Button SDK

🚀 Sign-In With Frequency (SIWF) is an authentication SDK designed for seamless integration with web applications.

This repository contains the SIWF Button Web SDK and example implementation for seamless integration and as a reference for how to use the SIWF Button in your web app.

📌 Index

  1. 🚀 Getting Started - SIWF Button Demo
  2. 📝 Getting Started - SIWF Button For Your Web App
  3. 🛠 Usage For Your Web App
  4. ⚙️ Configuration Options
  5. 🤝 Contributing

🚀 Getting Started - SIWF Button Demo

Follow these steps to set up and run the demo:

1️⃣ Clone the Repository

Run the following command in your terminal to clone the repository:

git clone [email protected]:ProjectLibertyLabs/siwf.git
cd siwf/libraries/sdk-web

2️⃣ Install Dependencies (if any)

No external dependencies are required! The SDK is designed to be lightweight and dependency-free.

3️⃣ Run the Demo

Start a local server to view the example (for example using npx serve):

npx serve -p 3000 .

4️⃣ Open in Browser

Open your browser and navigate to:

http://localhost:3000/example.html

Your SIWF Button Example should now be running! 🚀

📝 Getting Started - SIWF Button For Your Web App

⚙️ Requirements

The SIWF Button SDK is compatible with all modern browsers:

  • Chrome v53+
  • Firefox v63+
  • Edge v79+
  • Safari (macOS) v10+
  • Safari (iOS) v11+
  • Opera v40+

📥 Installation

Simply include the SDK in your HTML from jsDelivr (update the version as needed):

<script src="https://cdn.jsdelivr.net/npm/@projectlibertylabs/[email protected]/siwf-sdk-web.min.js"></script>

Or download from GitHub Releases and include it locally:

<script src="path/to/siwf-sdk-web.min.js"></script>

🛠 Usage For Your Web App

When you decide to use the SIWF Button in your own web app, follow the steps below for easy integration:

1️⃣ Define the SIWF Authentication Details

2️⃣ Display the SIWF Sign-In Button

You have two options to add the button to your UI:

Option A: Declarative HTML Implementation

<!-- Add a button container with data attributes -->
<div data-siwf-button="YOUR_ENCODED_SIGNED_REQUEST" data-siwf-mode="primary" data-siwf-endpoint="mainnet"></div>

Option B: JavaScript Implementation

<div id="siwf-button-container"></div>

<script>
  // Render a button
  SiwfButton.render("#siwf-button-container", "YOUR_ENCODED_SIGNED_REQUEST", {
    mode: "primary",
    endpoint: "mainnet",
  });
</script>

3️⃣ Handle Authentication Callbacks

Make sure your backend is configured to handle the authentication callback:

  1. The authentication callback URL must match what was specified in your signed request
  2. When the authentication flow completes, the user will be redirected to your callback URL
  3. Your backend should process the authentication response and initiate a session

Resources:

⚙️ Configuration Options

Button Modes

The SIWF Button supports three visual styles:

// Primary mode (teal background, default)
SiwfButton.render("#container", encodedRequest, { mode: "primary" });

// Light mode (white background with border)
SiwfButton.render("#container", encodedRequest, { mode: "light" });

// Dark mode (black background)
SiwfButton.render("#container", encodedRequest, { mode: "dark" });

Environments

Choose the authentication environment:

// Production environment
SiwfButton.render("#container", encodedRequest, { endpoint: "mainnet" });

// Testing environment
SiwfButton.render("#container", encodedRequest, { endpoint: "testnet" });

// Custom environment
SiwfButton.render("#container", encodedRequest, { endpoint: "https://custom-mock.example.com" });

All Configuration Options

| Option | Type | Default | Description | | ----------------------------- | ------ | ------------- | ---------------------------------------------------------------------- | | mode | string | 'primary' | Button style: 'primary', 'light', or 'dark' | | endpoint | string | 'mainnet' | Authentication environment: 'mainnet', 'testnet', or a custom URL | | assetsUrl | string | default URL | URL to fetch button assets from | | additionalCallbackUrlParams | string | '' | Additional parameters to add to the callback URL (query string format) |

Data Attributes

When using HTML declarative implementation, you can configure the button with these attributes:

| Attribute | Description | | ------------------------------------- | ---------------------------------------------------- | | data-siwf-button | Required. The encoded signed request | | data-siwf-mode | Button style (primary, light, or dark) | | data-siwf-endpoint | Environment (mainnet, testnet, or custom URL) | | data-siwf-assets-url | Custom assets URL | | data-additional-callback-url-params | Additional callback parameters (query string format) |

🤝 Contributing

To contribute:

  • Fork the repo and create a feature branch.
  • Make changes and test.
  • Submit a pull request with details.

What's an Encoded Signed Request?

The encoded signed request is a Base64URL-encoded JSON string containing the necessary information for authentication. This includes:

  • The public key to verify signatures
  • The signature data
  • Callback URL
  • Requested permissions and credentials

Your application backend or integration partner should provide this encoded signed request.

Security Best Practices

  • Always validate authentication responses server-side
  • Use HTTPS in production
  • Set appropriate Content Security Policy (CSP) headers when deploying
  • Never store or expose private keys in client-side code

Developing

Running Tests

This uses visual regression testing. Therefore it is important to run the tests on the correct platform. There are Linux and Docker versions of this test setup:

  • Run Visual Regression Tests
    • Linux: npm test
    • Docker: npm run test:docker
  • Update Visual Regression Snapshots
    • Linux: npm run test:update
    • Docker: npm run test:update:docker

Release Process

  1. Make a new GitHub Release.
  2. Tag it with the version and the prefix sdk-web- i.e. sdk-web-v1.0.0.
  3. Complete the release notes.
  4. CI will run the NPM package release process, tagging it with that version and latest.

Note: You may also append the -rc<int> (-rc2) suffix to generate a pre-release.

License

Apache-2.0