common_access_token/constants.rs
1//! # Constants for Common Access Token
2//!
3//! This module provides centralized constants used throughout the Common Access Token library.
4//! It includes constants for CAT-specific claim keys, URI components, match types, and more.
5
6/// CAT-specific claim keys
7pub mod cat_keys {
8 /// Common Access Token Replay (catreplay) claim key
9 pub const CATREPLAY: i32 = 308;
10 /// Common Access Token Probability of Rejection (catpor) claim key
11 pub const CATPOR: i32 = 309;
12 /// Common Access Token Version (catv) claim key
13 pub const CATV: i32 = 310;
14 /// Common Access Token Network IP (catnip) claim key
15 pub const CATNIP: i32 = 311;
16 /// Common Access Token URI (catu) claim key
17 pub const CATU: i32 = 312;
18 /// Common Access Token Methods (catm) claim key
19 pub const CATM: i32 = 313;
20 /// Common Access Token ALPN (catalpn) claim key
21 pub const CATALPN: i32 = 314;
22 /// Common Access Token Header (cath) claim key
23 pub const CATH: i32 = 315;
24 /// Common Access Token Geographic ISO3166 (catgeoiso3166) claim key
25 pub const CATGEOISO3166: i32 = 316;
26 /// Common Access Token Geographic Coordinate (catgeocoord) claim key
27 pub const CATGEOCOORD: i32 = 317;
28 /// Common Access Token Altitude (catgeoalt) claim key
29 pub const CATGEOALT: i32 = 318;
30 /// Common Access Token TLS Public Key (cattpk) claim key
31 pub const CATTPK: i32 = 319;
32 /// Common Access Token If Data (catifdata) claim key
33 pub const CATIFDATA: i32 = 320;
34 /// Common Access Token DPoP Settings (catdpop) claim key
35 pub const CATDPOP: i32 = 321;
36 /// Common Access Token If (catif) claim key
37 pub const CATIF: i32 = 322;
38 /// Common Access Token Renewal (catr) claim key
39 pub const CATR: i32 = 323;
40}
41
42/// URI component identifiers for CATU claim
43pub mod uri_components {
44 /// Scheme (RFC 3986 Section 3.1)
45 pub const SCHEME: i32 = 0;
46 /// Host (RFC 3986 Section 3.2.2)
47 pub const HOST: i32 = 1;
48 /// Port (RFC 3986 Section 3.2.3)
49 pub const PORT: i32 = 2;
50 /// Path (RFC 3986 Section 3.3)
51 pub const PATH: i32 = 3;
52 /// Query (RFC 3986 Section 3.4)
53 pub const QUERY: i32 = 4;
54 /// Parent path
55 pub const PARENT_PATH: i32 = 5;
56 /// Filename
57 pub const FILENAME: i32 = 6;
58 /// Stem
59 pub const STEM: i32 = 7;
60 /// Extension
61 pub const EXTENSION: i32 = 8;
62}
63
64/// Match types for CATU claim
65pub mod match_types {
66 /// Exact text match
67 pub const EXACT: i32 = 0;
68 /// Prefix match
69 pub const PREFIX: i32 = 1;
70 /// Suffix match
71 pub const SUFFIX: i32 = 2;
72 /// Contains match
73 pub const CONTAINS: i32 = 3;
74 /// Regular expression match
75 pub const REGEX: i32 = 4;
76 /// SHA-256 match
77 pub const SHA256: i32 = -1;
78 /// SHA-512/256 match
79 pub const SHA512_256: i32 = -2;
80}
81
82/// Renewal types for CATR claim
83pub mod renewal_types {
84 /// Automatic renewal
85 pub const AUTOMATIC: i32 = 0;
86 /// Cookie renewal
87 pub const COOKIE: i32 = 1;
88 /// Header renewal
89 pub const HEADER: i32 = 2;
90 /// Redirect renewal
91 pub const REDIRECT: i32 = 3;
92}
93
94/// Renewal parameter labels for CATR claim
95pub mod renewal_params {
96 /// Renewal type
97 pub const TYPE: i32 = 0;
98 /// Expiration extension
99 pub const EXPADD: i32 = 1;
100 /// Renewal deadline
101 pub const DEADLINE: i32 = 2;
102 /// Name for cookie
103 pub const COOKIE_NAME: i32 = 3;
104 /// Name for header
105 pub const HEADER_NAME: i32 = 4;
106 /// Additional cookie parameters
107 pub const COOKIE_PARAMS: i32 = 5;
108 /// Additional header parameters
109 pub const HEADER_PARAMS: i32 = 6;
110 /// Status code for redirects
111 pub const STATUS_CODE: i32 = 7;
112}
113
114/// CATREPLAY values
115pub mod replay_values {
116 /// Replay is permitted
117 pub const PERMITTED: i32 = 0;
118 /// Replay is prohibited
119 pub const PROHIBITED: i32 = 1;
120 /// Reuse-detection
121 pub const REUSE_DETECTION: i32 = 2;
122}
123
124/// CWT claim keys as defined in RFC 8392
125pub mod cwt_keys {
126 /// Issuer claim key
127 pub const ISS: i32 = 1;
128 /// Subject claim key
129 pub const SUB: i32 = 2;
130 /// Audience claim key
131 pub const AUD: i32 = 3;
132 /// Expiration time claim key
133 pub const EXP: i32 = 4;
134 /// Not before claim key
135 pub const NBF: i32 = 5;
136 /// Issued at claim key
137 pub const IAT: i32 = 6;
138 /// CWT ID claim key
139 pub const CTI: i32 = 7;
140}
141
142/// COSE header parameter labels
143pub mod cose_labels {
144 /// Algorithm (used in protected header)
145 pub const ALG: i32 = 1;
146 /// Key identifier (used in protected or unprotected header)
147 pub const KID: i32 = 4;
148}
149
150/// COSE algorithm identifiers
151pub mod cose_algs {
152 /// HMAC with SHA-256 (COSE algorithm identifier: 5)
153 pub const HMAC_SHA_256: i32 = 5;
154}