Skip to main content

auth_token_to_json

Function auth_token_to_json 

Source
fn auth_token_to_json(bytes: &[u8]) -> FieldValue
Expand description

Parse an authorization_token byte value into JSON.

§What a value it cannot read renders as

The raw bytes, as fields::params and every other draft’s renderer do, and a field the value ran out before is simply absent. Field extraction runs on a message that has already decoded, so it has no refusal to give: what a peer sent is what there is to show.

That the bytes are a Token at all is not something this can assume. This function is reached from setup_option_name, whose whole purpose is asking a second draft about a parameter that arrived under a first — precisely where nothing has validated it against this draft’s rules. setup_option_name(13, &KeyValuePair { key: 0x03, value: KvpValue::Bytes(vec![]) }) is a public call with an empty value.