diff --git a/api/core/plugin/encrypt/__init__.py b/api/core/plugin/encrypt/__init__.py index 614ce81d20..313d161ec9 100644 --- a/api/core/plugin/encrypt/__init__.py +++ b/api/core/plugin/encrypt/__init__.py @@ -16,7 +16,16 @@ class PluginEncrypter: provider_identity=payload.identity, ) - if payload.opt == "encrypt": - return encrypter.encrypt(payload.data) - else: - return encrypter.decrypt(payload.data) \ No newline at end of file + try: + if payload.opt == "encrypt": + return { + "data": encrypter.encrypt(payload.data), + } + else: + return { + "data": encrypter.decrypt(payload.data), + } + except Exception as e: + return { + "error": str(e), + } diff --git a/api/core/plugin/entities/endpoint.py b/api/core/plugin/entities/endpoint.py index 54d718fd5b..2faa0e8f58 100644 --- a/api/core/plugin/entities/endpoint.py +++ b/api/core/plugin/entities/endpoint.py @@ -1,11 +1,28 @@ +from collections.abc import Mapping from datetime import datetime +from pydantic import BaseModel, Field + +from core.entities.provider_entities import ProviderConfig from core.plugin.entities.base import BasePluginEntity +class EndpointDeclaration(BaseModel): + """ + declaration of an endpoint + """ + + settings: Mapping[str, ProviderConfig] = Field(default_factory=Mapping) + + class EndpointEntity(BasePluginEntity): + """ + entity of an endpoint + """ + settings: dict hook_id: str tenant_id: str plugin_id: str expired_at: datetime + declaration: EndpointDeclaration = Field(default_factory=EndpointDeclaration)