aap-agent-core 2.5.0 → 2.6.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/constants.js +81 -0
- package/index.js +10 -6
- package/package.json +1 -1
package/constants.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AAP Constants
|
|
3
|
+
*
|
|
4
|
+
* Centralized constants to avoid magic numbers
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Protocol
|
|
8
|
+
export const PROTOCOL_VERSION = '2.6.0';
|
|
9
|
+
export const PROTOCOL_NAME = 'AAP';
|
|
10
|
+
|
|
11
|
+
// Timing
|
|
12
|
+
export const CHALLENGE_EXPIRY_MS = 60000; // 60 seconds
|
|
13
|
+
export const MAX_RESPONSE_TIME_MS = 6000; // 6 seconds (v2.6: 8s → 6s)
|
|
14
|
+
export const FETCH_TIMEOUT_MS = 30000; // 30 seconds
|
|
15
|
+
|
|
16
|
+
// Batch
|
|
17
|
+
export const BATCH_SIZE = 7; // v2.6: 5 → 7 challenges
|
|
18
|
+
export const MIN_PASS_COUNT = 7; // All must pass by default
|
|
19
|
+
|
|
20
|
+
// Crypto
|
|
21
|
+
export const NONCE_BYTES = 16;
|
|
22
|
+
export const NONCE_LENGTH = 32; // Hex string length
|
|
23
|
+
export const SALT_LENGTH = 6;
|
|
24
|
+
export const PUBLIC_ID_LENGTH = 20;
|
|
25
|
+
export const SIGNATURE_MIN_LENGTH = 50;
|
|
26
|
+
|
|
27
|
+
// Seeded random helpers
|
|
28
|
+
export const SEED_OFFSET_MULTIPLIER = 7; // Used in seededSelect
|
|
29
|
+
export const SEED_HEX_SLICE = 4; // nonce.slice(offset, offset + 4)
|
|
30
|
+
|
|
31
|
+
// Security
|
|
32
|
+
export const MAX_CHALLENGES_STORED = 10000; // DoS protection
|
|
33
|
+
export const MAX_BODY_SIZE = '10kb';
|
|
34
|
+
export const RATE_LIMIT_WINDOW_MS = 60000;
|
|
35
|
+
export const RATE_LIMIT_MAX_REQUESTS = 10;
|
|
36
|
+
export const RATE_LIMIT_MAX_FAILURES = 5;
|
|
37
|
+
|
|
38
|
+
// Challenge types
|
|
39
|
+
export const CHALLENGE_TYPES = [
|
|
40
|
+
'nlp_math',
|
|
41
|
+
'nlp_logic',
|
|
42
|
+
'nlp_extract',
|
|
43
|
+
'nlp_count',
|
|
44
|
+
'nlp_transform',
|
|
45
|
+
'nlp_multistep',
|
|
46
|
+
'nlp_pattern',
|
|
47
|
+
'nlp_analysis'
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
// Key format markers
|
|
51
|
+
export const PUBLIC_KEY_MARKER = 'BEGIN PUBLIC KEY';
|
|
52
|
+
export const PRIVATE_KEY_MARKER = 'BEGIN PRIVATE KEY';
|
|
53
|
+
|
|
54
|
+
// Default paths
|
|
55
|
+
export const DEFAULT_IDENTITY_PATH = '.aap/identity.json';
|
|
56
|
+
|
|
57
|
+
export default {
|
|
58
|
+
PROTOCOL_VERSION,
|
|
59
|
+
PROTOCOL_NAME,
|
|
60
|
+
CHALLENGE_EXPIRY_MS,
|
|
61
|
+
MAX_RESPONSE_TIME_MS,
|
|
62
|
+
FETCH_TIMEOUT_MS,
|
|
63
|
+
BATCH_SIZE,
|
|
64
|
+
MIN_PASS_COUNT,
|
|
65
|
+
NONCE_BYTES,
|
|
66
|
+
NONCE_LENGTH,
|
|
67
|
+
SALT_LENGTH,
|
|
68
|
+
PUBLIC_ID_LENGTH,
|
|
69
|
+
SIGNATURE_MIN_LENGTH,
|
|
70
|
+
SEED_OFFSET_MULTIPLIER,
|
|
71
|
+
SEED_HEX_SLICE,
|
|
72
|
+
MAX_CHALLENGES_STORED,
|
|
73
|
+
MAX_BODY_SIZE,
|
|
74
|
+
RATE_LIMIT_WINDOW_MS,
|
|
75
|
+
RATE_LIMIT_MAX_REQUESTS,
|
|
76
|
+
RATE_LIMIT_MAX_FAILURES,
|
|
77
|
+
CHALLENGE_TYPES,
|
|
78
|
+
PUBLIC_KEY_MARKER,
|
|
79
|
+
PRIVATE_KEY_MARKER,
|
|
80
|
+
DEFAULT_IDENTITY_PATH
|
|
81
|
+
};
|
package/index.js
CHANGED
|
@@ -14,14 +14,18 @@ import identity from './identity.js';
|
|
|
14
14
|
|
|
15
15
|
export { crypto, identity };
|
|
16
16
|
|
|
17
|
-
// Protocol constants
|
|
18
|
-
export const PROTOCOL_VERSION = '
|
|
19
|
-
export const DEFAULT_CHALLENGE_EXPIRY_MS =
|
|
20
|
-
export const DEFAULT_MAX_RESPONSE_TIME_MS =
|
|
17
|
+
// Protocol constants (v2.5.0)
|
|
18
|
+
export const PROTOCOL_VERSION = '2.5.0';
|
|
19
|
+
export const DEFAULT_CHALLENGE_EXPIRY_MS = 60000;
|
|
20
|
+
export const DEFAULT_MAX_RESPONSE_TIME_MS = 8000;
|
|
21
21
|
export const NONCE_BYTES = 16;
|
|
22
|
+
export const BATCH_SIZE = 5;
|
|
22
23
|
|
|
23
|
-
// Challenge types
|
|
24
|
-
export const CHALLENGE_TYPES = [
|
|
24
|
+
// Challenge types (v2.5)
|
|
25
|
+
export const CHALLENGE_TYPES = [
|
|
26
|
+
'nlp_math', 'nlp_logic', 'nlp_extract', 'nlp_count',
|
|
27
|
+
'nlp_transform', 'nlp_multistep', 'nlp_pattern', 'nlp_analysis'
|
|
28
|
+
];
|
|
25
29
|
|
|
26
30
|
export default {
|
|
27
31
|
...crypto,
|