Coverage for src/hush_hush/_generated/api/auth/get_owner_identity.py: 0%
35 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 http import HTTPStatus
4from typing import Any
6import httpx
8from ... import errors
9from ...client import AuthenticatedClient, Client
10from ...models.error import Error
11from ...models.owner_identity import OwnerIdentity
12from ...types import Response
15def _get_kwargs() -> dict[str, Any]:
17 _kwargs: dict[str, Any] = {
18 "method": "get",
19 "url": "/auth/identity",
20 }
22 return _kwargs
25def _parse_response(
26 *, client: AuthenticatedClient | Client, response: httpx.Response
27) -> Error | OwnerIdentity | None:
28 if response.status_code == 200:
29 response_200 = OwnerIdentity.from_dict(response.json())
31 return response_200
33 if response.status_code == 401:
34 response_401 = Error.from_dict(response.json())
36 return response_401
38 if client.raise_on_unexpected_status:
39 raise errors.UnexpectedStatus(response.status_code, response.content)
40 else:
41 return None
44def _build_response(
45 *, client: AuthenticatedClient | Client, response: httpx.Response
46) -> Response[Error | OwnerIdentity]:
47 return Response(
48 status_code=HTTPStatus(response.status_code),
49 content=response.content,
50 headers=response.headers,
51 parsed=_parse_response(client=client, response=response),
52 )
55def sync_detailed(
56 *,
57 client: AuthenticatedClient,
58) -> Response[Error | OwnerIdentity]:
59 """Report the calling session's escrowed identity public key
61 The web UI's create/edit dialog reads this to offer the owner's
62 own public key as an additional sealing recipient when the
63 owner-recipient opt-in checkbox is checked
64 (specs/secret-objects/spec.md's "Opt-in owner-recipient inclusion
65 at create time" requirement). An SDK client reads it too, with a
66 write bearer token and no session, to honour `keep_readable_copy`
67 on a create or update: the key is the same whichever credential
68 asks, since there is one user to read it from. Credentialed,
69 unlike `GET /auth/status`: an age public key isn't secret on its
70 own, but every other endpoint that exposes stored data
71 (`GET /consumers` included) stays behind a session or bearer
72 token, and this keeps that same posture rather than carving out
73 an exception.
75 Raises:
76 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
77 httpx.TimeoutException: If the request takes longer than Client.timeout.
79 Returns:
80 Response[Error | OwnerIdentity]
81 """
83 kwargs = _get_kwargs()
85 response = client.get_httpx_client().request(
86 **kwargs,
87 )
89 return _build_response(client=client, response=response)
92def sync(
93 *,
94 client: AuthenticatedClient,
95) -> Error | OwnerIdentity | None:
96 """Report the calling session's escrowed identity public key
98 The web UI's create/edit dialog reads this to offer the owner's
99 own public key as an additional sealing recipient when the
100 owner-recipient opt-in checkbox is checked
101 (specs/secret-objects/spec.md's "Opt-in owner-recipient inclusion
102 at create time" requirement). An SDK client reads it too, with a
103 write bearer token and no session, to honour `keep_readable_copy`
104 on a create or update: the key is the same whichever credential
105 asks, since there is one user to read it from. Credentialed,
106 unlike `GET /auth/status`: an age public key isn't secret on its
107 own, but every other endpoint that exposes stored data
108 (`GET /consumers` included) stays behind a session or bearer
109 token, and this keeps that same posture rather than carving out
110 an exception.
112 Raises:
113 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
114 httpx.TimeoutException: If the request takes longer than Client.timeout.
116 Returns:
117 Error | OwnerIdentity
118 """
120 return sync_detailed(
121 client=client,
122 ).parsed
125async def asyncio_detailed(
126 *,
127 client: AuthenticatedClient,
128) -> Response[Error | OwnerIdentity]:
129 """Report the calling session's escrowed identity public key
131 The web UI's create/edit dialog reads this to offer the owner's
132 own public key as an additional sealing recipient when the
133 owner-recipient opt-in checkbox is checked
134 (specs/secret-objects/spec.md's "Opt-in owner-recipient inclusion
135 at create time" requirement). An SDK client reads it too, with a
136 write bearer token and no session, to honour `keep_readable_copy`
137 on a create or update: the key is the same whichever credential
138 asks, since there is one user to read it from. Credentialed,
139 unlike `GET /auth/status`: an age public key isn't secret on its
140 own, but every other endpoint that exposes stored data
141 (`GET /consumers` included) stays behind a session or bearer
142 token, and this keeps that same posture rather than carving out
143 an exception.
145 Raises:
146 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
147 httpx.TimeoutException: If the request takes longer than Client.timeout.
149 Returns:
150 Response[Error | OwnerIdentity]
151 """
153 kwargs = _get_kwargs()
155 response = await client.get_async_httpx_client().request(**kwargs)
157 return _build_response(client=client, response=response)
160async def asyncio(
161 *,
162 client: AuthenticatedClient,
163) -> Error | OwnerIdentity | None:
164 """Report the calling session's escrowed identity public key
166 The web UI's create/edit dialog reads this to offer the owner's
167 own public key as an additional sealing recipient when the
168 owner-recipient opt-in checkbox is checked
169 (specs/secret-objects/spec.md's "Opt-in owner-recipient inclusion
170 at create time" requirement). An SDK client reads it too, with a
171 write bearer token and no session, to honour `keep_readable_copy`
172 on a create or update: the key is the same whichever credential
173 asks, since there is one user to read it from. Credentialed,
174 unlike `GET /auth/status`: an age public key isn't secret on its
175 own, but every other endpoint that exposes stored data
176 (`GET /consumers` included) stays behind a session or bearer
177 token, and this keeps that same posture rather than carving out
178 an exception.
180 Raises:
181 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
182 httpx.TimeoutException: If the request takes longer than Client.timeout.
184 Returns:
185 Error | OwnerIdentity
186 """
188 return (
189 await asyncio_detailed(
190 client=client,
191 )
192 ).parsed