{"id":15401127,"url":"https://github.com/sunfishcode/wasi-random-presentation","last_synced_at":"2026-03-29T22:30:16.714Z","repository":{"id":70209381,"uuid":"419476879","full_name":"sunfishcode/wasi-random-presentation","owner":"sunfishcode","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-21T14:55:12.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-14T23:56:46.864Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunfishcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-20T20:15:09.000Z","updated_at":"2021-10-22T22:25:35.000Z","dependencies_parsed_at":"2023-04-24T00:00:20.009Z","dependency_job_id":null,"html_url":"https://github.com/sunfishcode/wasi-random-presentation","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.375,"last_synced_commit":"e719f933af945a71512d9cb616c2f3ac27623a01"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fwasi-random-presentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fwasi-random-presentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fwasi-random-presentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunfishcode%2Fwasi-random-presentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunfishcode","download_url":"https://codeload.github.com/sunfishcode/wasi-random-presentation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239952603,"owners_count":19723922,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T15:56:33.653Z","updated_at":"2026-03-29T22:30:16.683Z","avatar_url":"https://github.com/sunfishcode.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WASI Random\n\nA proposed [WebAssembly System Interface](https://github.com/WebAssembly/WASI) API.\n\n### Current Phase\n\nPhase 2\n\n### Champions\n\n- Dan Gohman\n\n### Phase 4 Advancement Criteria\n\n - Two independent implementations.\n - At least one host implementation on each of:\n    - Linux\n    - macOS\n    - Windows\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Goals](#goals)\n- [Non-goals](#non-goals)\n- [API walk-through](#api-walk-through)\n- [Detailed design discussion](#detailed-design-discussion)\n  - [Should WASI random be async?](#should-wasi-random-be-async)\n  - [Should WASI random specify a number of bits of security?](#should-wasi-random-specify-a-number-of-bits-of-security)\n- [Stakeholder Interest \u0026 Feedback](#stakeholder-interest--feedback)\n- [References \u0026 acknowledgements](#references--acknowledgements)\n\n### Introduction\n\nWASI random provides APIs for obtaining random data, from a [CSPRNG].\n\n[CSPRNG]: https://en.wikipedia.org/wiki/Cryptographically-secure_pseudorandom_number_generator\n\n### Goals\n\nGoals include providing high-quality random data without burdening\napplications with the need to find ways to recover in case random data\nis either temporarily or permenantly unavailable.\n\n### Non-goals\n\nWASI random is not aiming to be a low-level TRNG or DRBG API. It does not\npublish entropy estimates or provide low-level access to entropy sources. It\ndoes not provide ways for users to manually reseed the CSPRNG.\n\nAnd, WASI random is not aiming to be a high-level general-purpose randomness\nAPI. It just returns random bytes, and expects other APIs will provide\nmore convenient interfaces on top of it.\n\n### API walk-through\n\nThere's just one function, `random_bytes`, and it takes a `pull-buffer` to\nwrite bytes into.\n\n### Detailed design discussion\n\n#### Should WASI random be async?\n\nDuring \"early boot\", some host platforms start in a state where they do not\nhave sufficient entropy to seed their CSPRNGs. One way to handle this is to\nmake the `random_bytes` function be async. Alternatively, it could return a\nspecialized error value indicating that randomness is temporarily unavailable.\n\nHowever, this puts the burden on applications to have other meaningful work\nto do while waiting for randomness to become available, work which may be\nexpected to generate network traffic or other I/O which would generate\nentropy. It's not clear that applications in general are prepared for this\nburden.\n\nAnd, this would put the burden on all applications that need random data.\nThe WASI random design puts the burden on platform designers to ensure that,\nif they need programs that need random data to run during early boot, their\nplatforms should be designed to support that.\n\n#### Should WASI random specify a number of bits of security?\n\nBest practices suggest that implementations should provide at least 196 bits\nof security. However, many host platforms' CSPRNG APIs do not currently\ndocument their bits of security, and it doesn't seem desirable to require\nwasm engines to run their own CSPRNG on a platform which alreay has one, so\nfor now, the API does not specify a specific number.\n\n### Stakeholder Interest \u0026 Feedback\n\nThere are currently several major WASI implementations of the WASI random API.\nIt provides the basis for implementing `getentropy` in wasi-libc, and it's\nwidely used.\n\n### References \u0026 acknowledgements\n\nMany thanks for valuable feedback and advice from:\n\n - Zach Lym\n - Luke Wagner\n - Linux Weekly News' many articles about Linux random APIs including [this one].\n\n[this one]: https://lwn.net/Articles/808575/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunfishcode%2Fwasi-random-presentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunfishcode%2Fwasi-random-presentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunfishcode%2Fwasi-random-presentation/lists"}