Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿ› ๏ธ [TASK] : Fix extraction of Cardano Addresses from a cardano address URI string #100

Open
1 of 2 tasks
Tracked by #1273
stevenj opened this issue Dec 10, 2024 · 1 comment
Open
1 of 2 tasks
Tracked by #1273
Assignees
Labels

Comments

@stevenj
Copy link
Collaborator

stevenj commented Dec 10, 2024

Summary

Addresss are not being extracted as full addresses by the cip509 library, fix that.

Description

This function:

pub fn extract_cip19_hash(uri: &str, prefix: Option<&str>) -> Option<Vec<u8>> {

Is extracting a hash from a string encoded cardano address, that can be found inside both C509 and X509 certificates.
It is incorrectly over-processing the data, making the public function not very usable, and requiring it to be rewritten for multiple different use cases.

The URL format is defined here: https://github.com/cardano-foundation/CIPs/pull/888/files

It needs to be fixed to return an enum type containing this type:

The data this function is returning (the hash) is available from this type, but this allows the function to also return anything known about the address, not just its hash. This is critical behaviour for the RBAC implementation in cat-gateway.

This function needs to be publicly accessible from the library.

All code which uses this function will need to be adjusted to work with its new result.

One way to do that could be:

  1. Create a new public function: parse_cip00134_uri(uri: &str) -> Result<pallas_addresses::Address> { ... }
  2. Modify extract_cip19_hash to use this function (and make it private to the crate as it should not be used by any consumer of the crate).

NOTE: A second implementation of this function currently exists within catalyst-libs/main/rust/cardano-chain-follower ignore this, as it will be removed at some future point when that library is refactored to use this new rbac-registration library.

Subtask List

@stevenj stevenj changed the title ๐Ÿ› ๏ธ [TASK] : Fix extraction of Cardano Addresses from a X509 or C509 certificate ๐Ÿ› ๏ธ [TASK] : Fix extraction of Cardano Addresses from a cardano address URI string Dec 10, 2024
@stevenj stevenj added the F14 label Dec 10, 2024
@stevenj stevenj added this to Catalyst Dec 10, 2024
@stevenj stevenj moved this from New to ๐Ÿ”– Ready in Catalyst Dec 10, 2024
@stanislav-tkach
Copy link
Contributor

NOTE: A second implementation of this function currently exists within catalyst-libs/main/rust/cardano-chain-follower ignore this, as it will be removed at some future point when that library is refactored to use this new rbac-registration library.

As far as I can see, it was already removed in the #96 pull request. One less thing to worry about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ๐Ÿ— In progress
Development

No branches or pull requests

2 participants