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
|
#!/usr/bin/env python
import jwt
receipt1 = {
"typ": "purchase-receipt",
"product": {
"url": "https://www.mozilla.org",
"storedata": "5169314356"
},
"user": {
"type": "directed-identifier",
"value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
},
"iss": "http://mochi.test:8888",
"nbf": 131360185,
"iat": 131360188,
"detail": "http://mochi.test:8888/receipt/5169314356",
"verify": "http://mochi.test:8888/verify/5169314356",
"reissue": "http://mochi.test:8888/reissue/5169314356"
}
receipt2 = {
"typ": "purchase-receipt",
"product": {
"url": "https://www.mozilla.org",
"storedata": "5169314357"
},
"user": {
"type": "directed-identifier",
"value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
},
"iss": "http://mochi.test:8888",
"nbf": 131360185,
"iat": 131360188,
"detail": "http://mochi.test:8888/receipt/5169314356",
"verify": "http://mochi.test:8888/verify/5169314356",
"reissue": "http://mochi.test:8888/reissue/5169314356"
}
receipt_without_typ = {
"product": {
"url": "https://www.mozilla.org",
"storedata": "5169314358"
},
"user": {
"type": "directed-identifier",
"value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
},
"iss": "http://mochi.test:8888",
"nbf": 131360185,
"iat": 131360188,
"detail": "http://mochi.test:8888/receipt/5169314356",
"verify": "http://mochi.test:8888/verify/5169314356",
"reissue": "http://mochi.test:8888/reissue/5169314356"
}
receipt_without_product = {
"typ": "purchase-receipt",
"user": {
"type": "directed-identifier",
"value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
},
"iss": "http://mochi.test:8888",
"nbf": 131360185,
"iat": 131360188,
"detail": "http://mochi.test:8888/receipt/5169314356",
"verify": "http://mochi.test:8888/verify/5169314356",
"reissue": "http://mochi.test:8888/reissue/5169314356"
}
receipt_without_user = {
"typ": "purchase-receipt",
"product": {
"url": "https://www.mozilla.org",
"storedata": "5169314358"
},
"iss": "http://mochi.test:8888",
"nbf": 131360185,
"iat": 131360188,
"detail": "http://mochi.test:8888/receipt/5169314356",
"verify": "http://mochi.test:8888/verify/5169314356",
"reissue": "http://mochi.test:8888/reissue/5169314356"
}
receipt_without_iss = {
"typ": "purchase-receipt",
"product": {
"url": "https://www.mozilla.org",
"storedata": "5169314358"
},
"user": {
"type": "directed-identifier",
"value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
},
"nbf": 131360185,
"iat": 131360188,
"detail": "http://mochi.test:8888/receipt/5169314356",
"verify": "http://mochi.test:8888/verify/5169314356",
"reissue": "http://mochi.test:8888/reissue/5169314356"
}
receipt_without_nbf = {
"typ": "purchase-receipt",
"product": {
"url": "https://www.mozilla.org",
"storedata": "5169314358"
},
"user": {
"type": "directed-identifier",
"value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
},
"iss": "http://mochi.test:8888",
"iat": 131360188,
"detail": "http://mochi.test:8888/receipt/5169314356",
"verify": "http://mochi.test:8888/verify/5169314356",
"reissue": "http://mochi.test:8888/reissue/5169314356"
}
receipt_without_iat = {
"typ": "purchase-receipt",
"product": {
"url": "https://www.mozilla.org",
"storedata": "5169314358"
},
"user": {
"type": "directed-identifier",
"value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
},
"iss": "http://mochi.test:8888",
"nbf": 131360185,
"detail": "http://mochi.test:8888/receipt/5169314356",
"verify": "http://mochi.test:8888/verify/5169314356",
"reissue": "http://mochi.test:8888/reissue/5169314356"
}
receipt_with_wrong_typ = {
"typ": "fake",
"product": {
"url": "https://www.mozilla.org",
"storedata": "5169314358"
},
"user": {
"type": "directed-identifier",
"value": "4fb35151-2b9b-4ba2-8283-c49d381640bd"
},
"iss": "http://mochi.test:8888",
"nbf": 131360185,
"iat": 131360188,
"detail": "http://mochi.test:8888/receipt/5169314356",
"verify": "http://mochi.test:8888/verify/5169314356",
"reissue": "http://mochi.test:8888/reissue/5169314356"
}
print("let valid_receipt1 = \"" + jwt.encode(receipt1, "") + "\";\n")
print("let valid_receipt2 = \"" + jwt.encode(receipt2, "") + "\";\n")
print("let receipt_without_typ = \"" + jwt.encode(receipt_without_typ, "") + "\";\n")
print("let receipt_without_product = \"" + jwt.encode(receipt_without_product, "") + "\";\n")
print("let receipt_without_user = \"" + jwt.encode(receipt_without_user, "") + "\";\n")
print("let receipt_without_iss = \"" + jwt.encode(receipt_without_iss, "") + "\";\n")
print("let receipt_without_nbf = \"" + jwt.encode(receipt_without_nbf, "") + "\";\n")
print("let receipt_without_iat = \"" + jwt.encode(receipt_without_iat, "") + "\";\n")
print("let receipt_with_wrong_typ = \"" + jwt.encode(receipt_with_wrong_typ, "") + "\";\n")
|