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

@lemmaoracle/agent

v0.0.29

Published

Agent Identity + Authority Credential schema WASM for Lemma circuits

Downloads

958

Readme

@lemmaoracle/agent

Agent Identity + Authority Credential schema for Lemma — implemented as a Rust WASM module with ZK identity-proof circuit.

Schema: agent-identity-authority-v1

Represents a verifiable credential with these field groups:

  • Identity: agentId, subjectId, controllerId, orgId
  • Authority: roles, scopes, permissions
  • Financial: spendLimit, currency, paymentPolicy
  • Lifecycle: issuedAt, expiresAt, revoked, revocationRef
  • Provenance: issuerId, sourceSystem, generatorId, chainContext

Build

cd packages/agent
pnpm build              # Build WASM via wasm-pack
pnpm type-check         # Type-check registration scripts
pnpm test               # Run Rust tests
pnpm register           # Register schema with Lemma
pnpm register:circuit   # Register circuit with Lemma

Registration

First build the WASM, then register with Lemma:

LEMMA_API_KEY=<key> PINATA_API_KEY=<key> PINATA_SECRET_API_KEY=<secret> pnpm register

Usage with Lemma SDK

The WASM schema is loaded and executed by the Lemma SDK's define() function, which:

  1. Downloads the WASM blob (from IPFS or HTTPS)
  2. Instantiates the wasm-bindgen JS shim
  3. Calls normalize(input) to canonicalize credential data
  4. Calls validate(input) for structural validation
import { create, schemas } from "@lemmaoracle/sdk";

const client = create({ apiBase: "...", apiKey: "..." });

// Register the schema
await schemas.register(client, {
  id: "agent-identity-authority-v1",
  description: "Agent Identity + Authority Credential",
  normalize: {
    artifact: { type: "ipfs", wasm: "ipfs://...", js: "ipfs://..." },
    hash: "0x...",
    abi: {
      raw: { identity: "object", authority: "object", ... },
      norm: { "identity.agentId": "string", ... },
    },
  },
  metadata: { type: "agent-identity-authority", version: "1.0.0", ... },
});

Example Credential Payload

{
  "schema": "agent-identity-authority-v1",
  "identity": {
    "agentId": "did:example:agent-42",
    "subjectId": "0x1234567890ABCDEF1234567890ABCDEF12345678",
    "controllerId": "did:example:controller-1",
    "orgId": "org:lemma-labs"
  },
  "authority": {
    "roles": [
      { "name": "operator" },
      { "name": "validator" }
    ],
    "scopes": [
      { "name": "read:data" },
      { "name": "write:data" }
    ],
    "permissions": [
      { "resource": "api", "action": "invoke" },
      { "resource": "ledger", "action": "query" }
    ]
  },
  "financial": {
    "spendLimit": 10000,
    "currency": "USD",
    "paymentPolicy": "pre-authorized"
  },
  "lifecycle": {
    "issuedAt": 1714000000,
    "expiresAt": 1745536000,
    "revoked": false,
    "revocationRef": "rev-list:123"
  },
  "provenance": {
    "issuerId": "did:example:issuer-org",
    "sourceSystem": "lemma-admin",
    "generatorId": "gen:v1.0",
    "chainContext": {
      "chainId": 8453,
      "network": "base"
    }
  }
}

Example Normalized Output

The normalize function canonicalizes all fields:

{
  "schema": "agent-identity-authority-v1",
  "identity": {
    "agentId": "did:example:agent-42",
    "subjectId": "0x1234567890abcdef1234567890abcdef12345678",
    "controllerId": "did:example:controller-1",
    "orgId": "org:lemma-labs"
  },
  "authority": {
    "roles": "operator,validator",
    "scopes": "read:data,write:data",
    "permissions": "api:invoke,ledger:query"
  },
  "financial": {
    "spendLimit": "10000",
    "currency": "USD",
    "paymentPolicy": "pre-authorized"
  },
  "lifecycle": {
    "issuedAt": "2024-04-25T01:46:40.000Z",
    "expiresAt": "2025-04-25T01:46:40.000Z",
    "revoked": "false",
    "revocationRef": "rev-list:123"
  },
  "provenance": {
    "issuerId": "did:example:issuer-org",
    "sourceSystem": "lemma-admin",
    "generatorId": "gen:v1.0",
    "chainId": "8453",
    "network": "base"
  }
}

ZK Circuit: agent-identity-v1

The circuits/ directory contains the agent-identity-v1 Groth16 circuit that proves an agent credential was issued by a trusted authority and is currently valid.

Circuit signals:

| Signal | Visibility | Description | | :--- | :--- | :--- | | identityHash | private | Poseidon hash of normalized identity fields | | authorityHash | private | Poseidon hash of normalized authority fields | | financialHash | private | Poseidon hash of normalized financial fields | | lifecycleHash | private | Poseidon hash of normalized lifecycle fields | | provenanceHash | private | Poseidon hash of normalized provenance fields | | salt | private | Binding randomness | | issuerSecretKey | private | Issuer's secret key for MAC verification | | mac | private | Issuer's MAC over the credentialCommitment | | issuedAt | private | Credential issuance timestamp | | expiresAt | private | Credential expiration (0 = none) | | revoked | private | Revocation flag (must be 0) | | credentialCommitment | public | Poseidon commitment binding all credential fields | | issuerPublicKey | public | Issuer's public key | | nowSec | public | Current unix timestamp |

Constraints:

  1. credentialCommitment = Poseidon6(identityHash, authorityHash, financialHash, lifecycleHash, provenanceHash, salt)
  2. issuerPublicKey = Poseidon1(issuerSecretKey) — key derivation
  3. mac = Poseidon2(credentialCommitment, issuerSecretKey) — issuer signature
  4. issuedAt <= nowSec — credential has been issued
  5. revoked === 0 — not revoked
  6. If expiresAt != 0: nowSec < expiresAt — not expired

Build the circuit:

cd packages/agent/circuits
npm run build

License

MIT