@atlasauth/pca-abe 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.
- package/LICENSE +21 -0
- package/README.md +63 -0
- package/package.json +26 -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,63 @@
|
|
|
1
|
+
# @atlasauth/pca-abe
|
|
2
|
+
|
|
3
|
+
Proof-carrying encryption for Proof-Carrying Authority (PCA). Tool payloads or results are sealed under an access policy over capability attributes (`holder:`, `verb:`, `resource:`, `scope:`), so they decrypt only for an agent whose PCA capability satisfies the policy. The construction is a Boneh-Franklin identity-based KEM on BLS12-381 composed over a monotone AND/OR/threshold tree by Shamir secret sharing, with the payload sealed by AES-256-GCM.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm i @atlasauth/pca-abe
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Depends on `@atlasauth/pca`, `@noble/curves` and `@noble/hashes` (installed transitively).
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { generateKeyPair, mintGrant, b64u, DEFAULT_RISK_POLICY } from '@atlasauth/pca';
|
|
17
|
+
import {
|
|
18
|
+
setup, keygenForCapability, encryptToolPayload, decryptWithCapability, Attr,
|
|
19
|
+
} from '@atlasauth/pca-abe';
|
|
20
|
+
|
|
21
|
+
// A capability bound to an agent, authorising `read` on /tickets/*.
|
|
22
|
+
const principal = generateKeyPair();
|
|
23
|
+
const agentPub = b64u(generateKeyPair().publicKey);
|
|
24
|
+
const { grant } = mintGrant({
|
|
25
|
+
principalSecret: principal.secretKey,
|
|
26
|
+
principalPublic: b64u(principal.publicKey),
|
|
27
|
+
holder: agentPub,
|
|
28
|
+
goal: 'read tickets',
|
|
29
|
+
envelope: {
|
|
30
|
+
predicates: [{ verb: 'read', resource: '/tickets/*' }],
|
|
31
|
+
caveats: [], agent_binding: {}, risk_policy: DEFAULT_RISK_POLICY,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// The issuer holds the master key; the encryptor only needs the public half.
|
|
36
|
+
const { mpk, msk } = setup();
|
|
37
|
+
const policy = { allOf: [{ attr: Attr.holder(agentPub) }, { attr: Attr.verb('read') }] };
|
|
38
|
+
const { ciphertext } = encryptToolPayload(mpk, policy, { ticket: 'T-42' });
|
|
39
|
+
|
|
40
|
+
// The issuer derives a key from the capability and hands it to the agent.
|
|
41
|
+
const key = keygenForCapability(msk, grant);
|
|
42
|
+
decryptWithCapability(key, ciphertext); // { ok: true, payload: { ticket: 'T-42' } }
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
A key derived from a capability that does not satisfy the policy gets `{ ok: false, reason }`.
|
|
46
|
+
|
|
47
|
+
## API
|
|
48
|
+
|
|
49
|
+
- Keys: `setup`, `keygenForAttributes`, `keygenForCapability`.
|
|
50
|
+
- Raw bytes/text: `encryptForPolicy`, `decrypt`, `decryptText`, `parseCiphertext`.
|
|
51
|
+
- Tool payloads: `encryptToolPayload`, `decryptWithCapability`.
|
|
52
|
+
- Policies: `Policy` (`{ attr }`, `{ allOf }`, `{ anyOf }`, `{ threshold, of }`), `normalizePolicy`, `satisfies`, `policyAttributes`.
|
|
53
|
+
- Attributes: `Attr`, `capabilityAttributes`.
|
|
54
|
+
|
|
55
|
+
## Status
|
|
56
|
+
|
|
57
|
+
Experimental and unaudited. Confidentiality rests on the Bilinear Diffie-Hellman assumption (random-oracle model); integrity on AES-256-GCM. Policies are monotone (no negation). This binds confidentiality to possession of capability-derived keys, not to a zero-knowledge proof, and collusion resistance holds only within a single issued key: two separately issued keys could pool attributes. Issue one key per capability. The scheme is not post-quantum.
|
|
58
|
+
|
|
59
|
+
Source and issues: https://github.com/Atlas-Authorization/pca
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT - see LICENSE
|
package/package.json
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlasauth/pca-abe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Proof-carrying encryption for PCA: attribute/policy-based encryption on BLS12-381 so a tool payload decrypts only for a holder whose capability satisfies the policy — binding confidentiality to proven authority.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"attribute-based encryption",
|
|
7
|
+
"bls12-381",
|
|
8
|
+
"policy encryption",
|
|
9
|
+
"agent authorization",
|
|
10
|
+
"proof-carrying authority",
|
|
11
|
+
"pca",
|
|
12
|
+
"ai agents"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"homepage": "https://github.com/Atlas-Authorization/pca#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/Atlas-Authorization/pca/issues"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/Atlas-Authorization/pca.git",
|
|
22
|
+
"directory": "packages/pca-abe"
|
|
23
|
+
},
|
|
5
24
|
"main": "./dist/index.js",
|
|
6
25
|
"types": "./dist/index.d.ts",
|
|
7
26
|
"exports": {
|
|
@@ -14,7 +33,7 @@
|
|
|
14
33
|
"dependencies": {
|
|
15
34
|
"@noble/curves": "^1.6.0",
|
|
16
35
|
"@noble/hashes": "^1.5.0",
|
|
17
|
-
"@atlasauth/pca": "0.
|
|
36
|
+
"@atlasauth/pca": "0.2.0"
|
|
18
37
|
},
|
|
19
38
|
"devDependencies": {
|
|
20
39
|
"typescript": "^5.6.3",
|
|
@@ -22,8 +41,12 @@
|
|
|
22
41
|
},
|
|
23
42
|
"files": [
|
|
24
43
|
"dist",
|
|
25
|
-
"README.md"
|
|
44
|
+
"README.md",
|
|
45
|
+
"LICENSE"
|
|
26
46
|
],
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=20"
|
|
49
|
+
},
|
|
27
50
|
"publishConfig": {
|
|
28
51
|
"access": "public"
|
|
29
52
|
},
|