How does user login to specific identity?

Hi folks! New comer here, just start learning to build dfinity app! I need some help regarding user identity.

For the record, I’m using the dfx (v0.7.0-beta4) cli tool. And I’ve read the access control tutorial.

So, I know I can create identity with dfx identity new bob. This will generate a .pem file in ~/.config/dfx/identity/bob/identity.pem. And I have no problem calling canister with specific identity from command line, it’s in the tutorial.

My question is, how do I do the same from a web frontend interface? I had a hard time finding useful info on this topic.

After some digging I learn that the frontend served from an asset canister, built with default setup, include the @dfinity/agent lib, and it will generate an Anonymous identity (using ED25519 I guess)?

How does the .pem file relate to the ED25519 key pair generated in browser? Can I import this .pem secretKey to be used in browser (convert it into a Ed25519KeyIdentity) , or vice versa?

Somebody unstuck me please! Thanks in advance.


How does the .pem file relate to the ED25519 key pair generated in browser?

I think the correct answer is: Not at all.

The identity management in the browser is undergoing some important and presumably innovative changes, but I am not sure how much I should spoil. Expect some interesting demos at next week’s event!


Hi, where can I find info about setting up a ED25519 key pair in my browser? thank u

I have an example of generating new identity and cache it in the browser: reversi/index.js at master · ninegua/reversi · GitHub

Note that this has nothing to do with the Internet Identity service on IC.


It is frontend javascript

1 Like

If you have followed the hello world tutorial, you have created a hello repository, and there is javascript file in src/hello_assets/src/index.js. You can modify it to use your own frontend code.

1 Like

Thank you so much! Appreciate all the help! :relaxed:

1 Like