@atlasauth/pca-dpop 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +59 -0
  3. package/package.json +28 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Atlas Authorization
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # @atlasauth/pca-dpop
2
+
3
+ Sender-constrained proof-of-possession for Proof-Carrying Authority. It ties a PCActn to the holder key (or TLS channel) that is allowed to use it, and interoperates with OAuth proof-of-possession:
4
+
5
+ - RFC 9449 DPoP: a holder-key-signed `dpop+jwt` proof over the HTTP method and target URI.
6
+ - RFC 8705 mutual TLS: the `x5t#S256` certificate-thumbprint confirmation.
7
+
8
+ A PCActn's bound holder key is the last capability in its chain (`cap_chain[last].holder`, an Ed25519 public key). That key is exactly an OKP/Ed25519 JWK, so a DPoP proof signed by it has a `jkt` thumbprint equal to the PCActn's binding.
9
+
10
+ ## Install
11
+
12
+ ```sh
13
+ npm i @atlasauth/pca-dpop
14
+ ```
15
+
16
+ Depends on `@atlasauth/pca` and `jose`.
17
+
18
+ ## Usage
19
+
20
+ ```ts
21
+ import { createDpopProof, assertPcaDpop, leafHolderJwk } from '@atlasauth/pca-dpop';
22
+
23
+ // Client: sign a DPoP proof with the same key that holds the PCActn's leaf capability.
24
+ const proof = await createDpopProof({
25
+ method: 'POST',
26
+ url: 'https://api.example.com/refunds',
27
+ privateKey: holderPrivateJwk, // { kty: 'OKP', crv: 'Ed25519', x, d }
28
+ publicJwk: leafHolderJwk(pcactn),
29
+ });
30
+
31
+ // Resource server: confirm the proof is held by the PCActn's bound key and is for this request.
32
+ const seenJti = new Set<string>(); // use a shared store with expiry in production
33
+ const result = await assertPcaDpop(pcactn, proof, {
34
+ method: 'POST',
35
+ url: 'https://api.example.com/refunds', // query and fragment are ignored
36
+ maxAgeSec: 300, // default 300
37
+ seenJti, // rejects a repeated jti
38
+ });
39
+ result.jkt; // verified key thumbprint
40
+ ```
41
+
42
+ `assertPcaDpop` throws a `DpopVerificationError` (with a `code` such as `typ`, `signature`, `htm`, `htu`, `iat_stale`, `jkt`, `jti_replay`) on any mismatch.
43
+
44
+ ## API
45
+
46
+ - `createDpopProof`, `verifyDpopProof` (generic RFC 9449 proofs, with optional `expectedJkt`, `seenJti`, `nonce` and `ath`)
47
+ - `bindPcaToDpop(pcactn)` returns `{ jkt }`, the `cnf` binding for the PCActn's holder key
48
+ - `assertPcaDpop(pcactn, proof, opts)` verifies a proof against that binding
49
+ - `leafHolderJwk`, `jwkThumbprint`, `normalizeHtu`, `athFor`
50
+ - `mtlsCnf(certDerOrPem)` returns `{ 'x5t#S256': ... }`
51
+ - `DPOP_ALLOWED_ALGS`: asymmetric algorithms only (`none` and MACs are rejected)
52
+
53
+ ## Status
54
+
55
+ Experimental. This package checks the proof only; it does not issue DPoP nonces, and replay protection is whatever `seenJti` store you supply. It does not verify the TLS client certificate itself, only computes its thumbprint for comparison. The cryptography is unaudited.
56
+
57
+ ## License
58
+
59
+ MIT - see LICENSE
package/package.json CHANGED
@@ -1,7 +1,28 @@
1
1
  {
2
2
  "name": "@atlasauth/pca-dpop",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Sender-constrained proof-of-possession for PCA: RFC 9449 DPoP proofs and RFC 8705 mTLS cnf binding, tying a PCActn to the holder key/channel for OAuth PoP interop.",
5
+ "keywords": [
6
+ "dpop",
7
+ "rfc 9449",
8
+ "mtls",
9
+ "rfc 8705",
10
+ "proof of possession",
11
+ "agent authorization",
12
+ "proof-carrying authority",
13
+ "pca",
14
+ "ai agents"
15
+ ],
16
+ "license": "MIT",
17
+ "homepage": "https://github.com/Atlas-Authorization/pca#readme",
18
+ "bugs": {
19
+ "url": "https://github.com/Atlas-Authorization/pca/issues"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/Atlas-Authorization/pca.git",
24
+ "directory": "packages/pca-dpop"
25
+ },
5
26
  "main": "./dist/index.js",
6
27
  "types": "./dist/index.d.ts",
7
28
  "exports": {
@@ -13,7 +34,7 @@
13
34
  },
14
35
  "dependencies": {
15
36
  "jose": "^5.9.6",
16
- "@atlasauth/pca": "0.1.0"
37
+ "@atlasauth/pca": "0.2.0"
17
38
  },
18
39
  "devDependencies": {
19
40
  "typescript": "^5.6.3",
@@ -21,8 +42,12 @@
21
42
  },
22
43
  "files": [
23
44
  "dist",
24
- "README.md"
45
+ "README.md",
46
+ "LICENSE"
25
47
  ],
48
+ "engines": {
49
+ "node": ">=20"
50
+ },
26
51
  "publishConfig": {
27
52
  "access": "public"
28
53
  },