nooschain / chain/actors / resolveApiActorFromPublicKey
Function: resolveApiActorFromPublicKey()
resolveApiActorFromPublicKey(
trx,publicKey):Promise<ResolvedActor>
Defined in: chain/actors.ts:103
Resolves the actor associated with an API request by looking up the provided public key in both the users and nodes tables. If the public key is not provided or is empty, it is treated as an anonymous actor. If the public key is found in the users table, it is treated as a user actor. If the public key is found in the nodes table, it is treated as a node actor. If the public key is not found in either table, it defaults to treating it as a user actor without an associated user ID or organization ID.
Parameters
trx
The database transaction to use for the lookup.
publicKey
string | undefined
The public key provided in the API request, which can be undefined or an empty string to indicate an anonymous actor.
Returns
Promise<ResolvedActor>
A promise that resolves to the resolved actor, which can be an anonymous actor, a user actor, or a node actor depending on the presence and lookup results of the public key.