Feature request: expose DPoP public key, signing, and encrypt/decrypt APIs
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- react-native, typescript
- 领域
- mobile-dev, security
调研方向
首先检查 Auth0.swift 和 Auth0.Android 中现有的原生 DPoP 密钥处理,然后跟踪这些实现如何桥接到 react-native-auth0。定义公钥、签名、加密和解密 API,但不得导出密钥材料,并包含列出的失败情况。当两个平台都提供一致的 API 和安全的密钥存储行为时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- TypeScript
- 星标
- 553
- 派生
- 244
- 平均合并
- 19 小时
- 30 天内合并 PR
- 39
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
auth0/react-native-auth0 的其他 Issue
-
feature request
难度 4/5 3-5 天 新手友好度 52/100
auth0/react-native-auth0#1735 ·
维护者通常 1 天内回复
-
Users getting logged out with "Unsuccessful Refresh Token exchange, reused refresh token detected"可能已有人在做 @subhankarmaiti 于 339 天前认领。 未关闭bug
auth0/react-native-auth0#1374 · 50 条评论 · 2 个 reaction · 已指派 1 人 ·
维护者通常 1 天内回复
查看 auth0/react-native-auth0 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
milind-soni/OpenMausBot#6730 ·
维护者通常 1 天内回复
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)未关闭area: @angular/build
难度 2/5 1-3 小时 新手友好度 65/100
angular/angular-cli#34764 ·
维护者通常 1 天内回复
-
status/need-triage
难度 2/5 1-3 小时 新手友好度 76/100
google-gemini/gemini-cli#30384 · 1 条评论 ·
维护者通常 1 天内回复
-
P2
难度 1/5 1 小时以内 新手友好度 84/100
维护者通常 1 天内回复
-
area:image documentation good first issue
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复