Socket
Book a DemoInstallSign in
Socket

@projectlibertylabs/mock-siwf-embedded-wallet-sdk

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@projectlibertylabs/mock-siwf-embedded-wallet-sdk

Mock SIWF SDK for Embedded Wallets

1.1.0
latest
Source
npmnpm
Version published
Weekly downloads
26
2500%
Maintainers
2
Weekly downloads
 
Created
Source

Mock Version of the SIWF Embedded Wallet SDK

NPM Version

Find the real package version here: https://github.com/ProjectLibertyLabs/siwf-embedded-wallet-sdk

Quick Start

Install

npm i @projectlibertylabs/mock-siwf-embedded-wallet-sdk

Use TypeScript/ESM


import { startSiwf } from "@projectlibertylabs/mock-siwf-embedded-wallet-sdk";

// ...
const startSiwfResponse = await startSiwf(
  userAddress,
  signatureFn,
  gatewayFetchFn,
  siwfSignedRequest,
  userHandle,
  email,
  msaCreationCallback,
);
  // ...
};

startSiwf Parameters

  • userAddress: The wallet address of the user
  • signatureFn: Connect the specific embedded wallet to the SDK (see Signature Function below)
  • gatewayFetchFn: Connect the SDK to the Frequency Gateway Account Service (see Gateway Fetch Function below)
  • userHandle: (Optional, New User Only) The user supplied handle to register
  • email: (Optional, New User Only) The user's email address for generating the values for the Recovery System
  • msaCreationCallback: (Optional) Will be called with the final MSA Id and Handle for the user (see MSA Callback Function below)

Function Details

Signature Function

This function connects your embedded wallet to the SIWF interface. It follows the same interface as the window.ethereum.request method, although is reduced in scope.

There are only two methods requested: eth_signTypedData_v4 for EIP-712 signature requests and personal_sign for CAIP-122 Sign In with X standard.

TypeScript Types

type SignatureFn = (request: WindowEthereumRequest) => Promise<string>;

Gateway Fetch Function

This function connects the SDK to your instance of Frequency Gateway Account Service. Remember that Account Service is NOT a public facing service, so MUST be securely proxied. This function will only call two endpoints, but you must map those endpoints to your own endpoints.

Endpoints Called

TypeScript Types

type Address = string;

type GatewayFetchFn = (
  method: "GET" | "POST",
  path: `/v1/accounts/account/${Address}` | "/v2/accounts/siwf",
  body?: undefined | { authorizationPayload: string; },
) => Promise<Response>;

MSA Callback Function

When a new user signs up, the allocation of the MSA Id on-chain can take some time. This callback will be called once the allocation is completed, or if the user already has an account, it will return the value without waiting.

interface AccountResponse {
  msaId: string;
  handle?: {
    base_handle: string;
    canonical_base: string;
    suffix: number;
  };
}

type MsaCreationCallbackFn = (account: AccountResponse) => void;

Turnkey Embedded Wallet

Examples and details for the Turnkey Embedded Wallet can be found Turnkey.md.

What does it mock?

  • DOES call the SignatureFn and GatewayFetchFn with the correct parameters.
  • DOES NOT use the responses from either the SignatureFn or the GatewayFetchFn.
  • Uses requests that may NOT validate for GatewayFetchFn due to the static nature, but they do have the correct structure.
  • Responses are static.
  • DOES NOT currently return the Recovery Secret or the original credential values

FAQs

Package last updated on 25 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.