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
173 174 175 176 177 178 179 180 181 182 183 184 185 | |
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
177 178 179 180 | |
validate_directory_id(value: str) -> str
classmethod
Source code in jmcore/src/jmcore/nick_auth.py
182 183 184 185 | |
NickAuthMode
Bases: StrEnum
Source code in jmcore/src/jmcore/nick_auth.py
29 30 31 32 | |
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
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
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
192 193 194 195 196 197 198 199 200 201 | |
validate_signature(value: str) -> str
classmethod
Source code in jmcore/src/jmcore/nick_auth.py
203 204 205 206 207 | |
NickAuthResult
Bases: _NickAuthPayload
Source code in jmcore/src/jmcore/nick_auth.py
210 211 212 213 214 215 216 217 218 | |
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
214 215 216 217 218 | |
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
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
create_nick_auth_proof(identity: NickIdentity, challenge: str, directory_id: str, handshake_line: str) -> NickAuthProof
Source code in jmcore/src/jmcore/nick_auth.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | |
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
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
handshake_line_sha256(line: str) -> str
Source code in jmcore/src/jmcore/nick_auth.py
221 222 223 224 | |
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
48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
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
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
validate_directory_id(value: str) -> str
Validate and return a JMP-0005 directory identity.
Source code in jmcore/src/jmcore/nick_auth.py
70 71 72 73 74 | |
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
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |