Skip to content

JS: Web Crypto subset — crypto.getRandomValues + digest primitives #337

Description

@mplsllc

Status

MacSurf does not currently expose the browser Web Crypto API. The old broad won't-fix umbrella #130 grouped Web Crypto with unrelated hardware/network APIs, but MacSurf already owns cryptographic infrastructure (macEntropy/macTLS), so a bounded useful subset is tractable even if full SubtleCrypto is not a near-term goal.

V1 scope

Prioritize APIs that real client-side code commonly probes and that map cleanly to existing primitives:

  1. crypto.getRandomValues(typedArray) backed by the browser's existing cryptographic entropy source.
  2. crypto.randomUUID() if UUID formatting can be supplied cheaply from the same entropy path.
  3. crypto.subtle.digest() for SHA-256 (and only additional digest algorithms already safely available).

Defer key import/export, asymmetric signing, ECDH, AES modes, PBKDF2/HKDF, etc. until real-page evidence justifies them.

Acceptance

  • getRandomValues fills supported integer typed arrays and rejects invalid/oversized requests correctly.
  • randomness comes from the existing secure entropy source, not rand().
  • SHA-256 digest matches known vectors and resolves through a Promise-compatible API.
  • focused QuickJS tests and real-page probe on hardware.

Related: historical umbrella #130.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: js-engineDuktape, ES5 evaluator, JS bindingsenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions