Skip to content
Integra Protocol
API

@integraledger/lcp/ap2

The exports of @integraledger/lcp/ap2.

Interfaces

Ap2Offer

Properties

PropertyType
checkoutstring
checkoutJwtstring
payloadPayload

MandateContent

Properties

PropertyType
checkout_hashstring
checkout_jwt?string

Presented

Properties

PropertyTypeDescription
checkout_jwtstringThe checkout JWT the presenter names as the latest.
checkout_mandatestringThe closed Checkout Mandate, an SD-JWT as presented.

Unsigned

Properties

PropertyType
contentobject
content.checkout_hashstring
content.checkout_jwtstring
content.vct"mandate.checkout.1"

Methods

complete()

complete(checkout_mandate): Presented

Parameters
ParameterType
checkout_mandatestring
Returns

Presented

Type Aliases

CheckoutOption

CheckoutOption = object

The checkout's own id, 1–256 characters.

Properties

PropertyType
checkoutstring

Jws

Jws = string

A compact JWS: three base64url segments joined by ".".


Payload

Payload = object

The checkout_jwt payload: the commerce object.

Index Signature

[k: string]: Json

Variables

CHECKOUT_VCT

const CHECKOUT_VCT: "mandate.checkout.1" = "mandate.checkout.1"


checkoutMandate

const checkoutMandate: Readonly<{ advertise: (payload, h, link, offer, agreementUrl?) => Refusal | Payload; bound: (presented) => Promise<`0x${string}` | Refusal>; build: (offer, h) => Promise<Refusal | Unsigned>; claims: boolean; id: "ap2/checkout-mandate"; pattern: LcpPattern; read: (doc) => Refusal | { agreement?: string; h: `0x${string}`; link: string; offer: Ap2Offer; }; tie: (options) => ["ap2", { options: readonly CheckoutOption[]; }]; unplaced: (option) => CheckoutOption; }>


issuedDigest

const issuedDigest: typeof digestJson = digestJson

The option digest the issuer keeps: SHA-256 over the RFC 8785 form.

Functions

checkoutBinding()

checkoutBinding(p): Promise<Refusal | { payload: Payload; }>

AP2's merchant check: the mandate's checkout_hash is the hash of the presenter's latest checkout_jwt, and a disclosed checkout_jwt is that JWT. Returns that JWT's payload.

Parameters

ParameterType
punknown

Returns

Promise<Refusal | { payload: Payload; }>


checkoutJwtOf()

checkoutJwtOf(m): Promise<string | Refusal>

The checkout_jwt the mandate discloses.

Parameters

ParameterType
mstring

Returns

Promise<string | Refusal>


jwsPayload()

jwsPayload(j): Refusal | Payload

The payload of a compact JWS, decoded as one JSON object. The signature is never verified.

Parameters

ParameterType
jstring

Returns

Refusal | Payload


readMandate()

readMandate(m): Promise<Refusal | MandateContent>

The closed Checkout Mandate inside an SD-JWT: exactly one resolved object whose vct is mandate.checkout.1, its checkout_hash, and its checkout_jwt when disclosed.

Parameters

ParameterType
munknown

Returns

Promise<Refusal | MandateContent>


tie()

tie(options): ["ap2", { options: readonly CheckoutOption[]; }]

The binding slot: the checkouts this ATR was minted for, each by its own id.

Parameters

ParameterType
optionsreadonly CheckoutOption[]

Returns

["ap2", { options: readonly CheckoutOption[]; }]

Last updated on

On this page