@integraledger/lcp/ap2
The exports of @integraledger/lcp/ap2.
Interfaces
Ap2Offer
Properties
| Property | Type |
|---|---|
checkout | string |
checkoutJwt | string |
payload | Payload |
MandateContent
Properties
Presented
Properties
| Property | Type | Description |
|---|---|---|
checkout_jwt | string | The checkout JWT the presenter names as the latest. |
checkout_mandate | string | The closed Checkout Mandate, an SD-JWT as presented. |
Unsigned
Properties
| Property | Type |
|---|---|
content | object |
content.checkout_hash | string |
content.checkout_jwt | string |
content.vct | "mandate.checkout.1" |
Methods
complete()
complete(
checkout_mandate):Presented
Parameters
| Parameter | Type |
|---|---|
checkout_mandate | string |
Returns
Type Aliases
CheckoutOption
CheckoutOption =
object
The checkout's own id, 1–256 characters.
Properties
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
constCHECKOUT_VCT:"mandate.checkout.1"="mandate.checkout.1"
checkoutMandate
constcheckoutMandate: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: readonlyCheckoutOption[]; }];unplaced: (option) =>CheckoutOption; }>
issuedDigest
constissuedDigest: typeofdigestJson=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
| Parameter | Type |
|---|---|
p | unknown |
Returns
Promise<Refusal | { payload: Payload; }>
checkoutJwtOf()
checkoutJwtOf(
m):Promise<string|Refusal>
The checkout_jwt the mandate discloses.
Parameters
| Parameter | Type |
|---|---|
m | string |
Returns
Promise<string | Refusal>
jwsPayload()
The payload of a compact JWS, decoded as one JSON object. The signature is never verified.
Parameters
| Parameter | Type |
|---|---|
j | string |
Returns
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
| Parameter | Type |
|---|---|
m | unknown |
Returns
Promise<Refusal | MandateContent>
tie()
tie(
options): ["ap2", {options: readonlyCheckoutOption[]; }]
The binding slot: the checkouts this ATR was minted for, each by its own id.
Parameters
| Parameter | Type |
|---|---|
options | readonly CheckoutOption[] |
Returns
["ap2", { options: readonly CheckoutOption[]; }]
Last updated on