Skip to content

fix(core): back-date DI proof created for clock skew; doc mediator CORS (0.1.1) - #51

Merged
stormer78 merged 1 commit into
mainfrom
clock-skew-proof-and-mediator-cors
May 31, 2026
Merged

fix(core): back-date DI proof created for clock skew; doc mediator CORS (0.1.1)#51
stormer78 merged 1 commit into
mainfrom
clock-skew-proof-and-mediator-cors

Conversation

@stormer78

Copy link
Copy Markdown
Contributor

Summary

Two fixes surfaced while debugging the provision-integration flow against a live VTA + mediator.

1. Clock-skew on the BootstrapRequest VP proof

The VTA's eddsa-jcs-2022 spec-conformance check rejects any proof whose created is in the verifier's future, with no skew tolerance. A wallet clock running slightly ahead of the VTA produced:

provision-integration: e.p.msg.bad-request — verify BootstrapRequest VP:
proof verification failed: ... Created date is in the future

signTrustTask now back-dates created by a configurable clockSkewMs (default 60s, still UTC via toISOString()) — covering normal NTP skew and sitting comfortably inside the ±5min window the VTA already allows on validUntil. Every wallet Data-Integrity proof (including the BootstrapRequest VP) flows through this signer.

2. Mediator CORS docs

A CORS-blocked cross-origin WebSocket upgrade fails as an opaque 1006 (WebSocket failed to open) even when REST auth works — a browser rejects the upgrade before the socket opens. Documented in the README: the mediator must allow the wallet's origin (or *), the symptom, and how to set it on affinidi-messaging-mediator.

Timestamp audit (the "are timestamps always UTC?" question)

Audited every timestamp site: all wire/proof/credential timestamps already use new Date().toISOString() (UTC Z). The only toLocaleDateString() is popup.tsx UI display (correctly localized). So this was never a conversion bug — purely missing skew tolerance.

Versions

Bumps @openvtc/pnm-core 0.1.0 → 0.1.1 (the published package with the fix) and the private app packages that ship it (pwa, extension, root). Dependents keep their ^0.1.0 (major.minor) pin, which accepts 0.1.1.

Tests

  • New regression test: proof created is UTC (…Z) and back-dated below call time, within a sane skew window.
  • Build + full core suite: 22 pass, 0 fail.

Follow-up (separate)

The companion library PR OpenVTC/vti-didcomm-js#2 adds the WS close-code diagnostics (which is how the CORS/1006 cause was pinned down) and inbound poison-frame resilience. Once that's published as 0.4.2, bump this package's @openvtc/vti-didcomm-js dep to pick it up. Kept on the published ^0.4.1 here so this PR is independently mergeable.

🤖 Generated with Claude Code

…CORS

Two fixes from a live provision-integration debugging session:

1. **Clock-skew on the BootstrapRequest VP proof.** The VTA's
   eddsa-jcs-2022 spec-conformance check rejects any proof whose
   `created` is in the verifier's future, with no skew tolerance. A
   wallet clock running slightly ahead produced "Created date is in the
   future". `signTrustTask` now back-dates `created` by a configurable
   `clockSkewMs` (default 60s, still UTC) — covering normal NTP skew and
   sitting inside the ±5min window the VTA already allows on validUntil.
   All wallet Data-Integrity proofs flow through this signer.

2. **Mediator CORS docs.** A CORS-blocked cross-origin WebSocket upgrade
   fails as an opaque 1006 ("WebSocket failed to open") even when REST
   auth works. Documented the requirement (allow the wallet origin or
   `*`) and the symptom in the README.

Audited every timestamp: all wire/proof/credential timestamps already
use `toISOString()` (UTC); the only `toLocaleDateString()` is UI display.

Bumps @openvtc/pnm-core (and the private app packages that ship it) to
0.1.1. Adds a regression test asserting `created` is UTC and back-dated.

Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
@stormer78
stormer78 merged commit 516a2c8 into main May 31, 2026
1 check passed
@stormer78
stormer78 deleted the clock-skew-proof-and-mediator-cors branch May 31, 2026 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant