crypticorn 2.0.1__py3-none-any.whl → 2.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,14 @@ from crypticorn.auth.client.models.authorize_user200_response_auth import (
23
23
  AuthorizeUser200ResponseAuth,
24
24
  )
25
25
  from crypticorn.auth.client.models.authorize_user_request import AuthorizeUserRequest
26
+ from crypticorn.auth.client.models.create_api_key200_response import (
27
+ CreateApiKey200Response,
28
+ )
29
+ from crypticorn.auth.client.models.create_api_key_request import CreateApiKeyRequest
26
30
  from crypticorn.auth.client.models.create_user_request import CreateUserRequest
31
+ from crypticorn.auth.client.models.get_api_keys200_response_inner import (
32
+ GetApiKeys200ResponseInner,
33
+ )
27
34
  from crypticorn.auth.client.models.list_wallets200_response import (
28
35
  ListWallets200Response,
29
36
  )
@@ -49,6 +56,12 @@ from crypticorn.auth.client.models.logout_default_response import LogoutDefaultR
49
56
  from crypticorn.auth.client.models.logout_default_response_issues_inner import (
50
57
  LogoutDefaultResponseIssuesInner,
51
58
  )
59
+ from crypticorn.auth.client.models.oauth_callback200_response import (
60
+ OauthCallback200Response,
61
+ )
62
+ from crypticorn.auth.client.models.oauth_callback200_response_user import (
63
+ OauthCallback200ResponseUser,
64
+ )
52
65
  from crypticorn.auth.client.models.refresh_token_info200_response import (
53
66
  RefreshTokenInfo200Response,
54
67
  )
@@ -0,0 +1,83 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Crypticorn Auth API
5
+
6
+ OpenAPI compliant REST API built using tRPC with Express
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+
26
+ class CreateApiKey200Response(BaseModel):
27
+ """
28
+ CreateApiKey200Response
29
+ """ # noqa: E501
30
+
31
+ api_key: StrictStr = Field(alias="apiKey")
32
+ __properties: ClassVar[List[str]] = ["apiKey"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of CreateApiKey200Response from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ return _dict
72
+
73
+ @classmethod
74
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
+ """Create an instance of CreateApiKey200Response from a dict"""
76
+ if obj is None:
77
+ return None
78
+
79
+ if not isinstance(obj, dict):
80
+ return cls.model_validate(obj)
81
+
82
+ _obj = cls.model_validate({"apiKey": obj.get("apiKey")})
83
+ return _obj
@@ -0,0 +1,141 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Crypticorn Auth API
5
+
6
+ OpenAPI compliant REST API built using tRPC with Express
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import (
21
+ BaseModel,
22
+ ConfigDict,
23
+ Field,
24
+ StrictFloat,
25
+ StrictInt,
26
+ StrictStr,
27
+ field_validator,
28
+ )
29
+ from typing import Any, ClassVar, Dict, List, Optional, Union
30
+ from typing_extensions import Annotated
31
+ from typing import Optional, Set
32
+ from typing_extensions import Self
33
+
34
+
35
+ class CreateApiKeyRequest(BaseModel):
36
+ """
37
+ CreateApiKeyRequest
38
+ """ # noqa: E501
39
+
40
+ name: StrictStr
41
+ scopes: Annotated[List[StrictStr], Field(min_length=1)]
42
+ expires_in: Optional[Union[StrictFloat, StrictInt]] = Field(
43
+ default=None, alias="expiresIn"
44
+ )
45
+ __properties: ClassVar[List[str]] = ["name", "scopes", "expiresIn"]
46
+
47
+ @field_validator("scopes")
48
+ def scopes_validate_enum(cls, value):
49
+ """Validates the enum"""
50
+ for i in value:
51
+ if i not in set(
52
+ [
53
+ "read:hive:model",
54
+ "read:hive:data",
55
+ "write:hive:model",
56
+ "write:hive:data",
57
+ "read:trade:bots",
58
+ "write:trade:bots",
59
+ "read:trade:api_keys",
60
+ "write:trade:api_keys",
61
+ "read:trade:orders",
62
+ "read:trade:actions",
63
+ "write:trade:actions",
64
+ "read:trade:exchanges",
65
+ "read:trade:futures",
66
+ "write:trade:futures",
67
+ "read:trade:notifications",
68
+ "write:trade:notifications",
69
+ "read:trade:strategies",
70
+ "write:trade:strategies",
71
+ "read:pay:payments",
72
+ "read:pay:products",
73
+ "write:pay:products",
74
+ "read:pay:subscriptions",
75
+ "write:pay:subscriptions",
76
+ "read:pay:now_payments",
77
+ "write:pay:now_payments",
78
+ "read:predictions",
79
+ ]
80
+ ):
81
+ raise ValueError(
82
+ "each list item must be one of ('read:hive:model', 'read:hive:data', 'write:hive:model', 'write:hive:data', 'read:trade:bots', 'write:trade:bots', 'read:trade:api_keys', 'write:trade:api_keys', 'read:trade:orders', 'read:trade:actions', 'write:trade:actions', 'read:trade:exchanges', 'read:trade:futures', 'write:trade:futures', 'read:trade:notifications', 'write:trade:notifications', 'read:trade:strategies', 'write:trade:strategies', 'read:pay:payments', 'read:pay:products', 'write:pay:products', 'read:pay:subscriptions', 'write:pay:subscriptions', 'read:pay:now_payments', 'write:pay:now_payments', 'read:predictions')"
83
+ )
84
+ return value
85
+
86
+ model_config = ConfigDict(
87
+ populate_by_name=True,
88
+ validate_assignment=True,
89
+ protected_namespaces=(),
90
+ )
91
+
92
+ def to_str(self) -> str:
93
+ """Returns the string representation of the model using alias"""
94
+ return pprint.pformat(self.model_dump(by_alias=True))
95
+
96
+ def to_json(self) -> str:
97
+ """Returns the JSON representation of the model using alias"""
98
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
99
+ return json.dumps(self.to_dict())
100
+
101
+ @classmethod
102
+ def from_json(cls, json_str: str) -> Optional[Self]:
103
+ """Create an instance of CreateApiKeyRequest from a JSON string"""
104
+ return cls.from_dict(json.loads(json_str))
105
+
106
+ def to_dict(self) -> Dict[str, Any]:
107
+ """Return the dictionary representation of the model using alias.
108
+
109
+ This has the following differences from calling pydantic's
110
+ `self.model_dump(by_alias=True)`:
111
+
112
+ * `None` is only added to the output dict for nullable fields that
113
+ were set at model initialization. Other fields with value `None`
114
+ are ignored.
115
+ """
116
+ excluded_fields: Set[str] = set([])
117
+
118
+ _dict = self.model_dump(
119
+ by_alias=True,
120
+ exclude=excluded_fields,
121
+ exclude_none=True,
122
+ )
123
+ return _dict
124
+
125
+ @classmethod
126
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
127
+ """Create an instance of CreateApiKeyRequest from a dict"""
128
+ if obj is None:
129
+ return None
130
+
131
+ if not isinstance(obj, dict):
132
+ return cls.model_validate(obj)
133
+
134
+ _obj = cls.model_validate(
135
+ {
136
+ "name": obj.get("name"),
137
+ "scopes": obj.get("scopes"),
138
+ "expiresIn": obj.get("expiresIn"),
139
+ }
140
+ )
141
+ return _obj
@@ -0,0 +1,144 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Crypticorn Auth API
5
+
6
+ OpenAPI compliant REST API built using tRPC with Express
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from datetime import datetime
21
+ from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+
27
+ class GetApiKeys200ResponseInner(BaseModel):
28
+ """
29
+ GetApiKeys200ResponseInner
30
+ """ # noqa: E501
31
+
32
+ id: StrictStr
33
+ user_id: StrictStr
34
+ scopes: List[StrictStr]
35
+ name: StrictStr
36
+ expires_at: Optional[datetime] = None
37
+ created_at: datetime
38
+ __properties: ClassVar[List[str]] = [
39
+ "id",
40
+ "user_id",
41
+ "scopes",
42
+ "name",
43
+ "expires_at",
44
+ "created_at",
45
+ ]
46
+
47
+ @field_validator("scopes")
48
+ def scopes_validate_enum(cls, value):
49
+ """Validates the enum"""
50
+ for i in value:
51
+ if i not in set(
52
+ [
53
+ "read:hive:model",
54
+ "read:hive:data",
55
+ "write:hive:model",
56
+ "write:hive:data",
57
+ "read:trade:bots",
58
+ "write:trade:bots",
59
+ "read:trade:api_keys",
60
+ "write:trade:api_keys",
61
+ "read:trade:orders",
62
+ "read:trade:actions",
63
+ "write:trade:actions",
64
+ "read:trade:exchanges",
65
+ "read:trade:futures",
66
+ "write:trade:futures",
67
+ "read:trade:notifications",
68
+ "write:trade:notifications",
69
+ "read:trade:strategies",
70
+ "write:trade:strategies",
71
+ "read:pay:payments",
72
+ "read:pay:products",
73
+ "write:pay:products",
74
+ "read:pay:subscriptions",
75
+ "write:pay:subscriptions",
76
+ "read:pay:now_payments",
77
+ "write:pay:now_payments",
78
+ "read:predictions",
79
+ ]
80
+ ):
81
+ raise ValueError(
82
+ "each list item must be one of ('read:hive:model', 'read:hive:data', 'write:hive:model', 'write:hive:data', 'read:trade:bots', 'write:trade:bots', 'read:trade:api_keys', 'write:trade:api_keys', 'read:trade:orders', 'read:trade:actions', 'write:trade:actions', 'read:trade:exchanges', 'read:trade:futures', 'write:trade:futures', 'read:trade:notifications', 'write:trade:notifications', 'read:trade:strategies', 'write:trade:strategies', 'read:pay:payments', 'read:pay:products', 'write:pay:products', 'read:pay:subscriptions', 'write:pay:subscriptions', 'read:pay:now_payments', 'write:pay:now_payments', 'read:predictions')"
83
+ )
84
+ return value
85
+
86
+ model_config = ConfigDict(
87
+ populate_by_name=True,
88
+ validate_assignment=True,
89
+ protected_namespaces=(),
90
+ )
91
+
92
+ def to_str(self) -> str:
93
+ """Returns the string representation of the model using alias"""
94
+ return pprint.pformat(self.model_dump(by_alias=True))
95
+
96
+ def to_json(self) -> str:
97
+ """Returns the JSON representation of the model using alias"""
98
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
99
+ return json.dumps(self.to_dict())
100
+
101
+ @classmethod
102
+ def from_json(cls, json_str: str) -> Optional[Self]:
103
+ """Create an instance of GetApiKeys200ResponseInner from a JSON string"""
104
+ return cls.from_dict(json.loads(json_str))
105
+
106
+ def to_dict(self) -> Dict[str, Any]:
107
+ """Return the dictionary representation of the model using alias.
108
+
109
+ This has the following differences from calling pydantic's
110
+ `self.model_dump(by_alias=True)`:
111
+
112
+ * `None` is only added to the output dict for nullable fields that
113
+ were set at model initialization. Other fields with value `None`
114
+ are ignored.
115
+ """
116
+ excluded_fields: Set[str] = set([])
117
+
118
+ _dict = self.model_dump(
119
+ by_alias=True,
120
+ exclude=excluded_fields,
121
+ exclude_none=True,
122
+ )
123
+ return _dict
124
+
125
+ @classmethod
126
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
127
+ """Create an instance of GetApiKeys200ResponseInner from a dict"""
128
+ if obj is None:
129
+ return None
130
+
131
+ if not isinstance(obj, dict):
132
+ return cls.model_validate(obj)
133
+
134
+ _obj = cls.model_validate(
135
+ {
136
+ "id": obj.get("id"),
137
+ "user_id": obj.get("user_id"),
138
+ "scopes": obj.get("scopes"),
139
+ "name": obj.get("name"),
140
+ "expires_at": obj.get("expires_at"),
141
+ "created_at": obj.get("created_at"),
142
+ }
143
+ )
144
+ return _obj
@@ -0,0 +1,109 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Crypticorn Auth API
5
+
6
+ OpenAPI compliant REST API built using tRPC with Express
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict
21
+ from typing import Any, ClassVar, Dict, List
22
+ from crypticorn.auth.client.models.authorize_user200_response_auth import (
23
+ AuthorizeUser200ResponseAuth,
24
+ )
25
+ from crypticorn.auth.client.models.oauth_callback200_response_user import (
26
+ OauthCallback200ResponseUser,
27
+ )
28
+ from typing import Optional, Set
29
+ from typing_extensions import Self
30
+
31
+
32
+ class OauthCallback200Response(BaseModel):
33
+ """
34
+ OauthCallback200Response
35
+ """ # noqa: E501
36
+
37
+ user: OauthCallback200ResponseUser
38
+ auth: AuthorizeUser200ResponseAuth
39
+ __properties: ClassVar[List[str]] = ["user", "auth"]
40
+
41
+ model_config = ConfigDict(
42
+ populate_by_name=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
+ return json.dumps(self.to_dict())
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
+ """Create an instance of OauthCallback200Response from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ """
71
+ excluded_fields: Set[str] = set([])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ # override the default output from pydantic by calling `to_dict()` of user
79
+ if self.user:
80
+ _dict["user"] = self.user.to_dict()
81
+ # override the default output from pydantic by calling `to_dict()` of auth
82
+ if self.auth:
83
+ _dict["auth"] = self.auth.to_dict()
84
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of OauthCallback200Response from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj)
94
+
95
+ _obj = cls.model_validate(
96
+ {
97
+ "user": (
98
+ OauthCallback200ResponseUser.from_dict(obj["user"])
99
+ if obj.get("user") is not None
100
+ else None
101
+ ),
102
+ "auth": (
103
+ AuthorizeUser200ResponseAuth.from_dict(obj["auth"])
104
+ if obj.get("auth") is not None
105
+ else None
106
+ ),
107
+ }
108
+ )
109
+ return _obj
@@ -0,0 +1,104 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Crypticorn Auth API
5
+
6
+ OpenAPI compliant REST API built using tRPC with Express
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+
26
+ class OauthCallback200ResponseUser(BaseModel):
27
+ """
28
+ OauthCallback200ResponseUser
29
+ """ # noqa: E501
30
+
31
+ email: StrictStr
32
+ id: StrictStr
33
+ name: Optional[StrictStr] = None
34
+ picture: Optional[StrictStr] = None
35
+ username: Optional[StrictStr] = None
36
+ phone: Optional[StrictStr] = None
37
+ __properties: ClassVar[List[str]] = [
38
+ "email",
39
+ "id",
40
+ "name",
41
+ "picture",
42
+ "username",
43
+ "phone",
44
+ ]
45
+
46
+ model_config = ConfigDict(
47
+ populate_by_name=True,
48
+ validate_assignment=True,
49
+ protected_namespaces=(),
50
+ )
51
+
52
+ def to_str(self) -> str:
53
+ """Returns the string representation of the model using alias"""
54
+ return pprint.pformat(self.model_dump(by_alias=True))
55
+
56
+ def to_json(self) -> str:
57
+ """Returns the JSON representation of the model using alias"""
58
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
+ return json.dumps(self.to_dict())
60
+
61
+ @classmethod
62
+ def from_json(cls, json_str: str) -> Optional[Self]:
63
+ """Create an instance of OauthCallback200ResponseUser from a JSON string"""
64
+ return cls.from_dict(json.loads(json_str))
65
+
66
+ def to_dict(self) -> Dict[str, Any]:
67
+ """Return the dictionary representation of the model using alias.
68
+
69
+ This has the following differences from calling pydantic's
70
+ `self.model_dump(by_alias=True)`:
71
+
72
+ * `None` is only added to the output dict for nullable fields that
73
+ were set at model initialization. Other fields with value `None`
74
+ are ignored.
75
+ """
76
+ excluded_fields: Set[str] = set([])
77
+
78
+ _dict = self.model_dump(
79
+ by_alias=True,
80
+ exclude=excluded_fields,
81
+ exclude_none=True,
82
+ )
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of OauthCallback200ResponseUser from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate(
95
+ {
96
+ "email": obj.get("email"),
97
+ "id": obj.get("id"),
98
+ "name": obj.get("name"),
99
+ "picture": obj.get("picture"),
100
+ "username": obj.get("username"),
101
+ "phone": obj.get("phone"),
102
+ }
103
+ )
104
+ return _obj
@@ -34,6 +34,7 @@ class Whoami200Response(BaseModel):
34
34
  picture: Optional[StrictStr] = None
35
35
  username: Optional[StrictStr] = None
36
36
  phone: Optional[StrictStr] = None
37
+ apikeys: Optional[List[StrictStr]] = None
37
38
  __properties: ClassVar[List[str]] = [
38
39
  "email",
39
40
  "id",
@@ -41,6 +42,7 @@ class Whoami200Response(BaseModel):
41
42
  "picture",
42
43
  "username",
43
44
  "phone",
45
+ "apikeys",
44
46
  ]
45
47
 
46
48
  model_config = ConfigDict(
@@ -99,6 +101,7 @@ class Whoami200Response(BaseModel):
99
101
  "picture": obj.get("picture"),
100
102
  "username": obj.get("username"),
101
103
  "phone": obj.get("phone"),
104
+ "apikeys": obj.get("apikeys"),
102
105
  }
103
106
  )
104
107
  return _obj
crypticorn/common/auth.py CHANGED
@@ -26,17 +26,17 @@ def Security( # noqa: N802
26
26
  Optional[Callable[..., Any]], Doc("A dependable callable (like a function).")
27
27
  ] = None,
28
28
  scopes: Annotated[
29
- Optional[list[Scope]], # Optional[Sequence[Union[str, Scope]]],
30
- Doc("OAuth2 scopes required for the *path operation*."),
29
+ Optional[list[Scope]],
30
+ Doc("API scopes required for the *path operation*."),
31
31
  ] = None,
32
32
  use_cache: Annotated[
33
33
  bool, Doc("Whether to cache the dependency during a single request.")
34
34
  ] = True,
35
35
  ) -> Any:
36
+ """Security Dependency. Extends the fastapi.Security class to support enum scopes instead of strings."""
37
+
36
38
  # Convert Enum scopes to string
37
- scopes_str = (
38
- [s.value if isinstance(s, Enum) else s for s in scopes] if scopes else None
39
- )
39
+ scopes_str = [s.value for s in scopes] if scopes else None
40
40
 
41
41
  return params.Security(
42
42
  dependency=dependency, scopes=scopes_str, use_cache=use_cache