MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / decode

Method decode

chirpstack/src/api/auth/claims.rs:56–63  ·  view source on GitHub ↗
(token: &str, secret: &[u8])

Source from the content-addressed store, hash-verified

54 }
55
56 pub fn decode(token: &str, secret: &[u8]) -> Result<Self> {
57 let mut val = Validation::new(Algorithm::HS256);
58 val.set_audience(&["chirpstack"]);
59 val.required_spec_claims = HashSet::new(); // make the 'exp' optional
60
61 let claim = decode::<AuthClaim>(token, &DecodingKey::from_secret(secret), &val)?;
62 Ok(claim.claims)
63 }
64}
65
66#[cfg(test)]

Callers 1

parse_tokenMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected