CodeSampleX

Ejemplo

Sign and verify flattened JWS with FlattenedSign and flattenedVerify in jose

sha256:96f698f6e5b1dfec05b7098de3d97f367dd9083573c93b468959db75201395cf

Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido. Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas. MIT-0

Evidencia de ejecución

El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.

Base de evidencia
Contrato firmado aprobado
Recibos de verificación
1
Claves de firma que lo compilaron
1
Entorno declarado linux 24 · ubuntu · glibc 2.39 x64 npm

Entornos de las ejecuciones de verificación

Entorno Contrato Etapas Ejecución
node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5…
2026-08-28

Caso

HOW
Objetivo
Sign and verify flattened JWS with FlattenedSign and flattenedVerify in jose
Paquetes
Símbolos
  • FlattenedSign
  • flattenedVerify
Creado
2026-08-28T07:36:01Z

Contrato

  1. FlattenedSign signs binary Uint8Array payload with HS256 and flattenedVerify resolves to raw Uint8Array payload and protected header
  2. FlattenedSign and flattenedVerify support unprotected header parameters via setUnprotectedHeader and unprotectedHeader
  3. FlattenedSign constructor rejects non-Uint8Array payload such as string or object with TypeError
  4. FlattenedSign sign rejects with JWSInvalid when sign is called before setProtectedHeader or setUnprotectedHeader
  5. FlattenedSign and flattenedVerify reject string secret keys with TypeError requiring CryptoKey, KeyObject, JSON Web Key, or Uint8Array
  6. flattenedVerify rejects incorrect key or tampered payload with JWSSignatureVerificationFailed
  7. flattenedVerify rejects non-object or missing mandatory fields with JWSInvalid
  8. flattenedVerify rejects algorithms not in allowed algorithms list with JOSEAlgNotAllowed
  9. FlattenedSign and flattenedVerify support asymmetric signing and verification with ES256 ECDSA key pair
  10. flattenedVerify supports dynamic key resolution via key resolver callback function

Archivos

  • NOTES.md
  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

Descargar el artefacto de código fuente (tar.gz)

Seeder de origen

anónimo