Version constants: 0.1.0-dev, implementing spec 0.8.2

- src/lib/dkc/version.ts exports VERSION (0.1.0-dev, which becomes
  0.1.0 once phase 2 adds the opening of capsules) and SPEC_VERSION
  (0.8.2, the tag spec-v0.8.2 of datekeys-go), from index.ts too.
- package.json and its lockfile move to 0.1.0-dev. version.test.ts ties
  VERSION to both and checks it is semantic versioning. It also ties
  SPEC_VERSION to the spec field of the shared vectors and fixtures.
  testing/vectors.ts now takes SPEC_VERSION from version.ts, so every
  vector file is checked against the version the library declares.
- The footer of the page shows both, instead of a fixed 0.8.2.
- README.md gains a "Versiones" section: the three versions (format,
  specification, library) and what 0.1.0-dev covers. CHANGELOG.md is
  new.

The Go reference gained datekeys.SpecVersion, datekeys.Version() and
`datekeys version` in 5b342d3.

npm run verify is green: 2,406 tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main
dev 1 week ago
parent 27083805c2
commit a9bdcecc28

@ -0,0 +1,24 @@
# Changelog
Cambios notables de la librería TypeScript y de la página. El proyecto usa versionado semántico; mientras sea 0.x, no hay promesa de estabilidad. La sección «Versiones» del [README](README.md) explica qué cubre cada número.
## 0.1.0 — sin publicar
Implementa la especificación DateKeys 0.8.2 (tag `spec-v0.8.2` de `datekeys-go`) para el perfil Quicknet, y pasa todos los vectores y fixtures compartidos de `datekeys-go` en `9ac9cd9`.
### Hecho
- Codec CBOR del perfil de §58 con los textos de error de la referencia Go.
- Schemas del Provider Profile, `PUBLIC_HEADER`, `CONTROL_CBOR` y `.dkk`.
- Tramas DKC1 y DKK1, cabeceras `age` y DateKey (`dk1_`).
- Extensiones, con los objetos y arrays de su registro.
- La inspección de los pasos 1 a 8 de §63.
- La página estática `/inspect`, sin red. Tras cada compilación se comprueban su política de seguridad y los paquetes de su bundle.
- Fase 2, en curso:
- dependencias de ejecución (`age-encryption` 0.3.1, `@noble/curves` y `@noble/hashes` 2.4.0) con sus guardas;
- el IBE de tlock (`ibe.ts`) y la verificación local de releases (`release.ts`), contrastados con la referencia Go.
- `VERSION` y `SPEC_VERSION`, también en el pie de la página.
### Pendiente para 0.1.0
- La apertura de cápsulas, pasos 9 a 18 de §63 (fase 2, pasos 5 a 8).

@ -12,6 +12,27 @@ La implementación de referencia es la librería Go `g.activething.com/go/DateKe
| Página inspector, sin red | SvelteKit estático: `src/routes/`, `src/lib/inspector/`, `src/lib/components/` | 5 | hecho |
| Cifrado y descifrado en el navegador | fase 2: [docs/PLAN_fase2_ibe_noble2.md](docs/PLAN_fase2_ibe_noble2.md) | 6 | en curso: dependencias y guardas hechas (paso 2 de la fase) |
## Versiones
Hay tres números de versión, cada uno con su significado, como en la referencia Go:
| Versión | Dónde | Cambia cuando |
|---|---|---|
| Formato | Dentro de los objetos: la versión de framing de DKC1 y DKK1 y la de schema de la clave 1, hoy todas 1 | Cambia el formato. Un lector rechaza una versión que no conoce (§70) |
| Especificación | `SPEC_VERSION` de `src/lib/dkc/version.ts`, hoy `0.8.2`: la del tag `spec-v0.8.2` de `datekeys-go` | Cambia el texto normativo |
| Librería | `VERSION` de `src/lib/dkc/version.ts`, igual al campo `version` de `package.json` | Cambia la API o el comportamiento. Versionado semántico, sin promesa de estabilidad antes de 1.0.0 |
`version.test.ts` comprueba que `VERSION` coincide con `package.json` y con su lockfile, y que `SPEC_VERSION` es la versión que nombran los vectores y fixtures compartidos; `vectors.test.ts` exige esa versión a cada fichero. El pie de la página muestra las dos.
La versión actual es `0.1.0-dev`. Será `0.1.0` cuando la fase 2 añada la apertura de cápsulas. Cubre:
- la especificación 0.8.2, con versiones de formato 1;
- solo el scheme de Quicknet (`bls-unchained-g1-rfc9380`): un perfil de otro scheme se inspecciona, pero su release no se verifica (decisión 3 del plan de la fase 2);
- la inspección de los pasos 1 a 8, el IBE de tlock (`ibe.ts`) y la verificación de releases (`release.ts`). La apertura (pasos 9 a 18) llega en la fase 2 y el cifrado en la fase 3;
- todos los vectores y fixtures compartidos de `datekeys-go` en `9ac9cd9` (`spec-v0.8.2`);
- navegadores con Web Crypto y Node 20 o posterior.
[CHANGELOG.md](CHANGELOG.md) recoge los cambios de cada versión.
## `src/lib/dkc`
Lo que hay hoy (pasos 1 a 8) no importa ninguna dependencia. Funciona en navegadores y en Node 20+: solo usa `Uint8Array`, `DataView`, `TextEncoder`/`TextDecoder`, `BigInt` y `crypto.subtle` (SHA-256). La fase 2 añade las dependencias de ejecución de su sección, y noble solo lo importarán `ibe.ts` y `release.ts`.

4
package-lock.json generated

@ -1,12 +1,12 @@
{
"name": "datekeys-app",
"version": "0.0.0",
"version": "0.1.0-dev",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "datekeys-app",
"version": "0.0.0",
"version": "0.1.0-dev",
"license": "Apache-2.0",
"dependencies": {
"@noble/curves": "2.4.0",

@ -1,6 +1,6 @@
{
"name": "datekeys-app",
"version": "0.0.0",
"version": "0.1.0-dev",
"private": true,
"description": "DateKeys in TypeScript: canonical CBOR codec, DKC1/DKK1 parsers, capsule inspector library and its static inspector page; later, browser encryption and decryption.",
"license": "Apache-2.0",

@ -16,3 +16,4 @@ export * from './framing.ts';
export * from './header.ts';
export * from './inspect.ts';
export * from './profile.ts';
export * from './version.ts';

@ -6,11 +6,12 @@
import { fromHex } from '../bytes.ts';
import { isErrorCode } from '../errors.ts';
import { SPEC_VERSION } from '../version.ts';
export type Json = Record<string, unknown>;
/** The version of the specification every vector file must name. */
export const SPEC_VERSION = '0.8.2';
/** The version of the specification every vector file must name: the one the library implements. */
export { SPEC_VERSION };
export class FormatError extends Error {
constructor(where: string, what: string) {

@ -0,0 +1,24 @@
import { readFileSync } from 'node:fs';
import { describe, expect, it } from 'vitest';
import { readJSON } from './testing/testdata.ts';
import { SPEC_VERSION, VERSION } from './version.ts';
// The version of the library is the one of package.json and its lockfile;
// the version of the specification is the one every shared vector file
// names (vectors.test.ts checks each file against it).
describe('versions', () => {
it('VERSION is the version of package.json and of its lockfile, in semantic versioning', () => {
const root = new URL('../../../', import.meta.url);
const pkg = JSON.parse(readFileSync(new URL('package.json', root), 'utf8')) as { version: string };
const lock = JSON.parse(readFileSync(new URL('package-lock.json', root), 'utf8')) as { version: string; packages: Record<string, { version?: string }> };
expect(VERSION).toBe(pkg.version);
expect([lock.version, lock.packages['']?.version]).toEqual([VERSION, VERSION]);
expect(VERSION).toMatch(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/);
});
it('SPEC_VERSION is the specification of the shared vectors and fixtures', () => {
for (const file of ['vectors/cbor.json', 'vectors/mutations.json', 'vectors/tlock_ibe.json', 'fixtures/time_only.json']) {
expect(readJSON<{ spec: string }>(file).spec, file).toBe(SPEC_VERSION);
}
});
});

@ -0,0 +1,17 @@
// The versions of this library. There are three, each with its own meaning
// (README, "Versiones"): the format versions inside the objects (framing and
// schema, 1 today; spec §70), the version of the specification it
// implements, and its own version.
/**
* The version of this library, as in package.json: 0.1.0 once phase 2 adds
* the opening of capsules to their inspection; 0.1.0-dev until then.
*/
export const VERSION = '0.1.0-dev';
/**
* The version of the DateKeys Protocol Specification that this library
* implements: the tag spec-v0.8.2 of the Go reference, whose shared vectors
* and fixtures (testdata/) all name it.
*/
export const SPEC_VERSION = '0.8.2';

@ -4,6 +4,7 @@
import { resolve } from '$app/paths';
import { page } from '$app/state';
import Mark from '$lib/components/Mark.svelte';
import { SPEC_VERSION, VERSION } from '$lib/dkc/version.ts';
let { children }: { children: Snippet } = $props();
@ -32,8 +33,8 @@
<footer class="site-footer">
<div class="wrap">
<p>
Protocolo DateKeys 0.8.2. La página se ejecuta entera en este navegador y su política de seguridad no le permite
conectarse a ningún otro sitio.
Protocolo DateKeys {SPEC_VERSION}, librería {VERSION}. La página se ejecuta entera en este navegador y su política de
seguridad no le permite conectarse a ningún otro sitio.
</p>
</div>
</footer>

Loading…
Cancel
Save

Powered by TurnKey Linux.