I’m building a browser client that talks to Motoko canister and would like to take advantage of the passed Principal in a shared function, but I cannot find any resources on how a function that is marked as ‘shared’, gets the ‘caller’ [Principal] property of the passed object assigned.
public shared(msg) func howMsgDotCallerIsAssigned() : async Text {
// how msg.caller is assigned?
// are there any docs explaining it?
return "I don't know";
}
I’m not sure if it’s assigned by the system itself based on some arbitrary variables or by the user? If it is assigned by the system, are there any variables modifiable by the client (the variables that make up the Principal)?
I know that the msg.caller can be used in simple authentication and that it defaults to “2vxsx-fae”.