1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! JWS compact form for ES256, as `mid-issuer` builds it.
//!
//! `base64url(header) "." base64url(payload) "." base64url(sig)` with the
//! fixed header `{"alg":"ES256","typ":"JWT"}` and the signature over
//! `SHA-256(base64url(header) "." base64url(payload))`.
use String;
use Engine;
use URL_SAFE_NO_PAD;
use crateDeviceSigner;
/// The exact header bytes. Changing them is a wire-format break.
pub const JWS_HEADER_JSON: &str = r#"{"alg":"ES256","typ":"JWT"}"#;
/// Build a compact ES256 JWS over `payload_json`.