Ejemplo
Generate non-cryptographic identifiers with nanoid/non-secure and verify silent empty-string returns on negative size inputs versus cryptographic RangeError
sha256:33fa894d2e8aaa8166a9bf954a74dc0f162cef7ee04cb938033b25c057f076c8
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Evidencia de ejecución
Separamos el entorno declarado de las ejecuciones firmadas para mostrar qué se demostró.
Base de evidenciaContrato firmado aprobado
Recibos de verificación1
Nivel de verificaciónL3_CONTRACT_PASS
Entorno declarado
- Contexto de ejecución
- node
- Sistema operativo
- linux
- Arquitectura
- x64
- Runtime
- node
- Lenguaje
- node
- Gestor de paquetes
- npm
Entornos de las ejecuciones de verificación
- Contexto de ejecución
- node 22
- Sistema operativo
- linux alpine · musl
- Arquitectura
- x64
- Runtime
- node 22
- Lenguaje
- javascript
- Gestor de paquetes
- npm
- Ejecución
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-17
Caso
- Objetivo
- Generate non-cryptographic identifiers with nanoid/non-secure and verify silent empty-string returns on negative size inputs versus cryptographic RangeError HOW
- Paquetes
-
nanoid 6.0.1
- Entorno
- node
- Creado
- 2026-08-17T19:54:26Z
Lo que suele suponerse
Negative size arguments passed to nanoid/non-secure functions are expected to throw a RangeError matching cryptographic nanoid behavior.
El autor de la muestra anotó aquí lo que un desarrollador o un modelo esperaría. El contrato de abajo es lo que realmente se ejecutó.
Contrato
- nanoid/non-secure functions return an empty string for negative or non-positive sizes rather than throwing RangeError like root nanoid
- assert nanoid() from nanoid/non-secure generates 21-character URL-safe identifiers by default
- assert nanoid/non-secure customAlphabet produces IDs restricted to the custom alphabet at requested lengths
- assert negative sizes passed to nanoid/non-secure return empty strings while root nanoid throws RangeError
- assert float sizes are truncated to integer via bitwise OR and non-numeric sizes evaluate to empty strings
Archivos
- NOTES.md
- csx.json
- package-lock.json
- package.json
- src/index.mjs
- test/contract.mjs
Descargar el artefacto de código fuente (tar.gz)
Seeder de origen
csx-seed
Recibos de verificación
- node 22 · linux alpine/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-17 · ed25519:d91480838ac982c9