API Design: Factory Pattern Friction With Rust
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- api, cryptography
Research direction
No source file, test, or entry point is named. Start by locating the existing Rust decoding API and reviewing how encoded algorithm-agnostic data is handled; compare the enum, trait-object, algorithm-specific, and hybrid options. Done means an agreed Rust-idiomatic factory-style API that preserves algorithm-agnostic decoding and has corresponding tests or documentation.
Written by the indexing model from the issue text.
Description
Problem
Rust is a multi-paradigm systems programming language that is not purely object-oriented. In comparison to other Bouncy Castle cryptography libraries that are expressed in native object-oriented languages (C# and Java, for example), Rust is unique given its strict nature.
As part of API design, factories are a contentious issue. In C# and Java counterparts, they are a utility class that creates cryptographic objects from encoded data without the caller needing to know the exact implementation type, which follows a factory pattern. They both use runtime data-driven dispatch (read and parse metadata, find discriminator field, choose constructor based on that value) to determine what specific cryptographic constructor to use.
Rust does not naturally model this pattern in the same way as Java or C#. As part of API design, we need to determine how factory-style decoding should be represented:
- Enum-based return types
- Trait objects
- Algorithm-specific constructors only
- Some hybrid approach
The goal is to provide a Rust-idiomatic API while preserving support for decoding algorithm-agnostic encoded data.
- Dominant language
- Rust
- Stars
- 25
- Forks
- 18
- Avg merge
- 16h 38m
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bcgit/bc-rust
-
good first issue refactor
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 58/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100