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

Access the underlying cid::Cid from the Atrium CID wrapper #289

Open
hbjydev opened this issue Mar 4, 2025 · 2 comments
Open

Access the underlying cid::Cid from the Atrium CID wrapper #289

hbjydev opened this issue Mar 4, 2025 · 2 comments

Comments

@hbjydev
Copy link

hbjydev commented Mar 4, 2025

Currently, the atrium_api::types::string::Cid struct defines that the underlying cid::Cid type is private;

pub struct Cid(cid::Cid)

I'd like to access the underlying cid::Cid instance for the sake of verifying the contents of the blob we get from the PDS versus the CID requested, but I can't currently see a way to do this without needlessly reprocessing it into a string and reading it with cid::Cid::from::<String>(...).

The easiest way would probably be to just make it pub cid::Cid, but if there's a different way I can get it I'd appreciate the help! 👍

@sugyan
Copy link
Owner

sugyan commented Mar 5, 2025

Since types::string::Cid implements AsRef<cid::Cid>, you can get a reference to cid::Cid by calling cid_val.as_ref().

@DrChat
Copy link
Contributor

DrChat commented Mar 15, 2025

While this doesn't directly address your question, atrium-repo does re-export Cid.
Seems pretty straightforward to extend atrium-api to re-export this type too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants