Support ECDSA P-256 and P-384 for TAP signatures

Aperta
#1,358 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@brendanjryan ci sta già lavorando.

Dal 24/11/2026.

  • #1363 di @brendanjryan — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
nodejs, typescript

Direzione di ricerca

Start with the Client.prover key check in the TAP identity adapter (mppx/extensions/identity/tap) and the shared HTTP message signature algorithm list and verifier that reject anything except Ed25519 and RSA-PSS SHA-512. Run the reproduction script to see the Signing keys must be Ed25519 or RSA-PSS SHA-512. error for P-256 and P-384. Done means both curves sign and verify with SHA-256 or SHA-384 and fixed-width raw r||s encoding, with the existing restrictions for other profiles unchanged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Expected Behavior

Feature request: support TAP signing and verification using ecdsa-p256-sha256 and ecdsa-p384-sha384, for local key pairs and remote signers.

Both algorithms have public definitions in RFC 9421 §3.3.4 and §3.3.5, and are listed in the IANA HTTP Signature Algorithms registry. This is a request to extend the supported set, rather than a claim that every RFC 9421 profile must implement every registered algorithm.

Current Behavior

Reproduced on the published [email protected] package using Node.js 24.15.0 on 2026-11-24. Ed25519 TAP signing and verification succeeds, while creating a TAP prover with an ECDSA P-256 or P-384 key throws Signing keys must be Ed25519 or RSA-PSS SHA-512.

The shared HTTP message signature algorithm list and verifier also support only Ed25519 and RSA-PSS SHA-512. The relevant algorithm list on current main is unchanged as of this report.

Possible Solution

Add the registered algorithms with explicit key-type and curve checks, SHA-256 for P-256 and SHA-384 for P-384, and the RFC's fixed-width raw r || s signature encoding (64 and 96 bytes respectively). A remote signer returning ASN.1 DER should fail the existing self-check with a useful error.

A tested implementation is available on our fork. It includes a patch changeset and tests that independently sign and verify with Node's crypto interface. Tests cover local and remote TAP signing, hashes, curves, encoding, replay, and tampering. The complete identity test selection passes: 302 tests across 16 files; build, lint/format, types, and package checks also pass.

The implementation preserves the existing Web Bot Auth and JWS attestation algorithm restrictions and does not change TAP's covered components, lifetimes, or payment policy. It is independent of the request-derived-components change.

Minimal Reproducible Example

In a temporary directory, install [email protected], save this as ecdsa.mjs, and run node ecdsa.mjs with Node.js 24. All keys are generated for this local reproduction.

import assert from 'node:assert/strict'
import { Store } from 'mppx/identity'
import { Client, Server } from 'mppx/extensions/identity/tap'

for (const curve of ['Ed25519', 'P-256', 'P-384']) {
  const key = await crypto.subtle.generateKey(
    curve === 'Ed25519' ? 'Ed25519' : { name: 'ECDSA', namedCurve: curve },
    false, ['sign', 'verify'],
  )
  try {
    const prover = Client.prover({ key, keyId: 'repro-agent', intent: 'browse', scope: '*' })
    const request = await prover.prove(new Request('https://merchant.example/resource'), {
      created: Math.floor(Date.now() / 1000) - 1,
      nonce: crypto.randomUUID(),
    })
    const result = await Server.verifier({
      keyResolver: () => key.publicKey,
      nonceStore: Store.memory(),
    }).verify(request)
    assert.equal(curve, 'Ed25519')
    assert.equal(result.status, 'valid')
    console.log(curve, result.status)
  } catch (error) {
    assert.notEqual(curve, 'Ed25519')
    assert.match(error.message, /Signing keys must be Ed25519 or RSA-PSS SHA-512/)
    console.log(curve, error.message)
  }
}

Observed output:

Ed25519 valid
P-256 Signing keys must be Ed25519 or RSA-PSS SHA-512.
P-384 Signing keys must be Ed25519 or RSA-PSS SHA-512.

Context

This would allow TAP integrations to use the public RFC-defined ECDSA algorithms with registered agent keys, including keys held by remote signing services. Would you accept adding this support to the TAP adapter while preserving the restrictions of other identity profiles?

Lingua principale
TypeScript
Stelle
196
Fork
79
Merge medio
15h 20m
PR unite (30g)
156

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di wevm/mppx

Tutte le issue di wevm/mppx

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.