Total re-design of Factory?

Abierto
#189 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Rust
Estrellas
25
Forks
18
Merge medio
56 min
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de bcgit/bc-rust

Todos los issues de bcgit/bc-rust

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.