swarmauri-core 0.7.5.dev1__tar.gz → 0.9.0.dev2__tar.gz
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.
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/PKG-INFO +3 -3
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/pyproject.toml +10 -5
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/README.md +2 -2
- swarmauri_core-0.9.0.dev2/swarmauri_core/certs/ICertService.py +193 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/certs/__init__.py +5 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/chains/IChain.py +4 -2
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/chains/IChainFactory.py +10 -9
- swarmauri_core-0.9.0.dev2/swarmauri_core/crypto/ICrypto.py +215 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/crypto/types.py +308 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/ensembles/IEnsemble.py +55 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/git_filters/IGitFilter.py +29 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/git_filters/__init__.py +5 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/keys/IKeyProvider.py +76 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/keys/__init__.py +17 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/keys/types.py +54 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/measurements/IMeasurement.py +1 -1
- swarmauri_core-0.9.0.dev2/swarmauri_core/measurements/IMeasurementCalculate.py +29 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/middlewares/IMiddleware.py +29 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/mre_crypto/IMreCrypto.py +191 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/mre_crypto/__init__.py +19 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/mre_crypto/types.py +50 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/tts → swarmauri_core-0.9.0.dev2/swarmauri_core/ocrs}/IPredict.py +7 -6
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/prompt_templates/IPromptTemplate.py +3 -3
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/prompts/IPrompt.py +2 -1
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/prompts/ITemplate.py +2 -2
- swarmauri_core-0.9.0.dev2/swarmauri_core/signing/ISigning.py +160 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/signing/__init__.py +6 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/signing/types.py +45 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/storage/IStorageAdapter.py +39 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/storage/__init__.py +3 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/task_mgmt_strategies/__init__.py +0 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/tensors/__init__.py +0 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/tokens/ITokenService.py +49 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/tokens/__init__.py +5 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/tool_llms/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/toolkits/IToolkit.py +6 -5
- swarmauri_core-0.9.0.dev2/swarmauri_core/toolkits/__init__.py +0 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/tools/__init__.py +0 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/tracing/__init__.py +0 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/transports/__init__.py +0 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/tts/__init__.py +0 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/utils/__init__.py +0 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/vector_stores/__init__.py +0 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/vectors/__init__.py +0 -0
- swarmauri_core-0.9.0.dev2/swarmauri_core/vlms/__init__.py +0 -0
- swarmauri_core-0.7.5.dev1/swarmauri_core/ComponentBase.py +0 -763
- swarmauri_core-0.7.5.dev1/swarmauri_core/measurements/IMeasurementCalculate.py +0 -29
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/LICENSE +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/README.md +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/agent_apis/IAgentCommands.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/agent_apis/IAgentRouterCRUD.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/agent_apis/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/agent_factories/IExportConf.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/agent_factories/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/agents/IAgent.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/agents/IAgentConversation.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/agents/IAgentParser.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/agents/IAgentRetrieve.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/agents/IAgentSystemContext.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/agents/IAgentToolkit.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/agents/IAgentVectorStore.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/agents/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/chains/ICallableChain.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/chains/IChainContext.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/chains/IChainContextLoader.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/chains/IChainDependencyResolver.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/chains/IChainStep.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/chains/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/chunkers/IChunker.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/chunkers/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/control_panels/IControlPanel.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/control_panels/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/conversations/IConversation.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/conversations/IMaxSize.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/conversations/ISystemContext.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/conversations/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/dataconnectors → swarmauri_core-0.9.0.dev2/swarmauri_core/crypto}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/dataconnectors/IDataConnector.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/distances → swarmauri_core-0.9.0.dev2/swarmauri_core/dataconnectors}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/distances/IDistanceSimilarity.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/document_stores → swarmauri_core-0.9.0.dev2/swarmauri_core/distances}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/document_stores/IDocumentRetrieve.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/document_stores/IDocumentStore.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/documents → swarmauri_core-0.9.0.dev2/swarmauri_core/document_stores}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/documents/IDocument.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/documents/IExperimentDocument.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/evaluator_pools → swarmauri_core-0.9.0.dev2/swarmauri_core/documents}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/embeddings/IFeature.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/embeddings/ISaveModel.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/embeddings/IVectorize.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/embeddings/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/evaluator_results → swarmauri_core-0.9.0.dev2/swarmauri_core/ensembles}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/evaluator_pools/IEvaluatorPool.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/evaluators → swarmauri_core-0.9.0.dev2/swarmauri_core/evaluator_pools}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/evaluator_results/IEvalResult.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/factories → swarmauri_core-0.9.0.dev2/swarmauri_core/evaluator_results}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/evaluators/IEvaluate.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/image_gens → swarmauri_core-0.9.0.dev2/swarmauri_core/evaluators}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/factories/IFactory.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/llms → swarmauri_core-0.9.0.dev2/swarmauri_core/factories}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/image_gens/IGenImage.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/logger_formatters → swarmauri_core-0.9.0.dev2/swarmauri_core/image_gens}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/inner_products/IInnerProduct.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/logger_handlers → swarmauri_core-0.9.0.dev2/swarmauri_core/inner_products}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/llms/IFit.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/llms/IPredict.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/loggers → swarmauri_core-0.9.0.dev2/swarmauri_core/llms}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/logger_formatters/IFormatter.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/measurements → swarmauri_core-0.9.0.dev2/swarmauri_core/logger_formatters}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/logger_handlers/IHandler.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/ocrs → swarmauri_core-0.9.0.dev2/swarmauri_core/logger_handlers}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/loggers/ILogger.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/parsers → swarmauri_core-0.9.0.dev2/swarmauri_core/loggers}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/matrices/IMatrix.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/pipelines → swarmauri_core-0.9.0.dev2/swarmauri_core/matrices}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/measurements/IMeasurementAggregate.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/measurements/IThreshold.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/programs → swarmauri_core-0.9.0.dev2/swarmauri_core/measurements}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/messages/IMessage.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/messages/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/metrics/IMetric.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/prompt_templates → swarmauri_core-0.9.0.dev2/swarmauri_core/metrics}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/prompts → swarmauri_core-0.9.0.dev2/swarmauri_core/middlewares}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/norms/INorm.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/norms/IUseInnerProduct.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/publishers → swarmauri_core-0.9.0.dev2/swarmauri_core/norms}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/rate_limits → swarmauri_core-0.9.0.dev2/swarmauri_core/ocrs}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/parsers/IParser.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/schema_converters → swarmauri_core-0.9.0.dev2/swarmauri_core/parsers}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/pipelines/IPipeline.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/service_registries → swarmauri_core-0.9.0.dev2/swarmauri_core/pipelines}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/programs/IProgram.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/sst → swarmauri_core-0.9.0.dev2/swarmauri_core/programs}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/swarm_apis → swarmauri_core-0.9.0.dev2/swarmauri_core/prompt_templates}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/prompts/IPromptMatrix.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/swarms → swarmauri_core-0.9.0.dev2/swarmauri_core/prompts}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/pseudometrics/IPseudometric.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/task_mgmt_strategies → swarmauri_core-0.9.0.dev2/swarmauri_core/pseudometrics}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/publishers/IPublish.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/tool_llms → swarmauri_core-0.9.0.dev2/swarmauri_core/publishers}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/rate_limits/IRateLimit.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/toolkits → swarmauri_core-0.9.0.dev2/swarmauri_core/rate_limits}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/schema_converters/ISchemaConvert.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/tools → swarmauri_core-0.9.0.dev2/swarmauri_core/schema_converters}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/seminorms/ISeminorm.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/tracing → swarmauri_core-0.9.0.dev2/swarmauri_core/seminorms}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/service_registries/IServiceRegistry.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/transports → swarmauri_core-0.9.0.dev2/swarmauri_core/service_registries}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/similarities/ISimilarity.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/tts → swarmauri_core-0.9.0.dev2/swarmauri_core/similarities}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/ocrs → swarmauri_core-0.9.0.dev2/swarmauri_core/sst}/IPredict.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/utils → swarmauri_core-0.9.0.dev2/swarmauri_core/sst}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/state/IState.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/vector_stores → swarmauri_core-0.9.0.dev2/swarmauri_core/state}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/swarm_apis/IAgentRegistrationAPI.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/swarm_apis/ISwarmAPI.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/vectors → swarmauri_core-0.9.0.dev2/swarmauri_core/swarm_apis}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/swarms/ISwarm.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/vlms → swarmauri_core-0.9.0.dev2/swarmauri_core/swarms}/__init__.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/task_mgmt_strategies/ITaskMgmtStrategy.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/tensors/ITensor.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/tool_llms/IToolPredict.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/tools/IParameter.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/tools/ITool.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/tracing/IChainTracer.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/tracing/ITraceContext.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/tracing/ITracer.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/transports/ITransport.py +0 -0
- {swarmauri_core-0.7.5.dev1/swarmauri_core/sst → swarmauri_core-0.9.0.dev2/swarmauri_core/tts}/IPredict.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/utils/ITransactional.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/vector_stores/ICloudVectorStore.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/vector_stores/IPersistentVectorStore.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/vector_stores/ISimilarity.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/vector_stores/IVectorNorm.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/vector_stores/IVectorStore.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/vector_stores/IVectorStoreRetrieve.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/vector_stores/IVectorStoreSaveLoad.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/vectors/IVector.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/vectors/IVectorMeta.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/vectors/IVectorProduct.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/vectors/IVectorTransform.py +0 -0
- {swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/vlms/IPredictVision.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: swarmauri-core
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0.dev2
|
|
4
4
|
Summary: This repository includes core interfaces for the Swarmauri framework.
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Author: Jacob Stewart
|
|
@@ -10,8 +10,8 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.10
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
-
Requires-Dist:
|
|
14
|
-
Requires-Dist:
|
|
13
|
+
Requires-Dist: aiofiles
|
|
14
|
+
Requires-Dist: typing_extensions
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
|
|
17
17
|

|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri-core"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.9.0.dev2"
|
|
4
4
|
description = "This repository includes core interfaces for the Swarmauri framework."
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Jacob Stewart", email = "jacob@swarmauri.com" },
|
|
@@ -17,22 +17,26 @@ classifiers = [
|
|
|
17
17
|
requires-python = ">=3.10,<3.13"
|
|
18
18
|
|
|
19
19
|
dependencies = [
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"typing_extensions",
|
|
21
|
+
"aiofiles",
|
|
22
22
|
]
|
|
23
23
|
|
|
24
|
+
|
|
25
|
+
|
|
24
26
|
[dependency-groups]
|
|
25
27
|
dev = [
|
|
26
28
|
"flake8>=7.0",
|
|
27
29
|
"pytest>=8.0",
|
|
30
|
+
"pytest-asyncio>=0.24.0",
|
|
28
31
|
"pytest-xdist>=3.6.1",
|
|
29
32
|
"pytest-json-report>=1.5.0",
|
|
30
33
|
"pytest-timeout>=2.3.1",
|
|
31
34
|
"ruff>=0.9.9",
|
|
32
|
-
"pytest-benchmark>=4.0.0"
|
|
35
|
+
"pytest-benchmark>=4.0.0",
|
|
33
36
|
]
|
|
34
37
|
|
|
35
38
|
[tool.pytest.ini_options]
|
|
39
|
+
asyncio_mode = "auto"
|
|
36
40
|
markers = [
|
|
37
41
|
"test: standard test",
|
|
38
42
|
"unit: Unit tests",
|
|
@@ -49,7 +53,8 @@ log_cli = true
|
|
|
49
53
|
log_cli_level = "INFO"
|
|
50
54
|
log_cli_format = "%(asctime)s [%(levelname)s] %(message)s"
|
|
51
55
|
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
|
|
56
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
52
57
|
|
|
53
58
|
[build-system]
|
|
54
59
|
requires = ["poetry-core>=1.0.0"]
|
|
55
|
-
build-backend = "poetry.core.masonry.api"
|
|
60
|
+
build-backend = "poetry.core.masonry.api"
|
|
@@ -14,11 +14,11 @@ The Core Library provides the foundational interfaces and abstract base classes
|
|
|
14
14
|
|
|
15
15
|
## Getting Started
|
|
16
16
|
|
|
17
|
-
To start developing with the Core Library, include it as a module in your Python project. Ensure you have Python 3.
|
|
17
|
+
To start developing with the Core Library, include it as a module in your Python project. Ensure you have Python 3.10 or later installed.
|
|
18
18
|
|
|
19
19
|
```python
|
|
20
20
|
# Example of using an abstract model interface from the Core Library
|
|
21
|
-
from
|
|
21
|
+
from swarmauri_core.models.IModel import IModel
|
|
22
22
|
|
|
23
23
|
class MyModel(IModel):
|
|
24
24
|
# Implement the abstract methods here
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import Iterable, Mapping, Optional, Sequence, TypedDict, Dict, Any
|
|
5
|
+
|
|
6
|
+
from swarmauri_core.crypto.types import (
|
|
7
|
+
KeyRef,
|
|
8
|
+
) # kid, version, material/public, export_policy, uses, tags
|
|
9
|
+
|
|
10
|
+
# -----------------------------------------------------------------------------
|
|
11
|
+
# Lightweight specs (intentionally library-agnostic; providers may accept more
|
|
12
|
+
# via the 'extensions' / 'opts' dictionaries).
|
|
13
|
+
# Times are UNIX epoch seconds (UTC). PEM/DER I/O is byte-oriented: providers
|
|
14
|
+
# should accept PEM or DER and return PEM by default (unless 'output_der=True').
|
|
15
|
+
# -----------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class SubjectSpec(TypedDict, total=False):
|
|
19
|
+
CN: str
|
|
20
|
+
C: str
|
|
21
|
+
ST: str
|
|
22
|
+
L: str
|
|
23
|
+
O: str # noqa: E741
|
|
24
|
+
OU: str
|
|
25
|
+
emailAddress: str
|
|
26
|
+
# You can pass additional RDNs via 'extra_rdns' using provider-specific names:
|
|
27
|
+
extra_rdns: Dict[str, str]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class AltNameSpec(TypedDict, total=False):
|
|
31
|
+
dns: Sequence[str] # DNS names (SAN)
|
|
32
|
+
ip: Sequence[str] # IPv4/IPv6 strings
|
|
33
|
+
uri: Sequence[str] # URI SANs
|
|
34
|
+
email: Sequence[str] # rfc822Name
|
|
35
|
+
upn: Sequence[str] # userPrincipalName (if provider supports)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class BasicConstraintsSpec(TypedDict, total=False):
|
|
39
|
+
ca: bool
|
|
40
|
+
path_len: Optional[int] # None ⇒ no limit encoded
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class KeyUsageSpec(TypedDict, total=False):
|
|
44
|
+
digital_signature: bool
|
|
45
|
+
content_commitment: bool # nonRepudiation
|
|
46
|
+
key_encipherment: bool
|
|
47
|
+
data_encipherment: bool
|
|
48
|
+
key_agreement: bool
|
|
49
|
+
key_cert_sign: bool
|
|
50
|
+
crl_sign: bool
|
|
51
|
+
encipher_only: bool
|
|
52
|
+
decipher_only: bool
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class ExtendedKeyUsageSpec(TypedDict, total=False):
|
|
56
|
+
# Either OID strings (e.g., "1.3.6.1.5.5.7.3.1") or common tokens ("serverAuth", "clientAuth", ...)
|
|
57
|
+
oids: Sequence[str]
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class NameConstraintsSpec(TypedDict, total=False):
|
|
61
|
+
permitted_dns: Sequence[str]
|
|
62
|
+
excluded_dns: Sequence[str]
|
|
63
|
+
permitted_ip: Sequence[str]
|
|
64
|
+
excluded_ip: Sequence[str]
|
|
65
|
+
permitted_uri: Sequence[str]
|
|
66
|
+
excluded_uri: Sequence[str]
|
|
67
|
+
permitted_email: Sequence[str]
|
|
68
|
+
excluded_email: Sequence[str]
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class CertExtensionSpec(TypedDict, total=False):
|
|
72
|
+
basic_constraints: BasicConstraintsSpec
|
|
73
|
+
key_usage: KeyUsageSpec
|
|
74
|
+
extended_key_usage: ExtendedKeyUsageSpec
|
|
75
|
+
name_constraints: NameConstraintsSpec
|
|
76
|
+
subject_alt_name: AltNameSpec # convenience; same as 'san' input
|
|
77
|
+
subject_key_identifier: bool # auto-derive from subject public key
|
|
78
|
+
authority_key_identifier: (
|
|
79
|
+
bool # auto-derive from issuer (requires ca_cert or ca public)
|
|
80
|
+
)
|
|
81
|
+
# Provider-specific or advanced extensions may be passed in 'extra':
|
|
82
|
+
extra: Dict[str, Any]
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
# Common alias for PEM/DER bytes
|
|
86
|
+
CertBytes = bytes
|
|
87
|
+
CsrBytes = bytes
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class ICertService(ABC):
|
|
91
|
+
"""X.509 / CSR service surface following RFC 5280 and RFC 2986."""
|
|
92
|
+
|
|
93
|
+
# ------------------------------------------------------------------
|
|
94
|
+
# capability probe
|
|
95
|
+
# ------------------------------------------------------------------
|
|
96
|
+
|
|
97
|
+
@abstractmethod
|
|
98
|
+
def supports(self) -> Mapping[str, Iterable[str]]:
|
|
99
|
+
"""Report advertised capabilities."""
|
|
100
|
+
...
|
|
101
|
+
|
|
102
|
+
# ------------------------------------------------------------------
|
|
103
|
+
# CSR (PKCS#10 - RFC 2986)
|
|
104
|
+
# ------------------------------------------------------------------
|
|
105
|
+
|
|
106
|
+
@abstractmethod
|
|
107
|
+
async def create_csr(
|
|
108
|
+
self,
|
|
109
|
+
key: KeyRef,
|
|
110
|
+
subject: SubjectSpec,
|
|
111
|
+
*,
|
|
112
|
+
san: Optional[AltNameSpec] = None,
|
|
113
|
+
extensions: Optional[CertExtensionSpec] = None,
|
|
114
|
+
sig_alg: Optional[str] = None,
|
|
115
|
+
challenge_password: Optional[str] = None,
|
|
116
|
+
output_der: bool = False,
|
|
117
|
+
opts: Optional[Dict[str, Any]] = None,
|
|
118
|
+
) -> CsrBytes:
|
|
119
|
+
"""Build and sign a PKCS#10 CSR (RFC 2986) using 'key'."""
|
|
120
|
+
...
|
|
121
|
+
|
|
122
|
+
# ------------------------------------------------------------------
|
|
123
|
+
# Certificates (self-signed / CA) - RFC 5280
|
|
124
|
+
# ------------------------------------------------------------------
|
|
125
|
+
|
|
126
|
+
@abstractmethod
|
|
127
|
+
async def create_self_signed(
|
|
128
|
+
self,
|
|
129
|
+
key: KeyRef,
|
|
130
|
+
subject: SubjectSpec,
|
|
131
|
+
*,
|
|
132
|
+
serial: Optional[int] = None,
|
|
133
|
+
not_before: Optional[int] = None,
|
|
134
|
+
not_after: Optional[int] = None,
|
|
135
|
+
extensions: Optional[CertExtensionSpec] = None,
|
|
136
|
+
sig_alg: Optional[str] = None,
|
|
137
|
+
output_der: bool = False,
|
|
138
|
+
opts: Optional[Dict[str, Any]] = None,
|
|
139
|
+
) -> CertBytes:
|
|
140
|
+
"""Create a self-signed certificate using 'key' as both subject and issuer."""
|
|
141
|
+
...
|
|
142
|
+
|
|
143
|
+
@abstractmethod
|
|
144
|
+
async def sign_cert(
|
|
145
|
+
self,
|
|
146
|
+
csr: CsrBytes,
|
|
147
|
+
ca_key: KeyRef,
|
|
148
|
+
*,
|
|
149
|
+
issuer: Optional[SubjectSpec] = None,
|
|
150
|
+
ca_cert: Optional[CertBytes] = None,
|
|
151
|
+
serial: Optional[int] = None,
|
|
152
|
+
not_before: Optional[int] = None,
|
|
153
|
+
not_after: Optional[int] = None,
|
|
154
|
+
extensions: Optional[CertExtensionSpec] = None,
|
|
155
|
+
sig_alg: Optional[str] = None,
|
|
156
|
+
output_der: bool = False,
|
|
157
|
+
opts: Optional[Dict[str, Any]] = None,
|
|
158
|
+
) -> CertBytes:
|
|
159
|
+
"""Issue an end-entity or intermediate certificate from a CSR."""
|
|
160
|
+
...
|
|
161
|
+
|
|
162
|
+
# ------------------------------------------------------------------
|
|
163
|
+
# verification
|
|
164
|
+
# ------------------------------------------------------------------
|
|
165
|
+
|
|
166
|
+
@abstractmethod
|
|
167
|
+
async def verify_cert(
|
|
168
|
+
self,
|
|
169
|
+
cert: CertBytes,
|
|
170
|
+
*,
|
|
171
|
+
trust_roots: Optional[Sequence[CertBytes]] = None,
|
|
172
|
+
intermediates: Optional[Sequence[CertBytes]] = None,
|
|
173
|
+
check_time: Optional[int] = None,
|
|
174
|
+
check_revocation: bool = False,
|
|
175
|
+
opts: Optional[Dict[str, Any]] = None,
|
|
176
|
+
) -> Dict[str, Any]:
|
|
177
|
+
"""Verify an X.509 certificate and optionally its chain."""
|
|
178
|
+
...
|
|
179
|
+
|
|
180
|
+
# ------------------------------------------------------------------
|
|
181
|
+
# parsing
|
|
182
|
+
# ------------------------------------------------------------------
|
|
183
|
+
|
|
184
|
+
@abstractmethod
|
|
185
|
+
async def parse_cert(
|
|
186
|
+
self,
|
|
187
|
+
cert: CertBytes,
|
|
188
|
+
*,
|
|
189
|
+
include_extensions: bool = True,
|
|
190
|
+
opts: Optional[Dict[str, Any]] = None,
|
|
191
|
+
) -> Dict[str, Any]:
|
|
192
|
+
"""Parse an X.509 certificate into a JSON-serializable mapping."""
|
|
193
|
+
...
|
|
@@ -26,7 +26,7 @@ class IChain(ABC):
|
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
28
|
@abstractmethod
|
|
29
|
-
def add_step(self, step: IChainStep, **kwargs) -> None:
|
|
29
|
+
def add_step(self, step: IChainStep, **kwargs: dict[str, Any]) -> None:
|
|
30
30
|
"""
|
|
31
31
|
Adds a new step to the chain. Steps are executed in the order they are added.
|
|
32
32
|
Each step is represented by a Callable, which can be a function or method, with
|
|
@@ -51,7 +51,9 @@ class IChain(ABC):
|
|
|
51
51
|
pass
|
|
52
52
|
|
|
53
53
|
@abstractmethod
|
|
54
|
-
def execute(
|
|
54
|
+
def execute(
|
|
55
|
+
self, *args: tuple[Any, ...], **kwargs: dict[str, Any]
|
|
56
|
+
) -> Dict[str, Any]:
|
|
55
57
|
"""
|
|
56
58
|
Initiates the execution of the chain. This involves invoking each step in the order
|
|
57
59
|
they have been added to the chain, passing control from one step to the next, and optionally
|
{swarmauri_core-0.7.5.dev1 → swarmauri_core-0.9.0.dev2}/swarmauri_core/chains/IChainFactory.py
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Any, Dict, List, Optional
|
|
3
|
+
|
|
3
4
|
from swarmauri_core.chains.IChain import IChain
|
|
4
5
|
from swarmauri_core.chains.IChainStep import IChainStep
|
|
5
6
|
|
|
@@ -10,7 +11,7 @@ class IChainFactory(ABC):
|
|
|
10
11
|
"""
|
|
11
12
|
|
|
12
13
|
@abstractmethod
|
|
13
|
-
def create_chain(self, steps: List[IChainStep] = None) -> IChain:
|
|
14
|
+
def create_chain(self, steps: Optional[List[IChainStep]] = None) -> IChain:
|
|
14
15
|
pass
|
|
15
16
|
|
|
16
17
|
@abstractmethod
|
|
@@ -18,11 +19,11 @@ class IChainFactory(ABC):
|
|
|
18
19
|
pass
|
|
19
20
|
|
|
20
21
|
@abstractmethod
|
|
21
|
-
def set_chain(self, chain: IChain):
|
|
22
|
+
def set_chain(self, chain: IChain) -> None:
|
|
22
23
|
pass
|
|
23
24
|
|
|
24
25
|
@abstractmethod
|
|
25
|
-
def reset_chain(self):
|
|
26
|
+
def reset_chain(self) -> None:
|
|
26
27
|
pass
|
|
27
28
|
|
|
28
29
|
@abstractmethod
|
|
@@ -30,15 +31,15 @@ class IChainFactory(ABC):
|
|
|
30
31
|
pass
|
|
31
32
|
|
|
32
33
|
@abstractmethod
|
|
33
|
-
def set_chain_steps(self, steps: List[IChainStep]):
|
|
34
|
+
def set_chain_steps(self, steps: List[IChainStep]) -> None:
|
|
34
35
|
pass
|
|
35
36
|
|
|
36
37
|
@abstractmethod
|
|
37
|
-
def add_chain_step(self, step: IChainStep):
|
|
38
|
+
def add_chain_step(self, step: IChainStep) -> None:
|
|
38
39
|
pass
|
|
39
40
|
|
|
40
41
|
@abstractmethod
|
|
41
|
-
def remove_chain_step(self, key: str):
|
|
42
|
+
def remove_chain_step(self, key: str) -> None:
|
|
42
43
|
pass
|
|
43
44
|
|
|
44
45
|
@abstractmethod
|
|
@@ -46,7 +47,7 @@ class IChainFactory(ABC):
|
|
|
46
47
|
pass
|
|
47
48
|
|
|
48
49
|
@abstractmethod
|
|
49
|
-
def set_configs(self, **configs):
|
|
50
|
+
def set_configs(self, **configs) -> None:
|
|
50
51
|
pass
|
|
51
52
|
|
|
52
53
|
@abstractmethod
|
|
@@ -54,5 +55,5 @@ class IChainFactory(ABC):
|
|
|
54
55
|
pass
|
|
55
56
|
|
|
56
57
|
@abstractmethod
|
|
57
|
-
def set_config(self, key: str, value: Any):
|
|
58
|
+
def set_config(self, key: str, value: Any) -> None:
|
|
58
59
|
pass
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# swarmauri_core/crypto/ICrypto.py
|
|
2
|
+
"""
|
|
3
|
+
ICrypto: Single-recipient cryptography provider interface.
|
|
4
|
+
|
|
5
|
+
Scope
|
|
6
|
+
-----
|
|
7
|
+
- Symmetric AEAD over arbitrary plaintext using a DEK (encrypt/decrypt).
|
|
8
|
+
- Key wrap/unwrap of DEKs under KEKs (HSM/PKCS#11/OpenPGP/RSA-OAEP/etc).
|
|
9
|
+
- Public-key sealing/unsealing (sealed-box/PGP message/RSA-OAEP-seal).
|
|
10
|
+
|
|
11
|
+
Intentionally out of scope
|
|
12
|
+
--------------------------
|
|
13
|
+
- Multi-Recipient Encryption (MRE): use swarmauri_core.mre_crypto.IMreCrypto.
|
|
14
|
+
- Signing/verification (single or multi-signer): use signing plugins
|
|
15
|
+
(e.g., swarmauri_core.signing.IEnvelopeSign).
|
|
16
|
+
|
|
17
|
+
Capability discovery
|
|
18
|
+
--------------------
|
|
19
|
+
Implementations advertise supported algorithms via ``supports()``, using
|
|
20
|
+
keys for any operation they handle. Providers MAY separate advertise
|
|
21
|
+
algorithms by direction (e.g., ``encrypt`` vs ``decrypt``) when they only
|
|
22
|
+
support one side.
|
|
23
|
+
|
|
24
|
+
Example capability map::
|
|
25
|
+
|
|
26
|
+
{
|
|
27
|
+
"encrypt": ("AES-256-GCM", "XCHACHA20-POLY1305"),
|
|
28
|
+
"decrypt": ("AES-256-GCM",),
|
|
29
|
+
"wrap": ("AES-KW", "RSA-OAEP-SHA256", "OpenPGP"),
|
|
30
|
+
"unwrap": ("AES-KW", "RSA-OAEP-SHA256", "OpenPGP"),
|
|
31
|
+
"seal": ("OpenPGP-SEAL", "X25519-SEALEDBOX"),
|
|
32
|
+
"unseal": ("OpenPGP-SEAL", "X25519-SEALEDBOX"),
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Notes
|
|
36
|
+
-----
|
|
37
|
+
- AEAD nonces must obey each algorithm's requirements (e.g., 12 bytes for AES-GCM).
|
|
38
|
+
- Providers MAY enforce ExportPolicy/KeyUse constraints carried in KeyRef.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
from __future__ import annotations
|
|
42
|
+
|
|
43
|
+
from abc import ABC, abstractmethod
|
|
44
|
+
from typing import Dict, Iterable, Optional
|
|
45
|
+
|
|
46
|
+
from .types import (
|
|
47
|
+
AEADCiphertext,
|
|
48
|
+
Alg,
|
|
49
|
+
KeyRef,
|
|
50
|
+
WrappedKey,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class ICrypto(ABC):
|
|
55
|
+
@abstractmethod
|
|
56
|
+
def supports(self) -> Dict[str, Iterable[Alg]]:
|
|
57
|
+
"""
|
|
58
|
+
Return a capability map describing supported algorithms.
|
|
59
|
+
|
|
60
|
+
Expected keys (all optional; omit if unsupported):
|
|
61
|
+
- "encrypt" / "decrypt": AEAD algorithms for each direction
|
|
62
|
+
- "wrap" / "unwrap": key-wrapping algorithms
|
|
63
|
+
- "seal" / "unseal": sealed-box style algorithms
|
|
64
|
+
|
|
65
|
+
Example::
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
"encrypt": ("AES-256-GCM", "XCHACHA20-POLY1305"),
|
|
69
|
+
"decrypt": ("AES-256-GCM",),
|
|
70
|
+
"wrap": ("AES-KW", "RSA-OAEP-SHA256"),
|
|
71
|
+
"unwrap": ("AES-KW", "RSA-OAEP-SHA256"),
|
|
72
|
+
"seal": ("X25519-SEALEDBOX",),
|
|
73
|
+
"unseal": ("X25519-SEALEDBOX",),
|
|
74
|
+
}
|
|
75
|
+
"""
|
|
76
|
+
...
|
|
77
|
+
|
|
78
|
+
# ────────────────────────── Symmetric AEAD ──────────────────────────
|
|
79
|
+
|
|
80
|
+
@abstractmethod
|
|
81
|
+
async def encrypt(
|
|
82
|
+
self,
|
|
83
|
+
key: KeyRef,
|
|
84
|
+
pt: bytes,
|
|
85
|
+
*,
|
|
86
|
+
alg: Optional[Alg] = None,
|
|
87
|
+
aad: Optional[bytes] = None,
|
|
88
|
+
nonce: Optional[bytes] = None,
|
|
89
|
+
) -> AEADCiphertext:
|
|
90
|
+
"""
|
|
91
|
+
AEAD-encrypt 'pt' with the provided DEK 'key'.
|
|
92
|
+
|
|
93
|
+
Parameters:
|
|
94
|
+
key : KeyRef for a data-encryption key (DEK) usable with 'alg'.
|
|
95
|
+
pt : plaintext bytes.
|
|
96
|
+
alg : AEAD algorithm identifier; if None, provider chooses a default.
|
|
97
|
+
aad : optional additional authenticated data; not encrypted, but bound.
|
|
98
|
+
nonce : algorithm-specific nonce/IV; provider MAY generate if None.
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
AEADCiphertext: (kid, version, alg, nonce, ct, tag[, aad])
|
|
102
|
+
"""
|
|
103
|
+
...
|
|
104
|
+
|
|
105
|
+
@abstractmethod
|
|
106
|
+
async def decrypt(
|
|
107
|
+
self,
|
|
108
|
+
key: KeyRef,
|
|
109
|
+
ct: AEADCiphertext,
|
|
110
|
+
*,
|
|
111
|
+
aad: Optional[bytes] = None,
|
|
112
|
+
) -> bytes:
|
|
113
|
+
"""
|
|
114
|
+
AEAD-decrypt 'ct' with the DEK 'key'. If 'aad' is provided, it must
|
|
115
|
+
match the value supplied during encryption.
|
|
116
|
+
|
|
117
|
+
Raises on authentication failure.
|
|
118
|
+
"""
|
|
119
|
+
...
|
|
120
|
+
|
|
121
|
+
# ─────────────────────────── Wrap / Unwrap ──────────────────────────
|
|
122
|
+
|
|
123
|
+
@abstractmethod
|
|
124
|
+
async def wrap(
|
|
125
|
+
self,
|
|
126
|
+
kek: KeyRef,
|
|
127
|
+
*,
|
|
128
|
+
dek: Optional[bytes] = None,
|
|
129
|
+
wrap_alg: Optional[Alg] = None,
|
|
130
|
+
nonce: Optional[bytes] = None,
|
|
131
|
+
aad: Optional[bytes] = None,
|
|
132
|
+
) -> WrappedKey:
|
|
133
|
+
"""
|
|
134
|
+
Protect a DEK under a KEK.
|
|
135
|
+
|
|
136
|
+
Parameters:
|
|
137
|
+
kek : KeyRef for the key-encryption key (KEK).
|
|
138
|
+
dek : raw DEK bytes to wrap. If None, provider MAY generate a new DEK.
|
|
139
|
+
wrap_alg : wrapping algorithm identifier; provider MAY default if None.
|
|
140
|
+
nonce : optional per-wrap nonce/IV (algorithm-specific).
|
|
141
|
+
aad : optional additional authenticated data bound to the wrap.
|
|
142
|
+
|
|
143
|
+
Returns:
|
|
144
|
+
WrappedKey: opaque blob + metadata to later recover the DEK.
|
|
145
|
+
|
|
146
|
+
Notes:
|
|
147
|
+
- Providers SHOULD honor ExportPolicy/KeyUse from both KEK and DEK KeyRefs.
|
|
148
|
+
- Some HSM-backed providers may encode handles/labels rather than raw bytes.
|
|
149
|
+
"""
|
|
150
|
+
...
|
|
151
|
+
|
|
152
|
+
@abstractmethod
|
|
153
|
+
async def unwrap(
|
|
154
|
+
self,
|
|
155
|
+
kek: KeyRef,
|
|
156
|
+
wrapped: WrappedKey,
|
|
157
|
+
*,
|
|
158
|
+
aad: Optional[bytes] = None,
|
|
159
|
+
) -> bytes:
|
|
160
|
+
"""
|
|
161
|
+
Recover a DEK from 'wrapped' using KEK 'kek'.
|
|
162
|
+
|
|
163
|
+
Parameters:
|
|
164
|
+
aad : optional additional authenticated data to validate.
|
|
165
|
+
|
|
166
|
+
Returns:
|
|
167
|
+
bytes: the raw DEK.
|
|
168
|
+
|
|
169
|
+
Notes:
|
|
170
|
+
- HSM-backed providers may refuse export and instead return a handle;
|
|
171
|
+
such providers SHOULD document their behavior or expose a separate
|
|
172
|
+
decrypt() that accepts handles, not bytes.
|
|
173
|
+
"""
|
|
174
|
+
...
|
|
175
|
+
|
|
176
|
+
# ─────────────────────────── Seal / Unseal ──────────────────────────
|
|
177
|
+
|
|
178
|
+
@abstractmethod
|
|
179
|
+
async def seal(
|
|
180
|
+
self,
|
|
181
|
+
recipient: KeyRef,
|
|
182
|
+
pt: bytes,
|
|
183
|
+
*,
|
|
184
|
+
alg: Optional[Alg] = None,
|
|
185
|
+
) -> bytes:
|
|
186
|
+
"""
|
|
187
|
+
Public-key 'sealed' encryption to 'recipient' without caller-managed DEKs.
|
|
188
|
+
Example algs: "OpenPGP-SEAL", "X25519-SEALEDBOX", "RSA-OAEP-SHA256-SEAL".
|
|
189
|
+
|
|
190
|
+
Returns:
|
|
191
|
+
bytes: sealed ciphertext.
|
|
192
|
+
|
|
193
|
+
Notes:
|
|
194
|
+
- Sealed primitives typically do not bind external AAD. If you need
|
|
195
|
+
authenticated metadata, prefer AEAD or wrap a CEK with AEAD outside.
|
|
196
|
+
"""
|
|
197
|
+
...
|
|
198
|
+
|
|
199
|
+
@abstractmethod
|
|
200
|
+
async def unseal(
|
|
201
|
+
self,
|
|
202
|
+
recipient_priv: KeyRef,
|
|
203
|
+
sealed: bytes,
|
|
204
|
+
*,
|
|
205
|
+
alg: Optional[Alg] = None,
|
|
206
|
+
) -> bytes:
|
|
207
|
+
"""
|
|
208
|
+
Decrypt 'sealed' bytes addressed to 'recipient_priv'.
|
|
209
|
+
|
|
210
|
+
Returns:
|
|
211
|
+
bytes: plaintext.
|
|
212
|
+
|
|
213
|
+
Raises on authentication/decryption failure.
|
|
214
|
+
"""
|
|
215
|
+
...
|