Skip to content

feat(paymentcryptography): the payment keys in the Cloud Explorer - #476

Merged
fredpena merged 4 commits into
floci-io:mainfrom
chhil:feat/payment-cryptography
Nov 20, 2026
Merged

fredpena merged 4 commits into
floci-io:mainfrom
chhil:feat/payment-cryptography

Conversation

@chhil

@chhil chhil commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds AWS Payment Cryptography to the Cloud Explorer through the schema-driven
pattern: a catalog row, a schema, an adapter and a test. The only frontend
line is the nav icon; the table, the form and the inspector are rendered from
the schema.

The key is the resource, as it is in the reference's own key list. The table
shows the ARN, the class, the usage, the algorithm, the state, the two flags
and the moment the key was made. The inspector adds the check value and the
algorithm it was computed with, the modes of use, the origin and the tags.

A key is made the way the reference makes one: a TR-31 usage, an algorithm that
usage allows, and the modes of use that say what the key may be used for. The
class follows from the algorithm, so the form does not ask for one: a symmetric
algorithm makes a SYMMETRIC_KEY and an RSA or EC one a key pair. The adapter
refuses an algorithm the usage does not allow and names the ones it does, and
refuses a key with no mode of use, because such a key does no work.

Deletion is the reference's own: the key is disabled and stays readable until
the waiting period ends, so it keeps its row until then.

What the view does not hold is said above the list rather than left to be
guessed at: aliases, key replication and Multi-Party Approval are not in it.
The Edit tags capability is listed and the adapter implements it, but the
generic view has no tags control yet, the same way KMS lists it.

Adds @aws-sdk/client-payment-cryptography, pinned to the version the other
AWS clients are on so both lockfiles stay additive.

Type of change

  • Bug fix (fix:)
  • New feature / service UI (feat:)
  • Breaking change (feat!: or fix!:)
  • Docs / chore

Area

  • Frontend (packages/frontend)
  • API / Cloud Proxy (packages/api)
  • Cloud Explorer adapter / schema
  • Build / CI / Docker

Verification

Against a local Floci core (:4566) with four real payment cryptography keys,
made through the console's own API and through the AWS CLI:

  • a TR-31 K0 key encryption key of AES-256, exportable and tagged;
  • a TR-31 P0 PIN encryption key of TDES-2KEY;
  • a TR-31 M1 ISO 9797-1 MAC key of TDES-3KEY;
  • a TR-31 K2 TR-34 asymmetric key of RSA-2048, a key pair.

GET /api/clouds/aws/services/paymentcryptography/resources returns the four
with their class, usage, algorithm, state, flags and check value, and
GET .../resources/<keyArn> returns the modes of use and the tags. The keys
were made through POST .../resources with the form's own values, and the
answer carries the class the algorithm implies and the check value the
algorithm's own kind computes (CMAC under an AES key).

In the browser, /cloud-explorer/aws/paymentcryptography lists the keys with
the notice and the columns, the create form renders the usage, the algorithm,
the two flags and the nine modes of use, each select opening on the value it
saves rather than on a "Default" entry, and the inspector opens on a row with
the tags as chips. No console errors.

Checks: pnpm lint, pnpm type-check, pnpm test (2853 API tests, 29 of them
new in AwsPaymentCryptographyAdapter.test.ts, and 314 frontend tests) and
pnpm build pass.

Checklist

  • pnpm lint, pnpm type-check, pnpm test, and pnpm build pass locally
  • New or updated tests added where it makes sense (bun test in packages/api)
  • No fake/mock data added: unwired states stay empty or show an explicit placeholder
  • Commit messages / PR title follow Conventional Commits
  • Layout or look-and-feel changes close an issue that came from an accepted Discussion, or this PR has none (new services through the existing views, bug fixes that restore the intended layout, and accessibility fixes are exempt)
  • I have no more than 2 open, non-draft pull requests and no more than 4 open pull requests in total (drafts included) in this repository (maintainers and dependency bots are exempt).

Adds AWS Payment Cryptography to the Cloud Explorer through the schema-driven
pattern: a catalog row, a schema, an adapter and a test.

The key is the resource, as it is in the reference's own key list: the table
shows the ARN, the class, the usage, the algorithm, the state, the two flags
and the moment the key was made, and the inspector adds the check value, the
modes of use and the tags.

A key is made the way the reference makes one: a TR-31 usage, an algorithm
that usage allows, and the modes of use that say what the key may be used
for. The class follows from the algorithm, so the form does not ask for one.
The adapter refuses an algorithm the usage does not allow, naming the ones it
does, and refuses a key with no mode of use, because such a key does no work.

Deletion is the reference's own: the key is disabled and stays readable until
the waiting period ends, and the tags are edited with the same pair of
operations the reference uses.

Adds @aws-sdk/client-payment-cryptography, pinned to the version the other
AWS clients are on so the lockfiles stay additive.
A select the form left on its default entry showed "Default" and saved
something the page never showed: the usage and the algorithm were resolved on
the server, and the form said nothing about what they would be.

Both now carry their default, so the form opens on the values that are saved,
and the descriptions say what the default is. The algorithm's default is the
first one the usage allows, which is the usage's own table and not a fixed
value, so it is named in the description rather than in the field.
…able

The create form took any algorithm the usage's family allowed and any
combination of modes of use, so it could ask for a key the reference refuses:
an elliptic curve key for a usage that takes an RSA one, or a MAC key that may
encrypt.

The reference publishes the table of valid key attributes, and it is now the
authority: the algorithm has to be one the usage allows, and the modes of use
have to be one of the combinations the usage allows. The table is the
reference's own, and the local runtime is more permissive in two places, so the
table and not the runtime decides.

The algorithm is no longer given a fixed default, because the one that is
saved depends on the usage: it is left unset and the adapter takes it from the
usage's own table, the way the KMS adapter takes the key spec. A mode is
parsed with the shared rule as well, so an answer that is neither of the two
is refused rather than taken for a no.
@chhil

chhil commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

A local review of this pull request with pr-agent found six issues. Four were
right and are in, in d39ef53. Two were not.

Right, and fixed

  • The algorithm table. The branch let an asymmetric usage take either family of
    algorithm. The reference's own table of valid key attributes says otherwise:
    TR31_D1_ASYMMETRIC_KEY_FOR_DATA_ENCRYPTION, TR31_S0_ASYMMETRIC_KEY_FOR_DIGITAL_SIGNATURE
    and TR31_K2_TR34_ASYMMETRIC_KEY take an RSA key, and
    TR31_K3_ASYMMETRIC_KEY_FOR_KEY_AGREEMENT takes an elliptic curve one. The
    table is now the authority, and a refusal names the algorithms the usage does
    take.
  • The modes of use. The branch accepted any combination of them. The reference
    allows a fixed set per usage, so a MAC key that may encrypt was accepted here
    and refused there. The combinations are now checked against the usage's own
    list, and the refusal names the ones that are valid.
  • The static default. The branch gave the algorithm a fixed default of
    TDES_2KEY, which the usage's own table contradicts for the asymmetric
    usages, and the adapter's fallback only ran when the value was absent. The
    default is gone: the algorithm is left unset and the adapter takes it from the
    usage's table, the way the KMS adapter takes the key spec.
  • The boolean parsing. A mode was read as value === 'true', so any other
    non-empty answer became a quiet "no". It is parsed with the shared rule now,
    so an answer that is neither of the two is refused.

Not right

  • The timestamp field. The finding says the Key type has no CreateTimestamp
    and that the adapter would not compile. It does have it: the SDK's
    models_0.d.ts carries CreateTimestamp: Date | undefined at line 186, and
    pnpm type-check passes over the file.
  • The unsupported fields. The finding says MultiRegionKeyType and
    PrimaryRegion are KMS members rather than Payment Cryptography ones. They are
    on the Key type too, at lines 216 and 221 of the same file, and the API
    reference lists both in the CreateKey response.

Both of those read as a model from a neighbouring service, which is why the
checks that would have caught them are the ones that ran: the type-check and the
tests over the SDK's own types.

The table the four fixes follow is the reference's
Understanding key attributes
page, and its own examples in
Creating keys
agree with it. One place they differ: the hash usage's table lists only the
symmetric algorithms, while the guide's own HMAC example creates a
HMAC_SHA512 key, so the hash algorithms are offered for that usage as well.
The two usages the model names but the reference's table does not, the ISO 16609
MAC key and the PIN generation key, take the rule of the family they belong to.

Checks: pnpm lint, pnpm type-check, pnpm test (2852 API tests, 28 of them
new in AwsPaymentCryptographyAdapter.test.ts, and 314 frontend tests) and
pnpm build pass.

@chhil
chhil marked this pull request as ready for review November 20, 2026 06:25
@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous finding is fixed and no new actionable issues were found.

Summary

Adds Payment Cryptography keys to the existing Cloud Explorer views.

  • Cloud Explorer shows and manages AWS Payment Cryptography keys.

The requested greptile_confidence label could not be added because GitHub authentication is unavailable.

Reviews (2) · Last reviewed commit: "perf(paymentcryptography): the health ch..." · Reviewed by Greptile

…ccount

The service status is polled every few seconds, and it fell back to the
adapter's own list, which reads every page of keys and then every key in full.
One page is enough to say the service answers, so the probe asks for one.
@fredpena
fredpena merged commit 74d2e7f into floci-io:main Nov 20, 2026
9 of 10 checks passed
fredpena pushed a commit that referenced this pull request Nov 21, 2026
## Summary

The `updateTags` capability has been advertised since the capability
existed, and
the console had no way to reach it, so the tags a resource showed were
the ones it
would keep. KMS declares the capability and the console never rendered
it.

The resource panel now carries the control: the tags a resource has,
editable,
saved through the adapter's own `updateTags`, which is where a key with
a null
value is one whose tag is removed. The control appears only for a
service whose
schema declares the capability, so a service that cannot edit its tags
shows
none.

This is the shared half of the payment cryptography work, and it stands
on its
own: it needs nothing from #476, and #476 needs nothing from it.

## Type of change

- [ ] Bug fix (`fix:`)
- [x] New feature / service UI (`feat:`)
- [ ] Breaking change (`feat!:` or `fix!:`)
- [ ] Docs / chore

## Area

- [x] Frontend (`packages/frontend`)
- [x] API / Cloud Proxy (`packages/api`)
- [ ] Cloud Explorer adapter / schema
- [ ] Build / CI / Docker

## Verification

Against a local Floci core (`:4566`):

- a KMS key with tags, edited in the panel: a tag's value changed, a tag
added
  and a tag removed, and the key comes back with the three;
- a resource whose service does not declare `updateTags` shows no
control, and
the API answers the request with `501 operation_not_supported`, which is
the
  error the service layer raises for an adapter without the method;
- an unknown service answers `404`;
- the tags refresh after they are edited: the panel asks again for the
resource's
  own query and for the list, which are the two that carry them.

Checks: `pnpm lint`, `pnpm type-check`, `pnpm test` (2904 API tests, 3
of them
new in `clouds.tags.test.ts`, and 321 frontend tests, 6 of them new in
`resourceTags.test.ts`) and `pnpm build` pass.

## Note on the shared surface

The control lands in the shared resource panel, which the repository's
rules
ask to change only for an issue that came from an accepted Discussion.
The
argument for doing it directly is that the capability was already
declared and
the console simply could not reach it, so this is the control the schema
always
promised. Happy to split the API half out if the panel is the part that
needs
the discussion.

## Checklist

- [x] `pnpm lint`, `pnpm type-check`, `pnpm test`, and `pnpm build` pass
locally
- [x] New or updated tests added where it makes sense (`bun test` in
`packages/api`, vitest in `packages/frontend`)
- [x] No fake/mock data added: unwired states stay empty or show an
explicit placeholder
- [x] Commit messages / PR title follow Conventional Commits
- [x] Layout or look-and-feel changes close an issue that came from an
accepted Discussion, or this PR has none (new services through the
existing views, bug fixes that restore the intended layout, and
accessibility fixes are exempt)
- [x] I have no more than 2 open, non-draft pull requests and no more
than 4 open pull requests in total (drafts included) in this repository
(maintainers and dependency bots are exempt).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants