Canister test by ic-repl: how to set anonymous identity?


I’m attempting to rewrite canister level unit tests in ic-repl for my project.
But, I couldn’t find a way to set an anonymous identity.

In dfx, following command sets anonymous identity:

dfx identity use anonymous

How can I do the same thing in ic-repl?

I have tried to set “anonymous” identity in ic-repl, but this code just generated the identity named “anonymous”, not anonymous identity.

identity anonymous;
call todo_ic.showCaller();
// Current identity 7up7p-jdoh4-r2kau-5zxoe-g5mfx....
// -> not anonymous identity


Pinging @chenyan and adding twenty characters to this post.


The default identity when entering ic-repl is the anonymous identity. However, you cannot switch back to anonymous after you use an identity command. I can add a binding for anonymous if needed.


Thank you for your reply! @chenyan

If switching to anonymous becomes possible, ic-repl would be more useful for writing anonymous testing scenarios.

I opened the feature request issue here:

1 Like