Sign In

@peac/adapter-x402-pinata

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@peac/adapter-x402-pinata

Pinata private IPFS objects event normalizer for PEAC protocol

latest
Source
npmnpm
Version
0.9.31
Version published
Weekly downloads
5
-16.67%
Maintainers
1
Weekly downloads
 
Created
Source

@peac/adapter-x402-pinata

x402+Pinata private IPFS objects adapter for PEAC protocol.

Maps Pinata private object access events to PaymentEvidence using the PEIP-OBJ/private@1 subject profile.

Installation

pnpm add @peac/adapter-x402-pinata

Usage

import { fromAccessEvent, fromWebhookEvent } from '@peac/adapter-x402-pinata';

// Process an access event with CIDv0
const result = fromAccessEvent({
  accessId: 'acc_abc123',
  cid: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG',
  amount: 250, // in minor units (cents)
  currency: 'USD',
  visibility: 'private',
  contentType: 'application/json',
  contentSize: 1024,
});

if (result.ok) {
  console.log(result.value); // PaymentEvidence
  // evidence includes: store: 'ipfs', object_id: <CID>, profile: 'PEIP-OBJ/private@1'
} else {
  console.error(result.error);
}

// Process an access event with CIDv1
const resultV1 = fromAccessEvent({
  accessId: 'acc_xyz789',
  cid: 'bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku',
  amount: 100,
  currency: 'USD',
  ttl: 3600, // 1 hour
  expiresAt: '2025-12-31T23:59:59Z',
});

// Process a webhook event
const webhookResult = fromWebhookEvent({
  type: 'access.granted',
  data: {
    accessId: 'acc_def456',
    cid: 'QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG',
    amount: 500,
    currency: 'USD',
  },
});

Configuration

import { fromAccessEvent, type PinataConfig } from '@peac/adapter-x402-pinata';

const config: PinataConfig = {
  defaultEnv: 'test',
  defaultVisibility: 'private',
  allowedGateways: ['my-gateway.pinata.cloud'],
};

const result = fromAccessEvent(event, config);

Supported CID Formats

  • CIDv0: Base58btc encoded (starts with Qm)
  • CIDv1: Base32 encoded (starts with bafy or other multibase prefixes)

Documentation

See peacprotocol.org for full documentation.

License

Apache-2.0

PEAC Protocol is an open source project stewarded by Originary and community contributors.

Originary | Docs | GitHub

FAQs

Package last updated on 13 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts