
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@semore/ap2-adapter
Advanced tools
AP2 (Agent Payments Protocol) Intent/Cart/Payment VC helpers — Ed25519 did:web signature chain scaffold.
Part of Semore — Agentic Commerce on the AI Grand Cycle. Korean vertical multi-adapter. (ADR-0111)
W3C Verifiable Credentials helpers for the AP2 (Agent Payments Protocol) Intent → Cart → Payment mandate chain.
AP2 establishes a three-step cryptographic chain that lets an AI agent make a payment on behalf of a user while every party (user, agent, merchant) can independently verify the scope and provenance of the authorisation.
What this means for an LLM agent. The mandate chain is how Semore exposes commerce capability overhang to you: you (the agent) author the IntentMandate the moment a user expresses a goal, refine it into a CartMandate against a live catalog, and surface a PaymentMandate at the merchant boundary — all without ever seeing PAN/CVV, and with every step independently verifiable. Capability that used to require a hosted-page redirect now lives inside the agent loop.
Source of Truth: this directory in the Semore monorepo until repo split. The production chain issuance (
issueMandateVC,verifyChain) lives in the internal Semore API atapps/api/src/lib/ap2.ts. This package exposes the stable public shapes and a referenceverifyMandateChainscaffold.Standards-body posture [LEGAL-PENDING]: References to W3C Verifiable Credentials 2.0 and the AP2 Agent Payments Protocol are nominative fair use. Semore claims no endorsement by, affiliation with, or co-authorship of W3C or the AP2 working group. Any co-branded integration is (proposed, subject to joint agreement) with the respective body. [EXTERNAL-ADVISORY]
IntentMandate ──(parent)──▶ CartMandate ──(parent)──▶ PaymentMandate
issuer = user-DID issuer = agent-DID issuer = merchant-DID
what user wants what agent picked what will settle
Each mandate is a W3C VC 2.0 JWT (EdDSA) signed by its issuer DID.
Semore issues the merchant-side link of the chain via did:web:semore.net.
npm install @semore/ap2-adapter
# or
pnpm add @semore/ap2-adapter
import {
createIntentMandate,
createCartMandate,
createPaymentMandate,
verifyMandateChain,
} from "@semore/ap2-adapter";
const intent = createIntentMandate({
issuerDid: "did:web:user.example",
subjectDid: "did:web:user.example",
claims: { naturalLanguage: "buy Korean sunscreen under $30" },
});
const cart = createCartMandate({
issuerDid: "did:web:agent.example",
subjectDid: "did:web:user.example",
parentVcId: intent.id,
claims: { items: [{ skuId: "sku_abc", qty: 1, priceUsd: "24.00" }] },
});
const payment = createPaymentMandate({
issuerDid: "did:web:semore.net",
subjectDid: "did:web:user.example",
parentVcId: cart.id,
claims: { paymentProof: { rail: "card", authCode: "auth_123" } },
});
const result = await verifyMandateChain([intent, cart, payment], {
resolveDid: async (did) => fetchDidDocument(did),
});
IntentMandate, CartMandate, PaymentMandate (W3C VC 2.0).create*Mandate(...) factories that assemble the VC envelope (signing is delegated to
the caller — bring your own Ed25519 key via the sign option).verifyMandateChain(chain, opts) — structural + parent-link + signature verification.resolveDid callback — the canonical did:web
resolver is a single fetch(...).did:web:semore.net keys are not in this repo.Semore publishes its DID document at https://semore.net/.well-known/did.json.
Your resolveDid callback fetches the document, walks verificationMethod, and
imports each public JWK into a CryptoKey keyed by its id.
import type { VerifyChainOptions } from "@semore/ap2-adapter";
interface DidDocument {
readonly id: string;
readonly verificationMethod: ReadonlyArray<{
readonly id: string;
readonly type: string;
readonly controller: string;
readonly publicKeyJwk: JsonWebKey;
}>;
}
const resolveDid: VerifyChainOptions["resolveDid"] = async (did) => {
const url =
did === "did:web:semore.net"
? "https://semore.net/.well-known/did.json"
: `https://${did.replace("did:web:", "")}/.well-known/did.json`;
const res = await fetch(url);
const doc = (await res.json()) as DidDocument;
const keys: Record<string, CryptoKey> = {};
for (const vm of doc.verificationMethod) {
keys[vm.id] = await crypto.subtle.importKey(
"jwk",
vm.publicKeyJwk,
{ name: "Ed25519" },
true,
["verify"],
);
}
return keys;
};
Cache the resolved keys per-DID (Cloudflare KV, an in-memory LRU, or your framework's cache primitive) to avoid re-fetching on every verify call.
semore.hq@gmail.com · GitHub @semore_hqApache-2.0 — see LICENSE.
Copyright (c) Semore Founding Team.
FAQs
AP2 (Agent Payments Protocol) Intent/Cart/Payment VC helpers — Ed25519 did:web signature chain scaffold.
The npm package @semore/ap2-adapter receives a total of 7 weekly downloads. As such, @semore/ap2-adapter popularity was classified as not popular.
We found that @semore/ap2-adapter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.