1.5.0 • Published 3 months ago

@socketfi/sdk v1.5.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

🔌 SocketFi SDK

A lightweight JavaScript SDK for connecting to a SocketFi Smart Wallet from your web app.

This SDK provides a simple interface to:

  • Initiate a SocketFi smart wallet connection
  • Retrieve active session
  • Log out and clear the session

⚙️ Installation

You can install this SDK via npm:

npm install @socketfi-sdk

How to use SocketFi SDK

1. Import the SDK

import {
  socketConnect,
  getSocketSession,
  deleteSocketSession,
} from "@socketfi/sdk";

2. Initiate a Connection

This triggers a full-screen modal that lets the user connect their SocketFi smart wallet via passkey login.

const { userProfile, accessToken } = await socketConnect();
console.log("Connected user:", userProfile);

3. Get the Active Session

Check if the user is already connected:

const session = await getSocketSession();

if (session) {
  console.log("User is already connected:", session.userProfile);
} else {
  console.log("No active session.");
}

4. Clear the Session

To log out or disconnect the current user:

await deleteSocketSession();
console.log("User session cleared.");
1.5.0

3 months ago

1.4.0

3 months ago

1.3.0

3 months ago

1.2.0

3 months ago

1.1.0

3 months ago

1.0.5

3 months ago

1.0.4

3 months ago

1.0.2

3 months ago

1.0.1

3 months ago

1.0.0

3 months ago