I have two canisters deployed locally: a Motoko canister and an assets canister with a TypeScript frontend.
When I use a seed-phrase-based, logged-in, Stoic Identity in the frontend to call into the (backend) Motoko canister, the backend canister always reports that "msg.caller" is my default local wallet principal - not the Stoic Identity principal.
The key code looks like this:
----- TypeScript Frontend -----
StoicIdentity.load().then(async (identity: any) => {
const agent = new HttpAgent({
host: 'http://localhost:3000', // host doesn't seem to matter for this issue
identity
});
await agent.fetchRootKey(); // for local development only
const testActor = Actor.createActor(actorIdl, {
agent: agent,
canisterId: canisterId
});
const res = await testActor.doStuff()
}
----- Motoko Backend: "testActor" -----
public func doStuff() : async Bool {
...
Debug.print(debug_show(msg.caller)); // prints default local wallet principal, not Stoic Identity principal
...
return true;
}
Am I right to expect that "msg.caller" should be the Stoic Identity principal, and not my default local wallet principal?
I have two canisters deployed locally: a Motoko canister and an assets canister with a TypeScript frontend.
When I use a seed-phrase-based, logged-in, Stoic Identity in the frontend to call into the (backend) Motoko canister, the backend canister always reports that "msg.caller" is my default local wallet principal - not the Stoic Identity principal.
The key code looks like this:
----- TypeScript Frontend -----
----- Motoko Backend: "testActor" -----
Am I right to expect that "msg.caller" should be the Stoic Identity principal, and not my default local wallet principal?