Support | Question
I’m trying to call a canister from my backend using the identity that the user obtained from the frontend. Is it possible to recreate this identity using the principal ID or from a _delegation
by stringifying the Identity object? Thank you.
Delegations are a great way to send a user’s identity to the server without actually sending the private key.
Basically you’d:
- Creat identity on client side (can be ed25519, ecdsa etc)
- Create identity on server side (can be ed25519, ecdsa etc, doesn’t need to match client identity type)
- Send public key of server side identity to client
- Use DelegationChain.create with client identity and server identity public key
- Call toJSON on this delegation chain and send JSON to server
- Use DelegationChain.fromJSON to re-create it from the received JSON
- Use DelegationIdentity.fromDelegation with server identity and delegation chain
- Now you can make calls on behalf of user using this DelegationIdentiy
1 Like