Repository navigation
Expand file tree
/
Copy pathself_serve_activation_vectors.json
More file actions
358 lines (358 loc) · 16.7 KB
/
Copy pathself_serve_activation_vectors.json
File metadata and controls
358 lines (358 loc) · 16.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
{
"format": "authforge-self-serve-activation",
"version": 1,
"description": "Cross-SDK conformance vectors for POST /auth/offline/activate. Mock the server with each case's response, call activate_offline(licenseKey, path) with the config below, and check expect. Every case must also assert the request (method, path, body fields).",
"config": {
"appId": "test-app",
"appSecret": "test-app-secret",
"publicKey": "11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=",
"licenseKey": "TEST-KEY0-0000-0000",
"hwid": "testhwid",
"note": "Use the SDK's HWID override (or test hook) to make the local HWID equal config.hwid."
},
"request": {
"method": "POST",
"path": "/auth/offline/activate",
"bodyFields": [
"appId",
"appSecret",
"licenseKey",
"hwid",
"nonce"
],
"note": "Body must carry exactly these fields: appId, appSecret and licenseKey from config, hwid equal to the HWID login() would send, and a fresh nonce from the SDK's existing generator."
},
"expectations": {
"activated": "Return success, write fileWritten byte-for-byte to path (atomically, creating parent directories), and leave the client authenticated with session kind 'offline' and the listed variables, exactly as login_from_file() would. No heartbeat starts.",
"error": "Surface errorCode through the SDK's error type, with fatal/transient as listed. Do not write path, do not modify an existing file at path, do not exit the process, and leave the client unauthenticated.",
"offline_file_rejected": "SDK-level code for a success response whose file fails local verification. `detail` is the verifier's reason; include it in the error message."
},
"cases": [
{
"name": "activated_new_machine",
"description": "201: a new file for this machine. Verify, write it, start an offline session.",
"response": {
"status": 201,
"body": {
"status": "success",
"file": "-----BEGIN AUTHFORGE LICENSE-----\nVersion: 1\nApp-Id: test-app\nLicense: TEST-KEY0-0000-0000\nKey-Id: kid-test-0001\nExpires-At: never\n\neyJ2IjoxLCJ0eXAiOiJhdXRoZm9yZ2UtbGljZW5zZSIsImFwcElkIjoidGVzdC1h\ncHAiLCJsaWNlbnNlS2V5IjoiVEVTVC1LRVkwLTAwMDAtMDAwMCIsImp0aSI6IjAw\nMDAwMDAwLTAwMDAtNDAwMC04MDAwLTAwMDAwMDAwMDBhMSIsImtpZCI6ImtpZC10\nZXN0LTAwMDEiLCJpc3N1ZWRBdCI6IjIwMjYtMTAtMDlUMTI6MDA6MDAuMDAwWiIs\nImV4cGlyZXNBdCI6bnVsbCwiaHdpZCI6eyJtb2RlIjoiYm91bmQiLCJod2lkcyI6\nWyJ0ZXN0aHdpZCJdfSwibGljZW5zZUV4cGlyZXNBdCI6bnVsbCwibGljZW5zZVZh\ncmlhYmxlcyI6eyJ0aWVyIjoibGlmZXRpbWUifSwiYXBwVmFyaWFibGVzIjp7InRo\nZW1lIjoiZGFyayJ9fQ==\n-----END AUTHFORGE LICENSE-----\n-----BEGIN AUTHFORGE SIGNATURE-----\nDhSH8XlZ/VTgn94AYALsWiny50Z6VOhqjl+qO7PQgGmM8EfpEs2c3z8v6rQKg3XI\nA3dTQ9alHa3aSi6pFBreDg==\n-----END AUTHFORGE SIGNATURE-----\n",
"fileName": "TEST-KEY0-0000-0000.authforge",
"jti": "00000000-0000-4000-8000-0000000000a1",
"replay": false
}
},
"expect": {
"outcome": "activated",
"writesFile": true,
"fileWritten": "-----BEGIN AUTHFORGE LICENSE-----\nVersion: 1\nApp-Id: test-app\nLicense: TEST-KEY0-0000-0000\nKey-Id: kid-test-0001\nExpires-At: never\n\neyJ2IjoxLCJ0eXAiOiJhdXRoZm9yZ2UtbGljZW5zZSIsImFwcElkIjoidGVzdC1h\ncHAiLCJsaWNlbnNlS2V5IjoiVEVTVC1LRVkwLTAwMDAtMDAwMCIsImp0aSI6IjAw\nMDAwMDAwLTAwMDAtNDAwMC04MDAwLTAwMDAwMDAwMDBhMSIsImtpZCI6ImtpZC10\nZXN0LTAwMDEiLCJpc3N1ZWRBdCI6IjIwMjYtMTAtMDlUMTI6MDA6MDAuMDAwWiIs\nImV4cGlyZXNBdCI6bnVsbCwiaHdpZCI6eyJtb2RlIjoiYm91bmQiLCJod2lkcyI6\nWyJ0ZXN0aHdpZCJdfSwibGljZW5zZUV4cGlyZXNBdCI6bnVsbCwibGljZW5zZVZh\ncmlhYmxlcyI6eyJ0aWVyIjoibGlmZXRpbWUifSwiYXBwVmFyaWFibGVzIjp7InRo\nZW1lIjoiZGFyayJ9fQ==\n-----END AUTHFORGE LICENSE-----\n-----BEGIN AUTHFORGE SIGNATURE-----\nDhSH8XlZ/VTgn94AYALsWiny50Z6VOhqjl+qO7PQgGmM8EfpEs2c3z8v6rQKg3XI\nA3dTQ9alHa3aSi6pFBreDg==\n-----END AUTHFORGE SIGNATURE-----\n",
"replay": false,
"sessionKind": "offline",
"licenseVariables": {
"tier": "lifetime"
},
"appVariables": {
"theme": "dark"
}
}
},
{
"name": "activated_replay",
"description": "200: the machine already had a file; the server returns the identical bytes. Same handling as 201.",
"response": {
"status": 200,
"body": {
"status": "success",
"file": "-----BEGIN AUTHFORGE LICENSE-----\nVersion: 1\nApp-Id: test-app\nLicense: TEST-KEY0-0000-0000\nKey-Id: kid-test-0001\nExpires-At: never\n\neyJ2IjoxLCJ0eXAiOiJhdXRoZm9yZ2UtbGljZW5zZSIsImFwcElkIjoidGVzdC1h\ncHAiLCJsaWNlbnNlS2V5IjoiVEVTVC1LRVkwLTAwMDAtMDAwMCIsImp0aSI6IjAw\nMDAwMDAwLTAwMDAtNDAwMC04MDAwLTAwMDAwMDAwMDBhMSIsImtpZCI6ImtpZC10\nZXN0LTAwMDEiLCJpc3N1ZWRBdCI6IjIwMjYtMTAtMDlUMTI6MDA6MDAuMDAwWiIs\nImV4cGlyZXNBdCI6bnVsbCwiaHdpZCI6eyJtb2RlIjoiYm91bmQiLCJod2lkcyI6\nWyJ0ZXN0aHdpZCJdfSwibGljZW5zZUV4cGlyZXNBdCI6bnVsbCwibGljZW5zZVZh\ncmlhYmxlcyI6eyJ0aWVyIjoibGlmZXRpbWUifSwiYXBwVmFyaWFibGVzIjp7InRo\nZW1lIjoiZGFyayJ9fQ==\n-----END AUTHFORGE LICENSE-----\n-----BEGIN AUTHFORGE SIGNATURE-----\nDhSH8XlZ/VTgn94AYALsWiny50Z6VOhqjl+qO7PQgGmM8EfpEs2c3z8v6rQKg3XI\nA3dTQ9alHa3aSi6pFBreDg==\n-----END AUTHFORGE SIGNATURE-----\n",
"fileName": "TEST-KEY0-0000-0000.authforge",
"jti": "00000000-0000-4000-8000-0000000000a1",
"replay": true
}
},
"expect": {
"outcome": "activated",
"writesFile": true,
"fileWritten": "-----BEGIN AUTHFORGE LICENSE-----\nVersion: 1\nApp-Id: test-app\nLicense: TEST-KEY0-0000-0000\nKey-Id: kid-test-0001\nExpires-At: never\n\neyJ2IjoxLCJ0eXAiOiJhdXRoZm9yZ2UtbGljZW5zZSIsImFwcElkIjoidGVzdC1h\ncHAiLCJsaWNlbnNlS2V5IjoiVEVTVC1LRVkwLTAwMDAtMDAwMCIsImp0aSI6IjAw\nMDAwMDAwLTAwMDAtNDAwMC04MDAwLTAwMDAwMDAwMDBhMSIsImtpZCI6ImtpZC10\nZXN0LTAwMDEiLCJpc3N1ZWRBdCI6IjIwMjYtMTAtMDlUMTI6MDA6MDAuMDAwWiIs\nImV4cGlyZXNBdCI6bnVsbCwiaHdpZCI6eyJtb2RlIjoiYm91bmQiLCJod2lkcyI6\nWyJ0ZXN0aHdpZCJdfSwibGljZW5zZUV4cGlyZXNBdCI6bnVsbCwibGljZW5zZVZh\ncmlhYmxlcyI6eyJ0aWVyIjoibGlmZXRpbWUifSwiYXBwVmFyaWFibGVzIjp7InRo\nZW1lIjoiZGFyayJ9fQ==\n-----END AUTHFORGE LICENSE-----\n-----BEGIN AUTHFORGE SIGNATURE-----\nDhSH8XlZ/VTgn94AYALsWiny50Z6VOhqjl+qO7PQgGmM8EfpEs2c3z8v6rQKg3XI\nA3dTQ9alHa3aSi6pFBreDg==\n-----END AUTHFORGE SIGNATURE-----\n",
"replay": true,
"sessionKind": "offline",
"licenseVariables": {
"tier": "lifetime"
},
"appVariables": {
"theme": "dark"
}
}
},
{
"name": "reject_tampered_file",
"description": "Signature does not verify. Do not write.",
"response": {
"status": 201,
"body": {
"status": "success",
"file": "-----BEGIN AUTHFORGE LICENSE-----\nVersion: 1\nApp-Id: test-app\nLicense: TEST-KEY0-0000-0000\nKey-Id: kid-test-0001\nExpires-At: never\n\neyJ2IjoxLCA0eXAiOiJhdXRoZm9yZ2UtbGljZW5zZSIsImFwcElkIjoidGVzdC1h\ncHAiLCJsaWNlbnNlS2V5IjoiVEVTVC1LRVkwLTAwMDAtMDAwMCIsImp0aSI6IjAw\nMDAwMDAwLTAwMDAtNDAwMC04MDAwLTAwMDAwMDAwMDBhMSIsImtpZCI6ImtpZC10\nZXN0LTAwMDEiLCJpc3N1ZWRBdCI6IjIwMjYtMTAtMDlUMTI6MDA6MDAuMDAwWiIs\nImV4cGlyZXNBdCI6bnVsbCwiaHdpZCI6eyJtb2RlIjoiYm91bmQiLCJod2lkcyI6\nWyJ0ZXN0aHdpZCJdfSwibGljZW5zZUV4cGlyZXNBdCI6bnVsbCwibGljZW5zZVZh\ncmlhYmxlcyI6eyJ0aWVyIjoibGlmZXRpbWUifSwiYXBwVmFyaWFibGVzIjp7InRo\nZW1lIjoiZGFyayJ9fQ==\n-----END AUTHFORGE LICENSE-----\n-----BEGIN AUTHFORGE SIGNATURE-----\nDhSH8XlZ/VTgn94AYALsWiny50Z6VOhqjl+qO7PQgGmM8EfpEs2c3z8v6rQKg3XI\nA3dTQ9alHa3aSi6pFBreDg==\n-----END AUTHFORGE SIGNATURE-----\n",
"fileName": "TEST-KEY0-0000-0000.authforge",
"jti": "00000000-0000-4000-8000-0000000000a1",
"replay": false
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "offline_file_rejected",
"fatal": true,
"detail": "bad_signature"
}
},
{
"name": "reject_wrong_key",
"description": "Signed by a key that is not configured. Do not write.",
"response": {
"status": 201,
"body": {
"status": "success",
"file": "-----BEGIN AUTHFORGE LICENSE-----\nVersion: 1\nApp-Id: test-app\nLicense: TEST-KEY0-0000-0000\nKey-Id: kid-test-0001\nExpires-At: never\n\neyJ2IjoxLCJ0eXAiOiJhdXRoZm9yZ2UtbGljZW5zZSIsImFwcElkIjoidGVzdC1h\ncHAiLCJsaWNlbnNlS2V5IjoiVEVTVC1LRVkwLTAwMDAtMDAwMCIsImp0aSI6IjAw\nMDAwMDAwLTAwMDAtNDAwMC04MDAwLTAwMDAwMDAwMDBhMSIsImtpZCI6ImtpZC10\nZXN0LTAwMDEiLCJpc3N1ZWRBdCI6IjIwMjYtMTAtMDlUMTI6MDA6MDAuMDAwWiIs\nImV4cGlyZXNBdCI6bnVsbCwiaHdpZCI6eyJtb2RlIjoiYm91bmQiLCJod2lkcyI6\nWyJ0ZXN0aHdpZCJdfSwibGljZW5zZUV4cGlyZXNBdCI6bnVsbCwibGljZW5zZVZh\ncmlhYmxlcyI6eyJ0aWVyIjoibGlmZXRpbWUifSwiYXBwVmFyaWFibGVzIjp7InRo\nZW1lIjoiZGFyayJ9fQ==\n-----END AUTHFORGE LICENSE-----\n-----BEGIN AUTHFORGE SIGNATURE-----\nFzb4jQ1VzHzTrUMUWblaxo3+MWModFTwqPuqGUvRvHEHeWWwNlwlgGyq5n5mVrAA\neweAQzlXPHzE0/4n04spBg==\n-----END AUTHFORGE SIGNATURE-----\n",
"fileName": "TEST-KEY0-0000-0000.authforge",
"jti": "00000000-0000-4000-8000-0000000000a1",
"replay": false
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "offline_file_rejected",
"fatal": true,
"detail": "bad_signature"
}
},
{
"name": "reject_other_hwid",
"description": "Valid signature but bound to a different machine. Do not write.",
"response": {
"status": 201,
"body": {
"status": "success",
"file": "-----BEGIN AUTHFORGE LICENSE-----\nVersion: 1\nApp-Id: test-app\nLicense: TEST-KEY0-0000-0000\nKey-Id: kid-test-0001\nExpires-At: never\n\neyJ2IjoxLCJ0eXAiOiJhdXRoZm9yZ2UtbGljZW5zZSIsImFwcElkIjoidGVzdC1h\ncHAiLCJsaWNlbnNlS2V5IjoiVEVTVC1LRVkwLTAwMDAtMDAwMCIsImp0aSI6IjAw\nMDAwMDAwLTAwMDAtNDAwMC04MDAwLTAwMDAwMDAwMDBhMSIsImtpZCI6ImtpZC10\nZXN0LTAwMDEiLCJpc3N1ZWRBdCI6IjIwMjYtMTAtMDlUMTI6MDA6MDAuMDAwWiIs\nImV4cGlyZXNBdCI6bnVsbCwiaHdpZCI6eyJtb2RlIjoiYm91bmQiLCJod2lkcyI6\nWyJvdGhlcmh3aWQiXX0sImxpY2Vuc2VFeHBpcmVzQXQiOm51bGwsImxpY2Vuc2VW\nYXJpYWJsZXMiOnsidGllciI6ImxpZmV0aW1lIn0sImFwcFZhcmlhYmxlcyI6eyJ0\naGVtZSI6ImRhcmsifX0=\n-----END AUTHFORGE LICENSE-----\n-----BEGIN AUTHFORGE SIGNATURE-----\nkKSVeCfk8mWEpVDlCeOTjOqmvrElAGLzB3A88acscIYdDZ6fLoKzc2DVo8nqbOC4\nAV841g274LmygkGhpGEwDg==\n-----END AUTHFORGE SIGNATURE-----\n",
"fileName": "TEST-KEY0-0000-0000.authforge",
"jti": "00000000-0000-4000-8000-0000000000a1",
"replay": false
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "offline_file_rejected",
"fatal": true,
"detail": "hwid_mismatch"
}
},
{
"name": "reject_wrong_app",
"description": "Valid signature but for another app. Do not write.",
"response": {
"status": 201,
"body": {
"status": "success",
"file": "-----BEGIN AUTHFORGE LICENSE-----\nVersion: 1\nApp-Id: other-app\nLicense: TEST-KEY0-0000-0000\nKey-Id: kid-test-0001\nExpires-At: never\n\neyJ2IjoxLCJ0eXAiOiJhdXRoZm9yZ2UtbGljZW5zZSIsImFwcElkIjoib3RoZXIt\nYXBwIiwibGljZW5zZUtleSI6IlRFU1QtS0VZMC0wMDAwLTAwMDAiLCJqdGkiOiIw\nMDAwMDAwMC0wMDAwLTQwMDAtODAwMC0wMDAwMDAwMDAwYTEiLCJraWQiOiJraWQt\ndGVzdC0wMDAxIiwiaXNzdWVkQXQiOiIyMDI2LTEwLTA5VDEyOjAwOjAwLjAwMFoi\nLCJleHBpcmVzQXQiOm51bGwsImh3aWQiOnsibW9kZSI6ImJvdW5kIiwiaHdpZHMi\nOlsidGVzdGh3aWQiXX0sImxpY2Vuc2VFeHBpcmVzQXQiOm51bGwsImxpY2Vuc2VW\nYXJpYWJsZXMiOnsidGllciI6ImxpZmV0aW1lIn0sImFwcFZhcmlhYmxlcyI6eyJ0\naGVtZSI6ImRhcmsifX0=\n-----END AUTHFORGE LICENSE-----\n-----BEGIN AUTHFORGE SIGNATURE-----\nqnfzIOqaab/rfzoYeTWfwjKkwzM7WsNlqdcpTtGCVOTMotiU1z3t96MYMqCdnGX9\nfsmAV8Ew+yRPycjusbrDAQ==\n-----END AUTHFORGE SIGNATURE-----\n",
"fileName": "TEST-KEY0-0000-0000.authforge",
"jti": "00000000-0000-4000-8000-0000000000a1",
"replay": false
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "offline_file_rejected",
"fatal": true,
"detail": "wrong_app"
}
},
{
"name": "reject_missing_file",
"description": "Success status without a file field. Existing malformed-response handling; do not write.",
"response": {
"status": 201,
"body": {
"status": "success",
"jti": "00000000-0000-4000-8000-0000000000a1",
"replay": false
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "unexpected_response",
"fatal": false
}
},
{
"name": "error_offline_activation_disabled",
"description": "The app has not opted in to self-serve activation.",
"response": {
"status": 403,
"body": {
"status": "failed",
"error": "offline_activation_disabled"
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "offline_activation_disabled",
"fatal": true
}
},
{
"name": "error_offline_activation_requires_perpetual",
"description": "The license has an expiry; only perpetual licenses can self-serve.",
"response": {
"status": 409,
"body": {
"status": "failed",
"error": "offline_activation_requires_perpetual"
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "offline_activation_requires_perpetual",
"fatal": true
}
},
{
"name": "error_offline_activation_requires_seats",
"description": "Unlimited-seat (shared) licenses cannot self-serve.",
"response": {
"status": 409,
"body": {
"status": "failed",
"error": "offline_activation_requires_seats"
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "offline_activation_requires_seats",
"fatal": true
}
},
{
"name": "error_offline_activation_limit_reached",
"description": "Every machine slot on the license is used. HWID resets do not free them; the buyer must contact the vendor.",
"response": {
"status": 403,
"body": {
"status": "failed",
"error": "offline_activation_limit_reached"
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "offline_activation_limit_reached",
"fatal": true
}
},
{
"name": "error_hwid_mismatch",
"description": "No free seat for this machine.",
"response": {
"status": 403,
"body": {
"status": "failed",
"error": "hwid_mismatch"
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "hwid_mismatch",
"fatal": true
}
},
{
"name": "error_revoked",
"description": "Existing code, existing classification.",
"response": {
"status": 410,
"body": {
"status": "failed",
"error": "revoked"
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "revoked",
"fatal": true
}
},
{
"name": "error_invalid_key",
"description": "Existing code, existing classification (transient in every SDK today).",
"response": {
"status": 401,
"body": {
"status": "failed",
"error": "invalid_key"
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "invalid_key",
"fatal": false
}
},
{
"name": "error_no_credits",
"description": "The app owner is out of credits. Existing code, existing classification.",
"response": {
"status": 429,
"body": {
"status": "failed",
"error": "no_credits"
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "no_credits",
"fatal": false
}
},
{
"name": "error_rate_limited",
"description": "Existing code. The SDK may retry exactly as login() does for rate_limited; a server that keeps answering this ends in this error.",
"response": {
"status": 429,
"body": {
"status": "failed",
"error": "rate_limited"
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "rate_limited",
"fatal": false
}
},
{
"name": "error_system_error",
"description": "Existing code, existing classification.",
"response": {
"status": 500,
"body": {
"status": "failed",
"error": "system_error"
}
},
"expect": {
"outcome": "error",
"writesFile": false,
"errorCode": "system_error",
"fatal": false
}
}
]
}