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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ajna-inc/poe-proofs

v0.2.1

Published

Zero-knowledge proofs for Time, Location, and more (POE Protocol) - React Native & Node.js

Readme

@ajna-inc/poe-proofs

Zero-knowledge proofs for Time and Location verification - POE Protocol compatible.

Platform Support

| Feature | React Native | Node.js | |---------|-------------|---------| | Time Proof Generation | Full | - | | Location Proof Generation | Full | - | | Proof Verification | Full | Full | | Poseidon Hashing | Full | Full | | Commitment Computation | Full | Full | | Type Definitions | Full | Full |

React Native: Full proof generation using device sensors (GPS, magnetometer) and blockchain anchoring.

Node.js: Server-side verification of proofs using snarkjs. Proof generation requires mobile device sensors.

Installation

React Native

npm install @ajna-inc/poe-proofs
# or
yarn add @ajna-inc/poe-proofs

iOS

cd ios && pod install

Android

No additional steps required. Native libraries are automatically linked.

Node.js (Verification Only)

npm install @ajna-inc/poe-proofs snarkjs

Usage

React Native - Generate Proofs

import {
  generateTimeProofPOE,
  generateLocationProofPOE,
  verifyTimeProofPOE,
} from '@ajna-inc/poe-proofs';

// Generate a time proof (anchored to Ethereum blockchain)
const timeProof = await generateTimeProofPOE({
  nonce: Date.now(),
  contextHash: 12345,
  sessionId: 67890,
  deviceTimestamp: Math.floor(Date.now() / 1000),
  tolerance: 300, // 5 minutes
});

console.log(`Time proof valid: ${timeProof.isValid}`);
console.log(`Drift: ${timeProof.drift} seconds`);
console.log(`Block: #${timeProof.blockNumber}`);

// Generate a location proof (uses GPS + magnetometer + barometer)
const locationProof = await generateLocationProofPOE({
  nonce: Date.now(),
  contextHash: 12345,
  sessionId: 67890,
  latitude: 37.7749,
  longitude: -122.4194,
  altitudeM: 10,
  gpsAccuracyM: 5,
  magXUt: 22.5,
  magYUt: 5.2,
  magZUt: 42.1,
  pressurePa: 101325,
  proofTimestamp: Math.floor(Date.now() / 1000),
  currentTimestamp: Math.floor(Date.now() / 1000),
  magneticTolerancePercent: 30,
  altitudeToleranceM: 50,
});

console.log(`Location proof valid: ${locationProof.isValid}`);
console.log(`Confidence: ${locationProof.confidenceScore}%`);

Node.js - Verify Proofs

// Import from the package (auto-detects Node.js environment)
import { verifyTimeProofPOE, verifyLocationProofPOE } from '@ajna-inc/poe-proofs';

// Or explicitly import the Node.js module
import { verifyTimeProofPOE } from '@ajna-inc/poe-proofs/node';

// Verify a time proof received from mobile
const isValid = await verifyTimeProofPOE(
  proofJson,           // JSON string from mobile
  publicInputs,        // Array of public input strings
  './time_proof.vkey.json'  // Path to verification key (optional, bundled by default)
);

console.log(`Proof valid: ${isValid}`);

// Verify a location proof
const locationValid = await verifyLocationProofPOE(
  proofJson,
  publicInputs,
  './location_proof.vkey.json'
);

Utility Functions (Both Platforms)

import {
  hash2,
  hash3,
  computeCommitment,
  generateNonce,
  DOMAIN_TAGS,
} from '@ajna-inc/poe-proofs';

// Poseidon hashing (BN254 field)
const hash = hash2(BigInt(1), BigInt(2));

// Generate secure nonce
const nonce = generateNonce();

// Compute domain-separated commitment
const commit = computeCommitment(DOMAIN_TAGS.NONCE, nonce);

API Reference

Proof Generation (React Native Only)

generateTimeProofPOE(input)

Generate a Groth16 time proof anchored to Ethereum blockchain.

interface TimeProofInputNew {
  nonce: number;
  contextHash: number;
  sessionId: number;
  deviceTimestamp: number;
  tolerance: number;
}

generateLocationProofPOE(input)

Generate a Groth16 location proof with magnetic field validation.

interface LocationProofInputNew {
  nonce: number;
  contextHash: number;
  sessionId: number;
  latitude: number;        // GPS latitude (-90 to 90)
  longitude: number;       // GPS longitude (-180 to 180)
  altitudeM: number;       // Altitude in meters
  gpsAccuracyM: number;    // GPS accuracy in meters
  magXUt: number;          // Magnetometer X (microtesla)
  magYUt: number;          // Magnetometer Y (microtesla)
  magZUt: number;          // Magnetometer Z (microtesla)
  pressurePa: number;      // Barometric pressure (Pascals)
  proofTimestamp: number;
  currentTimestamp: number;
  magneticTolerancePercent: number;
  altitudeToleranceM: number;
}

Verification (Both Platforms)

verifyTimeProofPOE(proofJson, publicInputs, vkeyPath?)

Verify a time proof. On React Native, uses native MoPro. On Node.js, uses snarkjs.

verifyLocationProofPOE(proofJson, publicInputs, vkeyPath?)

Verify a location proof.

Hashing & Commitments

hash2(a, b) / hash3(a, b, c)

Poseidon hash functions (BN254 field, matches circomlib).

computeCommitment(domain, value)

Compute domain-separated Poseidon commitment.

DOMAIN_TAGS

Domain separation tags for different commitment types:

  • NONCE, CONTEXT, SESSION, COORDS, MAGNETIC, ALTITUDE, TIMESTAMPS

Utilities

generateNonce() / generateNonceNumber()

Generate cryptographically secure nonces.

scaleCoordinate(coord) / scaleAltitude(meters) / scaleMagnetic(nT)

Scale values for circuit compatibility.

formatAsPOEMessage(proof, programId, messageId)

Format proof as POE DIDComm message.

toSnarkjsFormat(proof)

Convert proof to snarkjs-compatible format.

Verification Keys

Verification keys are bundled with the package:

node_modules/@ajna-inc/poe-proofs/lib/vkeys/
├── time_proof.vkey.json
└── location_proof.vkey.json

You can also access them via:

import timeVkey from '@ajna-inc/poe-proofs/vkeys/time_proof.vkey.json';

Building from Source

Prerequisites

  • Node.js 18+
  • Rust (latest stable)
  • Android NDK 25.1 (for Android)
  • Xcode 15+ (for iOS)

Build Commands

# Install dependencies
npm install

# Build TypeScript + extract verification keys
npm run build

# Build native libraries
npm run build:native

# Run tests
npm test              # Jest unit tests
npm run test:node     # Node.js integration tests

Security

  • Groth16 Proofs: Zero-knowledge proofs using BN254 curve
  • Poseidon Hashing: Efficient ZK-friendly hash function
  • Blockchain Anchoring: Time proofs anchored to Ethereum blocks
  • World Magnetic Model: Location validation against expected magnetic field
  • Anti-Replay: Nonce-based replay protection

License

MIT