You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3622895
Browse filesBrowse the repository at this point in the historyBrowse files
Support Link Pay Token checkout in vault card commands (#298)
## Summary
Brings the vault card commands in line with the Link Pay Token vault API
(kernel/kernel#3950).
- **Authorize at checkout:** `items invoke <vault> <key> authorize`
takes optional `--browser-id` and `--page-url`, sent as `browser_id` and
`page_url`. The CLI rejects one without the other, a blank browser ID, a
non-https or credential-bearing page URL, and either flag on any other
operation, all before calling the API. Without the flags, authorize
still sends `{"type":"authorize"}`.
- **Authorize errors:** Link card authorize failures print the API's
code and message plus a recovery step. Checkout inspection errors
(`page_not_found`, `ambiguous_page`, `browser_not_found`,
`browser_unavailable`, `destination_denied`, `timeout`, `browser_error`)
say no payment request was made, to fix the tab and authorize again, and
to fall back to a virtual card if inspection keeps failing.
`invalid_request` covers the virtual card limit; 429 says wait and
authorize again.
- **Fill without fields:** card fills may omit `fields` (a Link Pay
Token fill requires this); the request then omits `fields`, and the
item's fill description and API validation decide. Credential fills
still require fields client-side. A field-less result (`"fields":[]`) is
accepted for `completed`, `failed`, and `unknown`, and human output says
to submit the checkout yourself.
- **Card update:** unchanged PATCH path, now tested for success and for
the 409 a Link card returns after it is authorized at a checkout. Its
help says it works only before a Link card is authorized at a checkout;
after that, delete and recreate.
- **Help text:** one shared Link checkout flow (`linkCardFlowHelp`)
appears in `vaults`, `wallets create`, `cards create`, `cards update`,
and `items invoke`, in the order reach checkout → create card →
authorize with browser ID and page URL → share approval URL → wait for
fill → fill → submit yourself. Removed or reworded text that conflicted
with it (browser attached after card creation, "authorize takes no
parameters", unconditional "checkout cards can be edited between
authorizations", provider-assigned domains for Link, bare "never
retry"). README's Link section follows the same flow.
- **Runtime output:** the wallet's server-generated `description` is
shown in human and JSON output. `items get` on a requested Link card
suggests `authorize --browser-id ... --page-url ...`. Link card guidance
now gives recovery steps instead of "never retry automatically".
## SDK
Bumps `github.com/kernel/kernel-go-sdk` to v0.126.0.
## Testing
- `go vet ./...` and `go test ./...` pass.
- `golangci-lint run`: no findings on changed lines (pre-existing
findings elsewhere are unchanged).
- New tests in `cmd/vaults_link_test.go` cover: the shared flow
appearing in every command's help and its step order; retired wording;
the authorize request body with and without checkout flags; client-side
flag validation (no API call); error guidance for each authorize error
code; Pay Token fill with no `fields` in the request and field-less
results; credential fill still requiring fields; Link card update
success and 409; and wallet description output.
- Not run against the production API.
---------
Co-authored-by: rgarcia <72655+rgarcia@users.noreply.github.com>
Copy file name to clipboardExpand all lines: README.md
+63-28Lines changed: 63 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -416,10 +416,10 @@ cannot switch projects.
416
416
|`kernel vaults wallets get <vault> <key>`| Observe wallet state and its hosted action; `--wait 0..60`, `--open`|
417
417
|`kernel vaults wallets payment-methods <vault> <key>`| Fetch advertised live payment methods; JSON is the item with `expanded.payment_methods`|
418
418
|`kernel vaults cards create <vault> <key> --provider link\|agentcard\|kernel --spec '<json>'`| Create a card request without authorizing it |
419
-
|`kernel vaults cards update <vault> <key> --provider link\|agentcard --spec '<json>'`| Update a card spec; pending issuance preserves omitted optional fields, and the API enforces state/provider constraints |
419
+
|`kernel vaults cards update <vault> <key> --provider link\|agentcard --spec '<json>'`| Update a card spec before it is authorized at a checkout; pending issuance preserves omitted optional fields, and the API enforces state/provider constraints |
420
420
|`kernel vaults items list <vault>`| List item keys, types, providers, status, and required actions |
421
421
|`kernel vaults items get <vault> <key>`| Inspect state/actions/returned AgentCard aliases and copyable operation commands; `--wait 0..60`, `--expand payment_methods`, `--open`|
422
-
|`kernel vaults items invoke <vault> <key> <operation>`| GET the item, then POST an advertised operation; `authorize --open` opens a returned HTTPS action; `prepare_checkout --params '<json>'` prepares an unused AgentCard card for Square Pay; `fill --params '<json>'` fills checkout or login fields; `collect --open` opens a credential item's hosted form |
422
+
|`kernel vaults items invoke <vault> <key> <operation>`| GET the item, then POST an advertised operation; `authorize --browser-id <id> --page-url <url>` authorizes a Link card at checkout; `authorize --open` opens a returned HTTPS action; `prepare_checkout --params '<json>'` prepares an unused AgentCard card for Square Pay; `fill --params '<json>'` fills checkout or login fields; `collect --open` opens a credential item's hosted form |
423
423
|`kernel vaults items webmcp invoke <vault> <key>`| Invoke a live WebMCP tool with item fields bound to null input slots; `--browser-id`, `--tool-ref`, `--page-url`, `--input`/`--input-file`, repeatable `--bind <field>=<json-pointer>`, `--timeout-sec 1..120`. Same as `items invoke <vault> <key> webmcp_invoke --params '<json>'`|
returnfmt.Errorf("confirm_transaction currency must match the approved purchase currency and amount must not exceed the approved purchase amount; operation was not invoked")
returnfmt.Errorf("--browser-id and --page-url only apply to Link cards; authorize was not invoked")
315
+
}
312
316
ifoperation=="fill" {
317
+
if!linkCard&&len(params.Fill.Fields) ==0 {
318
+
returnfmt.Errorf("fill for this item requires 1-32 fields binding field names to selectors; only a Link card's fill may omit them. fill was not invoked")
0 commit comments