Using owners
Owners control resources in the Privy API, allowing them to modify or take actions with resources, such as updating a policy or sending a transaction with a wallet.
At a high-level, you can use owners in the following flows.
To assign an owner to a resource, simply pass the identifier for the owner (a user ID for a user, a public key for an authorization key, or a key quorum ID for a key quorum) in the owner
field of the request to create the resource.
To assign an owner to a resource, simply pass the identifier for the owner (a user ID for a user, a public key for an authorization key, or a key quorum ID for a key quorum) in the owner
field of the request to create the resource.
To update a resource with an owner, follow the steps below.
Get your owner's private key
First, get your owner’s private key. If your owner is an authorization key, get the private key of the keypair you generated. If your owner is a user, request the user key with the user’s access token.
Sign the request to the Privy API
Next, sign the request to update your desired resource with the private key from step 1.
If using Privy’s NodeJS SDK, you can simply pass your private key to the SDK, and the SDK will automatically sign requests when you invoke methods on the Privy client.
Include the signature in request headers
Lastly, include the signature from step 2 in a privy-authorization-signature
header on the request. Privy will verify the signature on the request, and if valid, update the desired resource.
If using Privy’s NodeJS SDK, you can simply pass your private key to the SDK, and the SDK will automatically sign requests and include the signature as a privy-authorization-signature
header when you invoke methods on the Privy client.
To take actions with a wallet, such as sending a transaction or signing a message, follow the steps below.
Get your owner's private key
First, get your owner’s private key. If your owner is an authorization key, get the private key of the keypair you generated. If your owner is a user, request the user key with the user’s access token.
Sign the request to the Privy API
Next, sign the request you intend to make to Privy with the private key from step 1.
If using Privy’s NodeJS SDK, you can simply pass your private key to the SDK, and the SDK will automatically sign requests when you invoke methods on the Privy client.
Include the signature in request headers
Lastly, include the signature from step 2 in a privy-authorization-signature
header on the request. Privy will verify the signature on the request, and if valid, execute the request.
If using Privy’s NodeJS SDK, you can simply pass your private key to the SDK, and the SDK will automatically sign requests and include the signature as a privy-authorization-signature
header when you invoke methods on the Privy client.