tripwire-server 0.1.1 → 0.3.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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +48 -13
  3. data/lib/tripwire/server/client.rb +171 -16
  4. data/lib/tripwire/server/crypto_support.rb +49 -0
  5. data/lib/tripwire/server/gate_delivery.rb +298 -0
  6. data/lib/tripwire/server/sealed_token.rb +2 -0
  7. data/lib/tripwire/server/version.rb +1 -1
  8. data/lib/tripwire/server.rb +12 -0
  9. data/spec/README.md +37 -6
  10. data/spec/fixtures/api/fingerprints/detail.json +70 -0
  11. data/spec/fixtures/api/fingerprints/list.json +37 -0
  12. data/spec/fixtures/api/gate/agent-token-verify.json +12 -0
  13. data/spec/fixtures/api/gate/login-session-consume.json +10 -0
  14. data/spec/fixtures/api/gate/login-session-create.json +12 -0
  15. data/spec/fixtures/api/gate/registry-detail.json +45 -0
  16. data/spec/fixtures/api/gate/registry-list.json +47 -0
  17. data/spec/fixtures/api/gate/service-create.json +49 -0
  18. data/spec/fixtures/api/gate/service-detail.json +49 -0
  19. data/spec/fixtures/api/gate/service-disable.json +49 -0
  20. data/spec/fixtures/api/gate/service-update.json +49 -0
  21. data/spec/fixtures/api/gate/services-list.json +51 -0
  22. data/spec/fixtures/api/gate/session-ack.json +10 -0
  23. data/spec/fixtures/api/gate/session-create.json +13 -0
  24. data/spec/fixtures/api/gate/session-poll.json +36 -0
  25. data/spec/fixtures/api/sessions/detail.json +405 -0
  26. data/spec/fixtures/api/sessions/list.json +36 -0
  27. data/spec/fixtures/api/teams/api-key-create.json +21 -0
  28. data/spec/fixtures/api/teams/api-key-list.json +26 -0
  29. data/spec/fixtures/api/teams/api-key-revoke.json +20 -0
  30. data/spec/fixtures/api/teams/api-key-rotate.json +21 -0
  31. data/spec/fixtures/api/teams/team-create.json +14 -0
  32. data/spec/fixtures/api/teams/team-update.json +14 -0
  33. data/spec/fixtures/api/teams/team.json +14 -0
  34. data/spec/fixtures/errors/invalid-api-key.json +3 -3
  35. data/spec/fixtures/errors/missing-api-key.json +2 -2
  36. data/spec/fixtures/errors/not-found.json +4 -4
  37. data/spec/fixtures/errors/validation-error.json +6 -7
  38. data/spec/fixtures/gate-delivery/approved-webhook-payload.valid.json +20 -0
  39. data/spec/fixtures/gate-delivery/delivery-request.json +9 -0
  40. data/spec/fixtures/gate-delivery/env-policy.json +40 -0
  41. data/spec/fixtures/gate-delivery/vector.v1.json +28 -0
  42. data/spec/fixtures/gate-delivery/webhook-signature.json +9 -0
  43. data/spec/fixtures/manifest.json +179 -0
  44. data/spec/fixtures/sealed-token/vector.v1.json +37 -24
  45. data/spec/openapi.json +4905 -779
  46. data/spec/sealed-token.md +36 -17
  47. metadata +36 -14
  48. data/spec/fixtures/public-api/fingerprints/detail.json +0 -40
  49. data/spec/fixtures/public-api/fingerprints/list.json +0 -31
  50. data/spec/fixtures/public-api/sessions/detail.json +0 -47
  51. data/spec/fixtures/public-api/sessions/list.json +0 -33
  52. data/spec/fixtures/public-api/teams/api-key-create.json +0 -18
  53. data/spec/fixtures/public-api/teams/api-key-list.json +0 -23
  54. data/spec/fixtures/public-api/teams/api-key-rotate.json +0 -18
  55. data/spec/fixtures/public-api/teams/team-create.json +0 -11
  56. data/spec/fixtures/public-api/teams/team-update.json +0 -11
  57. data/spec/fixtures/public-api/teams/team.json +0 -11
  58. /data/spec/fixtures/{public-api/teams/api-key-revoke.json → api/gate/agent-token-revoke.json} +0 -0
data/spec/sealed-token.md CHANGED
@@ -7,7 +7,7 @@ This document is the language-agnostic contract for verifying those tokens in pu
7
7
  ## Overview
8
8
 
9
9
  - Input: a base64-encoded sealed token string
10
- - Output: a JSON payload describing the scored Tripwire result for the current action
10
+ - Output: a JSON payload describing the verified Tripwire session decision for the current action
11
11
  - Confidentiality and integrity: AES-256-GCM
12
12
  - Compression: zlib deflate/inflate
13
13
 
@@ -65,23 +65,42 @@ Any failure in decoding, parsing, authentication, decompression, or JSON parsing
65
65
 
66
66
  The decrypted JSON payload currently includes:
67
67
 
68
- - `eventId`
69
- - `sessionId`
70
- - `verdict`
71
- - `score`
72
- - `manipulationScore`
73
- - `manipulationVerdict`
74
- - `evaluationDuration`
75
- - `scoredAt`
76
- - `metadata`
68
+ - `object`
69
+ - `session_id`
70
+ - `decision`
71
+ - `request`
72
+ - `visitor_fingerprint`
77
73
  - `signals`
78
- - `categoryScores`
79
- - `botAttribution`
80
- - `visitorId`
81
- - `visitorIdConfidence`
82
- - `embedContext`
83
- - `phase`
84
- - `provisional`
74
+ - `score_breakdown`
75
+ - `attribution`
76
+ - `embed`
77
+
78
+ The payload is aligned to the same public vocabulary as the Sessions API:
79
+
80
+ - `decision`
81
+ - `event_id`
82
+ - `verdict`
83
+ - `risk_score`
84
+ - `phase`
85
+ - `is_provisional`
86
+ - `manipulation`
87
+ - `evaluation_duration_ms`
88
+ - `evaluated_at`
89
+ - `request`
90
+ - `url`
91
+ - `user_agent`
92
+ - `ip_address`
93
+ - `screen_size`
94
+ - `is_touch_capable`
95
+ - `visitor_fingerprint`
96
+ - `object`
97
+ - `id`
98
+ - `confidence`
99
+ - `identified_at`
100
+ - `score_breakdown`
101
+ - `categories`
102
+ - `attribution`
103
+ - `bot`
85
104
 
86
105
  Public SDKs should treat the payload as forward-compatible:
87
106
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tripwire-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ABXY Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-25 00:00:00.000000000 Z
11
+ date: 2026-04-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Customer-facing Ruby SDK for Tripwire Sessions, Fingerprints, Teams,
14
14
  and sealed token verification.
@@ -22,27 +22,49 @@ files:
22
22
  - README.md
23
23
  - lib/tripwire/server.rb
24
24
  - lib/tripwire/server/client.rb
25
+ - lib/tripwire/server/crypto_support.rb
25
26
  - lib/tripwire/server/errors.rb
27
+ - lib/tripwire/server/gate_delivery.rb
26
28
  - lib/tripwire/server/sealed_token.rb
27
29
  - lib/tripwire/server/types.rb
28
30
  - lib/tripwire/server/version.rb
29
31
  - spec/LICENSE
30
32
  - spec/README.md
33
+ - spec/fixtures/api/fingerprints/detail.json
34
+ - spec/fixtures/api/fingerprints/list.json
35
+ - spec/fixtures/api/gate/agent-token-revoke.json
36
+ - spec/fixtures/api/gate/agent-token-verify.json
37
+ - spec/fixtures/api/gate/login-session-consume.json
38
+ - spec/fixtures/api/gate/login-session-create.json
39
+ - spec/fixtures/api/gate/registry-detail.json
40
+ - spec/fixtures/api/gate/registry-list.json
41
+ - spec/fixtures/api/gate/service-create.json
42
+ - spec/fixtures/api/gate/service-detail.json
43
+ - spec/fixtures/api/gate/service-disable.json
44
+ - spec/fixtures/api/gate/service-update.json
45
+ - spec/fixtures/api/gate/services-list.json
46
+ - spec/fixtures/api/gate/session-ack.json
47
+ - spec/fixtures/api/gate/session-create.json
48
+ - spec/fixtures/api/gate/session-poll.json
49
+ - spec/fixtures/api/sessions/detail.json
50
+ - spec/fixtures/api/sessions/list.json
51
+ - spec/fixtures/api/teams/api-key-create.json
52
+ - spec/fixtures/api/teams/api-key-list.json
53
+ - spec/fixtures/api/teams/api-key-revoke.json
54
+ - spec/fixtures/api/teams/api-key-rotate.json
55
+ - spec/fixtures/api/teams/team-create.json
56
+ - spec/fixtures/api/teams/team-update.json
57
+ - spec/fixtures/api/teams/team.json
31
58
  - spec/fixtures/errors/invalid-api-key.json
32
59
  - spec/fixtures/errors/missing-api-key.json
33
60
  - spec/fixtures/errors/not-found.json
34
61
  - spec/fixtures/errors/validation-error.json
35
- - spec/fixtures/public-api/fingerprints/detail.json
36
- - spec/fixtures/public-api/fingerprints/list.json
37
- - spec/fixtures/public-api/sessions/detail.json
38
- - spec/fixtures/public-api/sessions/list.json
39
- - spec/fixtures/public-api/teams/api-key-create.json
40
- - spec/fixtures/public-api/teams/api-key-list.json
41
- - spec/fixtures/public-api/teams/api-key-revoke.json
42
- - spec/fixtures/public-api/teams/api-key-rotate.json
43
- - spec/fixtures/public-api/teams/team-create.json
44
- - spec/fixtures/public-api/teams/team-update.json
45
- - spec/fixtures/public-api/teams/team.json
62
+ - spec/fixtures/gate-delivery/approved-webhook-payload.valid.json
63
+ - spec/fixtures/gate-delivery/delivery-request.json
64
+ - spec/fixtures/gate-delivery/env-policy.json
65
+ - spec/fixtures/gate-delivery/vector.v1.json
66
+ - spec/fixtures/gate-delivery/webhook-signature.json
67
+ - spec/fixtures/manifest.json
46
68
  - spec/fixtures/sealed-token/invalid.json
47
69
  - spec/fixtures/sealed-token/vector.v1.json
48
70
  - spec/openapi.json
@@ -59,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
59
81
  requirements:
60
82
  - - ">="
61
83
  - !ruby/object:Gem::Version
62
- version: 2.6.0
84
+ version: 3.3.0
63
85
  required_rubygems_version: !ruby/object:Gem::Requirement
64
86
  requirements:
65
87
  - - ">="
@@ -1,40 +0,0 @@
1
- {
2
- "data": {
3
- "object": "fingerprint",
4
- "id": "vis_example_one",
5
- "firstSeenAt": "2026-03-24T19:58:00.000Z",
6
- "lastSeenAt": "2026-03-24T20:00:05.000Z",
7
- "seenCount": 3,
8
- "lastUserAgent": "Mozilla/5.0",
9
- "lastIp": "203.0.113.9",
10
- "expiresAt": "2026-06-22T20:00:05.000Z",
11
- "anchorWebglHash": null,
12
- "anchorParamsHash": null,
13
- "anchorAudioHash": null,
14
- "fingerprintVector": [
15
- 1,
16
- 0,
17
- 1
18
- ],
19
- "hasCookie": true,
20
- "hasLs": true,
21
- "hasIdb": true,
22
- "hasSw": false,
23
- "hasWn": false,
24
- "sessions": [
25
- {
26
- "eventId": "evt_example_one",
27
- "verdict": "human",
28
- "riskScore": 9,
29
- "scoredAt": "2026-03-24T20:00:05.000Z",
30
- "userAgent": "Mozilla/5.0",
31
- "url": "https://example.com/signup",
32
- "clientIp": "203.0.113.9",
33
- "screenSize": "1440x900",
34
- "categoryScores": {
35
- "behavioral": 9
36
- }
37
- }
38
- ]
39
- }
40
- }
@@ -1,31 +0,0 @@
1
- {
2
- "data": [
3
- {
4
- "object": "fingerprint",
5
- "id": "vis_example_one",
6
- "firstSeenAt": "2026-03-24T19:58:00.000Z",
7
- "lastSeenAt": "2026-03-24T20:00:05.000Z",
8
- "seenCount": 3,
9
- "lastUserAgent": "Mozilla/5.0",
10
- "lastIp": "203.0.113.9",
11
- "expiresAt": "2026-06-22T20:00:05.000Z",
12
- "anchorWebglHash": null,
13
- "anchorParamsHash": null,
14
- "anchorAudioHash": null,
15
- "fingerprintVector": [
16
- 1,
17
- 0,
18
- 1
19
- ],
20
- "hasCookie": true,
21
- "hasLs": true,
22
- "hasIdb": true,
23
- "hasSw": false,
24
- "hasWn": false
25
- }
26
- ],
27
- "pagination": {
28
- "limit": 50,
29
- "hasMore": false
30
- }
31
- }
@@ -1,47 +0,0 @@
1
- {
2
- "data": {
3
- "object": "session",
4
- "id": "sid_example_one",
5
- "createdAt": "2026-03-24T20:00:00.000Z",
6
- "latestEventId": "evt_example_one",
7
- "latestResult": {
8
- "eventId": "evt_example_one",
9
- "verdict": "human",
10
- "riskScore": 9,
11
- "phase": "behavioral",
12
- "provisional": false,
13
- "manipulationScore": 0,
14
- "manipulationVerdict": "none",
15
- "evaluationDuration": 142,
16
- "scoredAt": "2026-03-24T20:00:05.000Z",
17
- "visitorId": "vis_example_one",
18
- "metadata": {
19
- "userAgent": "Mozilla/5.0",
20
- "url": "https://example.com/signup",
21
- "screenSize": "1440x900",
22
- "touchDevice": false,
23
- "clientIp": "203.0.113.9"
24
- }
25
- },
26
- "ipIntel": null,
27
- "fingerprint": {
28
- "object": "fingerprint",
29
- "id": "vis_example_one",
30
- "confidence": 94,
31
- "timestamp": "2026-03-24T20:00:05.000Z"
32
- },
33
- "resultHistory": [
34
- {
35
- "eventId": "evt_example_one",
36
- "verdict": "human",
37
- "riskScore": 9,
38
- "phase": "behavioral",
39
- "provisional": false,
40
- "manipulationScore": 0,
41
- "manipulationVerdict": "none",
42
- "evaluationDuration": 142,
43
- "scoredAt": "2026-03-24T20:00:05.000Z"
44
- }
45
- ]
46
- }
47
- }
@@ -1,33 +0,0 @@
1
- {
2
- "data": [
3
- {
4
- "object": "session",
5
- "id": "sid_example_one",
6
- "createdAt": "2026-03-24T20:00:00.000Z",
7
- "latestEventId": "evt_example_one",
8
- "latestResult": {
9
- "eventId": "evt_example_one",
10
- "verdict": "human",
11
- "riskScore": 9,
12
- "phase": "behavioral",
13
- "provisional": false,
14
- "manipulationScore": 0,
15
- "manipulationVerdict": "none",
16
- "evaluationDuration": 142,
17
- "scoredAt": "2026-03-24T20:00:05.000Z"
18
- },
19
- "fingerprint": {
20
- "object": "fingerprint",
21
- "id": "vis_example_one",
22
- "confidence": 94,
23
- "timestamp": "2026-03-24T20:00:05.000Z"
24
- },
25
- "lastScoredAt": "2026-03-24T20:00:05.000Z"
26
- }
27
- ],
28
- "pagination": {
29
- "limit": 50,
30
- "hasMore": true,
31
- "nextCursor": "cur_sessions_page_2"
32
- }
33
- }
@@ -1,18 +0,0 @@
1
- {
2
- "data": {
3
- "object": "api_key",
4
- "id": "key_example",
5
- "key": "pk_live_example",
6
- "secretKey": "sk_live_example",
7
- "name": "Production",
8
- "isTest": false,
9
- "allowedOrigins": [
10
- "https://example.com"
11
- ],
12
- "rateLimit": 600,
13
- "status": "active",
14
- "createdAt": "2026-03-24T19:00:00.000Z",
15
- "rotatedAt": null,
16
- "revokedAt": null
17
- }
18
- }
@@ -1,23 +0,0 @@
1
- {
2
- "data": [
3
- {
4
- "object": "api_key",
5
- "id": "key_example",
6
- "key": "pk_live_example",
7
- "name": "Production",
8
- "isTest": false,
9
- "allowedOrigins": [
10
- "https://example.com"
11
- ],
12
- "rateLimit": 600,
13
- "status": "active",
14
- "createdAt": "2026-03-24T19:00:00.000Z",
15
- "rotatedAt": null,
16
- "revokedAt": null
17
- }
18
- ],
19
- "pagination": {
20
- "limit": 50,
21
- "hasMore": false
22
- }
23
- }
@@ -1,18 +0,0 @@
1
- {
2
- "data": {
3
- "object": "api_key",
4
- "id": "key_rotated",
5
- "key": "pk_live_rotated",
6
- "secretKey": "sk_live_rotated",
7
- "name": "Production",
8
- "isTest": false,
9
- "allowedOrigins": [
10
- "https://example.com"
11
- ],
12
- "rateLimit": 600,
13
- "status": "active",
14
- "createdAt": "2026-03-24T19:10:00.000Z",
15
- "rotatedAt": null,
16
- "revokedAt": null
17
- }
18
- }
@@ -1,11 +0,0 @@
1
- {
2
- "data": {
3
- "object": "team",
4
- "id": "team_example",
5
- "name": "Example Team",
6
- "slug": "example-team",
7
- "status": "active",
8
- "createdAt": "2026-03-24T19:00:00.000Z",
9
- "updatedAt": "2026-03-24T19:00:00.000Z"
10
- }
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "data": {
3
- "object": "team",
4
- "id": "team_example",
5
- "name": "Updated Example Team",
6
- "slug": "example-team",
7
- "status": "active",
8
- "createdAt": "2026-03-24T19:00:00.000Z",
9
- "updatedAt": "2026-03-24T19:10:00.000Z"
10
- }
11
- }
@@ -1,11 +0,0 @@
1
- {
2
- "data": {
3
- "object": "team",
4
- "id": "team_example",
5
- "name": "Example Team",
6
- "slug": "example-team",
7
- "status": "active",
8
- "createdAt": "2026-03-24T19:00:00.000Z",
9
- "updatedAt": "2026-03-24T19:10:00.000Z"
10
- }
11
- }