How to convert principal to account id in rust

Hello Dears!

Is it possible to convert principal to account id?
if yes, then how can I do that in rust?

What do you mean by account id? Do you mean the anchor id that you create with the Internet Identity canister? That is private, and AFAIK cannot be inferred from the principal.

For now, you can copy this file ic-repl/ at master · chenyan2002/ic-repl · GitHub to your project and use AccountIdentifier::new(principal, None) to get the account id.

Eventually, we want to put this into the ic-type crate to avoid code duplication.

1 Like