Skip to content

Claude/research crypto api 01 sx ts ltr cv5 bf qc1 p ghe2 xd#1385

Draft
Frank-en-stein wants to merge 4 commits intojstz-dev:mainfrom
Frank-en-stein:claude/research-crypto-api-01SXTsLTRCv5BfQC1PGhe2XD
Draft

Claude/research crypto api 01 sx ts ltr cv5 bf qc1 p ghe2 xd#1385
Frank-en-stein wants to merge 4 commits intojstz-dev:mainfrom
Frank-en-stein:claude/research-crypto-api-01SXTsLTRCv5BfQC1PGhe2XD

Conversation

@Frank-en-stein
Copy link
Contributor

Please go the the Preview tab and select the appropriate sub-template:

Add two detailed technical documents analyzing Web Crypto API requirements
and jstz's current cryptographic capabilities:

- crypto-api-checklist.md: Complete W3C Web Crypto API specification
  breakdown with tiered feature classification (TIER 1/2/3) for
  JavaScript platform implementation requirements

- crypto-api-support-matrix.md: Exhaustive analysis of jstz's current
  crypto support, comparing protocol-level Rust implementations against
  Web Crypto API requirements for JavaScript smart functions

Key findings:
- jstz currently has 0% Web Crypto API support in JavaScript
- Strong protocol-level crypto (Ed25519, P256, Secp256k1, Blake2b)
- Deterministic execution model requires seeded PRNG approach
- Recommends phased implementation starting with deterministic subset
Add practical implementation roadmap with:
- Phase-by-phase implementation plan (6 sprints, 9-15 weeks)
- Specific code examples and file locations for each feature
- Technical decisions needed (extension approach, randomness strategy)
- Recommended implementation order prioritizing deterministic operations
- Testing strategy and success metrics

Focus on jstz-specific constraints:
- Deterministic execution requirement
- Leveraging existing jstz_crypto Rust implementations
- Integration with Deno runtime architecture
- Smart function security considerations
…essment

CORRECTED FINDINGS:

Web Standards Support:
- jstz HAS ~60-70% web standards coverage (Fetch, Streams, URL, Encoding, etc.)
- Previous claim of "0% support" was incorrect and misleading
- Runtime includes deno_web, deno_url, deno_fetch_base, providing rich web APIs

Web Crypto API Specific:
- JavaScript access: ~1% (2/247 WPT tests passing)
- The 2 passing tests verify crypto is NOT available (correct behavior)
- Functional Web Crypto: 0% (no crypto.subtle, no getRandomValues)
- This is the gap, not general web standards

Protocol-Level Cryptography:
- Excellent Rust implementation (Ed25519, P256, Secp256k1, Blake2b)
- Not exposed to JavaScript smart functions
- Used for protocol operations (signing, verification, hashing)

Key Evidence:
- Global scope analysis (98_global_scope.js): 40+ web APIs, no crypto
- Extension init (runtime.rs:490-516): 8 extensions, no deno_crypto
- WPT results parsed: 2/247 passing (both test for crypto absence)
- Dependency analysis: deno_web present, deno_crypto absent

Changes:
- Completely rewrote crypto-api-support-matrix.md with accurate data
- Added section 1: "Web Standards Support in jstz" (comprehensive)
- Documented all available APIs with source references
- Corrected WPT analysis with actual test count and pass/fail breakdown
- Updated implementation roadmap with corrected current state
@Frank-en-stein Frank-en-stein marked this pull request as draft November 18, 2025 23:27
Add detailed, actionable 3-phase implementation plan (12-18 weeks):

Phase 1 (6-8 weeks): MVP - Core Deterministic Operations
- Hash functions (SHA-256/384/512, Blake2b)
- Signature verification (Ed25519, P-256)
- Key import/export (raw, JWK)
- Success: 15-20% WPT pass rate

Phase 2 (4-6 weeks): Extended Deterministic Operations
- HMAC (SHA-256/384/512)
- AES-GCM encryption/decryption
- PBKDF2 key derivation
- Success: 30-40% WPT pass rate

Phase 3 (2-4 weeks): Advanced Features & Optimization
- Randomness strategy decision (strict vs seeded PRNG)
- Optional Secp256k1 support
- Performance optimization
- Success: 40-50% WPT pass rate

Plan includes:
- Detailed code examples for each feature
- Specific files to create/modify with line numbers
- Acceptance criteria for each deliverable
- Risk assessment and mitigation strategies
- Resource estimates (952 hours, ~$150k-200k budget)
- Testing strategy (unit, integration, WPT)
- Security considerations and audit checkpoints
- Rollout plan (beta → preview → production)

Key decisions documented:
- Extension approach (custom jstz_crypto vs deno_crypto)
- Randomness strategy (3 options with trade-offs)
- Private key handling in smart functions
- Performance targets per operation

All recommendations based on:
- Existing jstz_crypto Rust implementation
- Deterministic execution requirements
- Web Crypto API W3C specification
- Smart contract platform comparison
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