Feature request: expose DPoP public key, signing, and encrypt/decrypt APIs
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- react-native, typescript
- Domain
- mobile-dev, security
Research direction
Start by reviewing the existing native DPoP key handling in Auth0.swift and Auth0.Android, then trace how those implementations are bridged into react-native-auth0. Define the public-key, signing, encryption, and decryption APIs without exporting key material, including the listed failure cases. Done means both platforms expose consistent APIs and secure key-storage behavior.
Written by the indexing model from the issue text.
Description
Checklist
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Describe the problem you'd like to have solved
With useDPoP: true, react-native-auth0 already uses a native DPoP keypair, but the library does not expose APIs to reuse that keypair for additional application-level cryptographic operations.
For our backend flow, DPoP validation is already in place and already gives the expected guarantees:
- request binding and replay protections via claims such as
htu,htm,jti,ath - nonce handling when required by the resource server
- token/key binding via
cnfthumbprint (the access token is tied to that DPoP key)
After this standard DPoP validation, we also need to validate additional request data (for example, request body integrity) using the same cryptographic identity represented by the DPoP keypair.
Today this is not possible with official APIs, so apps cannot reliably reuse the native Auth0-managed keypair for those additional checks.
Describe the ideal solution
Expose native cryptographic APIs that reuse the same DPoP identity managed by Auth0 native SDKs:
getDPoPPublicKey()signWithDPoPPrivateKey(payload: string | Uint8Array)encrypt(payload: string | Uint8Array, recipientJwk?: Record<string, unknown>)decrypt(ciphertext: string | Uint8Array)
Security expectation:
- private keys and key material must never be exported to JavaScript
- only native cryptographic operations should be exposed
- key usage must remain restricted to secure platform storage (iOS Keychain/Secure Enclave and Android Keystore)
Expected server-side validation order in the signature flow:
- validate
Authorizationtoken - validate
DPoPproof - extract
jwkfrom validatedDPoP - validate
x-body-signatureagainst request body with thatjwk
Alternatives and current workarounds
Current workaround is patching node_modules to add custom native bridge methods on iOS and Android.
This is fragile and expensive to maintain over upgrades, and it can diverge from official Auth0 DPoP behavior over time.
Alternative of creating a second keypair outside Auth0 is also undesirable because it breaks the single cryptographic identity model already established by DPoP + cnf.
Additional context
Example API usage (body signature + DPoP):
import Auth0 from 'react-native-auth0';
const auth0 = new Auth0({
domain: 'YOUR_DOMAIN',
clientId: 'YOUR_CLIENT_ID',
useDPoP: true,
});
const method = 'POST';
const path = '/method-with-signed-payload';
const body = JSON.stringify({ data: 'information-to-be-signed' });
const dpopHeaders = /* regular getDPoPHeaders() creation */;
const bodySignature = await auth0.signWithDPoPPrivateKey(body);
await fetch(`https://api.example.com${path}`, {
method,
headers: {
'content-type': 'application/json',
'x-body-signature': bodySignature,
...dpopHeaders,
},
body,
});
Example API usage (encrypt/decrypt):
const statePlaintext = JSON.stringify({ data: 'sensitive-client-state' });
// Option A: encrypt to self
const encryptedState = await auth0.encrypt(statePlaintext);
// Option B: encrypt to an explicit recipient JWK
// const recipientJwk = { kty: 'EC', crv: 'P-256', x: '...', y: '...' };
// const encryptedState = await auth0.encrypt(statePlaintext, recipientJwk);
await fetch('https://api.example.com/state', {
method: 'PUT',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ state: encryptedState }),
});
const response = await fetch('https://api.example.com/state', { method: 'GET' });
const { state } = await response.json();
const decryptedState = await auth0.decrypt(state);
The server stores encrypted state but cannot read plaintext content in this model.
Platform expectations:
- iOS: use the same key material managed by Auth0.swift DPoP internals.
- Android: use the same key material managed by Auth0.Android DPoP internals.
- If keypair does not exist yet, return a clear, typed error (or document bootstrap requirement clearly).
- For encrypt/decrypt APIs, use secure device-bound keys managed in native keystore/keychain.
Error handling suggestion:
- keypair not found
- keychain/keystore access failure
- signing failure
- invalid payload input
- encryption/decryption failure
- Dominant language
- TypeScript
- Stars
- 553
- Forks
- 244
- Avg merge
- 19h
- Merged PRs (30d)
- 39
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from auth0/react-native-auth0
-
feature request
Difficulty 4/5 3-5 days Newbie friendliness 52/100
auth0/react-native-auth0#1735 ·
Maintainers usually reply within 1 day
-
Users getting logged out with "Unsuccessful Refresh Token exchange, reused refresh token detected"Possibly taken @subhankarmaiti claimed this 339 days ago. Openbug
auth0/react-native-auth0#1374 · 50 comments · 2 reactions · 1 assignee ·
Maintainers usually reply within 1 day
All issues in auth0/react-native-auth0
Similar issues
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)Openarea: @angular/build
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
angular/angular-cli#34764 ·
Maintainers usually reply within 1 day
-
status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
google-gemini/gemini-cli#30384 · 1 comment ·
Maintainers usually reply within 1 day
-
P2
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug ready-for-human
Difficulty 2/5 1-3 hours Newbie friendliness 60/100
LucasSantana-Dev/Lucky#3150 ·
Maintainers usually reply within 1 day
-
enhancement good first issue priority: low size: XS
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day