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

@peerpiper/iframe-wallet-sdk

v0.0.13

Published

NOTE: If you simply want to deploy your own wallet, you have options:

Downloads

6

Readme

PeerPiper iFrame Wallet Software Dev Kit

NOTE: If you simply want to deploy your own wallet, you have options:

Use the default PeerPiper Web3 Wallet, or use the kit to make your own / integrate to your back end.

This library contains:

  • ENGINE: The iFrame Wallet engine that can be used with any front end framework, and
  • FRONTEND: The Svelte Wallet Front end as a reference implementation of how to use the engine.

Using the Front End

If you want to host your own wallet, using Svelte simply do:

<script>
	import { FrontEnd } from '@peerpiper/iframe-wallet-sdk';
</script>

<FrontEnd />

That's it, the wallet takes care of the rest.

Using the Engine

If you wanted to use another front end (say, React or some other lesser technology) then you can interface witht the engine.

The engine exports the class and types for use by a front end, simply import them:

Client Connection via PenPal RPC

Since the wallet and keys are held in a separate Browser context (iFrame) the front end needs to connect to the engine via remote procedure call (RPC) using penpal. This is done via a Connector. To establish an RPC Connection to the Wallet Engine via the Connector, the API is:

// Connect to the Wallet engine
import { Connection } from '@peerpiper/iframe-wallet-sdk';

const connection = new Connection();
connector = await connection.init(optionalHandlers);

const connectionReady = async () => {
	connector.walletReady(); // signal to the connector the wallet has loaded
};

Confirm Wallet Transactions

You can set custom wallet confirmation functions by passing them into the config file.

import { handlers } from '@peerpiper/iframe-wallet-sdk';

const confirm = async (confirmSection, params) => {
	// are you sure you want this DApp to sign/decrypt/re-encrypt?
};

// pass the above confirm function to the handlers so they can use it when their methods are called
handlers.setConfig('confirm', confirm);

// the engine will insert this into the process flow
// await confirm(...) // wait for user to approved/disapprove

Connect to Web3 Connector

The SDK also exports handy CONSTANTS to make a connection between the embedded iFrame and the Parent website where the keys are held.

// the website looking to use the iFram Wallet
// ./src/lib/frontend/Conector.svelte
import { CONSTANTS } from '@peerpiper/iframe-wallet-sdk';
CONSTANTS.OPENED_SIGNAL;
CONSTANTS.WINDOW_SYNC;
CONSTANTS.CLOSING;

// the opened Parent Wallet Website
// ./src/lib/frontend/Opened.svelte
import { CONSTANTS } from '@peerpiper/iframe-wallet-sdk';
CONSTANTS.OPENED_SIGNAL;
CONSTANTS.WINDOW_SYNC;
CONSTANTS.CLOSING;

Using the wallet

Since the Wallet is kept in it's own separate browsing context (to keep your keys safely away form the actual website), the Web3 Wallet Connector is used to actually use most of the wallet functionality.

That said, there are a few functions that are used when the wallet is not embedded in another site. These are generating keys and loading keys from storage. These functions are exported as utility functions:

import {
	generateMnemonic,
	generateRsaJwk,
	loadSecrets,
	getLoadedKeys
} from '@peerpiper/iframe-wallet-sdk';

Using the Wallet (via Connector)

Since the Wallet is kept in it's own separate browsing context (to keep your keys safely away form the actual website), the Web3 Wallet Connector is used to actually use most of the wallet functionality.

Web3 Connector: Connector

The Wallet API is used ndirectly through the Connector and the API can be found over at that link, but generally it looks something like:

import { Proxcryptor } from '@peerpiper/iframe-wallet-sdk';

await proxcryptor.getPublicKey();
await proxcryptor.selfEncrypt(symmetricKey, tag); // encrypt something with your key
await proxcryptor.selfDecrypt(tagNode.encryptedKey); // decrypt something you encrypted, no need to Transform it for yourself
await proxcryptor.transformEncrypt(targetPublicKey, tag); // encrypt for another, granting their key access
await proxcryptor.reDecrypt(re_encrypted_message); // decrypt a msg that's been reEncrypted for you

Contributing

Pull requests, issue logs are welcome. Wallet infrastructure should be own by all of us and available to everyone.