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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@uniswap/tamperproof-transactions

v2.0.0

Published

Implementation of EIP-7754

Readme

tamperproof-transactions

Implementation of EIP-7754

Installation

yarn add @uniswap/tamperproof-transactions
# or
npm install @uniswap/tamperproof-transactions

API

Supported algorithms

Algorithms are specified using standard JWS-style names. The library currently supports:

'ES256' | 'ES384' | 'ES512' | 'EdDSA' | 'PS256' | 'PS384' | 'PS512' | 'RS256' | 'RS384' | 'RS512'

sign(data, privateKeyHex, algorithm): Promise<string>

Signs input using Web Crypto with the given algorithm.

  • data: string | object. If an object is provided, it is serialized to bytes using canonical JSON (sorted keys, undefined dropped).
  • privateKeyHex: PKCS#8-encoded private key as a hex string (with or without 0x).
  • algorithm: one of the supported algorithm names listed above.
  • Returns a Promise<string> resolving to a hex string signature prefixed with 0x. For ECDSA algorithms, the signature is raw r || s bytes.

Example

import { sign } from '@uniswap/tamperproof-transactions';

const data = { method: 'eth_sendTransaction', params: { to: '0xabc...', value: '0x1' } };
const privateKeyHex = '0x...'; // PKCS#8 private key, hex-encoded
const signature = await sign(data, privateKeyHex, 'RS256');

verifyAsyncJson(calldata, signatureHex, url, id): Promise<boolean>

Verifies a signature by fetching a manifest of public keys (over HTTPS) and selecting the key with matching id.

  • calldata: string | object (object is canonicalized the same way as in sign).
  • signatureHex: hex string signature (with or without 0x).
  • url: a URL instance pointing to the manifest (must be https:).
  • id: string identifier of the public key within the manifest.

Example

import { verifyAsyncJson } from '@uniswap/tamperproof-transactions';

const url = new URL('https://example.com/keys.json');
const ok = await verifyAsyncJson({ foo: 'bar' }, '0x...', url, '1');

verifyAsyncDns(calldata, signatureHex, host, id): Promise<boolean>

Resolves a DNS TXT record for host using DNS-over-HTTPS, extracts a TWIST= path, fetches the manifest over HTTPS, and verifies the signature using the key with the provided id.

  • calldata: string.
  • signatureHex: hex string signature (with or without 0x).
  • host: domain name to query for a TXT record containing TWIST=.
  • id: string identifier of the public key within the manifest.

Example

import { verifyAsyncDns } from '@uniswap/tamperproof-transactions';

const ok = await verifyAsyncDns('hello', '0x...', 'example.com', '1');

verify(calldata, signatureHex, publicKey, algorithm): Promise<boolean>

Lower-level verification helper if you already have a CryptoKey public key object.

  • publicKey: a Web Crypto CryptoKey imported for verification.
  • algorithm: one of the supported algorithm names listed above.

generate(...publicKeys): string

Generates a JSON manifest string containing an array of public keys.

Types

type PublicKey = {
  key: string; // SPKI-encoded public key as hex (with or without 0x)
  algorithm: 'ES256' | 'ES384' | 'ES512' | 'EdDSA' | 'PS256' | 'PS384' | 'PS512' | 'RS256' | 'RS384' | 'RS512';
};

The returned JSON has the shape:

{
  "publicKeys": [
    { "id": "1", "alg": "RS256", "publicKey": "0x..." }
  ]
}

Example

import { generate } from '@uniswap/tamperproof-transactions';

const json = generate({ key: '0x...', algorithm: 'RS256' });

Utilities

The following helpers are also exported:

  • canonicalStringify(value: unknown): string
  • serializeRequestPayload<T>(value: T): Uint8Array

These are used internally to canonicalize objects before signing/verifying.


License

MIT