ap2_mandate_verifier 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.ja.md +15 -6
- data/README.md +15 -6
- data/docs/PAYMENT.md +3 -3
- data/docs/POST_RELEASE_110.md +39 -0
- data/docs/PUBLIC_API.md +8 -4
- data/docs/RELEASE_110_CANDIDATE.md +2 -0
- data/docs/RELEASE_120_CANDIDATE.md +32 -0
- data/docs/SELECTIVE_PAYMENT.md +67 -0
- data/docs/evidence/1.1.0_publication.json +101 -0
- data/examples/selective_payment.rb +71 -0
- data/lib/ap2_mandate_verifier/payment.rb +5 -0
- data/lib/ap2_mandate_verifier/selective_payment.rb +259 -0
- data/lib/ap2_mandate_verifier.rb +1 -0
- metadata +10 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e431208b52fd8a58051de955bc910cbc6e2664808fe53a765914e952e4d2099
|
|
4
|
+
data.tar.gz: cf859059c924aa787c332e35025353a5081f86046ae58bb5e24fc4699a0e9831
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4fb8fc6295bd87b021479ea09f9dc6e3508514af54c3f61a0bfa36c0b25e4594a3f1c61d66223c86322b055be5336ce3507f821016e020c5026f1f9de92e1413
|
|
7
|
+
data.tar.gz: f31945327b10670c340541815e131a5246e51dcc0c8faceb9f6a6a29895072172fad916fc3a7fd76087ecd991c6ac35f97eb80c6088f5304ca926699a55e52b7
|
data/README.ja.md
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
# AP2 Mandate Verifier — Checkout委任のRuby SDK
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
### 次期1.2.0候補:Payment候補の選択的開示(未公開)
|
|
4
4
|
|
|
5
|
-
1.1.0
|
|
5
|
+
公開済み安定版は引き続き1.1.0です。新しい明示的な`SelectivePayment` profileで、支払先・決済手段の非選択候補を送らずに検証できます。必須条件・委任・原文参照は省略しません。[API・プライバシー・Python差分](docs/SELECTIVE_PAYMENT.md)、[保持/送信を比較するRuby単体例](examples/selective_payment.rb)、[候補・公開準備](docs/RELEASE_120_CANDIDATE.md)。既存`Payment`の既定profileは変更しません。
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
### 公開済み1.1.0:Payment
|
|
9
|
+
|
|
10
|
+
Direct/条件付きPayment Mandateと成功/エラーPayment Receiptを追加しました。[API・制約・信頼境界](docs/PAYMENT.md)、[Ruby単体サンプル](examples/payment.rb)、[公開照合記録](docs/POST_RELEASE_110.md)、[GitHub Release](https://github.com/cuichangquan/ap2-mandate-verifier/releases/tag/v1.1.0)。検証成功は実行許可ではなく、永続的・原子的な単発利用管理と実決済は利用アプリの責任です。
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
gem install ap2_mandate_verifier --version 1.1.0
|
|
14
|
+
ruby "$(ruby -e 'puts Gem::Specification.find_by_name("ap2_mandate_verifier", "1.1.0").full_gem_path')/examples/payment.rb"
|
|
15
|
+
```
|
|
16
|
+
|
|
8
17
|
[English](README.md)
|
|
9
18
|
|
|
10
|
-
**公開済み安定版は1.
|
|
19
|
+
**公開済み安定版は1.1.0です。**
|
|
11
20
|
|
|
12
21
|
1.0.0では、既存のDirectと条件付きCheckoutの公開API・保守契約を確立しました。
|
|
13
22
|
0.8.0の引数・既定値・profile・結果の意味・保存形式と製品実装を維持します。
|
|
@@ -27,8 +36,8 @@ Agent処理へProvider秘密鍵を渡しません。[API・信頼境界](docs/CO
|
|
|
27
36
|
正式対応MRI 3.4.12/4.0.9で動くRuby単体の導入例です。source checkoutやRailsは不要です:
|
|
28
37
|
|
|
29
38
|
```sh
|
|
30
|
-
gem install ap2_mandate_verifier --version 1.
|
|
31
|
-
ruby "$(ruby -e 'puts Gem::Specification.find_by_name("ap2_mandate_verifier", "1.
|
|
39
|
+
gem install ap2_mandate_verifier --version 1.1.0
|
|
40
|
+
ruby "$(ruby -e 'puts Gem::Specification.find_by_name("ap2_mandate_verifier", "1.1.0").full_gem_path')/examples/conditional_checkout.rb"
|
|
32
41
|
```
|
|
33
42
|
|
|
34
43
|
[Ruby単体の実行例](examples/conditional_checkout.rb)はインストール済み公開APIだけを使い、
|
|
@@ -58,7 +67,7 @@ Rubyで購入委任データを検証する、AP2の固定profile向けGemです
|
|
|
58
67
|
正式対応は **MRI 3.4.12とMRI 4.0.9** です。利用者が選ぶGem環境で導入します。
|
|
59
68
|
|
|
60
69
|
```sh
|
|
61
|
-
gem install ap2_mandate_verifier --version 1.
|
|
70
|
+
gem install ap2_mandate_verifier --version 1.1.0
|
|
62
71
|
```
|
|
63
72
|
|
|
64
73
|
BundlerのGemfile:
|
data/README.md
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
# AP2 Mandate Verifier — Ruby SDK for Checkout delegation
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
### Unpublished1.2.0 candidate: selective Payment
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Published1.1.0 remains the stable release. The next candidate adds explicit `SelectivePayment` candidate-array disclosure: retain confidential full issuance, send selected payee/instrument disclosures only, and verify every mandatory condition and exact original-wire reference. [Profile/API/privacy/Python limits](docs/SELECTIVE_PAYMENT.md), [plain Ruby retained-vs-sent example](examples/selective_payment.rb), [candidate release preparation](docs/RELEASE_120_CANDIDATE.md). Existing `Payment` defaults remain unchanged.
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
### Published 1.1.0: Payment
|
|
9
|
+
|
|
10
|
+
1.1.0 adds Direct and conditional Payment Mandates plus signed Success/Error Payment Receipts. [Payment APIs and constraints](docs/PAYMENT.md), [plain Ruby lifecycle sample](examples/payment.rb), [verified publication](docs/POST_RELEASE_110.md), [GitHub Release](https://github.com/cuichangquan/ap2-mandate-verifier/releases/tag/v1.1.0). Verification does not grant execution permission; durable atomic one-use state and actual payment remain application responsibilities.
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
gem install ap2_mandate_verifier --version 1.1.0
|
|
14
|
+
ruby "$(ruby -e 'puts Gem::Specification.find_by_name("ap2_mandate_verifier", "1.1.0").full_gem_path')/examples/payment.rb"
|
|
15
|
+
```
|
|
16
|
+
|
|
8
17
|
[日本語](README.ja.md)
|
|
9
18
|
|
|
10
|
-
**Published stable: 1.
|
|
19
|
+
**Published stable: 1.1.0.**
|
|
11
20
|
|
|
12
21
|
1.0.0 establishes the stable public contract for the existing
|
|
13
22
|
Direct and conditional Checkout APIs. It preserves 0.8.0 signatures, defaults,
|
|
@@ -31,8 +40,8 @@ multi-item profile. Provider private keys never enter Agent operations.
|
|
|
31
40
|
Ruby-only Quick Start on MRI 3.4.12 or 4.0.9; no source checkout or Rails required:
|
|
32
41
|
|
|
33
42
|
```sh
|
|
34
|
-
gem install ap2_mandate_verifier --version 1.
|
|
35
|
-
ruby "$(ruby -e 'puts Gem::Specification.find_by_name("ap2_mandate_verifier", "1.
|
|
43
|
+
gem install ap2_mandate_verifier --version 1.1.0
|
|
44
|
+
ruby "$(ruby -e 'puts Gem::Specification.find_by_name("ap2_mandate_verifier", "1.1.0").full_gem_path')/examples/conditional_checkout.rb"
|
|
36
45
|
```
|
|
37
46
|
|
|
38
47
|
The [standalone Ruby example](examples/conditional_checkout.rb) uses only installed
|
|
@@ -66,7 +75,7 @@ The [Rails demo](https://github.com/cuichangquan/ap2-mandate-verifier-demo#readm
|
|
|
66
75
|
Formal support is **MRI 3.4.12 and MRI 4.0.9**. In your chosen Gem environment:
|
|
67
76
|
|
|
68
77
|
```sh
|
|
69
|
-
gem install ap2_mandate_verifier --version 1.
|
|
78
|
+
gem install ap2_mandate_verifier --version 1.1.0
|
|
70
79
|
```
|
|
71
80
|
|
|
72
81
|
Or add to your Gemfile:
|
data/docs/PAYMENT.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Payment APIs —
|
|
1
|
+
# Payment APIs — published 1.1.0
|
|
2
2
|
|
|
3
|
-
Published 1.0.0
|
|
3
|
+
Published 1.0.0 established the Checkout-only API contract; [1.1.0 is now published](POST_RELEASE_110.md). These additive APIs do not change its arguments, defaults, profiles, accepted inputs, results, storage or Checkout Receipt references. The Gem is framework independent; Rails is optional.
|
|
4
4
|
|
|
5
5
|
## Supported profile and specification
|
|
6
6
|
|
|
@@ -61,7 +61,7 @@ Wire limit is 32,769 bytes, one final `~` plus at most one content disclosure, d
|
|
|
61
61
|
|
|
62
62
|
SDK verification is not final execution approval or payment success. User authentication/consent, key storage/enrollment/revocation, current order/trust policy, actual payment, durable one-use identity and atomic reservation/consumption belong to the app. Recheck them immediately before execution. No SDK object prevents replay across calls/processes. Persist original Open/final strings and exact Checkout inputs in protected storage; use present, then reverify with current external inputs. Never deserialize a successful Verification as proof. An authentic Error is not automatic retry permission. Missing/unverifiable Receipt or uncertain processing stays pending and requires reconciliation.
|
|
63
63
|
|
|
64
|
-
After installing
|
|
64
|
+
After installing published 1.1.0, run:
|
|
65
65
|
|
|
66
66
|
```sh
|
|
67
67
|
ruby -e 's=Gem::Specification.find_by_name("ap2_mandate_verifier", "1.1.0"); require File.join(s.full_gem_path, "examples/payment.rb"); PaymentExample.run'
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# 1.1.0 publication and verification
|
|
2
|
+
|
|
3
|
+
Owner registered 1.1.0 on RubyGems at **2026-11-03 09:20:11.580 UTC**. Independent official metadata and distribution retrieval confirms publication. [Machine-readable receipt](evidence/1.1.0_publication.json).
|
|
4
|
+
|
|
5
|
+
| Identity | Verified value |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| Gem / version / platform | ap2_mandate_verifier / 1.1.0 / ruby |
|
|
8
|
+
| Prerelease / yanked at comparison | false / false |
|
|
9
|
+
| Bytes | 115,200 |
|
|
10
|
+
| SHA256 | `4c64cf5b6c61ae4395577828093a6f4022c35cf18b6ad1bcfcb9f95fbb4f43c9` |
|
|
11
|
+
| Release source | `89e779cadeac0ea7941e68f12951eed13f1b8081` |
|
|
12
|
+
| Reviewed/tested source | `631537ec52c33c3472fd856da55faeff3fb62203` |
|
|
13
|
+
| Same source tree | `4282e3349d2a2851940d3f153460a013f0ea6ceb` |
|
|
14
|
+
| Payload comparison | All 38 archive/source/installed files identical on both MRI endpoints |
|
|
15
|
+
|
|
16
|
+
The downloaded public archive is byte-for-byte identical to the Owner-approved candidate. The registry metadata SHA and GitHub Release asset also agree. Association with source follows the retained reviewed candidate and every payload comparison, not a RubyGems source attestation. No Gem rebuild or version overwrite was performed. After successful registration, no additional push was attempted.
|
|
17
|
+
|
|
18
|
+
The Owner's terminal reported successful registration while the browser showed a WebAuthn verification/callback error. These are distinct observations: registry metadata and actual distributed bytes establish successful publication. A cached metadata URL initially retained its earlier HTTP 404; a fresh read returned the published version and matching SHA. The browser error's precise cause is not established. It does not justify another push or credential/security-setting changes.
|
|
19
|
+
|
|
20
|
+
## Tag and Release
|
|
21
|
+
|
|
22
|
+
[Formal v1.1.0 Release](https://github.com/cuichangquan/ap2-mandate-verifier/releases/tag/v1.1.0), ID 432487583, is public, non-draft and non-prerelease, published 2026-11-03T09:23:10Z. Annotated tag object `dff5006234c35c24de416786fa7d088953f86105` peels to the release-source commit above. The attached `ap2_mandate_verifier-1.1.0.gem` was downloaded independently and matches the same SHA256 and byte count.
|
|
23
|
+
|
|
24
|
+
## Verification and compatibility
|
|
25
|
+
|
|
26
|
+
The approved candidate's existing Checkout regression and 113 Payment assertions per source/installed runtime, strict latest-HEAD independent reviews and [CI](https://github.com/cuichangquan/ap2-mandate-verifier/actions/runs/41605001799) are recorded in [Issue #235](https://github.com/cuichangquan/ap2-mandate-verifier/issues/235). Official AP2 SHA `b4587ac1d055888a73b4b21750973cffba961793` SDK/Schema comparisons cover Ruby→Python and Python→Ruby Direct/conditional Payment and both Receipt outcomes, plus independent original-wire hashes. Tests are synthetic and scoped; they do not establish general AP2 conformance or real Issuer trust.
|
|
27
|
+
|
|
28
|
+
After publication, fresh containers separately install the **downloaded public archive**, compare all 38 files against the formal tag source and installed payload, and pass the existing installed package checks, 113 Payment assertions and Direct/conditional/Success/Error packaged examples on MRI **3.4.12 and 4.0.9**. Updated published-guide checks also pass both English/Japanese README Quick Starts and retained Checkout walkthroughs plus the installed Payment sample. Repeated transitive suites are not summed into a total. Subsequent documentation CI is separate from the pre-release source/package CI above.
|
|
29
|
+
|
|
30
|
+
Dependencies remain json=2.19.9, jwt=3.3.0, base64=0.3.0, openssl=4.0.2 and digest=3.2.1. Existing 1.0.0 Checkout arguments/defaults/profiles/results/storage and Receipt references are preserved. [Payment API and bounds](PAYMENT.md) are additive. The Gem's immutable packaged README/API documents retain their preparation snapshot; current repository publication records supersede status wording without changing published bytes.
|
|
31
|
+
|
|
32
|
+
## Usage and application duties
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
gem install ap2_mandate_verifier --version 1.1.0
|
|
36
|
+
ruby "$(ruby -e 'puts Gem::Specification.find_by_name("ap2_mandate_verifier", "1.1.0").full_gem_path')/examples/payment.rb"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Framework-independent SDK use needs no Rails. The separate Rails demo upgrade uses the same public artifact and verifies it independently; it performs no deployment. SDK verification is not final execution permission. Receipt authentication and reported outcome are separate. Applications retain consent/trust/key lifecycle, current-order checks, durable atomic one-use state, actual payment and reconciliation of missing/invalid Receipts or uncertain processing. Unsupported recurrence/budget, PISP/execution_date/risk_data and arbitrary disclosure/delegation forms reject under the documented profile. No real payment or production deployment was performed.
|
data/docs/PUBLIC_API.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Ruby SDK public API — 1.
|
|
1
|
+
# Ruby SDK public API — 1.x
|
|
2
2
|
|
|
3
|
-
**Status: published 1.0.0.**
|
|
3
|
+
**Status: published 1.1.0; the original 1.0.0 Checkout contract below is preserved.**
|
|
4
4
|
This document defines the 1.x contract for the existing Checkout APIs.
|
|
5
5
|
The 1.0.0 release preserves the 0.8.0 runtime behavior, API names and accepted
|
|
6
6
|
formats. Exact distribution identity and validation are in
|
|
@@ -198,6 +198,10 @@ details, not extension hooks. Ruby visibility alone does not make them an SDK AP
|
|
|
198
198
|
This does not remove the published partial-verification entries above, their
|
|
199
199
|
observable error behavior, or the documented profile identities and bounds.
|
|
200
200
|
|
|
201
|
-
## Additive
|
|
201
|
+
## Additive published 1.1.0 Payment APIs
|
|
202
202
|
|
|
203
|
-
The preceding 1.0.0 Checkout contract remains unchanged. New `Payment` and `PaymentReceipt` APIs have a separate [
|
|
203
|
+
The preceding 1.0.0 Checkout contract remains unchanged. New `Payment` and `PaymentReceipt` APIs have a separate [Payment contract](PAYMENT.md); they are available in 1.1.0 and later, not in 1.0.0.
|
|
204
|
+
|
|
205
|
+
## Unpublished1.2.0 candidate
|
|
206
|
+
|
|
207
|
+
New explicit `SelectivePayment` APIs are described in the [candidate contract](SELECTIVE_PAYMENT.md). They do not alter the published1.1.0 `Payment` default profile or Receipt reference format. They are not yet available in the public1.1.0 Gem.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
> Historical preparation snapshot. The exact approved candidate is now published; see [publication evidence](POST_RELEASE_110.md). The original approval boundaries below describe that earlier checkpoint.
|
|
2
|
+
|
|
1
3
|
# 1.1.0 candidate — publication requires Owner approval
|
|
2
4
|
|
|
3
5
|
Status: unpublished candidate. Published 1.0.0 remains available and unchanged. The source version 1.1.0 is a proposal for additive Payment APIs under the existing 1.x Checkout contract. Do not tag, publish GitHub Release, push/yank RubyGems, announce or deploy on the basis of this document.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# 1.2.0 candidate — unpublished, Owner decision required
|
|
2
|
+
|
|
3
|
+
Published1.1.0 remains the released SDK. This is preparation for an additive opt-in Payment candidate-disclosure profile. No RubyGems push/yank, formal tag, GitHub Release, announcement or deployment is authorized by this document. The Owner decides final version and publication after reviewing exact source/artifact/verification identity in Issue#238.
|
|
4
|
+
|
|
5
|
+
## Proposed Release body
|
|
6
|
+
|
|
7
|
+
Adds `SelectivePayment` for conditional Payment with individually disclosed payee and payment-instrument candidates. Retain the full issuance confidentially, select candidates, and send only the reduced Open plus Agent Closed. Mandatory amount/currency/time/delegation/fixed fields/Checkout reference remain visible and verified; partial disclosure never makes a required condition optional. Existing1.1.0 Checkout, Payment and Receipt APIs/defaults/formats are unchanged.
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
# Read approved_combinations from the protected consent record; do not derive
|
|
11
|
+
# broader consent by expanding a correlated subset into a Cartesian product.
|
|
12
|
+
full = AP2MandateVerifier::SelectivePayment.issue_open(
|
|
13
|
+
**approved_open_inputs, approved_combinations: protected_approved_pairs,
|
|
14
|
+
selective: :both)
|
|
15
|
+
sent = AP2MandateVerifier::SelectivePayment.select(
|
|
16
|
+
open_sd_jwt: full, payee_index: 0, instrument_index: 0)
|
|
17
|
+
# Agent signs the exact reduced `sent` bytes, then receiver uses independently
|
|
18
|
+
# trusted Checkout/payment/key/challenge inputs. See examples/selective_payment.rb.
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Supported: single immediate conditional Payment, one Agent hop, candidate-array elements only, independent Cartesian allowlists with explicit approval guard. Correlated subsets require separate singleton/approved-rectangle Open Mandates; unsupported correlation, mandatory-field hiding, unknown structures and arbitrary SD reject. This does not add a generic selective-disclosure API or change Checkout disclosure support.
|
|
22
|
+
|
|
23
|
+
[Full profile, reference and Python interoperability contract](SELECTIVE_PAYMENT.md). Receipt authenticity, reported outcome and final execution permission remain separate. Application-owned consent/trust/key lifecycle, durable atomic one-use state and payment execution are required. Unknown/missing Receipt remains pending and never automatic retry permission.
|
|
24
|
+
|
|
25
|
+
## Exact-artifact publication checklist (not execution authority)
|
|
26
|
+
|
|
27
|
+
1. Confirm the recorded reviewed and merged source/tree, latest-HEAD independent review with zero substantive unresolved findings, relevant CI, both MRI endpoint regressions, candidate ordinary installation/all-file identity, installed sample/privacy comparison and honest official SDK/profile-adapter interoperability scope. Missing required verification means HOLD.
|
|
28
|
+
2. Verify exact candidate filename/bytes/SHA256 and unchanged five runtime dependencies in the final manifest and Issue#238. Earlier development builds are not publication candidates. Owner chooses version and approves that exact artifact plus any formal tag/Release/announcement separately.
|
|
29
|
+
3. Only after that separate approval, inspect current registry/version/tag/Release state. Never overwrite a version or rebuild during publication. Publish the approved archive using existing Owner-controlled authentication; stop at any human authentication handoff and never request credentials/OTP in chat. On uncertain outcome inspect registry before retry.
|
|
30
|
+
4. Fetch actual public metadata/distribution, compare full bytes/SHA256 and every payload against approved source, install into fresh isolated environments and rerun published lifecycle/privacy/Receipt guides. Only then create the approved tag on the approved source and publish Release. Preserve source vs repository-only postpublication documentation identities.
|
|
31
|
+
|
|
32
|
+
No new publication/deployment workflow is introduced. Current product CI builds test candidates only. Existing unrelated research/Rust/production HOLDs remain untouched. Tested MRI endpoints remain3.4.12 and4.0.9; runtime dependencies remain json2.19.9,jwt3.3.0,base640.3.0,openssl4.0.2,digest3.2.1. Installation range>=3.4.12,<4.1 is not formal support for every intermediate release.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Payment candidate disclosure — unpublished1.2.0 profile
|
|
2
|
+
|
|
3
|
+
Published1.1.0 remains available with its unchanged complete-content Payment profile. New `AP2MandateVerifier::SelectivePayment` is an explicit opt-in conditional-only profile: `ap2.payment.selective_candidates.1`. Existing `Payment` remains strict and does not accept this new Open format. Existing Checkout/Payment/Receipt keyword/default/result/storage/reference contracts are unchanged. Payment verification/issuance additionally detaches mutable Agent-key inputs consistently and rechecks copied Checkout time; this tightens snapshot safety without changing supported formats or defaults. This is a framework-independent Ruby API; Rails is optional.
|
|
4
|
+
|
|
5
|
+
## Normative source and policy boundary
|
|
6
|
+
|
|
7
|
+
Adopted official AP2 source/SDK/Schema SHA: `b4587ac1d055888a73b4b21750973cffba961793`. Current upstream `e1ea56db72a6385bce3e5c1112b3a56ce60acb43` has identical relevant specification/Schema/SDK. The `open_payment_mandate.json` allowed_payees and allowed_payment_instruments definitions explicitly mark their allowed arrays as selectively disclosable. This profile permits disclosure only at those ARRAY ELEMENT positions; each disclosure is `[salt, complete_candidate_object]` committed through `{"...":digest}` using SHA256/base64url without padding. Salts use16random bytes. Root header remains ES256/example+sd-jwt; Agent terminal is ES256/kb+sd-jwt.
|
|
8
|
+
|
|
9
|
+
An Open has exactly the existing four constraints: amount_range, allowed_payees, allowed_payment_instruments and payment.reference. The entire Open content and all constraint types/fields are mandatory, as are cnf/iat/exp and any fixed payee/payment_amount/payment_instrument. They cannot be hidden. The new root's signed `ap2_profile` marker and the independently selected API fix this exact grammar. Unresolved commitments are allowed only at known candidate positions; no hidden whole condition, unknown location, nested SD, decoy, duplicate digest/disclosure, extra disclosure or unsupported field is accepted. Strictness is a scoped profile, not proof about arbitrary SD-JWT or a source of trust in the signer.
|
|
10
|
+
|
|
11
|
+
**Independent allowlists mean Cartesian product.** `[A,B]` and `[X,Y]` authorize all four combinations, not only `(A,X),(B,Y)`. Issuance requires `approved_combinations` from the application's protected approval record: integer index pairs must exactly cover the Cartesian product, with no duplicate/missing/extra pair. Correlated subsets reject BEFORE signer invocation. Do not auto-generate a broader approval matrix from a paired policy. For a correlated policy, issue separate singleton-pair or explicitly approved rectangular-subset Open Mandates, retaining the required amount/reference/time limits in each. This release does not claim general pairing-constraint support. The SDK does not authenticate user consent or the provenance of the supplied approval record.
|
|
12
|
+
|
|
13
|
+
## Public lifecycle
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
full = AP2MandateVerifier::SelectivePayment.issue_open(
|
|
17
|
+
**independently_approved_open_inputs,
|
|
18
|
+
approved_combinations: protected_approved_pairs, selective: :both)
|
|
19
|
+
sent = AP2MandateVerifier::SelectivePayment.select(
|
|
20
|
+
open_sd_jwt: full, payee_index: 0, instrument_index: 0)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`full` is confidential issuance material containing all disclosures. Retain it in protected application storage; do not send/log it. `sent` contains only the Open content disclosure plus selected candidate disclosures for selective axes. Nonselective axes are inline and therefore fully visible. `selective: :payees`, `:instruments` and `:both` explicitly determine the privacy boundary at issuance. Pass nil for each nonselective-axis index; providing an index for that axis rejects. Selection indices refer to the ORIGINAL signed candidate positions; reconstruction/removal of hidden array items does not renumber their meaning.
|
|
24
|
+
|
|
25
|
+
| API | Contract |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| `issue_open` | open_checkout_sd_jwt, constraints, fixed, approved_combinations, selective, agent_public_key_pem, issued_at, expires_at, signer, public_key_pem → confidential original issuance String. Constraints supplies exactly the three existing amount/payee/instrument conditions; reference is calculated from exact Open Checkout. |
|
|
28
|
+
| `select` | open_sd_jwt, payee_index, instrument_index → detached reduced Open String. Structural selection, not authenticity/consent. Each selective axis reveals exactly one candidate; nonselective axis remains visible. |
|
|
29
|
+
| `issue_closed` | open_presentation, payment, trusted_provider_public_key_pem, agent_public_key_pem, audience, nonce, verified_at, signer → Payment::Presentation with reduced Open and final Closed only. No Provider signer is passed to Agent. |
|
|
30
|
+
| `present` | open_presentation, closed_sd_jwt → Payment::Presentation preserving exact received reduced Open and final Closed; structural restoration only. |
|
|
31
|
+
| `verify` | open_presentation, closed_sd_jwt, checkout_inputs, expected_payment, trusted_provider_public_key_pem, expected_agent_public_key_pem, expected_audience, expected_nonce, verified_at → Payment::Verification. Reruns complete existing conditional Checkout verification, then root/delegation/conditions/reference/expected payment. |
|
|
32
|
+
|
|
33
|
+
The seven `checkout_inputs` are the original public `verify_checkout` keywords, prepared if useful with `InputBuilder.inputs`, at the same explicit verified_at. Expected Checkout/payment/keys/audience/challenge/time must come from independently trusted application state, not received unverified Payment. `Payment.details` can assemble expected payment from an independent Merchant JWT/key/current order and selected instrument. Full issuance/selection/restoration does not grant execution permission.
|
|
34
|
+
|
|
35
|
+
Result is the unchanged immutable `Payment::Verification`: verified?, code, selected payment claims, reference and expiry only; no full issuance/candidate universe. Existing `PaymentReceipt.sign/verify` works on the unchanged final Closed format. Errors use a fixed redacted new-profile Invalid exception without underlying cause; verify fails closed with no selected claims. No raw candidate, wire, parser cause or hidden value belongs in diagnostics/logs. Process/signing failure is not permission and may require reconciliation; preflight bounds run before signing callbacks.
|
|
36
|
+
|
|
37
|
+
## Original bytes, restoration and privacy
|
|
38
|
+
|
|
39
|
+
| Value | Exact SHA256 target |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| Issuer signature | Original compact root JWT; unchanged when its disclosure subset/order changes |
|
|
42
|
+
| Agent sd_hash | ACTUAL reduced Open presentation, all selected disclosure strings in transmitted order, including terminal `~` |
|
|
43
|
+
| transaction_id | Original Merchant Checkout JWT, unchanged by Payment disclosure choice |
|
|
44
|
+
| payment.reference | Exact Open Checkout presentation from the independently verified Checkout chain |
|
|
45
|
+
| Payment Receipt reference | Final Closed Payment SD-JWT alone including its terminal `~`; excludes Open and chain `~~` separator |
|
|
46
|
+
|
|
47
|
+
Subset/order changes preserve the issuer JWT but change the presented Open hash. Agent must sign the intended exact presentation; later insertion/removal/reordering must fail, never repair the wire from retained issuance. Changing selected candidate usually changes final Closed payment and Receipt reference; with the same Closed claims, a newly signed Agent terminal can still differ and references always follow exact actual bytes. No JSON rebuilding substitutes for original-wire references. Persist exact sent Open and final Closed; `present` restores without reconstructing hidden data, then `verify` must run again with current independent inputs.
|
|
48
|
+
|
|
49
|
+
The receiver does not receive unselected candidate objects, their random salts or leaf disclosure strings. It DOES see commitment count/order, fixed mandatory fields and selected values. Stable issuer JWT/digests permit linkage between presentations of the same issuance; count hiding, padding/decoys, traffic-analysis resistance, unlinkability and secrecy from the issuer/holder are not promised. Nonselective inline axes are deliberately visible. Issuance and protected approval state necessarily contain candidate values; keep them separate from transmitted data and operational logs.
|
|
50
|
+
|
|
51
|
+
## SDK differences and honest interoperability scope
|
|
52
|
+
|
|
53
|
+
Pinned Python `MandateClient.present` selects root2-element vct disclosures and3-element named claims, but drops candidate2-element array leaf disclosures. Its high-level selector cannot directly generate this profile. Use the tested explicit profile adapter and official lower-level issuance/chain primitives, and retain the exact received disclosure strings; do not claim the unsupported selector succeeds.
|
|
54
|
+
|
|
55
|
+
Official generic crypto verification and Schema validation are not this profile's semantic oracle. For example, the one-time Python payment constraint checker can accept a visible Open missing amount_range, and official Schema does not require all four constraints. This profile explicitly requires them and rejects signed missing/hidden mandatory conditions. Independent profile expectations check this safety boundary alongside official signature/chain/typed condition/Schema validation. Tests must report which layer passed and which stricter profile checks rejected; no signature-only or repaired-input result is called full Payment verification.
|
|
56
|
+
|
|
57
|
+
## Limits, example and application responsibilities
|
|
58
|
+
|
|
59
|
+
At most8payees/8instruments, one Agent hop, one immediate payment, supported1.1.0 integer minor units/currencies and600-second lifetime. Only known candidate-array disclosures are supported; no generic arbitrary SD or Checkout selective-disclosure extension. Open wire is limited to65,536bytes, root compactJWT to16,384bytes, each decoded disclosure to24,576bytes, and total disclosures to2–17. Each candidate array has1–8entries; selected presentation requires one revealed candidate per selective axis. Existing JSON depth24, finalClosed32,769-byte wire and per-field bounds are reused. All structural/signing bounds are checked before signer effects. Recurrence/budget/PISP/execution_date/risk_data, arbitrary delegation, unsupported algorithms and unknown constraints reject.
|
|
60
|
+
|
|
61
|
+
After installing the candidate with its pinned dependencies:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
ruby "$(ruby -e 'puts Gem::Specification.find_by_name("ap2_mandate_verifier", "1.2.0").full_gem_path')/examples/selective_payment.rb"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The runnable example prints retained/transmitted disclosure counts and byte counts, confirms unchanged issuer JWT and changed presentation bytes, verifies chosen Payment and both Receipt outcomes without printing unselected values/disclosures. Its approved matrix is explicitly synthetic; real code reads protected consent. The application owns user authentication/consent, key enrollment/custody/revocation, current order/trust, final authorization, payment, durable one-use identity and atomic state transitions. Missing/invalid Receipt or uncertain processing remains pending, never automatic retry permission. Candidate status and exact artifact verification are in [release preparation](RELEASE_120_CANDIDATE.md).
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"verified_at_utc": "2026-11-03T09:28:07.972453+00:00",
|
|
3
|
+
"name": "ap2_mandate_verifier",
|
|
4
|
+
"version": "1.1.0",
|
|
5
|
+
"platform": "ruby",
|
|
6
|
+
"registered_at": "2026-11-03T09:20:11.580Z",
|
|
7
|
+
"prerelease": false,
|
|
8
|
+
"yanked": false,
|
|
9
|
+
"ruby_requirement": ">= 3.4.12, < 4.1",
|
|
10
|
+
"runtime_dependencies": [
|
|
11
|
+
{
|
|
12
|
+
"name": "base64",
|
|
13
|
+
"requirements": "= 0.3.0"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "digest",
|
|
17
|
+
"requirements": "= 3.2.1"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "json",
|
|
21
|
+
"requirements": "= 2.19.9"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "jwt",
|
|
25
|
+
"requirements": "= 3.3.0"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "openssl",
|
|
29
|
+
"requirements": "= 4.0.2"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"bytes": 115200,
|
|
33
|
+
"sha256": "4c64cf5b6c61ae4395577828093a6f4022c35cf18b6ad1bcfcb9f95fbb4f43c9",
|
|
34
|
+
"registry_metadata_sha_matches": true,
|
|
35
|
+
"candidate_public_archive_byte_identical": true,
|
|
36
|
+
"github_asset_byte_identical": true,
|
|
37
|
+
"payloads": 38,
|
|
38
|
+
"all_payloads_match_release_source_and_installed": true,
|
|
39
|
+
"release_source_sha": "89e779cadeac0ea7941e68f12951eed13f1b8081",
|
|
40
|
+
"reviewed_tested_sha": "631537ec52c33c3472fd856da55faeff3fb62203",
|
|
41
|
+
"release_tree": "4282e3349d2a2851940d3f153460a013f0ea6ceb",
|
|
42
|
+
"files_sha256": {
|
|
43
|
+
"LICENSE": "1442143c4265d88eedfc14f25d04298449358c837b0bb58dfa825f84b36391c8",
|
|
44
|
+
"README.ja.md": "8a9a9ad129dbd0be6a98d3097608f0e66705f832ee4e63b2026bcfd46095192e",
|
|
45
|
+
"README.md": "bc72e6df953d53ea8ac23d106c8d7a5e02aa28cd75328479b04f3fd68f4e8dfe",
|
|
46
|
+
"SECURITY.md": "3308faded0eaad624c5caf7477d59d6f172804588e910975873ef6a657010a06",
|
|
47
|
+
"docs/BUYER_DIRECT_CHECKOUT.md": "96c67be9340a152d8bb4d10ea69b812eedce995a7d7b6a54bc0de3e6efca6ed5",
|
|
48
|
+
"docs/CONDITIONAL_CHECKOUT.md": "6ce7b14e3171525a7cbd4283862f724f98650f3f3e669bfab84345273ef3a2a7",
|
|
49
|
+
"docs/DIAGNOSTICS.ja.md": "302c87b40cb44bda43af021448ebe83409db96bbb2b0fb9c44e6a3dc78f3d433",
|
|
50
|
+
"docs/DIAGNOSTICS.md": "881cb7416ac1b18c26042ffa7f3bdbb33ccf5dbc95a2f7394f753271807df056",
|
|
51
|
+
"docs/INPUT_BUILDER.md": "428dbe89887fa13868dd750d19b524aa614eb8a80268bae6e4fd0c837a69841c",
|
|
52
|
+
"docs/MERCHANT_SIGNING.md": "31af8ead7fd507d72af4c400f2134e753d6d2297b1d6b85c831b3bd53185eeb4",
|
|
53
|
+
"docs/MULTI_ITEM_CHECKOUT.md": "3db7caa63b33e7204c8d512ed22403fcceb2b90e198d9e963f13b2610c40b228",
|
|
54
|
+
"docs/PAYMENT.md": "7fea7f2d3433ad5d8fc922a0109d1a6ec34a60f4a1977eee42b43b02e688ccbc",
|
|
55
|
+
"docs/POST_RELEASE_MAINTENANCE.md": "d6662cd35a86d4b8f24a2d350cfef80f3e0b7a1c21bde079757da1b1ae6b5ea0",
|
|
56
|
+
"docs/PUBLIC_API.md": "1be306928a23dd49fe5d08da7714f7f524aed446a04926a6599d5355eef76a42",
|
|
57
|
+
"docs/RELEASE_100_CANDIDATE.md": "4c67c42b9d9987272bb9ef826c48651f7179888549dfe89e973589c8820555df",
|
|
58
|
+
"docs/RELEASE_110_CANDIDATE.md": "4bb9597c2ef0a7e8aa6ecd796f1886acad8dd0bd601ff84cf915260d24833c8b",
|
|
59
|
+
"docs/SUPPORT_CONTRACT.md": "fe48c918918d644bd580e9bdd3d6f80b1a0341a0360b36065149d2cd4e8cb0b3",
|
|
60
|
+
"examples/conditional_checkout.rb": "dd672cc54c4a6650bfff654eb777eddd379c892481b67e58781e297a02c4c5af",
|
|
61
|
+
"examples/payment.rb": "48706d40d97d21c616d4b34f6c8d78c58fa57a7266dfaa81739a971b48cfa019",
|
|
62
|
+
"lib/ap2_mandate_verifier.rb": "0a3608df80855b4986e105667aded9d63ada32b93b0d84f8e7a933636825df1b",
|
|
63
|
+
"lib/ap2_mandate_verifier/buyer.rb": "1a9c129b6eb33ac508472aa634eee7afc4add5a537a5c3cb7d49d12557269588",
|
|
64
|
+
"lib/ap2_mandate_verifier/checkout_jwt.rb": "d96a1e8ea9d69787ce94c35253b866c0d5fb867b8864cd7a9f93a526adbb8781",
|
|
65
|
+
"lib/ap2_mandate_verifier/checkout_receipt.rb": "ba37ef2519eb49d46313c2c85cba894e0e644626e33247d227e0b4c26149c303",
|
|
66
|
+
"lib/ap2_mandate_verifier/conditional_checkout.rb": "685a57939b8a1774dfeb40f2ba2fcb96686f613e4bbe02cb315a82b598e0391e",
|
|
67
|
+
"lib/ap2_mandate_verifier/diagnostic.rb": "0d2e961d80d5f29d42b49898e2df993f60962766437958adba568cbf9b5d7f1e",
|
|
68
|
+
"lib/ap2_mandate_verifier/host_binding.rb": "1373efe503ccc5eda817ffd790799fc622d6cb106f8b7da85ef2b3f4693c662e",
|
|
69
|
+
"lib/ap2_mandate_verifier/input_builder.rb": "a35a5ce9160f0a8816c6dde6eeeeac09724b655d465c5caf7f14acdbe17e3290",
|
|
70
|
+
"lib/ap2_mandate_verifier/input_validator.rb": "395f8e6f2012ab400d7b17f1fdcf4ee63a3c1c9622da4f2b32d35b522542bf00",
|
|
71
|
+
"lib/ap2_mandate_verifier/merchant_signature.rb": "f41aafd533dc3f988956c4503325ebbd82dc43a8bc1511e8c26572b4c32e7e70",
|
|
72
|
+
"lib/ap2_mandate_verifier/payment.rb": "93a44f115fd869fcc497e30e434253292b47aed6ec26502657c70b1477a1b285",
|
|
73
|
+
"lib/ap2_mandate_verifier/payment_receipt.rb": "31ad00de7c733810c6b243dcaf9880576cc3e552892eeeadaf16d212f2179335",
|
|
74
|
+
"lib/ap2_mandate_verifier/purchase_binding.rb": "6f3f966eed59511eed54cc7f28bb8fe83123d43b5b213502a9ea5cc328c53690",
|
|
75
|
+
"lib/ap2_mandate_verifier/research_result.rb": "6b0bc022e57a2a837e296f2b1bfe9a154d69b4c98fea46e269e2d3f28a1c948b",
|
|
76
|
+
"lib/ap2_mandate_verifier/result.rb": "ba4fc058784e34a870507446224121a6ba09387137ef2a8c044e02256fc6c64f",
|
|
77
|
+
"lib/ap2_mandate_verifier/root_disclosures.rb": "7e9d2f51a24c344b54fd4e63e6619108b794b88d0adc003b6cdee821b39a8d65",
|
|
78
|
+
"lib/ap2_mandate_verifier/root_signature.rb": "d9b68d989700a0c103f80004e14fb2d3aa992f823434e07bf2971f63052519dd",
|
|
79
|
+
"lib/ap2_mandate_verifier/scoped_constraints.rb": "5d50858ba365e2716b635a2888f08f38afda7937be879347dd536d11f7b5d44b",
|
|
80
|
+
"lib/ap2_mandate_verifier/trust_context.rb": "897936b2fec31e63a673ca15e89485c5254f13a427aafae9504e3c2525601f97"
|
|
81
|
+
},
|
|
82
|
+
"tag": "v1.1.0",
|
|
83
|
+
"tag_object": "dff5006234c35c24de416786fa7d088953f86105",
|
|
84
|
+
"github_release": {
|
|
85
|
+
"id": 432487583,
|
|
86
|
+
"published_at": "2026-11-03T09:23:10Z",
|
|
87
|
+
"draft": false,
|
|
88
|
+
"prerelease": false,
|
|
89
|
+
"url": "https://github.com/cuichangquan/ap2-mandate-verifier/releases/tag/v1.1.0"
|
|
90
|
+
},
|
|
91
|
+
"postpublication_validation": {
|
|
92
|
+
"mri": [
|
|
93
|
+
"3.4.12",
|
|
94
|
+
"4.0.9"
|
|
95
|
+
],
|
|
96
|
+
"ordinary_install_source_archive_installed_equality": "PASS both endpoints; release-tag source, no rebuild",
|
|
97
|
+
"payment_assertions_each_installed": 113,
|
|
98
|
+
"published_guides": "PASS both endpoints; EN/JA README, retained Checkout examples, installed Payment sample"
|
|
99
|
+
},
|
|
100
|
+
"authentication_observation": "Owner terminal reported successful registration; browser reported verification callback error. Registry metadata and distribution independently confirm publication. No retry push performed; browser error root cause not established."
|
|
101
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Installed SDK only. Confidential issuance stays local; simulated payments only.
|
|
3
|
+
require "ap2_mandate_verifier"
|
|
4
|
+
require_relative "conditional_checkout"
|
|
5
|
+
module SelectivePaymentExample
|
|
6
|
+
M = AP2MandateVerifier
|
|
7
|
+
NOW = ConditionalCheckoutExample::NOW
|
|
8
|
+
def self.run
|
|
9
|
+
state = ConditionalCheckoutExample.run
|
|
10
|
+
provider, agent, merchant = state.fetch(:keys)
|
|
11
|
+
signer = ->(key) { M::CheckoutJWT.es256_signer(private_key: key) }
|
|
12
|
+
checkout = state.fetch(:closed).checkout_jwt
|
|
13
|
+
chosen_instrument = {"id" => "synthetic-card-A", "type" => "card"}
|
|
14
|
+
details = M::Payment.details(checkout_jwt: checkout, trusted_merchant_public_key_pem: merchant.public_to_pem,
|
|
15
|
+
expected_merchant_id: "shop", payment_instrument: chosen_instrument)
|
|
16
|
+
payees = [details.fetch("payee"), {"id" => "another-shop", "name" => "Private alternative payee"}]
|
|
17
|
+
instruments = [chosen_instrument, {"id" => "private-alternative-B", "type" => "card"}]
|
|
18
|
+
conditions = [{"type" => "payment.amount_range", "currency" => "USD", "min" => 100, "max" => 300},
|
|
19
|
+
{"type" => "payment.allowed_payees", "allowed" => payees},
|
|
20
|
+
{"type" => "payment.allowed_payment_instruments", "allowed" => instruments}]
|
|
21
|
+
# This list comes from the app's PROTECTED approval record: every crossproduct
|
|
22
|
+
# combination is expressly approved. Do not expand a correlated subset here.
|
|
23
|
+
approved_combinations = [[0, 0], [0, 1], [1, 0], [1, 1]]
|
|
24
|
+
full = M::SelectivePayment.issue_open(open_checkout_sd_jwt: state.fetch(:opening).root_presentation,
|
|
25
|
+
constraints: conditions, fixed: {}, approved_combinations: approved_combinations, selective: :both,
|
|
26
|
+
agent_public_key_pem: agent.public_to_pem, issued_at: NOW, expires_at: NOW+60,
|
|
27
|
+
signer: signer.call(provider), public_key_pem: provider.public_to_pem)
|
|
28
|
+
reduced = M::SelectivePayment.select(open_sd_jwt: full, payee_index: 0, instrument_index: 0)
|
|
29
|
+
transmitted_disclosures = reduced.split("~", -1)[1...-1]
|
|
30
|
+
visible = transmitted_disclosures.map { |wire| JSON.parse(Base64.urlsafe_decode64(wire)) }
|
|
31
|
+
hidden_leaves = full.split("~", -1)[1...-1].select do |wire|
|
|
32
|
+
value = JSON.parse(Base64.urlsafe_decode64(wire))[1]
|
|
33
|
+
value == payees[1] || value == instruments[1]
|
|
34
|
+
end
|
|
35
|
+
raise "privacy boundary failed" unless (hidden_leaves & transmitted_disclosures).empty? &&
|
|
36
|
+
!JSON.generate(visible).include?("Private alternative") && !JSON.generate(visible).include?("private-alternative-B")
|
|
37
|
+
# Keep full confidential issuance in protected storage; send only reduced.
|
|
38
|
+
# No original unselected disclosure or confidential full wire is printed.
|
|
39
|
+
puts "Retained locally: payees=2; instruments=2; disclosures=#{full.count('~')-1}; bytes=#{full.bytesize}"
|
|
40
|
+
puts "Sent: chosen payee=shop; chosen instrument=synthetic-card-A; disclosures=#{reduced.count('~')-1}; bytes=#{reduced.bytesize}"
|
|
41
|
+
puts "Issuer JWT unchanged=#{full.split('~').first == reduced.split('~').first}; presentation bytes changed=#{full != reduced}"
|
|
42
|
+
closed = M::SelectivePayment.issue_closed(open_presentation: reduced, payment: details,
|
|
43
|
+
trusted_provider_public_key_pem: provider.public_to_pem, agent_public_key_pem: agent.public_to_pem,
|
|
44
|
+
audience: "credential-provider", nonce: "synthetic-selective-payment-nonce", verified_at: NOW,
|
|
45
|
+
signer: signer.call(agent))
|
|
46
|
+
restored = M::SelectivePayment.present(open_presentation: reduced, closed_sd_jwt: closed.closed_sd_jwt)
|
|
47
|
+
checkout_inputs = M::InputBuilder.inputs(**state.fetch(:host_inputs), saved_challenge: state.fetch(:saved),
|
|
48
|
+
terminal_jws: state.fetch(:closed).terminal_jws, expected_challenge_issuer_id: "host",
|
|
49
|
+
clock_source_id: "synthetic-clock", verified_at: NOW)
|
|
50
|
+
verified = M::SelectivePayment.verify(open_presentation: restored.open_sd_jwt, closed_sd_jwt: restored.closed_sd_jwt,
|
|
51
|
+
checkout_inputs: checkout_inputs, expected_payment: details, trusted_provider_public_key_pem: provider.public_to_pem,
|
|
52
|
+
expected_agent_public_key_pem: agent.public_to_pem, expected_audience: "credential-provider",
|
|
53
|
+
expected_nonce: "synthetic-selective-payment-nonce", verified_at: NOW)
|
|
54
|
+
raise "selective verification failed" unless verified.verified?
|
|
55
|
+
puts "Selected Payment verified=true; unselected candidate values/disclosures were not sent"
|
|
56
|
+
%w[Success Error].each do |outcome|
|
|
57
|
+
fields = outcome == "Success" ? {psp_confirmation_id: "synthetic-psp", network_confirmation_id: "synthetic-network"} :
|
|
58
|
+
{error: "declined", error_description: "Simulated rejection"}
|
|
59
|
+
receipt = M::PaymentReceipt.sign(closed_sd_jwt: restored.closed_sd_jwt, issuer: "processor",
|
|
60
|
+
payment_id: "synthetic-selective-payment", outcome: outcome, issued_at: NOW, **fields,
|
|
61
|
+
signer: signer.call(merchant), public_key_pem: merchant.public_to_pem)
|
|
62
|
+
checked = M::PaymentReceipt.verify(jwt: receipt.jwt, closed_sd_jwt: restored.closed_sd_jwt,
|
|
63
|
+
trusted_public_key_pem: merchant.public_to_pem, expected_issuer: "processor", expected_payment_id: "synthetic-selective-payment",
|
|
64
|
+
not_before: NOW, not_after: NOW+60, verified_at: NOW)
|
|
65
|
+
raise "receipt failed" unless checked.verified? && checked.outcome == outcome
|
|
66
|
+
puts "Payment Receipt #{outcome}: authentic=#{checked.verified?}; reported_success=#{checked.payment_succeeded?}"
|
|
67
|
+
end
|
|
68
|
+
puts "Synthetic only. Verification is not execution permission; one-use atomic state belongs to the app; unknown outcome remains pending."
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
SelectivePaymentExample.run if $PROGRAM_NAME == __FILE__
|
|
@@ -76,6 +76,7 @@ module AP2MandateVerifier
|
|
|
76
76
|
# Provider signer is deliberately absent. Existing signed Open grants the hop.
|
|
77
77
|
def self.issue_closed(open_sd_jwt:, payment:, trusted_provider_public_key_pem:, agent_public_key_pem:,
|
|
78
78
|
audience:, nonce:, verified_at:, signer:)
|
|
79
|
+
agent_public_key_pem = InputValidator.snapshot!(agent_public_key_pem, max_bytes: 1_024)
|
|
79
80
|
opening, root = verified_root!(open_sd_jwt, trusted_provider_public_key_pem)
|
|
80
81
|
open!(opening); valid_now!(opening, verified_at)
|
|
81
82
|
raise Invalid unless opening.fetch("cnf") == {"jwk" => RootSignature.public_jwk!(agent_public_key_pem)}
|
|
@@ -124,6 +125,10 @@ module AP2MandateVerifier
|
|
|
124
125
|
checkout_inputs = checkout_inputs.to_h do |key, value|
|
|
125
126
|
[key, key == :verified_at ? value : InputValidator.snapshot!(value, max_bytes: limits.fetch(key, 131_072))]
|
|
126
127
|
end.freeze
|
|
128
|
+
raise Invalid unless checkout_inputs[:verified_at] == verified_at
|
|
129
|
+
if checkout_mode == :conditional
|
|
130
|
+
expected_agent_public_key_pem = InputValidator.snapshot!(expected_agent_public_key_pem, max_bytes: 1_024)
|
|
131
|
+
end
|
|
127
132
|
expected = copy_details!(expected_payment)
|
|
128
133
|
case checkout_mode
|
|
129
134
|
when :direct
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module AP2MandateVerifier
|
|
4
|
+
# Explicit conditional-Payment profile. Unknown hidden conditions are never
|
|
5
|
+
# inferred to be absent; unresolved commitments exist only at candidate slots.
|
|
6
|
+
module SelectivePayment
|
|
7
|
+
PROFILE_REF = "ap2.payment.selective_candidates.1".freeze
|
|
8
|
+
MAX_WIRE = 65_536
|
|
9
|
+
MAX_DISCLOSURES = 17
|
|
10
|
+
AXES = {"payment.allowed_payees" => "payee", "payment.allowed_payment_instruments" => "payment_instrument"}.freeze
|
|
11
|
+
class Invalid < ArgumentError
|
|
12
|
+
def initialize = super("invalid selective payment information")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# All candidates and their exact Cartesian authorization come from a
|
|
16
|
+
# protected approval record. This confidential issuance MUST NOT be sent.
|
|
17
|
+
def self.issue_open(open_checkout_sd_jwt:, constraints:, fixed:, approved_combinations:, selective:,
|
|
18
|
+
agent_public_key_pem:, issued_at:, expires_at:, signer:, public_key_pem:)
|
|
19
|
+
RootSignature.send(:dependencies!)
|
|
20
|
+
raise Invalid unless %i[payees instruments both].include?(selective)
|
|
21
|
+
checkout = Payment.send(:checkout_open!, open_checkout_sd_jwt)
|
|
22
|
+
cs = InputBuilder.send(:copy!, constraints)
|
|
23
|
+
raise Invalid unless cs.instance_of?(Array)
|
|
24
|
+
cs << {"type" => "payment.reference", "conditional_transaction_id" => digest(checkout)}
|
|
25
|
+
value = InputBuilder.send(:copy!, fixed)
|
|
26
|
+
raise Invalid unless value.instance_of?(Hash) && (value.keys - Payment::FIELDS.drop(1)).empty?
|
|
27
|
+
opening = value.merge("vct" => "mandate.payment.open.1", "iat" => issued_at, "exp" => expires_at,
|
|
28
|
+
"cnf" => {"jwk" => RootSignature.public_jwk!(agent_public_key_pem)}, "constraints" => cs)
|
|
29
|
+
Payment.send(:open!, opening)
|
|
30
|
+
payees = constraint!(opening, "payment.allowed_payees").fetch("allowed")
|
|
31
|
+
instruments = constraint!(opening, "payment.allowed_payment_instruments").fetch("allowed")
|
|
32
|
+
pairs = InputBuilder.send(:copy!, approved_combinations)
|
|
33
|
+
expected = payees.each_index.flat_map { |p| instruments.each_index.map { |i| [p, i] } }
|
|
34
|
+
raise Invalid unless pairs.instance_of?(Array) && pairs.size == expected.size && pairs.all? do |pair|
|
|
35
|
+
pair.instance_of?(Array) && pair.size == 2 && pair.all? { |n| Object.instance_method(:instance_of?).bind_call(n, Integer) }
|
|
36
|
+
end
|
|
37
|
+
raise Invalid unless pairs.sort == expected.sort
|
|
38
|
+
AXES.each do |type, field|
|
|
39
|
+
raise Invalid if opening.key?(field) && !constraint!(opening, type).fetch("allowed").include?(opening[field])
|
|
40
|
+
end
|
|
41
|
+
disclosures = []
|
|
42
|
+
modes = selective == :both ? AXES.keys : [selective == :payees ? AXES.keys[0] : AXES.keys[1]]
|
|
43
|
+
modes.each do |type|
|
|
44
|
+
c = constraint!(opening, type)
|
|
45
|
+
c["allowed"] = c["allowed"].map { |candidate| disclose!(candidate, disclosures) }
|
|
46
|
+
end
|
|
47
|
+
content = []
|
|
48
|
+
pointer = disclose!(opening, content)
|
|
49
|
+
payload = {"ap2_profile" => PROFILE_REF, "_sd_alg" => "sha-256", "delegate_payload" => [pointer]}
|
|
50
|
+
preview = [encode({"alg" => "ES256", "typ" => "example+sd-jwt"}), encode(payload), encode("\0" * 64)].join(".")
|
|
51
|
+
wire = ([preview] + content + disclosures + [""]).join("~")
|
|
52
|
+
parse!(wire, complete: true) # Full wire/disclosure bounds BEFORE signer effects.
|
|
53
|
+
jwt = MerchantSignature.sign!(payload, signer, public_key_pem, typ: "example+sd-jwt")
|
|
54
|
+
([jwt] + content + disclosures + [""]).join("~").freeze
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Each selective index selects one original signed candidate slot. For an
|
|
58
|
+
# inline/nonselective axis, pass nil: every approved inline value is visible.
|
|
59
|
+
def self.select(open_sd_jwt:, payee_index:, instrument_index:)
|
|
60
|
+
parsed = parse!(open_sd_jwt, complete: true)
|
|
61
|
+
keep = [parsed.fetch(:content_digest)]
|
|
62
|
+
{"payment.allowed_payees" => payee_index, "payment.allowed_payment_instruments" => instrument_index}.each do |type, index|
|
|
63
|
+
c = constraint!(parsed.fetch(:original), type)
|
|
64
|
+
slots = parsed.fetch(:slots).fetch(type)
|
|
65
|
+
if slots.empty?
|
|
66
|
+
raise Invalid unless index.nil?
|
|
67
|
+
else
|
|
68
|
+
raise Invalid unless Object.instance_method(:instance_of?).bind_call(index, Integer) && index.between?(0, slots.size - 1)
|
|
69
|
+
keep << slots.fetch(index)
|
|
70
|
+
field = AXES.fetch(type)
|
|
71
|
+
selected = parsed.fetch(:values).fetch(slots.fetch(index))
|
|
72
|
+
raise Invalid if parsed.fetch(:original).key?(field) && parsed.fetch(:original)[field] != selected
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
wire = ([parsed.fetch(:compact)] + parsed.fetch(:disclosures).select { |d| keep.include?(digest(d)) } + [""]).join("~")
|
|
76
|
+
parse!(wire, complete: false)
|
|
77
|
+
wire.freeze
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def self.issue_closed(open_presentation:, payment:, trusted_provider_public_key_pem:, agent_public_key_pem:,
|
|
81
|
+
audience:, nonce:, verified_at:, signer:)
|
|
82
|
+
agent = InputValidator.snapshot!(agent_public_key_pem, max_bytes: 1_024)
|
|
83
|
+
provider = InputValidator.snapshot!(trusted_provider_public_key_pem, max_bytes: 1_024)
|
|
84
|
+
aud = InputValidator.snapshot!(audience, max_bytes: 512)
|
|
85
|
+
challenge = InputValidator.snapshot!(nonce, max_bytes: 512)
|
|
86
|
+
parsed = authenticated!(open_presentation, provider)
|
|
87
|
+
opening = parsed.fetch(:opening)
|
|
88
|
+
Payment.send(:valid_now!, opening, verified_at)
|
|
89
|
+
raise Invalid unless opening.fetch("cnf") == {"jwk" => RootSignature.public_jwk!(agent)}
|
|
90
|
+
closed = Payment.send(:copy_details!, payment).merge("vct" => "mandate.payment.1", "iat" => verified_at, "exp" => opening.fetch("exp"))
|
|
91
|
+
Payment.send(:closed!, closed); Payment.send(:conditions!, opening, closed)
|
|
92
|
+
Payment.send(:text!, aud, 512); Payment.send(:text!, challenge, 512)
|
|
93
|
+
claims = {"delegate_payload" => [closed], "iat" => verified_at, "aud" => aud, "nonce" => challenge,
|
|
94
|
+
"sd_hash" => digest(parsed.fetch(:wire))}
|
|
95
|
+
Payment.send(:preflight!, claims, "kb+sd-jwt")
|
|
96
|
+
terminal = MerchantSignature.sign!(claims, signer, agent, typ: "kb+sd-jwt")
|
|
97
|
+
Payment::Presentation.send(:new, parsed.fetch(:wire), terminal + "~")
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Structural restoration only. It never authenticates a stored presentation.
|
|
101
|
+
def self.present(open_presentation:, closed_sd_jwt:)
|
|
102
|
+
root = parse!(open_presentation, complete: false)
|
|
103
|
+
terminal, wire = Payment.send(:final!, closed_sd_jwt, conditional: true)
|
|
104
|
+
closed = terminal.fetch("delegate_payload").first
|
|
105
|
+
bind_terminal!(root, terminal, closed)
|
|
106
|
+
Payment::Presentation.send(:new, root.fetch(:wire), wire)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def self.verify(open_presentation:, closed_sd_jwt:, checkout_inputs:, expected_payment:,
|
|
110
|
+
trusted_provider_public_key_pem:, expected_agent_public_key_pem:,
|
|
111
|
+
expected_audience:, expected_nonce:, verified_at:)
|
|
112
|
+
CheckoutReceipt.send(:epoch!, verified_at)
|
|
113
|
+
agent = InputValidator.snapshot!(expected_agent_public_key_pem, max_bytes: 1_024)
|
|
114
|
+
provider = InputValidator.snapshot!(trusted_provider_public_key_pem, max_bytes: 1_024)
|
|
115
|
+
aud = InputValidator.snapshot!(expected_audience, max_bytes: 512)
|
|
116
|
+
nonce = InputValidator.snapshot!(expected_nonce, max_bytes: 512)
|
|
117
|
+
fields = %i[trust_json selection_json host_json root_presentation terminal_jws host_checkout_jws verified_at]
|
|
118
|
+
raise Invalid unless checkout_inputs.instance_of?(Hash) && checkout_inputs.size == fields.size &&
|
|
119
|
+
fields.all? { |f| checkout_inputs.key?(f) } && checkout_inputs[:verified_at] == verified_at
|
|
120
|
+
limits = {host_json: 32_768, terminal_jws: 32_768, host_checkout_jws: 16_384}
|
|
121
|
+
inputs = checkout_inputs.to_h do |key, value|
|
|
122
|
+
[key, key == :verified_at ? value : InputValidator.snapshot!(value, max_bytes: limits.fetch(key, 131_072))]
|
|
123
|
+
end.freeze
|
|
124
|
+
raise Invalid unless inputs.size == fields.size && fields.all? { |f| inputs.key?(f) } && inputs[:verified_at] == verified_at
|
|
125
|
+
expected = Payment.send(:copy_details!, expected_payment)
|
|
126
|
+
checkout = AP2MandateVerifier.verify_checkout(**inputs)
|
|
127
|
+
raise Invalid unless checkout.success?
|
|
128
|
+
raise Invalid unless expected.fetch("transaction_id") == digest(inputs.fetch(:host_checkout_jws))
|
|
129
|
+
binding = checkout.evidence["checkout_binding"]
|
|
130
|
+
amount = expected.fetch("payment_amount")
|
|
131
|
+
raise Invalid unless expected.fetch("payee").fetch("id") == binding.fetch("merchant_id") &&
|
|
132
|
+
amount.fetch("currency") == binding.fetch("currency") && amount.fetch("amount") == binding.fetch("expected_total")
|
|
133
|
+
Payment.send(:bind_checkout!, expected, Payment.send(:jwt_payload!, inputs.fetch(:host_checkout_jws), "JWT"))
|
|
134
|
+
parsed = authenticated!(open_presentation, provider)
|
|
135
|
+
opening = parsed.fetch(:opening)
|
|
136
|
+
Payment.send(:valid_now!, opening, verified_at)
|
|
137
|
+
raise Invalid unless opening.fetch("cnf") == {"jwk" => RootSignature.public_jwk!(agent)}
|
|
138
|
+
terminal, wire = Payment.send(:final!, closed_sd_jwt, conditional: true)
|
|
139
|
+
RootSignature.verified_payload!(wire.split("~", -1).first, agent,
|
|
140
|
+
expected_typ: "kb+sd-jwt", max_bytes: 32_768)
|
|
141
|
+
Payment.send(:text!, aud, 512); Payment.send(:text!, nonce, 512)
|
|
142
|
+
raise Invalid unless terminal.fetch("aud") == aud && terminal.fetch("nonce") == nonce &&
|
|
143
|
+
terminal.fetch("iat") <= verified_at && verified_at - terminal.fetch("iat") <= 300
|
|
144
|
+
closed = terminal.fetch("delegate_payload").first
|
|
145
|
+
bind_terminal!(parsed, terminal, closed)
|
|
146
|
+
Payment.send(:valid_now!, closed, verified_at)
|
|
147
|
+
ref = constraint!(opening, "payment.reference").fetch("conditional_transaction_id")
|
|
148
|
+
raise Invalid unless ref == digest(inputs.fetch(:root_presentation)) && closed.slice(*Payment::FIELDS) == expected
|
|
149
|
+
Payment::Verification.send(:new, closed, wire)
|
|
150
|
+
rescue StandardError, LoadError
|
|
151
|
+
Payment::Verification.send(:new)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def self.bind_terminal!(root, terminal, closed)
|
|
155
|
+
opening = root.fetch(:opening)
|
|
156
|
+
Payment.send(:closed!, closed)
|
|
157
|
+
raise Invalid unless terminal.fetch("sd_hash") == digest(root.fetch(:wire)) && terminal.fetch("iat") == closed.fetch("iat") &&
|
|
158
|
+
closed.fetch("iat") >= opening.fetch("iat") && closed.fetch("exp") <= opening.fetch("exp")
|
|
159
|
+
Payment.send(:conditions!, opening, closed)
|
|
160
|
+
end
|
|
161
|
+
def self.authenticated!(wire, key)
|
|
162
|
+
parsed = parse!(wire, complete: false)
|
|
163
|
+
RootSignature.verified_payload!(parsed.fetch(:compact), key, max_bytes: 16_384)
|
|
164
|
+
parsed
|
|
165
|
+
end
|
|
166
|
+
def self.parse!(source, complete:)
|
|
167
|
+
RootSignature.send(:dependencies!)
|
|
168
|
+
wire = InputValidator.snapshot!(source, max_bytes: MAX_WIRE)
|
|
169
|
+
raise Invalid unless wire.ascii_only? && wire.end_with?("~")
|
|
170
|
+
compact, *disclosures = wire.split("~", -1)
|
|
171
|
+
disclosures.pop
|
|
172
|
+
raise Invalid unless disclosures.size.between?(2, MAX_DISCLOSURES) && disclosures.none?(&:empty?)
|
|
173
|
+
compact = InputValidator.snapshot!(compact, max_bytes: 16_384)
|
|
174
|
+
claims = Payment.send(:jwt_payload!, compact, "example+sd-jwt")
|
|
175
|
+
Payment.send(:exact!, claims, %w[ap2_profile _sd_alg delegate_payload])
|
|
176
|
+
raise Invalid unless claims["ap2_profile"] == PROFILE_REF && claims["_sd_alg"] == "sha-256" &&
|
|
177
|
+
claims["delegate_payload"].instance_of?(Array) && claims["delegate_payload"].size == 1
|
|
178
|
+
pointer = claims.fetch("delegate_payload").first
|
|
179
|
+
Payment.send(:exact!, pointer, ["..."])
|
|
180
|
+
hash!(pointer["..."])
|
|
181
|
+
values = {}; salts = []
|
|
182
|
+
disclosures.each do |disclosure|
|
|
183
|
+
value = Buyer.send(:decode_disclosure!, disclosure, 2)
|
|
184
|
+
hash = digest(disclosure)
|
|
185
|
+
raise Invalid if values.key?(hash) || salts.include?(value[0])
|
|
186
|
+
salts << value[0]
|
|
187
|
+
values[hash] = value[1]
|
|
188
|
+
end
|
|
189
|
+
content_digest = pointer.fetch("...")
|
|
190
|
+
original = values.fetch(content_digest)
|
|
191
|
+
raise Invalid unless original.instance_of?(Hash) && original["constraints"].instance_of?(Array)
|
|
192
|
+
opening = InputBuilder.send(:copy!, original)
|
|
193
|
+
slots = {}; used = [content_digest]; all_commitments = [content_digest]
|
|
194
|
+
AXES.each do |type, field|
|
|
195
|
+
c = constraint!(opening, type)
|
|
196
|
+
Payment.send(:exact!, c, %w[type allowed])
|
|
197
|
+
list = c.fetch("allowed")
|
|
198
|
+
raise Invalid unless list.instance_of?(Array) && list.size.between?(1, 8)
|
|
199
|
+
markers = list.map { |item| item.instance_of?(Hash) && item.keys == ["..."] }
|
|
200
|
+
raise Invalid unless markers.all? || markers.none?
|
|
201
|
+
slots[type] = []
|
|
202
|
+
if markers.all?
|
|
203
|
+
selected = []
|
|
204
|
+
list.each do |item|
|
|
205
|
+
h = item.fetch("..."); hash!(h)
|
|
206
|
+
raise Invalid if all_commitments.include?(h)
|
|
207
|
+
all_commitments << h; slots[type] << h
|
|
208
|
+
if values.key?(h)
|
|
209
|
+
selected << values.fetch(h); used << h
|
|
210
|
+
elsif complete
|
|
211
|
+
raise Invalid
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
raise Invalid unless complete ? selected.size == list.size : selected.size == 1
|
|
215
|
+
c["allowed"] = selected
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
raise Invalid if slots.values.all?(&:empty?)
|
|
219
|
+
raise Invalid unless used.sort == values.keys.sort
|
|
220
|
+
Payment.send(:open!, opening) # Only candidate markers were resolved/omitted.
|
|
221
|
+
{wire: wire, compact: compact, disclosures: disclosures, opening: opening,
|
|
222
|
+
original: original, content_digest: content_digest, slots: slots, values: values}
|
|
223
|
+
end
|
|
224
|
+
def self.constraint!(opening, type)
|
|
225
|
+
cs = opening.fetch("constraints")
|
|
226
|
+
raise Invalid unless cs.instance_of?(Array)
|
|
227
|
+
found = cs.select { |c| c.instance_of?(Hash) && c["type"] == type }
|
|
228
|
+
raise Invalid unless found.size == 1
|
|
229
|
+
found.first
|
|
230
|
+
end
|
|
231
|
+
def self.disclose!(value, disclosures)
|
|
232
|
+
require "securerandom"
|
|
233
|
+
wire = encode([encode(SecureRandom.random_bytes(16)), value])
|
|
234
|
+
disclosures << wire
|
|
235
|
+
{"..." => digest(wire)}
|
|
236
|
+
end
|
|
237
|
+
def self.hash!(value)
|
|
238
|
+
raise Invalid unless value.instance_of?(String) && value.match?(/\A[A-Za-z0-9_-]{43}\z/)
|
|
239
|
+
end
|
|
240
|
+
def self.encode(value) = Buyer.send(:encode, value)
|
|
241
|
+
def self.digest(wire) = Payment.send(:digest, wire)
|
|
242
|
+
|
|
243
|
+
%i[issue_open select issue_closed present verify].each do |name|
|
|
244
|
+
implementation = method(name)
|
|
245
|
+
fields = implementation.parameters.map(&:last).freeze
|
|
246
|
+
define_singleton_method(name) do |**args|
|
|
247
|
+
unless (fields - args.keys).empty? && (args.keys - fields).empty?
|
|
248
|
+
next Payment::Verification.send(:new) if name == :verify
|
|
249
|
+
raise Invalid
|
|
250
|
+
end
|
|
251
|
+
implementation.call(**args)
|
|
252
|
+
rescue StandardError, LoadError
|
|
253
|
+
next Payment::Verification.send(:new) if name == :verify
|
|
254
|
+
raise Invalid.new, cause: nil
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
singleton_methods(false).reject { |n| %i[issue_open select issue_closed present verify].include?(n) }.each { |n| private_class_method n }
|
|
258
|
+
end
|
|
259
|
+
end
|
data/lib/ap2_mandate_verifier.rb
CHANGED
|
@@ -17,6 +17,7 @@ require_relative "ap2_mandate_verifier/buyer"
|
|
|
17
17
|
require_relative "ap2_mandate_verifier/conditional_checkout"
|
|
18
18
|
require_relative "ap2_mandate_verifier/payment"
|
|
19
19
|
require_relative "ap2_mandate_verifier/payment_receipt"
|
|
20
|
+
require_relative "ap2_mandate_verifier/selective_payment"
|
|
20
21
|
|
|
21
22
|
module AP2MandateVerifier
|
|
22
23
|
# Accepts original JSON bytes only. Syntax validity is not AP2 validity,
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ap2_mandate_verifier
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- AP2 Mandate Verifier contributors
|
|
@@ -82,8 +82,9 @@ dependencies:
|
|
|
82
82
|
description: 'Framework-independent Ruby SDK for supported AP2 Checkout profiles:
|
|
83
83
|
Merchant JWT signing, Direct and conditional Mandate issuance and presentation,
|
|
84
84
|
full verification with immutable Evidence, Checkout Receipts, Direct and conditional
|
|
85
|
-
Payment Mandates, and Payment Receipts.
|
|
86
|
-
|
|
85
|
+
Payment Mandates, and Payment Receipts. Adds opt-in selective Payment candidate
|
|
86
|
+
disclosure. Requires independently trusted application inputs; verification does
|
|
87
|
+
not grant purchase or payment permission.'
|
|
87
88
|
executables: []
|
|
88
89
|
extensions: []
|
|
89
90
|
extra_rdoc_files: []
|
|
@@ -100,13 +101,18 @@ files:
|
|
|
100
101
|
- docs/MERCHANT_SIGNING.md
|
|
101
102
|
- docs/MULTI_ITEM_CHECKOUT.md
|
|
102
103
|
- docs/PAYMENT.md
|
|
104
|
+
- docs/POST_RELEASE_110.md
|
|
103
105
|
- docs/POST_RELEASE_MAINTENANCE.md
|
|
104
106
|
- docs/PUBLIC_API.md
|
|
105
107
|
- docs/RELEASE_100_CANDIDATE.md
|
|
106
108
|
- docs/RELEASE_110_CANDIDATE.md
|
|
109
|
+
- docs/RELEASE_120_CANDIDATE.md
|
|
110
|
+
- docs/SELECTIVE_PAYMENT.md
|
|
107
111
|
- docs/SUPPORT_CONTRACT.md
|
|
112
|
+
- docs/evidence/1.1.0_publication.json
|
|
108
113
|
- examples/conditional_checkout.rb
|
|
109
114
|
- examples/payment.rb
|
|
115
|
+
- examples/selective_payment.rb
|
|
110
116
|
- lib/ap2_mandate_verifier.rb
|
|
111
117
|
- lib/ap2_mandate_verifier/buyer.rb
|
|
112
118
|
- lib/ap2_mandate_verifier/checkout_jwt.rb
|
|
@@ -125,6 +131,7 @@ files:
|
|
|
125
131
|
- lib/ap2_mandate_verifier/root_disclosures.rb
|
|
126
132
|
- lib/ap2_mandate_verifier/root_signature.rb
|
|
127
133
|
- lib/ap2_mandate_verifier/scoped_constraints.rb
|
|
134
|
+
- lib/ap2_mandate_verifier/selective_payment.rb
|
|
128
135
|
- lib/ap2_mandate_verifier/trust_context.rb
|
|
129
136
|
homepage: https://github.com/cuichangquan/ap2-mandate-verifier
|
|
130
137
|
licenses:
|