Accountmaker Docs
Tipos

Clave de Cliente

Par de claves para firmar tokens con clave pública en JWKS.

cryptography jwt jwks signing keys

Clave de Cliente

Una Clave de Cliente es un par criptográfico para firmar tokens. La clave pública se expone via JWKS; la privada nunca se expone.

Schema

interface ClientKey {
  kid: string; // Key ID en JWT header
  credential_id: string; // Client ID (cid...)
  jwk: object; // JWK público
  public_key: string; // Clave pública PEM
}

Propiedades

PropiedadTipoDescripción
kidstringKey ID
credential_idstringCliente dueño de la clave
jwkobjectJWK público
public_keystringClave pública PEM

JWKS

Claves públicas en /.well-known/jwks.json:

{
  "keys": [
    {
      "kty": "RSA",
      "use": "sig",
      "kid": "key_2kHfPZcN9xW4mE8RtY7vB",
      "alg": "RS256",
      "n": "0vx7agoebG...",
      "e": "AQAB"
    }
  ]
}

Rotación

Create New Key

Sign with New Key

Old Key in JWKS

Delete Old Key

Buenas prácticas:

  • Rotar claves periódicamente
  • Mantener 2-4 claves activas durante transición
  • Claves antiguas siguen en JWKS

Ejemplo

{
  "kid": "key_2kHfPZcN9xW4mE8RtY7vB",
  "credential_id": "cid_1jGePYbM8wV3lD7QsX6uA",
  "jwk": { "kty": "RSA", "kid": "key_..." },
  "public_key": "-----BEGIN PUBLIC KEY-----..."
}

Relacionado