WasmCon 2026 in Seattle is the premier conference for the WebAssembly ecosystem — covering Wasmtime, WasmEdge, WASI, the Component Model, and production Wasm deployments on edge networks and cloud platforms. UUID generation in sandboxed Wasm modules was a recurring topic: the sandbox-by-default model means Wasm modules cannot call syscall(SYS_getrandom) or clock_gettime() directly — they must request these capabilities from the host runtime via WASI interfaces. Sessions covered how to generate correct UUID v7 values across Wasmtime, browser, Cloudflare Workers, and Fastly Compute environments.
Event details
| Conference | WasmCon 2026 |
| Date | October 1–2, 2026 |
| Location | Seattle, WA, USA |
| Focus | UUID v7 in WebAssembly — WASI random/clock APIs, Rust Wasm, edge runtimes |
Session: UUID v7 in Rust compiled to wasm32-wasip2
The opening session demonstrated building a Rust library that generates UUID v7 and compiles to WASI Preview 2 (wasm32-wasip2), where host-provided randomness and clock access are available via WASI component imports:
// Cargo.toml
// [dependencies]
// uuid7 = "0.7"
// wasm-bindgen = "0.2" (for wasm32-unknown-unknown / browser targets)
//
// [[bin]]
// name = "uuid_gen"
// crate-type = ["cdylib"]
// src/lib.rs — compiles to wasm32-wasip2 or wasm32-unknown-unknown
use uuid7::uuid7;
/// Generate a UUID v7 string — called from the Wasm host
#[no_mangle]
pub extern "C" fn generate_uuid_v7() -> *mut u8 {
let id = uuid7().to_string(); // "019434a1-7c30-7000-..."
let mut bytes = id.into_bytes();
bytes.push(0); // null terminator for C string reading by host
let ptr = bytes.as_mut_ptr();
std::mem::forget(bytes); // host is responsible for freeing
ptr
}
/// Free memory allocated by generate_uuid_v7
#[no_mangle]
pub extern "C" fn free_string(ptr: *mut u8, len: usize) {
unsafe { drop(Vec::from_raw_parts(ptr, len, len)) }
}
The uuid7 crate links to the WASI wasi:random/random and wasi:clocks/wall-clock imports when compiled for wasm32-wasip2 — no changes to application code are needed compared to a native Rust build. See UUID in Rust.
Session: UUID v7 in the Wasm Component Model
WASI Preview 2’s Component Model allows defining typed interfaces in WIT (WebAssembly Interface Types). The session covered exporting a UUID generation interface:
// wit/uuid-gen.wit
package my:uuid-gen@0.1.0;
interface uuid-ops {
/// Generate a UUID v7 as a 36-character hyphenated string
generate-v7: func() -> string;
/// Extract Unix millisecond timestamp from a UUID v7 string
/// Returns 0 if the input is not a valid UUID v7
extract-timestamp-ms: func(id: string) -> u64;
}
world uuid-generator {
export uuid-ops;
}
// src/lib.rs — Component Model export implementation
wit_bindgen::generate!({
world: "uuid-generator",
path: "wit/uuid-gen.wit",
});
use uuid7::{uuid7, Uuid};
struct UuidGen;
impl exports::my::uuid_gen::uuid_ops::Guest for UuidGen {
fn generate_v7() -> String {
uuid7().to_string()
}
fn extract_timestamp_ms(id: String) -> u64 {
id.parse::<Uuid>()
.map(|u| u.get_time().unwrap_or(0))
.unwrap_or(0)
}
}
export!(UuidGen);
The Component Model’s typed interface means host runtimes (Wasmtime, WasmEdge, jco) can call generate-v7 without manually decoding pointer/length pairs. See UUID Bit Fields for the timestamp extraction bit layout.
Session: UUID v7 in browser WebAssembly (wasm-bindgen)
For Wasm modules running in the browser, wasm-bindgen bridges Rust to JavaScript’s Date.now() and crypto.getRandomValues():
// src/lib.rs — wasm32-unknown-unknown target with wasm-bindgen
use wasm_bindgen::prelude::*;
use uuid::{Uuid, Timestamp, NoContext};
fn js_now_ms() -> u64 {
js_sys::Date::now() as u64
}
#[wasm_bindgen]
pub fn generate_uuid_v7() -> String {
let ms = js_now_ms();
let secs = ms / 1_000;
let nanos = ((ms % 1_000) * 1_000_000) as u32;
let ts = Timestamp::from_unix(NoContext, secs, nanos);
Uuid::new_v7(ts).to_string()
}
#[wasm_bindgen]
pub fn extract_timestamp_ms(id: &str) -> u64 {
id.parse::<Uuid>()
.ok()
.map(|u| {
let b = u.as_bytes();
u64::from_be_bytes([0, 0, b[0], b[1], b[2], b[3], b[4], b[5]])
})
.unwrap_or(0)
}
// JavaScript — calling Wasm UUID v7 functions via wasm-bindgen glue
import init, { generate_uuid_v7, extract_timestamp_ms } from './pkg/uuid_gen.js';
await init();
const id = generate_uuid_v7();
console.log(id); // "019434a1-7c30-7000-..."
console.log(extract_timestamp_ms(id)); // 1748433060000 (Unix ms)
The Wasm module bundles to approximately 30KB gzipped — smaller than most UUID JavaScript libraries when including the full Rust UUID implementation. See UUID v7 for the specification.
Session: UUID v7 on Cloudflare Workers (edge)
Edge runtimes that run a JavaScript/TypeScript layer with optional Wasm modules can generate UUID v7 in the TypeScript layer and pass it to the Wasm module:
// worker.ts — Cloudflare Workers
import { v7 as uuidv7 } from 'uuid';
interface Env {
WASM_MODULE: Fetcher;
}
export default {
async fetch(request: Request, env: Env): Promise<Response> {
// Generate UUID v7 in the TypeScript layer — Web Crypto API is available
const eventId = uuidv7();
const payload = {
event_id: eventId,
event_type: 'request.received',
timestamp: Date.now(),
url: request.url,
method: request.method,
};
// Pass event_id to downstream Wasm processing module
const result = await processEvent(payload);
return Response.json({
event_id: eventId,
result,
});
},
};
async function processEvent(payload: object): Promise<object> {
// Call Wasm module for CPU-intensive processing
// The UUID v7 is passed as part of the payload — no generation in Wasm needed
return payload;
}
Sessions recommended generating UUID v7 in the JavaScript/TypeScript layer for edge Workers — the Web Crypto API and Date.now() are always available, and the UUID can be passed into Wasm as a string parameter. See UUID Generation Strategies.
Session: UUID v7 validation in Wasm for API gateways
Wasm-based API gateways (running in Envoy, NGINX Unit, or Istio WASM plugins) can validate UUID v7 headers without leaving the data plane:
// Envoy WASM filter — validate Idempotency-Key header as UUID v7
use proxy_wasm::traits::*;
use proxy_wasm::types::*;
use uuid::Uuid;
struct UuidFilter;
impl HttpContext for UuidFilter {
fn on_http_request_headers(&mut self, _: usize, _: bool) -> Action {
if let Some(key) = self.get_http_request_header("idempotency-key") {
match key.parse::<Uuid>() {
Ok(id) if id.get_version_num() == 7 => Action::Continue,
Ok(_) => {
self.send_http_response(400, vec![], Some(b"Expected UUID v7"));
Action::Pause
}
Err(_) => {
self.send_http_response(400, vec![], Some(b"Invalid UUID format"));
Action::Pause
}
}
} else {
// No idempotency key — generate one and add to upstream headers
let id = uuid7::uuid7().to_string();
self.set_http_request_header("idempotency-key", Some(&id));
Action::Continue
}
}
}
proxy_wasm::main! {{ proxy_wasm::set_http_context(|_, _| Box::new(UuidFilter)); }}
This pattern moves UUID validation logic out of application code and into the infrastructure layer — consistent across all services behind the gateway. See UUID as Idempotency Keys.
Attendee tips
- WASI provides randomness and clock —
wasm32-wasip2targets automatically link towasi:random/randomandwasi:clocks/wall-clock; theuuid7crate uses both with no extra configuration. - Browser targets need
wasm-bindgen—wasm32-unknown-unknowndoes not have WASI; usewasm-bindgento bridgeDate.now()andcrypto.getRandomValues(). - Generate at the edge, not in Wasm — for Cloudflare Workers and Fastly Compute, generate UUID v7 in the JavaScript/TypeScript layer and pass it to Wasm as a parameter.
- Component Model WIT — expose UUID operations via a typed WIT interface for clean host/guest contracts.
- Validation filters — Wasm-based gateway filters are an excellent fit for UUID v7 header validation — fast, sandboxed, and language-agnostic.
Related events
- RustConf 2026 — UUID v7 in Rust Services
- RustEurope 2026 — UUID v7 Implementation in Rust
- JSConf EU 2025 — UUID v7 in Web Applications
Further reading
- UUID in Rust — uuid crate full guide
- UUID Generation Strategies — server, client, edge
- UUID as Idempotency Keys
- UUID Bit Fields — version and variant
- Time Precision — UUID v7 millisecond timestamp
- RFC 9562 — the current UUID standard
External references
- WasmCon — official site
- uuid7 crate on docs.rs
- WebAssembly Component Model — Bytecode Alliance
- WASI — WebAssembly System Interface
- RFC 9562 — UUID standard
Frequently asked questions
Can a WebAssembly module generate UUID v7 without host imports?
No — a pure WebAssembly module without host imports has no access to a clock or cryptographically secure random source. UUID v7 requires both: a monotonic wall clock (for the 48-bit millisecond timestamp) and a CSPRNG (for the 74 random bits). Both must come from the host environment via WASI imports (wasi:random/random and wasi:clocks/wall-clock) or equivalent Web API calls (crypto.getRandomValues() and Date.now()) when running in a browser JavaScript environment. A module compiled from Rust using wasm32-wasip2 and the uuid7 crate links to these host functions automatically. See RFC 9562.
How does UUID v7 generation work in Cloudflare Workers backed by WebAssembly?
Cloudflare Workers run in a V8 isolate where the Web Crypto API is available. A Rust Wasm module compiled with wasm-bindgen can call js_sys::Date::now() for the timestamp and web_sys::window().crypto().get_random_values() for entropy, or use the uuid crate with the js feature flag which wires these up automatically. Alternatively, the TypeScript worker layer generates UUID v7 using the uuid npm package and passes the value to the Wasm module as a parameter. See UUID Generation Strategies.
What is the WASI 0.3 API for getting the current time in a Wasm module?
WASI 0.3 (Preview 3) exposes wall clock time via the wasi:clocks/wall-clock@0.2.0 interface — the now() function returns a Datetime struct with seconds: u64 and nanoseconds: u32. In Rust, the wasi crate (generated from WIT bindings) wraps this: wasi::clocks::wall_clock::now(). The uuid7 crate and the uuid crate with the wasm-bindgen feature use the JavaScript Date.now() equivalent when compiled for wasm32-unknown-unknown. See Time Precision.