Skip to main content

webui_handler_set_nonce

Function webui_handler_set_nonce 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn webui_handler_set_nonce( handler_ptr: *mut c_void, nonce: *const c_char, )
Expand description

Set the CSP nonce for inline <script> tags on a handler instance.

When set, all subsequent renders via webui_handler_render will include nonce="VALUE" on inline script tags and emit a <meta name="webui-nonce" content="VALUE"> tag in the <head>.

Pass NULL to clear a previously set nonce.

§Thread Safety

Concurrent render calls are supported after configuration. Callers must not call set_nonce or destroy the handler concurrently with any operation on the same handler_ptr.

§Safety

  • handler_ptr must be a valid pointer returned by webui_handler_create.
  • nonce must be a valid null-terminated UTF-8 string, or NULL.
  • Caller must ensure exclusive access to handler_ptr (no concurrent calls).