Skip to content

feat: add three impls for random seed#1019

Draft
peter-jerry-ye wants to merge 1 commit intomainfrom
zihang/feat-random-seed-wasm
Draft

feat: add three impls for random seed#1019
peter-jerry-ye wants to merge 1 commit intomainfrom
zihang/feat-random-seed-wasm

Conversation

@peter-jerry-ye
Copy link
Copy Markdown
Contributor

@peter-jerry-ye peter-jerry-ye commented Sep 12, 2025

Related Issues

  • Related issues: #____

This PR adds the random bytes generator for the Wasm runtime. Three implementations are provided, one is to be chosen based on the interface.

  • wasip1 provides the API based on wasi preview 1
  • wasip2 provides the API based on wasi preview 2
  • custom provides the API based on custom names

The main.mbt demonstrates the examples of using them to provide insecure seeds as two UInt64.

Unfortunately, when returning a tuple, it is not using multi-value return but rather a struct.

Type of Pull Request

  • Bug fix
  • New feature
    • I have already discussed this feature with the maintainers.
  • Refactor
  • Performance optimization
  • Documentation
  • Other (please describe):

Does this PR change existing behavior?

  • Yes (please describe the changes below)

  • No

Does this PR introduce new dependencies?

  • No
  • Yes (please check binary size changes)

Checklist:

  • Tests added/updated for bug fixes or new features
  • Compatible with Windows/Linux/macOS

@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com Bot commented Sep 12, 2025

@lynzrand
Copy link
Copy Markdown
Contributor

the js glue part looks good to me. pending on apis

@lynzrand lynzrand marked this pull request as draft September 28, 2025 06:49
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