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

passkey-kit

v0.9.4

Published

A helper library for creating and using smart wallet accounts on the Stellar blockchain.

Downloads

2,502

Readme

Passkey Kit

[!WARNING]
Code in this repo is demo material only. It has not been audited. Do not use to hold, protect, or secure anything.

Passkey kit is a basic TypeScript SDK for creating and managing Stellar smart wallets. It's intended to be used in tandem with Launchtube for submitting passkey signed transactions onchain however this is not a requirement. This is both a client and a server side library. PasskeyKit on the client and PasskeyServer on the server.

Demo site: passkey-kit-demo.pages.dev

To get started first install the package:

pnpm i passkey-kit

On the client:

const account = new PasskeyKit({
    rpcUrl: env.PUBLIC_rpcUrl,
    networkPassphrase: env.PUBLIC_networkPassphrase,
    factoryContractId: env.PUBLIC_factoryContractId,
});

On the server:

const account = new PasskeyServer({
    rpcUrl: env.PUBLIC_rpcUrl,
    launchtubeUrl: env.PUBLIC_launchtubeUrl,
    launchtubeJwt: env.PRIVATE_launchtubeJwt,
    mercuryUrl: env.PUBLIC_mercuryUrl,
    mercuryJwt: env.PRIVATE_mercuryJwt,
});

This is a fully typed library so docs aren't provided, however there's a full example showcasing all the core public methods in the ./demo directory. I also recommend reviewing the Super Peach repo for an example of how you could implement both the client and server side in a more real-world scenario.

Good luck, have fun, and change the world!

For any questions or to showcase your progress please join the #passkeys channel on our Discord.

Deploy the event indexer

In order to utilize the Mercury Zephyr indexing service to track available signers and reverse lookup smart wallet contract addresses from passkey ids you'll need to deploy the Zephyr program from inside the ./zephyr directory.

cd ./zephyr
cargo install mercury-cli
# Get a JWT from Mercury https://test.mercurydata.app
export MERCURY_JWT="<YOUR.MERCURY.JWT>"
# Make sure you're on Rust version 1.79.0 or newer
mercury-cli --jwt $MERCURY_JWT --local false --mainnet false deploy

TypeScript gotchas

This is a TypeScript library and the npm package doesn't export a JavaScript version. The @stellar/stellar-sdk library is enormous and I really don't wan't folks bundling it up twice. Therefore you'll need to ensure you're transpiling this library into your project and that goes for either a TS project or a JS one. For many of you this will "just work" but for others you'll need to do some fiddling.

For example if you're using NextJS this will mean modifying your next.config.mjs file to include the following packages in the transpilePackages key:

/** @type {import('next').NextConfig} */
const nextConfig = {
    transpilePackages: [
        'passkey-kit', 
        'passkey-factory-sdk', 
        'passkey-kit-sdk',
        'sac-sdk',
    ]
};

export default nextConfig;

If someone smarter than me knows how to include an optional JS build from a TS library please submit a PR. I just don't want to deploy a compiled version of this and wind up having folks doubling up on an already gargantuan dependency.

Contributing

Passkey kit consists of three primary directories:

  • ./src - Contains the TypeScript files for the actual TS SDK library.
  • ./demo - Contains a basic demo of the SDK in action.
  • ./contracts - Contains the Rust Soroban smart contracts of the smart wallet implementation.
  • ./zephyr - Contains the Zephyr program for processing smart wallet events.

To install dependencies:

pnpm i

To build:

pnpm run build

To run the demo:

cd ./demo
pnpm i
pnpm run start

[!IMPORTANT] If you fiddle with contracts in ./contracts you'll need to run the make commands. Just remember to update the WEBAUTHN_FACTORY and WEBAUTHN_WASM values from the make deploy command before running make init.

[!IMPORTANT] Keep in mind the bindings here in ./packages have been heavily modified. Be careful when rebuilding and updating. Likely you'll only want to update the src/index.ts files in each respective package vs swapping out entire directories.