Skip to content

codegen(wasm): Crypto externs from #746 compile to unsupplied host imports (LinkError at load) #822

Done

Description

@hyperpolymath

Follow-up to #746 (closed by #816, which covers the JS targets).

Gap

On the core-WASM target, the 6 Crypto externs from #816 (sha256, hmac_sha256, base64url_encode, base64url_decode, rsa_sign_pkcs1_sha256, rsa_verify_pkcs1_sha256) compile to host imports such as Crypto.sha256. No host shim in this repo supplies them. A program that uses one compiles, then fails at instantiation with a LinkError.

Repro:

use Crypto::{ sha256 };
pub fn main() -> Int { let d = sha256([1, 2]); len(d) }

affinescript compile succeeds. The module imports Crypto.sha256.

Options

  1. Give a compile-time UnsupportedFeature error on core WASM for these 6 externs (the interim that Crypto: no hashing, HMAC or RSA signing - blocks GitHub App auth from AffineScript (priority) #746 proposes).
  2. Add a host shim that supplies the imports from node:crypto, reading [Int] arrays from linear memory.
  3. Implement SHA-256, HMAC and base64url in AffineScript itself (pure WASM). RSA stays as option 1 or 2, because it needs bignum modexp.

Generated by Claude Code

Activity

  1. whatproblem-ai commented on Nov 27, 2026

    @whatproblem-ai

    Problem: On the core-WASM target, the 6 Crypto externs from #816 (sha256, hmac_sha256, base64url_encode, base64url_decode, rsa_sign_pkcs1_sha256, rsa_verify_pkcs1_sha256) compile to host imports such as Crypto.sha256. No shim in the repo supplies these imports, so affinescript compile succeeds and instantiation then fails with LinkError.

    Expected: The program either fails at compile time with UnsupportedFeature or runs, depending on which of options 1–3 is chosen.

    Missing: which option to pursue (or which mix, such as 3 plus 1 for RSA), and the host runtime used to observe the LinkError.


    Clarity: 90%. Clear enough to work on.

    ⌨️ Commands · 💬 Have feedback? Tell us · 🎯 New here? Add WhatProblem to your repo · 🔒 Privacy

  2. coderabbitai commented on Nov 27, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #816 - feat(stdlib): Crypto sha256, HMAC, base64url, RS256 sign/verify (#746) [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  3. added
    bindings
    bug
    enhancement
    scope:repo
    on Nov 27, 2026
  4. added
    architecture
    on Nov 27, 2026
  5. added 5 commits that reference this issue on Nov 27, 2026
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

    architecturebindingsbugenhancementscope:repo

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions