How to use same account on nns.ic0.app and dfx command line?

I am developing with Ubuntu 20.04 and have gone through the tutorials. The problem is that when I tried to access nns.ic0.app from my browsers, it notified me that ic0.app wants to use some sort of authentication. After pressing proceed, it doesn’t do anything. 10 seconds later the ic0.app says authentication failed.

So, I used my phone to connect to NNS.

Now, I want to be able to use the nns.ic0.app with GUI and develop with the same credentials on linux command line.

I linked a canister to the GUI on my phone but cannot add cycles to it(can’t scroll down to confirm transaction). Also, on ic0.app it says that I’m linked but not administrator so I can’t do anything.

The only thing in the docs related to my question is:

Problems:
I don’t know if this is to actually allow access and is just a meta example.

I don’t understand the code so would rather not do it this way

Does it have to be this elaborate or is there a simpler way?

Thanks

3 Likes

I’ve got the same issue here. Do you find a way to do that?

Good question. I’ve pinged team to see who can best help.

As the original question is quite old, could you elaborate what exactly you are trying to do?

Generally, the NNS dapp and dfx work quite differently, so there is a chance that the answer is that it cannot be done. But I would like to know more precisely what you are trying to achieve. Maybe there’s a way around it.

dfx can control a canister directly. There is a private key in a file that dfx can access and that private key can control the canister. That private key can be accessed and copied to a different device for example. With the NNS dapp it is different. The NNS dapp uses the “internet identity” and keys are generally stored inside hardware such as biometric sensor from where they cannot be extracted.

To be able to give a better answer please provide for details.

1 Like

Thanks for replying. I’m new to IC development. I noticed there’s a command

dfx identity import <identity> <pem-file>

I was wondering whether I can extract a PEM file of my NNS private key, and use the NNS account with DFX. Seems there’s no way to do that.

I wouldn’t say there’s no way, but I would say there’s no way that works out of the box. Here is a possible starting point: The IC has a delegation mechanism for public keys, and in fact Internet Identity builds heavily on that. One could, from a protocol perspective, have Internet Identity issue a delegation to your dfx key, and then dfx could use that delegation to send calls to the IC under that identity.
Unfortunately, the delegation mechanism is not implemented in dfx and I think not even in agent-rs, but this is definitely something that could be added there.

3 Likes

Thanks a lot for the detailed explanation. Looking forward for the dfx support of delegation :slight_smile:

1 Like

There are some nimble beginnings in that PR:

It doesn’t do delegations, yet, though, merely adds the dfx key as a “devices”.

2 Likes

Unsurprisingly, there’s pushback from security against adding dfx as a permanent device. We’ll probably go with a solution that offers a delegation for dfx

3 Likes