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

@palisadeinc/identity-sdk

v1.0.0-alpha.18

Published

Palisade Identity SDK

Downloads

7

Readme

identity-sdk

JavaScript SDK for the Palisade Identity app integration, including a demo company integration

Palisade Identity JavaScript SDK

Welcome to the Palisade Identity JavaScript SDK repository. This SDK enables developers to easily integrate Palisade Identity's authentication and identity management services into their JavaScript applications.

Table of Contents

Introduction

The Palisade Identity JavaScript SDK provides a set of tools and methods to streamline the implementation of authentication, secure wallet creation (via MPC), transaction signing, transaction submission and passkey secured approval in your JavaScript applications.

Browser Requirements

The Palisade Identity JavaScript SDK makes use of modern browser API's including:

Features

  • User authentication (login, logout, session management)
  • User registration and wallet creation using MPC
  • Secure API requests with token-based authentication
  • Easy integration with JavaScript/TypeScript applications

Installation

Install the SDK via npm:

npm install @palisadeinc/identity-sdk

or via yarn:

yarn add @palisadeinc/identity-sdk

Quick Start

Here's a simple example to get you started with the Palisade Identity SDK:

import { PalisadeIdentitySDK } from "@palisadeinc/identity-sdk";

// Initialize the SDK
const palisade = new PalisadeIdentitySDK({
  clientId: "YOUR_CLIENT_ID",
  iconUrl: "https://placehold.co/40x40",
});

// Call the connect method to initiate the create wallet / login flow
palisade.connect();

Usage

Initializing the SDK

Before using any SDK functions, you must initialize it with your configuration:

import { PalisadeIdentitySDK } from "@palisadeinc/identity-sdk";

const palisade = new PalisadeIdentitySDK({
  clientId: "YOUR_CLIENT_ID",
  iconUrl: "https://placehold.co/40x40",
});

// User creates or connects their Palisade wallet
palisade.on("connected", () => {});

// User disconnects their Palisade wallet
palisade.on("disconnected", () => {});

// User approves a transaction
palisade.on("transaction-approved", (data) => {
  console.log(data.signature, data.id, data.encodedTransaction);
});

// User rejects a transaction
palisade.on("transaction-rejected", () => {});

Methods

Method: palisade.signTransaction(encodedTransaction)

This method is used to initiate the process of signing a transaction. It opens a window to allow the user to use their passkey to approve the transaction.

Parameters

  • encodedTransaction: string - The encoded representation of the transaction that needs to be signed.

Description

When palisade.signTransaction(encodedTransaction) is called, a window is opened where the user can use their passkey to approve the transaction. This method initiates the user authentication and approval process, ensuring the transaction is signed securely.

Example

To sign a transaction, call the palisade.signTransaction method with the encoded transaction data as the parameter. Here's an example of how to do it:

const encodedTransaction = "base64encodedtransactiondata";

palisade.signTransaction(encodedTransaction);

In this example, an encoded transaction is passed to the signTransaction method. The user is then prompted to use their passkey to approve the transaction, completing the signing process.

Method: palisade.submitTransaction(encodedTransaction)

This method is used to submit a transaction to the network. It takes the encoded transaction data as a parameter and sends it for processing.

Usage

To submit a transaction, call the palisade.submitTransaction method with the encoded transaction data as the parameter. Here's an example of how to do it:

palisade.submitTransaction(encodedTransaction);

Parameters

  • encodedTransaction: string - The encoded representation of the transaction that needs to be submitted.

Description

When palisade.submitTransaction(encodedTransaction) is called, the provided encoded transaction data is submitted to the network for processing. This method handles the necessary steps to ensure the transaction is correctly sent and processed by the network.

Example

To submit a transaction, call the palisade.submitTransaction method with the encoded transaction data as the parameter. Here's an example of how to do it:

const encodedTransaction = "base64encodedtransactiondata";

palisade.submitTransaction(encodedTransaction);

Events

Event: connected

This event is triggered when the connection to the Palisade service is successfully established. It does not provide any additional data, as it simply indicates the successful connection.

Example

To handle the connected event, you need to subscribe to it using the palisade.on method. Here's an example of how to do it:

palisade.on("connected", () => {
  console.log("Successfully connected to Palisade service.");
});

Event: disconnected

This event is triggered when the connection to the Palisade service is lost. It does not provide any additional data, as it simply indicates the disconnection.

Example

To handle the disconnected event, you need to subscribe to it using the palisade.on method. Here's an example of how to do it:

palisade.on("disconnected", () => {
  console.log("Disconnected from Palisade service.");
});

Event: transaction-approved

This event is triggered when a user approves a transaction. It provides detailed information about the approved transaction including the signature, transaction ID, and the encoded transaction data.

Event Data Structure

The event handler receives a data object with the following properties:

  • signature: string - The cryptographic signature of the transaction.
  • id: string - The unique identifier of the transaction.
  • encodedTransaction: string - The encoded representation of the transaction.

Example

To handle the transaction-approved event, you need to subscribe to it using the palisade.on method. Here's an example of how to do it:

palisade.on("transaction-approved", (data) => {
  console.log("Transaction Signature:", data.signature);
  console.log("Transaction ID:", data.id);
  console.log("Encoded Transaction:", data.encodedTransaction);
});

Event: transaction-rejected

This event is triggered when a user rejects a transaction. It does not provide any additional data, as it simply indicates the rejection action.

Usage

To handle the transaction-rejected event, you need to subscribe to it using the palisade.on method. Here's an example of how to do it:

palisade.on("transaction-rejected", () => {
  console.log("Transaction was rejected by the user.");
});

Contact

If you have any questions, issues, or feedback, please open an issue on this repository or contact us at [email protected]