Coverage for src/hush_hush/_generated/models/registration_finish_request.py: 43%
56 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-16 16:01 +0000
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-16 16:01 +0000
1# Code generated by openapi-python-client from hush-hush/api/openapi.yaml; DO NOT EDIT.
3from __future__ import annotations
5from collections.abc import Mapping
6from typing import TYPE_CHECKING, Any, TypeVar
8from attrs import define as _attrs_define
9from attrs import field as _attrs_field
11from ..types import UNSET, Unset
13if TYPE_CHECKING:
14 from ..models.registration_finish_request_credential import RegistrationFinishRequestCredential
17T = TypeVar("T", bound="RegistrationFinishRequest")
20@_attrs_define
21class RegistrationFinishRequest:
22 """
23 Attributes:
24 credential (RegistrationFinishRequestCredential): The browser's attestation response, exactly as
25 `navigator.credentials.create()` returned it.
26 nickname (str | Unset): A human-readable label for this credential, shown in the credentials list.
27 wrapped_identity (str | Unset): This credential's own copy of the user's escrowed writer
28 identity private key, wrapped client-side with a key derived
29 from this credential's WebAuthn PRF extension output and
30 base64-encoded. Omitted when the browser's registration
31 reported no PRF support for this credential - the server
32 never generates, verifies, or unwraps this value, only stores
33 it.
34 public_key (str | Unset): The escrowed writer identity's age recipient string, sent
35 only on the account's first-ever registration - a repeat
36 registration resending this is a no-op against the identity
37 already recorded, never an overwrite.
38 recovery_wrapped_identity (str | Unset): The escrowed writer identity's private key, wrapped
39 client-side with a key derived from the one-time break-glass
40 recovery phrase, sent only on the account's first-ever
41 registration. The server never sees the phrase itself, only
42 this already-wrapped copy.
43 """
45 credential: RegistrationFinishRequestCredential
46 nickname: str | Unset = UNSET
47 wrapped_identity: str | Unset = UNSET
48 public_key: str | Unset = UNSET
49 recovery_wrapped_identity: str | Unset = UNSET
50 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
52 def to_dict(self) -> dict[str, Any]:
53 credential = self.credential.to_dict()
55 nickname = self.nickname
57 wrapped_identity = self.wrapped_identity
59 public_key = self.public_key
61 recovery_wrapped_identity = self.recovery_wrapped_identity
63 field_dict: dict[str, Any] = {}
64 field_dict.update(self.additional_properties)
65 field_dict.update(
66 {
67 "credential": credential,
68 }
69 )
70 if nickname is not UNSET:
71 field_dict["nickname"] = nickname
72 if wrapped_identity is not UNSET:
73 field_dict["wrapped_identity"] = wrapped_identity
74 if public_key is not UNSET:
75 field_dict["public_key"] = public_key
76 if recovery_wrapped_identity is not UNSET:
77 field_dict["recovery_wrapped_identity"] = recovery_wrapped_identity
79 return field_dict
81 @classmethod
82 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
83 from ..models.registration_finish_request_credential import (
84 RegistrationFinishRequestCredential, # noqa: PLC0415
85 )
87 d = dict(src_dict)
88 credential = RegistrationFinishRequestCredential.from_dict(d.pop("credential"))
90 nickname = d.pop("nickname", UNSET)
92 wrapped_identity = d.pop("wrapped_identity", UNSET)
94 public_key = d.pop("public_key", UNSET)
96 recovery_wrapped_identity = d.pop("recovery_wrapped_identity", UNSET)
98 registration_finish_request = cls(
99 credential=credential,
100 nickname=nickname,
101 wrapped_identity=wrapped_identity,
102 public_key=public_key,
103 recovery_wrapped_identity=recovery_wrapped_identity,
104 )
106 registration_finish_request.additional_properties = d
107 return registration_finish_request
109 @property
110 def additional_keys(self) -> list[str]:
111 return list(self.additional_properties.keys())
113 def __getitem__(self, key: str) -> Any:
114 return self.additional_properties[key]
116 def __setitem__(self, key: str, value: Any) -> None:
117 self.additional_properties[key] = value
119 def __delitem__(self, key: str) -> None:
120 del self.additional_properties[key]
122 def __contains__(self, key: str) -> bool:
123 return key in self.additional_properties