New:Socket for Asana Is Now Available.Learn more
Get Started

@grantex/mpp

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grantex/mpp

Grantex agent identity and delegation for MPP (Machine Payments Protocol)

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

@grantex/mpp

Agent identity and delegation for the Machine Payments Protocol (MPP). Lets merchants verify who authorized an AI agent's payment before fulfilling the request.

Install

npm install @grantex/mpp @grantex/sdk

Quick Start

Issue a Passport

import { Grantex } from '@grantex/sdk';
import { issuePassport } from '@grantex/mpp';

const grantex = new Grantex({ apiKey: process.env.GRANTEX_API_KEY });

const passport = await issuePassport(grantex, {
  agentId: 'ag_01HXYZ...',
  grantId: 'grnt_01HXYZ...',
  allowedMPPCategories: ['inference', 'compute'],
  maxTransactionAmount: { amount: 50, currency: 'USDC' },
  expiresIn: '24h',
});

Attach to MPP Requests

import { createMppPassportMiddleware } from '@grantex/mpp';

const middleware = createMppPassportMiddleware({ passport });
const enrichedRequest = await middleware(new Request(url, init));
const response = await fetch(enrichedRequest);

Verify on Merchant Side

import { verifyPassport, requireAgentPassport } from '@grantex/mpp';

// Standalone
const verified = await verifyPassport(encodedCredential, {
  requiredCategories: ['inference'],
  maxAmount: 10,
});

// Express middleware
app.use('/api/resource', requireAgentPassport({
  requiredCategories: ['inference'],
}));

Trust Registry

import { lookupOrgTrust } from '@grantex/mpp';

const record = await lookupOrgTrust('did:web:acme.com');
// { organizationDID, trustLevel, verificationMethod, domains, verifiedAt }

Error Codes

CodeDescription
PASSPORT_EXPIREDPassport validUntil has passed
PASSPORT_REVOKEDStatusList2021 bit is set
INVALID_SIGNATUREEd25519/RS256 signature verification failed
UNTRUSTED_ISSUERIssuer DID not in trusted list
CATEGORY_MISMATCHPassport categories don't cover required service
AMOUNT_EXCEEDEDPassport max amount below required threshold
MISSING_PASSPORTNo X-Grantex-Passport header
MALFORMED_CREDENTIALInvalid base64url or missing VC fields

License

Apache-2.0

Keywords

grantex

FAQs

Package last updated on 25 Jun 2026

Related posts