Skip to content

feat(signer): vokf-sign (VOKF-2 / S2) - #2

Merged
aggre merged 2 commits into
mainfrom
s2/signer
Jun 15, 2026
Merged

feat(signer): vokf-sign (VOKF-2 / S2)#2
aggre merged 2 commits into
mainfrom
s2/signer

Conversation

@yumemayu

Copy link
Copy Markdown
Member

S2 — @verifiable-okf/signer (VOKF-2)

Attaches a provenance block (content_hash + Ed25519 signature) to an OKF concept without mutating any other byte. Depends on the @verifiable-okf/canon core from S1 (PR #1).

Implements

  • Appends provenance at the end of the frontmatter (before closing ---); original frontmatter text + body kept verbatim.
  • Ed25519 (RFC 8032, deterministic) over the §6 signing payload; did:key issuer derived from the seed when not supplied.
  • vokf-sign CLI — private key read from hex/file, never logged or written to output.
  • Golden fixtures fixtures/{unsigned,signed}/ga4-event.md (fixed test seed + timestamps).

DoD(VOKF-2)

  • provenance キーのみ追加、既存frontmatter/body を1バイトも変えない(diffテスト)
  • 再署名で content_hash / signature がバイト同一(冪等
  • fixtures/unsignedfixtures/signed再現(golden一致)
  • 秘密鍵が出力・ログに残らない
  • 署名は再構成した §6 payload で検証成功(事前確認)
  • build + 全テスト green(canon 28 + signer 7 = 35)

スコープ調整(共有)

当初S2案にあった schema検証 / DID 解決 は、それらを実際に使う verifier(S3) にまとめます。S2では署名に必要な did:key 生成 のみ実装。

S3:verifier(§10 アルゴリズム)+ schema検証 + did:web/did:key 解決 + fixtures/tampered + 公開準備。

🤖 Generated with Claude Code

Mayumi Hara and others added 2 commits June 16, 2026 07:01
…tes (VOKF-2)

`@verifiable-okf/signer` attaches a `provenance` block (content_hash +
Ed25519 signature over the §6 payload) by appending it at the end of the
frontmatter, before the closing `---`. The original frontmatter text and
the body are preserved verbatim — only the provenance block is added.
Deterministic (idempotent): RFC 8032 Ed25519 + timestamps are inputs.

- keys.ts: Ed25519 (via @noble/curves), did:key derivation (multicodec
  ed25519-pub + base58btc multibase).
- sign.ts: signConcept(); signs over JCS(frontmatter* incl. provenance
  without signature.value) || 0x0A || canonical_body; issuer defaults to
  the did:key of the signing seed.
- cli.ts: `vokf-sign` (key from hex/file, never logged or written out).
- fixtures/{unsigned,signed}/ga4-event.md golden (fixed test seed +
  timestamps).

Tests (7): reproduces fixtures/signed from fixtures/unsigned; idempotent;
adds only provenance (body + original frontmatter byte-identical);
content_hash matches canon; signature verifies over the reconstructed
payload; private key never leaks into output; did:key issuer derived.
build + full suite green (35 tests total).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Without a topological dependency on the build task, turbo could build
`signer` in parallel with `canon`, so signer's tsc ran before canon's
dist/ existed and failed to resolve @verifiable-okf/canon. Local builds
passed only because canon's dist/ already existed; a clean CI checkout
surfaced the race. Adding "dependsOn": ["^build"] makes dependency
packages build first (mirroring the test task).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@aggre
aggre merged commit e492888 into main Jun 15, 2026
1 check passed
@aggre
aggre deleted the s2/signer branch June 15, 2026 22:19
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.

2 participants