To carry out an unauthenticated request, 4 headers are required:
Authentication Header - X-Encrypted-Session or X-Encrypted-WebAuthn-Signature or X-Encrypted-Key-Signature
X-Encrypted-Key
X-Encrypted-User
X-Scope-Id
X-Encrypted-Session is obtained when you authenticate with the Authenticating with API endpoint. This is used by enclave to verify your requests. Other 2 types of headers are obtained by signing the user details object directly using your auth method (passkeys or private key)
To setup an X-Encrypted-Key you need to generate a random AES Key, and then RSA encrypt it with the secure enclaves public key, we'll use TypeScript for the example below.
Here we setup a cryptoObj that can work in both browser and server environments and then a function to generate an AES Key.
Now you have your encryptedAesKey and encryptedUser you can use this value as the value in the request header as X-Encrypted-Key . With X-Scope-Id, X-Encrypted-User , X-Encrypted-Session and X-Encrypted-Key setup, you can now start interacting with Passport API to sign messages, transactions and everythig else!