@agentdock/crypto 0.4.0 → 0.4.1

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/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # @agentbox/crypto
1
+ # @agentdock/crypto
2
2
 
3
3
  > E2E 加密模块 — AES-256-GCM + Ed25519 + NaCl Box/SecretBox,浏览器与 Node.js 22+ 通用。
4
4
 
5
5
  ## 概述
6
6
 
7
- crypto 包实现 AgentBox 的端到端加密。**所有敏感数据在离开用户设备前加密,服务端永远看不到明文**。
7
+ crypto 包实现 AgentDock 的端到端加密。**所有敏感数据在离开用户设备前加密,服务端永远看不到明文**。
8
8
 
9
9
  支持两种运行环境:
10
10
 
@@ -42,7 +42,7 @@ src/
42
42
  ### AES-256-GCM (aes.ts)
43
43
 
44
44
  ```typescript
45
- import { encryptAesGcm, decryptAesGcm } from '@agentbox/crypto';
45
+ import { encryptAesGcm, decryptAesGcm } from '@agentdock/crypto';
46
46
 
47
47
  // 加密:返回 { c: base64(iv + ciphertext + tag), n: base64(nonce) }
48
48
  const bundle = await encryptAesGcm(data: Uint8Array, key: Uint8Array);
@@ -56,7 +56,7 @@ Bundle 格式:`iv(12 bytes) + ciphertext + tag(16 bytes)`,整体 Base64 编
56
56
  ### Ed25519 认证 (auth.ts)
57
57
 
58
58
  ```typescript
59
- import { authChallenge, verifyChallenge } from '@agentbox/crypto';
59
+ import { authChallenge, verifyChallenge } from '@agentdock/crypto';
60
60
 
61
61
  // 从 seed 生成 Ed25519 密钥对 + 签名挑战
62
62
  const result = await authChallenge(seed: Uint8Array);
@@ -71,7 +71,7 @@ const valid = await verifyChallenge(challenge, signature, publicKey);
71
71
  ### NaCl Box (box.ts)
72
72
 
73
73
  ```typescript
74
- import { encryptBox, decryptBox, boxPublicKeyFromSecretKey } from '@agentbox/crypto';
74
+ import { encryptBox, decryptBox, boxPublicKeyFromSecretKey } from '@agentdock/crypto';
75
75
 
76
76
  // 非对称加密(发送方用接收方公钥加密)
77
77
  const bundle = encryptBox(data: Uint8Array, recipientPublicKey: Uint8Array);
@@ -86,7 +86,7 @@ const publicKey = boxPublicKeyFromSecretKey(secretKey);
86
86
  ### NaCl SecretBox (secretbox.ts)
87
87
 
88
88
  ```typescript
89
- import { encryptSecretBox, decryptSecretBox } from '@agentbox/crypto';
89
+ import { encryptSecretBox, decryptSecretBox } from '@agentdock/crypto';
90
90
 
91
91
  // 对称加密(legacy 兼容)
92
92
  const bundle = encryptSecretBox(data: Uint8Array, secret: Uint8Array);
@@ -96,7 +96,7 @@ const plaintext = decryptSecretBox(bundle, secret);
96
96
  ### 密钥派生树 (keys.ts)
97
97
 
98
98
  ```typescript
99
- import { deriveSecretKeyTreeRoot, deriveSecretKeyTreeChild, deriveKey } from '@agentbox/crypto';
99
+ import { deriveSecretKeyTreeRoot, deriveSecretKeyTreeChild, deriveKey } from '@agentdock/crypto';
100
100
 
101
101
  // 从根密钥 + 标签派生子密钥
102
102
  const root = await deriveSecretKeyTreeRoot(masterSecret, 'Happy EnCoder');
@@ -109,7 +109,7 @@ const key = await deriveKey(secret, label, segments);
109
109
  ### Content Keypair (content.ts)
110
110
 
111
111
  ```typescript
112
- import { deriveContentKeyPair } from '@agentbox/crypto';
112
+ import { deriveContentKeyPair } from '@agentdock/crypto';
113
113
 
114
114
  // 'Happy EnCoder' + ['content'] + SHA-512[0:32] → NaCl Box keypair
115
115
  const { publicKey, secretKey } = await deriveContentKeyPair(secret);
@@ -118,24 +118,24 @@ const { publicKey, secretKey } = await deriveContentKeyPair(secret);
118
118
  ### HMAC-SHA512 (hmac.ts)
119
119
 
120
120
  ```typescript
121
- import { hmacSha512 } from '@agentbox/crypto';
121
+ import { hmacSha512 } from '@agentdock/crypto';
122
122
  const mac = await hmacSha512(key, data);
123
123
  ```
124
124
 
125
125
  ### 编码 (encoding.ts)
126
126
 
127
127
  ```typescript
128
- import { encodeBase64, decodeBase64, encodeBase64Url, decodeBase64Url } from '@agentbox/crypto';
128
+ import { encodeBase64, decodeBase64, encodeBase64Url, decodeBase64Url } from '@agentdock/crypto';
129
129
  ```
130
130
 
131
131
  ## 开发
132
132
 
133
133
  ```bash
134
134
  # 运行测试(111 tests)
135
- pnpm --filter @agentbox/crypto test
135
+ pnpm --filter @agentdock/crypto test
136
136
 
137
137
  # 覆盖率(目标 95%+)
138
- pnpm --filter @agentbox/crypto test:coverage
138
+ pnpm --filter @agentdock/crypto test:coverage
139
139
  ```
140
140
 
141
141
  ## 设计决策
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // @agentdock/crypto — E2E encryption for AgentBox
1
+ // @agentdock/crypto — E2E encryption for AgentDock
2
2
  // Web Crypto API + tweetnacl, browser + Node.js 22+ compatible
3
3
  // Base64 encoding/decoding
4
4
  export { encodeBase64, decodeBase64, encodeBase64Url, decodeBase64Url } from './encoding.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,+DAA+D;AAE/D,2BAA2B;AAC3B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE7F,kCAAkC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,oCAAoC;AACpC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAExD,cAAc;AACd,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,sBAAsB;AACtB,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGzF,qCAAqC;AACrC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAG1E,kDAAkD;AAClD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM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
1
  {
2
2
  "name": "@agentdock/crypto",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "E2E encryption for AgentDock — AES-256-GCM, key derivation, Web Crypto API",
5
5
  "license": "UNLICENSED",
6
6
  "author": "kevin8536945",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "tweetnacl": "^1.0.3",
25
- "@agentdock/wire": "0.4.0"
25
+ "@agentdock/wire": "0.4.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@vitest/coverage-v8": "^3.0.0",