jmcore.nick_auth
jmcore.nick_auth
Shared JMP-0005 nick ownership authentication primitives.
Classes
NickAuthChallenge
Bases: _NickAuthPayload
Source code in jmcore/src/jmcore/nick_auth.py
172 173 174 175 176 177 178 179 180 181 182 183 184 | |
Attributes
challenge: str
instance-attribute
directory_id: str = Field(alias='directory-id')
class-attribute
instance-attribute
Methods:
validate_challenge(value: str) -> str
classmethod
Source code in jmcore/src/jmcore/nick_auth.py
176 177 178 179 | |
validate_directory_id(value: str) -> str
classmethod
Source code in jmcore/src/jmcore/nick_auth.py
181 182 183 184 | |
NickAuthMode
Bases: StrEnum
Source code in jmcore/src/jmcore/nick_auth.py
28 29 30 31 | |
Attributes
DISABLED = 'disabled'
class-attribute
instance-attribute
PREFER_VERIFIED = 'prefer_verified'
class-attribute
instance-attribute
REQUIRE_VERIFIED = 'require_verified'
class-attribute
instance-attribute
NickAuthProof
Bases: _NickAuthPayload
Source code in jmcore/src/jmcore/nick_auth.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
Attributes
pubkey: str
instance-attribute
signature: str
instance-attribute
Methods:
validate_pubkey(value: str) -> str
classmethod
Source code in jmcore/src/jmcore/nick_auth.py
191 192 193 194 195 196 197 198 199 200 201 202 | |
validate_signature(value: str) -> str
classmethod
Source code in jmcore/src/jmcore/nick_auth.py
204 205 206 207 208 | |
NickAuthResult
Bases: _NickAuthPayload
Source code in jmcore/src/jmcore/nick_auth.py
211 212 213 214 215 216 217 218 219 | |
Attributes
code: Literal['ok', 'malformed', 'expired', 'invalid', 'policy']
instance-attribute
verified: bool
instance-attribute
Methods:
validate_result() -> Self
Source code in jmcore/src/jmcore/nick_auth.py
215 216 217 218 219 | |
Functions:
build_nick_auth_signed_message(challenge: str, directory_id: str, handshake_sha256: str, nick: str, pubkey: str) -> bytes
Source code in jmcore/src/jmcore/nick_auth.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
create_nick_auth_proof(identity: NickIdentity, challenge: str, directory_id: str, handshake_line: str) -> NickAuthProof
Source code in jmcore/src/jmcore/nick_auth.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
directory_id_for_endpoint(host: str, port: int) -> str
Derive a JMP-0005 identity from a selected Tor v3 endpoint.
Source code in jmcore/src/jmcore/nick_auth.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
handshake_line_sha256(line: str) -> str
Source code in jmcore/src/jmcore/nick_auth.py
222 223 224 225 | |
parse_strict_json_object(payload: str | bytes) -> dict[str, Any]
Parse a JSON object while rejecting duplicate keys and non-finite numbers.
Source code in jmcore/src/jmcore/nick_auth.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
validate_directory_endpoint(value: str) -> str
Validate an exact host:port key used to select an expected directory identity.
Source code in jmcore/src/jmcore/nick_auth.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
validate_directory_id(value: str) -> str
Validate and return a JMP-0005 directory identity.
Source code in jmcore/src/jmcore/nick_auth.py
69 70 71 72 73 | |
verify_nick_auth_proof(proof: NickAuthProof, expected_challenge: str, expected_directory_id: str, handshake_line: str, nick: str, protocol_version: int) -> bool
Source code in jmcore/src/jmcore/nick_auth.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |