Total re-design of Factory?

未关闭
#189 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust

调研方向

Start by reviewing the current factory crate and traits.rs, focusing on allocator constraints and trait object compatibility. Compare the existing design with the stated goals for algorithm abstraction and name-to-object mapping. Done means proposing a redesign that addresses those goals and identifies the intended std or no_std support level.

由索引模型根据 Issue 内容生成。

描述

We have a number of tickets open about factories. I think we agree that the current design of the factory basically needs to be deleted and re-designed from scratch.

Design goals:

  1. Provide an abstraction layer that keeps algorithm-specific code out of calling applications. For example, if an application needs a signature algorithm, it should be possible to build it abstractly so that the developer doesn't know or care whether it's ML-DSA-44, ML-DSA-87, ECDSA-P256, or something else. That essentially means that the abstraction layer should operate at the level of traits so that you only need to know that you're holding a &dyn Signer, or similar.
  2. Provide a string-to-object mapping; ie something that behaves something like let signer = SignerFactory::new_from_name("ML-DSA-65");
  3. That scaffolding will make it easy to build protocols like X.509, CMS, JWT, CWT, TLS (if we go there) because they just need a mapping table from however that protocol names algorithms (OIDs, codepoints, etc) to our canonical internal name, and then they can use the factory. In particular, that does separation of layers by keeping algorithm-specific junk out of the protocol layer.

We get to decide at what level of std, no_std+alloc, no_std, no_alloc we want the factory to be functional at. The current factory is attempting to be operable without an allocator, and this is the root of all the complexity. Doing this at the no_std+alloc level would be much simpler because then you'd have access to Box, which would make the whole thing easier.


PS -- if we trash the current factory crate, then that might soften the requirement that our traits.rs all need to be dyn-compatible, which would allow us to roll-back some of the hideous designs, like the fact that Hash's hash() isn't a static, but instead requires SHA256::new().hash(&msg); when it really should be SHA256::hash(&msg); for no good reason except that the latter is not dyn-compatible.

主要语言
Rust
星标
25
派生
18
平均合并
56 分钟
30 天内合并 PR
1

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bcgit/bc-rust 的其他 Issue

查看 bcgit/bc-rust 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。