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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@flowpay-io/embed-core

v1.1.1

Published

Flowpay SDK - Embed client - Core functionality and utilities

Readme

@flowpay-io/embed-core

Framework-agnostic core library for controlling Flowpay embedded iframe via postMessage.

Installation

pnpm add @flowpay-io/embed-core

Usage

import {
  createFlowpayClient,
  type InputLaunchPayload,
} from "@flowpay-io/embed-core";
import { createSignedLogin } from "@flowpay-io/embed-auth/client";
import { IsoCountryCode } from "@flowpay-io/shared/types";

// Create embed client
const client = createFlowpayClient({
  embedOrigin: "https://my.flowpay.io",
  signatureProvider: {
    signPayload: async (payload) => {
      // Use createSignedLogin to canonicalize, encode, and sign the payload
      // It delegates signature generation to your server (recommended)
      return await createSignedLogin(
        payload,
        async (canonicalPayload: string) => {
          const response = await fetch("/api/sign-payload", {
            method: "POST",
            body: JSON.stringify({ payload: canonicalPayload }),
          });
          const { signature } = await response.json();
          return signature;
        },
      );
    },
  },
});

// Use an iframe with allow attribute for camera, microphone, geolocation - required by KYC verification:
// <iframe id="my-iframe" allow="camera; microphone; geolocation" src="..."></iframe>

// Attach to iframe (after iframe loads)
const iframe = document.getElementById("my-iframe") as HTMLIFrameElement;
iframe.addEventListener("load", async () => {
  if (iframe.contentWindow) {
    client.attach(iframe.contentWindow, client.urls.embedOrigin);
    await client.waitUntilReady();

    // Login with launch payload (merchant = onboarding, customer = existing Flowpay customer)
    const launchPayload: InputLaunchPayload = {
      country: IsoCountryCode.CZ,
      merchantId: "merchant-123",
      partnerCode: "partner-abc",
      regNum: "12345678",
      userId: "user-456",
      email: "[email protected]",
      phone: "+420123456789",
      // createdAt is optional - auto-set by client when autoSetCreatedAt is true (default)
    };
    // For existing customer: { partnerCode, customerId, userId, repId }

    await client.login({ launchPayload });
  }
});

// Listen to events
client.on("ready", () => {
  console.log("Flowpay is ready");
});

client.on("loginSuccess", () => {
  console.log("Login successful");
});

Server-side Implementation

The client-side code above calls /api/sign-payload to sign the canonical payload. Here's an example server-side implementation:

import { generateSignature } from "@flowpay-io/embed-auth/server";

// This endpoint is called by the client-side handleSign callback
app.post("/api/sign-payload", async (req, res) => {
  const { payload: canonicalPayload } = req.body;

  const signature = await generateSignature(
    canonicalPayload,
    async () => process.env.PARTNER_SHARED_SECRET, // Store securely
  );

  res.json({ signature });
});

Configuration

The SDK accepts the following configuration options:

interface FlowpaySdkConfig {
  // Origin of the embedded iframe URL
  embedOrigin?: string;

  // Host origin (defaults to window.location.origin)
  hostOrigin?: string;

  // Allowed host origins for security validation
  allowedhostOrigins?: string[];

  // Enable simulation mode (development only)
  simulationMode?: boolean; // default: false

  // Custom logger
  logger?: {
    debug?: (...args: unknown[]) => void;
    warn?: (...args: unknown[]) => void;
    error?: (...args: unknown[]) => void;
  };

  // Signature provider for secure authentication
  signatureProvider?: SignatureProvider;

  // Automatically set createdAt on payload (default: true)
  autoSetCreatedAt?: boolean;
}

Links