[][src]Module wascap::wasm

Functions for extracting and embedding claims within a WebAssembly module

Functions

days_from_now_to_jwt_time
embed_claims

This function will embed a set of claims inside the bytecode of a WebAssembly module. The claims are converted into a JWT and signed using the provided KeyPair. According to the WebAssembly custom section specification, arbitary sets of bytes can be stored in a WebAssembly module without impacting parsers or interpreters. Returns a vector of bytes representing the new WebAssembly module which can be saved to a .wasm file

extract_claims

Extracts a set of claims from the raw bytes of a WebAssembly module. In the case where no JWT is discovered in the module, this function returns None. If there is a token in the file with a valid hash, then you will get a Token back containing both the raw JWT and the decoded claims.

sign_buffer_with_claims