Skip to content

Commit 839076e

Browse files
committed
Add Python bindings for async_enrollment_(submit|info|list|reject|accept)
1 parent dc49410 commit 839076e

File tree

15 files changed

+809
-3
lines changed

15 files changed

+809
-3
lines changed

server/parsec/_parsec.pyi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ from parsec._parsec_pyi.addrs import (
1515
ParsecPkiEnrollmentAddr,
1616
ParsecWorkspacePathAddr,
1717
)
18+
from parsec._parsec_pyi.async_enrollment import (
19+
AsyncEnrollmentAcceptPayload,
20+
AsyncEnrollmentSubmitPayload,
21+
)
1822
from parsec._parsec_pyi.certif import (
1923
DeviceCertificate,
2024
HashAlgorithm,
@@ -64,6 +68,7 @@ from parsec._parsec_pyi.enumerate import (
6468
)
6569
from parsec._parsec_pyi.ids import (
6670
AccountAuthMethodID,
71+
AsyncEnrollmentID,
6772
BlockID,
6873
BootstrapToken,
6974
ChunkID,
@@ -117,6 +122,9 @@ __all__ = [
117122
"ApiVersion",
118123
"ValidationCode",
119124
# Data Error
125+
# Async enrollment
126+
"AsyncEnrollmentAcceptPayload",
127+
"AsyncEnrollmentSubmitPayload",
120128
# Certif
121129
"DeviceCertificate",
122130
"HashAlgorithm",
@@ -164,6 +172,7 @@ __all__ = [
164172
"UserProfile",
165173
# Ids
166174
"AccountAuthMethodID",
175+
"AsyncEnrollmentID",
167176
"BlockID",
168177
"BootstrapToken",
169178
"ChunkID",
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS
2+
3+
from __future__ import annotations
4+
5+
from parsec._parsec_pyi.crypto import PublicKey, VerifyKey
6+
from parsec._parsec_pyi.enumerate import UserProfile
7+
from parsec._parsec_pyi.ids import DeviceID, DeviceLabel, HumanHandle, UserID
8+
9+
class AsyncEnrollmentSubmitPayload:
10+
def __init__(
11+
self,
12+
verify_key: VerifyKey,
13+
public_key: PublicKey,
14+
requested_device_label: DeviceLabel,
15+
requested_human_handle: HumanHandle,
16+
) -> None: ...
17+
@property
18+
def verify_key(self) -> VerifyKey: ...
19+
@property
20+
def public_key(self) -> PublicKey: ...
21+
@property
22+
def requested_device_label(self) -> DeviceLabel: ...
23+
@property
24+
def requested_human_handle(self) -> HumanHandle: ...
25+
@classmethod
26+
def load(cls, raw: bytes) -> AsyncEnrollmentSubmitPayload: ...
27+
def dump(self) -> bytes: ...
28+
29+
class AsyncEnrollmentAcceptPayload:
30+
def __init__(
31+
self,
32+
user_id: UserID,
33+
device_id: DeviceID,
34+
device_label: DeviceLabel,
35+
human_handle: HumanHandle,
36+
profile: UserProfile,
37+
root_verify_key: VerifyKey,
38+
): ...
39+
@property
40+
def user_id(self) -> UserID: ...
41+
@property
42+
def device_id(self) -> DeviceID: ...
43+
@property
44+
def device_label(self) -> DeviceLabel: ...
45+
@property
46+
def human_handle(self) -> HumanHandle: ...
47+
@property
48+
def profile(self) -> UserProfile: ...
49+
@property
50+
def root_verify_key(self) -> VerifyKey: ...
51+
@classmethod
52+
def load(cls, raw: bytes) -> AsyncEnrollmentAcceptPayload: ...
53+
def dump(self) -> bytes: ...

server/parsec/_parsec_pyi/ids.pyi

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,22 @@ class PKIEnrollmentID:
228228
@property
229229
def hyphenated(self) -> str: ...
230230

231+
class AsyncEnrollmentID:
232+
@classmethod
233+
def from_bytes(cls, bytes: bytes) -> AsyncEnrollmentID: ...
234+
@classmethod
235+
def from_hex(cls, hex: str) -> AsyncEnrollmentID: ...
236+
@classmethod
237+
def new(cls) -> AsyncEnrollmentID: ...
238+
@property
239+
def bytes(self) -> bytes: ...
240+
@property
241+
def hex(self) -> str: ...
242+
@property
243+
def int(self) -> int: ...
244+
@property
245+
def hyphenated(self) -> str: ...
246+
231247
class InvitationToken:
232248
def __hash__(self) -> int: ...
233249
@classmethod

server/parsec/_parsec_pyi/protocol/anonymous_cmds/v5/__init__.pyi

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,32 @@
44

55
from __future__ import annotations
66

7-
from . import organization_bootstrap, ping, pki_enrollment_info, pki_enrollment_submit
7+
from . import (
8+
async_enrollment_info,
9+
async_enrollment_submit,
10+
organization_bootstrap,
11+
ping,
12+
pki_enrollment_info,
13+
pki_enrollment_submit,
14+
)
815

916
class AnyCmdReq:
1017
@classmethod
1118
def load(
1219
cls, raw: bytes
1320
) -> (
14-
organization_bootstrap.Req | ping.Req | pki_enrollment_info.Req | pki_enrollment_submit.Req
21+
async_enrollment_info.Req
22+
| async_enrollment_submit.Req
23+
| organization_bootstrap.Req
24+
| ping.Req
25+
| pki_enrollment_info.Req
26+
| pki_enrollment_submit.Req
1527
): ...
1628

1729
__all__ = [
1830
"AnyCmdReq",
31+
"async_enrollment_info",
32+
"async_enrollment_submit",
1933
"organization_bootstrap",
2034
"ping",
2135
"pki_enrollment_info",
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS
2+
3+
# /!\ Autogenerated by misc/gen_protocol_typings.py, any modification will be lost !
4+
5+
from __future__ import annotations
6+
7+
from parsec._parsec import AsyncEnrollmentID, DateTime, PkiSignatureAlgorithm
8+
9+
class InfoStatus:
10+
pass
11+
12+
class InfoStatusSubmitted(InfoStatus):
13+
def __init__(self, submitted_on: DateTime) -> None: ...
14+
@property
15+
def submitted_on(self) -> DateTime: ...
16+
17+
class InfoStatusRejected(InfoStatus):
18+
def __init__(self, submitted_on: DateTime, rejected_on: DateTime) -> None: ...
19+
@property
20+
def rejected_on(self) -> DateTime: ...
21+
@property
22+
def submitted_on(self) -> DateTime: ...
23+
24+
class InfoStatusCancelled(InfoStatus):
25+
def __init__(self, submitted_on: DateTime, cancelled_on: DateTime) -> None: ...
26+
@property
27+
def cancelled_on(self) -> DateTime: ...
28+
@property
29+
def submitted_on(self) -> DateTime: ...
30+
31+
class InfoStatusAccepted(InfoStatus):
32+
def __init__(
33+
self,
34+
submitted_on: DateTime,
35+
accepted_on: DateTime,
36+
accept_payload: bytes,
37+
accept_payload_signature: AcceptPayloadSignature,
38+
) -> None: ...
39+
@property
40+
def accept_payload(self) -> bytes: ...
41+
@property
42+
def accept_payload_signature(self) -> AcceptPayloadSignature: ...
43+
@property
44+
def accepted_on(self) -> DateTime: ...
45+
@property
46+
def submitted_on(self) -> DateTime: ...
47+
48+
class AcceptPayloadSignature:
49+
pass
50+
51+
class AcceptPayloadSignaturePKI(AcceptPayloadSignature):
52+
def __init__(
53+
self,
54+
signature: bytes,
55+
algorithm: PkiSignatureAlgorithm,
56+
accepter_der_x509_certificate: bytes,
57+
intermediate_der_x509_certificates: list[bytes],
58+
) -> None: ...
59+
@property
60+
def accepter_der_x509_certificate(self) -> bytes: ...
61+
@property
62+
def algorithm(self) -> PkiSignatureAlgorithm: ...
63+
@property
64+
def intermediate_der_x509_certificates(self) -> list[bytes]: ...
65+
@property
66+
def signature(self) -> bytes: ...
67+
68+
class AcceptPayloadSignatureOpenBao(AcceptPayloadSignature):
69+
def __init__(self, signature: str, accepter_openbao_entity_id: str) -> None: ...
70+
@property
71+
def accepter_openbao_entity_id(self) -> str: ...
72+
@property
73+
def signature(self) -> str: ...
74+
75+
class Req:
76+
def __init__(self, enrollment_id: AsyncEnrollmentID) -> None: ...
77+
def dump(self) -> bytes: ...
78+
@property
79+
def enrollment_id(self) -> AsyncEnrollmentID: ...
80+
81+
class Rep:
82+
@staticmethod
83+
def load(raw: bytes) -> Rep: ...
84+
def dump(self) -> bytes: ...
85+
86+
class RepUnknownStatus(Rep):
87+
def __init__(self, status: str, reason: str | None) -> None: ...
88+
@property
89+
def status(self) -> str: ...
90+
@property
91+
def reason(self) -> str | None: ...
92+
93+
class RepOk(Rep):
94+
def __init__(self, unit: InfoStatus) -> None: ...
95+
@property
96+
def unit(self) -> InfoStatus: ...
97+
98+
class RepEnrollmentNotFound(Rep):
99+
def __init__(
100+
self,
101+
) -> None: ...
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS
2+
3+
# /!\ Autogenerated by misc/gen_protocol_typings.py, any modification will be lost !
4+
5+
from __future__ import annotations
6+
7+
from parsec._parsec import AsyncEnrollmentID, DateTime, PkiSignatureAlgorithm
8+
9+
class SubmitPayloadSignature:
10+
pass
11+
12+
class SubmitPayloadSignaturePKI(SubmitPayloadSignature):
13+
def __init__(
14+
self,
15+
signature: bytes,
16+
algorithm: PkiSignatureAlgorithm,
17+
submitter_der_x509_certificate: bytes,
18+
intermediate_der_x509_certificates: list[bytes],
19+
) -> None: ...
20+
@property
21+
def algorithm(self) -> PkiSignatureAlgorithm: ...
22+
@property
23+
def intermediate_der_x509_certificates(self) -> list[bytes]: ...
24+
@property
25+
def signature(self) -> bytes: ...
26+
@property
27+
def submitter_der_x509_certificate(self) -> bytes: ...
28+
29+
class SubmitPayloadSignatureOpenBao(SubmitPayloadSignature):
30+
def __init__(self, signature: str, submitter_openbao_entity_id: str) -> None: ...
31+
@property
32+
def signature(self) -> str: ...
33+
@property
34+
def submitter_openbao_entity_id(self) -> str: ...
35+
36+
class Req:
37+
def __init__(
38+
self,
39+
enrollment_id: AsyncEnrollmentID,
40+
force: bool,
41+
submit_payload: bytes,
42+
submit_payload_signature: SubmitPayloadSignature,
43+
) -> None: ...
44+
def dump(self) -> bytes: ...
45+
@property
46+
def enrollment_id(self) -> AsyncEnrollmentID: ...
47+
@property
48+
def force(self) -> bool: ...
49+
@property
50+
def submit_payload(self) -> bytes: ...
51+
@property
52+
def submit_payload_signature(self) -> SubmitPayloadSignature: ...
53+
54+
class Rep:
55+
@staticmethod
56+
def load(raw: bytes) -> Rep: ...
57+
def dump(self) -> bytes: ...
58+
59+
class RepUnknownStatus(Rep):
60+
def __init__(self, status: str, reason: str | None) -> None: ...
61+
@property
62+
def status(self) -> str: ...
63+
@property
64+
def reason(self) -> str | None: ...
65+
66+
class RepOk(Rep):
67+
def __init__(self, submitted_on: DateTime) -> None: ...
68+
@property
69+
def submitted_on(self) -> DateTime: ...
70+
71+
class RepEmailAlreadySubmitted(Rep):
72+
def __init__(self, submitted_on: DateTime) -> None: ...
73+
@property
74+
def submitted_on(self) -> DateTime: ...
75+
76+
class RepEmailAlreadyEnrolled(Rep):
77+
def __init__(
78+
self,
79+
) -> None: ...
80+
81+
class RepIdAlreadyUsed(Rep):
82+
def __init__(
83+
self,
84+
) -> None: ...
85+
86+
class RepInvalidSubmitPayload(Rep):
87+
def __init__(
88+
self,
89+
) -> None: ...
90+
91+
class RepInvalidSubmitPayloadSignature(Rep):
92+
def __init__(
93+
self,
94+
) -> None: ...
95+
96+
class RepInvalidDerX509Certificate(Rep):
97+
def __init__(
98+
self,
99+
) -> None: ...
100+
101+
class RepInvalidX509Trustchain(Rep):
102+
def __init__(
103+
self,
104+
) -> None: ...

server/parsec/_parsec_pyi/protocol/authenticated_cmds/v5/__init__.pyi

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
from __future__ import annotations
66

77
from . import (
8+
async_enrollment_accept,
9+
async_enrollment_list,
10+
async_enrollment_reject,
811
block_create,
912
block_read,
1013
certificate_get,
@@ -48,7 +51,10 @@ class AnyCmdReq:
4851
def load(
4952
cls, raw: bytes
5053
) -> (
51-
block_create.Req
54+
async_enrollment_accept.Req
55+
| async_enrollment_list.Req
56+
| async_enrollment_reject.Req
57+
| block_create.Req
5258
| block_read.Req
5359
| certificate_get.Req
5460
| device_create.Req
@@ -88,6 +94,9 @@ class AnyCmdReq:
8894

8995
__all__ = [
9096
"AnyCmdReq",
97+
"async_enrollment_accept",
98+
"async_enrollment_list",
99+
"async_enrollment_reject",
91100
"block_create",
92101
"block_read",
93102
"certificate_get",

0 commit comments

Comments
 (0)