MCPcopy Create free account
hub / github.com/Keats/jsonwebtoken / from_ec_components

Method from_ec_components

src/decoding.rs:151–164  ·  view source on GitHub ↗

If you have (x,y) ECDSA key components

(x: &str, y: &str)

Source from the content-addressed store, hash-verified

149
150 /// If you have (x,y) ECDSA key components
151 pub fn from_ec_components(x: &str, y: &str) -> Result<Self> {
152 let x_cmp = b64_decode(x)?;
153 let y_cmp = b64_decode(y)?;
154
155 let mut public_key = Vec::with_capacity(1 + x.len() + y.len());
156 public_key.push(0x04);
157 public_key.extend_from_slice(&x_cmp);
158 public_key.extend_from_slice(&y_cmp);
159
160 Ok(DecodingKey {
161 family: AlgorithmFamily::Ec,
162 kind: DecodingKeyKind::SecretOrDer(public_key),
163 })
164 }
165
166 /// If you have a EdDSA public key in PEM format, use this.
167 /// Only exists if the feature `use_pem` is enabled.

Callers

nothing calls this directly

Calls 1

b64_decodeFunction · 0.85

Tested by

no test coverage detected