From 413b78454f2b08e4a58c4608d97e180da038b84d Mon Sep 17 00:00:00 2001 From: fiatjaf_ Date: Sun, 5 Apr 2026 12:09:04 -0300 Subject: u32 Co-authored-by: Awiteb --- 5C.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5C.md b/5C.md index fc46ed2..218229c 100644 --- a/5C.md +++ b/5C.md @@ -30,7 +30,7 @@ Clients can publish a list of favorite scrolls using a NIP-51 standard list even ## String Convention -Unless noted otherwise (i.e. for hex pubkeys and ids), the module passes strings to the host as `(ptr: i32, len: i32)` pairs into its linear memory. The host returns strings (and other variable-length data) by returning an `i32` pointer to a buffer in linear memory whose first 4 bytes are the `u32_be` byte-length of the payload that follows. +Unless noted otherwise (i.e. for hex pubkeys and ids), the module passes strings to the host as `(ptr: i32, len: i32)` pairs into its linear memory. The host returns strings (and other variable-length data) by returning an `i32` pointer to a buffer in linear memory whose first 4 bytes are the `u32` byte-length of the payload that follows. For example, if `nostr.get_content(handle)` returns `7165` that will be a pointer to a buffer at location `7165`. If that buffer starts with `[ 00 00 00 03 ]` that means it contains 3 bytes (aside from the initial four), so we can keep reading it `[ 00 00 00 03 66 6f 6f ]` and conclude that the string is `"foo"`. -- cgit v1.2.3