social-kit / test / vectors / canon.json
  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
359
360
361
362
363
364
365
366
367
368
369
370
{
  "_doc": "canon.ts canonical-serialization byte contract: canon() outputs (string + UTF-8 hex + SHA-256), inputs the port must reject, and hkdfId/sha256B64url derivations. Inputs are described in input_desc (input_json only where a JSON round trip is canon-faithful); the construction code lives in compute.mjs canonCases().",
  "deterministic": {
    "cases": [
      {
        "name": "null",
        "input_desc": "null",
        "input_json": "null",
        "canon": "null",
        "utf8_hex": "6e756c6c",
        "sha256_b64url": "dCNOmK_nSY-12vHzasLXiswzlGT5UHA7jAGYkvmCuQs"
      },
      {
        "name": "true",
        "input_desc": "true",
        "input_json": "true",
        "canon": "true",
        "utf8_hex": "74727565",
        "sha256_b64url": "tb6kG2xiP3wJ8b8k3K5Y66s8DN2QrZZrxDpFtEhn4Ss"
      },
      {
        "name": "false",
        "input_desc": "false",
        "input_json": "false",
        "canon": "false",
        "utf8_hex": "66616c7365",
        "sha256_b64url": "_LzxZZCN0YqeSff_J4EBdtuOn2O0NSITdBZkJFIk-Ko"
      },
      {
        "name": "int-zero",
        "input_desc": "0",
        "input_json": "0",
        "canon": "0",
        "utf8_hex": "30",
        "sha256_b64url": "X-zrZv_IbzjZUnhsbWlsecLbwjndTpG0ZynXOif7V-k"
      },
      {
        "name": "int",
        "input_desc": "42",
        "input_json": "42",
        "canon": "42",
        "utf8_hex": "3432",
        "sha256_b64url": "c0dctApWjo2ooEXO0RATfhWfiQrE2og7axfcZRs6gEk"
      },
      {
        "name": "int-negative",
        "input_desc": "-7",
        "input_json": "-7",
        "canon": "-7",
        "utf8_hex": "2d37",
        "sha256_b64url": "p3DTJwydze3xLtn9cERPfIqVwmyuPK6b2GdJkJCi8Us"
      },
      {
        "name": "neg-zero",
        "input_desc": "-0 (negative zero)",
        "input_json": "0",
        "canon": "0",
        "utf8_hex": "30",
        "sha256_b64url": "X-zrZv_IbzjZUnhsbWlsecLbwjndTpG0ZynXOif7V-k"
      },
      {
        "name": "float",
        "input_desc": "3.14",
        "input_json": "3.14",
        "canon": "3.14",
        "utf8_hex": "332e3134",
        "sha256_b64url": "Lv_xJhwl2U3WaY6hBH9cCnEHypiwpsJCfuZhQUNQAhU"
      },
      {
        "name": "float-tenth",
        "input_desc": "0.1",
        "input_json": "0.1",
        "canon": "0.1",
        "utf8_hex": "302e31",
        "sha256_b64url": "FL5LRfGODYxntPcZtRRO7ohJfkE3CdEdhbCW2OI0YxA"
      },
      {
        "name": "max-safe-int",
        "input_desc": "9007199254740991",
        "input_json": "9007199254740991",
        "canon": "9007199254740991",
        "utf8_hex": "39303037313939323534373430393931",
        "sha256_b64url": "9AtCPC3ZX_Ky8CfiIgj0OM9yQoYuXnRoYOaXMIya3SY"
      },
      {
        "name": "beyond-safe-int",
        "input_desc": "2^53+1 (loses precision to ...992)",
        "input_json": "9007199254740992",
        "canon": "9007199254740992",
        "utf8_hex": "39303037313939323534373430393932",
        "sha256_b64url": "xoHaOdcnOmokwVycrDp1Um_y7Pi6TuYDRqDHDIFjvbI"
      },
      {
        "name": "exp-large",
        "input_desc": "1e21 (exponent form)",
        "input_json": "1e+21",
        "canon": "1e+21",
        "utf8_hex": "31652b3231",
        "sha256_b64url": "JBxGQ_pwsdzeEgW3G-TjvrsX6fiAyOGjPQ6tbCcnHTw"
      },
      {
        "name": "exp-small",
        "input_desc": "1e-7 (exponent form)",
        "input_json": "1e-7",
        "canon": "1e-7",
        "utf8_hex": "31652d37",
        "sha256_b64url": "WzPgLyxRA6BdMva6nLBYKURSv785OWf2i7MMG9y7qyI"
      },
      {
        "name": "nan",
        "input_desc": "NaN (JSON.stringify -> null)",
        "input_json": "null",
        "canon": "null",
        "utf8_hex": "6e756c6c",
        "sha256_b64url": "dCNOmK_nSY-12vHzasLXiswzlGT5UHA7jAGYkvmCuQs"
      },
      {
        "name": "infinity",
        "input_desc": "Infinity (JSON.stringify -> null)",
        "input_json": "null",
        "canon": "null",
        "utf8_hex": "6e756c6c",
        "sha256_b64url": "dCNOmK_nSY-12vHzasLXiswzlGT5UHA7jAGYkvmCuQs"
      },
      {
        "name": "string-plain",
        "input_desc": "\"hello\"",
        "input_json": "\"hello\"",
        "canon": "\"hello\"",
        "utf8_hex": "2268656c6c6f22",
        "sha256_b64url": "Wqdirjg_u3J688ejbUlApbjECpiUUtIwT8lY_z81Tno"
      },
      {
        "name": "string-empty",
        "input_desc": "empty string",
        "input_json": "\"\"",
        "canon": "\"\"",
        "utf8_hex": "2222",
        "sha256_b64url": "Eq4yyx7ALQHto1gbEnwf7jsNxTVy7WuvI5choD2C4SY"
      },
      {
        "name": "string-escapes",
        "input_desc": "quote, backslash, newline, tab, CR, control U+0001, DEL U+007F",
        "input_json": "\"q\\\"b\\\\n\\nt\\tr\\rc\\u0001d\"",
        "canon": "\"q\\\"b\\\\n\\nt\\tr\\rc\\u0001d\"",
        "utf8_hex": "22715c22625c5c6e5c6e745c74725c72635c7530303031647f22",
        "sha256_b64url": "IUAEfBReW7FDyaC1cQYzevKn99Yz-VVPYGZYCk6IHrc"
      },
      {
        "name": "string-2byte",
        "input_desc": "2-byte UTF-8: é ñ ő (hu)",
        "input_json": "\"éñő\"",
        "canon": "\"éñő\"",
        "utf8_hex": "22c3a9c3b1c59122",
        "sha256_b64url": "5lR0OQOudWijn9j0hGMc5t_iTMPB9njXg1_RJODJy5w"
      },
      {
        "name": "string-3byte",
        "input_desc": "3-byte UTF-8: € こんにちは",
        "input_json": "\"€こんにちは\"",
        "canon": "\"€こんにちは\"",
        "utf8_hex": "22e282ace38193e38293e381abe381a1e381af22",
        "sha256_b64url": "J-8vBbC0DFTGtdlUBZZkk04pHX4jAnDPSbvc7OxhY8E"
      },
      {
        "name": "string-4byte",
        "input_desc": "4-byte UTF-8 surrogate pairs: 🎟 𝄞 👩‍🚀 (ZWJ)",
        "input_json": "\"🎟𝄞👩‍🚀\"",
        "canon": "\"🎟𝄞👩‍🚀\"",
        "utf8_hex": "22f09f8e9ff09d849ef09f91a9e2808df09f9a8022",
        "sha256_b64url": "i_mITZznXfns76wFDZ4vySxCN8_hi5rh9NPcAIim8cY"
      },
      {
        "name": "string-lone-surrogate",
        "input_desc": "lone high surrogate U+D800 -> \\ud800 escape",
        "input_json": "\"\\ud800\"",
        "canon": "\"\\ud800\"",
        "utf8_hex": "225c756438303022",
        "sha256_b64url": "jAxZ3Q0nWq3NRipf4S6zUsvf6vlh6uT4WkZgUh330vU"
      },
      {
        "name": "string-line-seps",
        "input_desc": "U+2028/U+2029 emitted raw",
        "input_json": "\"a
b
c\"",
        "canon": "\"a
b
c\"",
        "utf8_hex": "2261e280a862e280a96322",
        "sha256_b64url": "GMa-4sEMrfXex3Lkshb5BgohgUowLOmJ4YMXivz0Pho"
      },
      {
        "name": "empty-object",
        "input_desc": "{}",
        "input_json": "{}",
        "canon": "{}",
        "utf8_hex": "7b7d",
        "sha256_b64url": "RBNvo1WzZ4oRRq0W9-hknpT7T8If536DEMBg9hyq_4o"
      },
      {
        "name": "empty-array",
        "input_desc": "[]",
        "input_json": "[]",
        "canon": "[]",
        "utf8_hex": "5b5d",
        "sha256_b64url": "T1PNoYwrqgwDVLtfmj7L5e0Sq02OEbqHPC8RFhICuUU"
      },
      {
        "name": "array-mixed",
        "input_desc": "[1,\"a\",null,true,[],{}] — order preserved",
        "input_json": "[1,\"a\",null,true,[],{}]",
        "canon": "[1,\"a\",null,true,[],{}]",
        "utf8_hex": "5b312c2261222c6e756c6c2c747275652c5b5d2c7b7d5d",
        "sha256_b64url": "sxuCargY3Kld0jCHlbSjaw3GSKx03ClgvI1bE91zjZQ"
      },
      {
        "name": "array-specials",
        "input_desc": "[-0, NaN, Infinity] -> [0,null,null]",
        "input_json": "[0,null,null]",
        "canon": "[0,null,null]",
        "utf8_hex": "5b302c6e756c6c2c6e756c6c5d",
        "sha256_b64url": "tnltmgJ3aymQbkNTlalSzt2MXOw4IBPB71vQ9dTehJw"
      },
      {
        "name": "object-unsorted-keys",
        "input_desc": "keys inserted b,a,c,B,A — sorted by UTF-16 code units",
        "input_json": "{\"b\":1,\"a\":2,\"c\":3,\"B\":4,\"A\":5}",
        "canon": "{\"A\":5,\"B\":4,\"a\":2,\"b\":1,\"c\":3}",
        "utf8_hex": "7b2241223a352c2242223a342c2261223a322c2262223a312c2263223a337d",
        "sha256_b64url": "UZSoKbKLOO25lGt39tRa_O2fnjt_pZmc9h2FP10milA"
      },
      {
        "name": "object-key-codeunit-order",
        "input_desc": "keys é,z,Z,a,_,0 inserted unsorted -> \"0\",\"Z\",\"_\",\"a\",\"z\",\"é\"",
        "input_json": "{\"0\":6,\"é\":1,\"z\":2,\"Z\":3,\"a\":4,\"_\":5}",
        "canon": "{\"0\":6,\"Z\":3,\"_\":5,\"a\":4,\"z\":2,\"é\":1}",
        "utf8_hex": "7b2230223a362c225a223a332c225f223a352c2261223a342c227a223a322c22c3a9223a317d",
        "sha256_b64url": "6I5w7pTot0vxmvBZmJiOHaTrqMb9HWOZVssQhCXtzZw"
      },
      {
        "name": "object-surrogate-key-order",
        "input_desc": "surrogate-pair key 🎟 (D83C..) sorts BEFORE U+FFFD key (code-unit sort)",
        "input_json": "{\"�\":2,\"🎟\":1}",
        "canon": "{\"🎟\":1,\"�\":2}",
        "utf8_hex": "7b22f09f8e9f223a312c22efbfbd223a327d",
        "sha256_b64url": "S4HitEftiLfR70SQbhBLOqHidwxIXQjZeR2dLIO23qs"
      },
      {
        "name": "object-undefined-filtered",
        "input_desc": "{a:1,b:undefined,c:2} — undefined-valued keys dropped",
        "input_json": "{\"a\":1,\"c\":2}",
        "canon": "{\"a\":1,\"c\":2}",
        "utf8_hex": "7b2261223a312c2263223a327d",
        "sha256_b64url": "_k_gHKIEs_NAi9bHwrA5UAcBwSR1NELuqrlsHdCCV-k"
      },
      {
        "name": "object-null-kept",
        "input_desc": "{a:null} is NOT {} (null vs absent)",
        "input_json": "{\"a\":null}",
        "canon": "{\"a\":null}",
        "utf8_hex": "7b2261223a6e756c6c7d",
        "sha256_b64url": "0JH5yDwJH3llL-h4Y3Wz_kzghhpW9b-6_tvkMYd_8Og"
      },
      {
        "name": "object-empty-string-key",
        "input_desc": "{\"\":1}",
        "input_json": "{\"\":1}",
        "canon": "{\"\":1}",
        "utf8_hex": "7b22223a317d",
        "sha256_b64url": "89ht4b9LNUOC-RoSpEh9qutWaSssRvLfUvb4OoRhAHQ"
      },
      {
        "name": "nested-unsorted",
        "input_desc": "nested objects unsorted at each level, arrays preserve order",
        "input_json": "{\"z\":{\"b\":[3,{\"y\":1,\"x\":2}],\"a\":null},\"a\":[{\"c\":1,\"b\":2}]}",
        "canon": "{\"a\":[{\"b\":2,\"c\":1}],\"z\":{\"a\":null,\"b\":[3,{\"x\":2,\"y\":1}]}}",
        "utf8_hex": "7b2261223a5b7b2262223a322c2263223a317d5d2c227a223a7b2261223a6e756c6c2c2262223a5b332c7b2278223a322c2279223a317d5d7d7d",
        "sha256_b64url": "MkOsjfposf1dbTbkBwxMBquDAyxvQyCouxwkLxWsNqs"
      },
      {
        "name": "date-object",
        "input_desc": "a Date has no enumerable own keys -> {} (quirk)",
        "input_json": null,
        "canon": "{}",
        "utf8_hex": "7b7d",
        "sha256_b64url": "RBNvo1WzZ4oRRq0W9-hknpT7T8If536DEMBg9hyq_4o"
      },
      {
        "name": "typed-array",
        "input_desc": "Uint8Array [1,2] -> {\"0\":1,\"1\":2} (numeric enumerable keys; quirk)",
        "input_json": "{\"0\":1,\"1\":2}",
        "canon": "{\"0\":1,\"1\":2}",
        "utf8_hex": "7b2230223a312c2231223a327d",
        "sha256_b64url": "mP_9Jh13TJ_6Pnx8vlrZYALTM2-8FNdZi4T2kIuMTOY"
      },
      {
        "name": "envelope-shaped",
        "input_desc": "realistic unsigned-envelope shape, keys inserted wire-order (t,id,from,ts,exp,body)",
        "input_json": "{\"t\":\"freq\",\"id\":\"AQIDBAUGBwgJCgsMDQ4PEA\",\"from\":{\"pub\":\"PUB\",\"x\":\"X\",\"xs\":\"XS\",\"name\":\"Ala \"},\"ts\":1735689600000,\"exp\":4102444800000,\"body\":{\"msg\":\"hei ✨\",\"k\":1}}",
        "canon": "{\"body\":{\"k\":1,\"msg\":\"hei ✨\"},\"exp\":4102444800000,\"from\":{\"name\":\"Ala \",\"pub\":\"PUB\",\"x\":\"X\",\"xs\":\"XS\"},\"id\":\"AQIDBAUGBwgJCgsMDQ4PEA\",\"t\":\"freq\",\"ts\":1735689600000}",
        "utf8_hex": "7b22626f6479223a7b226b223a312c226d7367223a2268656920e29ca8227d2c22657870223a343130323434343830303030302c2266726f6d223a7b226e616d65223a22416c6120222c22707562223a22505542222c2278223a2258222c227873223a225853227d2c226964223a2241514944424155474277674a4367734d445134504541222c2274223a2266726571222c227473223a313733353638393630303030307d",
        "sha256_b64url": "4b5NOLJk-Cj-gVF_4eDdkI12-8uTnlZmkSnCfkiHvys"
      },
      {
        "name": "receipt-shaped",
        "input_desc": "realistic receipt base, sc array order preserved, entry keys p,nm,s",
        "input_json": "{\"v\":1,\"g\":\"game.test\",\"m\":\"match\",\"r\":\"rrrrrrrrrrrrrrrrrrrrrr\",\"ts\":1735689600000,\"n\":3,\"sc\":[{\"p\":\"P1\",\"nm\":\"unu\",\"s\":300},{\"p\":\"P2\",\"nm\":\"doi\",\"s\":200}]}",
        "canon": "{\"g\":\"game.test\",\"m\":\"match\",\"n\":3,\"r\":\"rrrrrrrrrrrrrrrrrrrrrr\",\"sc\":[{\"nm\":\"unu\",\"p\":\"P1\",\"s\":300},{\"nm\":\"doi\",\"p\":\"P2\",\"s\":200}],\"ts\":1735689600000,\"v\":1}",
        "utf8_hex": "7b2267223a2267616d652e74657374222c226d223a226d61746368222c226e223a332c2272223a2272727272727272727272727272727272727272727272222c227363223a5b7b226e6d223a22756e75222c2270223a225031222c2273223a3330307d2c7b226e6d223a22646f69222c2270223a225032222c2273223a3230307d5d2c227473223a313733353638393630303030302c2276223a317d",
        "sha256_b64url": "dt9GeqRjqrXEcU_S_3ByZobUAW7Qh2mMY3U-ndcjJLA"
      }
    ],
    "throws": [
      {
        "name": "undefined-top-level",
        "input_desc": "canon(undefined) throws"
      },
      {
        "name": "undefined-in-array",
        "input_desc": "[1,undefined] throws (JSON.stringify would emit null)"
      },
      {
        "name": "function-value",
        "input_desc": "{a:fn} throws (only undefined is filtered)"
      },
      {
        "name": "function-in-array",
        "input_desc": "[fn] throws"
      },
      {
        "name": "bigint",
        "input_desc": "10n throws (unsupported type)"
      },
      {
        "name": "symbol-value",
        "input_desc": "{a:Symbol()} throws"
      }
    ],
    "hkdf": [
      {
        "name": "hkdfId-basic",
        "ikm_hex": "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a",
        "salt": "ardegazu.ro/social/v1",
        "info": "test|info|v1",
        "out_b64url": "9lLvLTa6aJQmVJnEkaFu0R8bkfWIfYuYdevt0CLkVVA"
      },
      {
        "name": "hkdfId-unicode-info",
        "ikm_hex": "0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a",
        "salt": "ardegazu.ro/social/v1",
        "info": "test|✨|v1",
        "out_b64url": "KyEhwCwMzUvrbAUFv0bqgTGZn7JitQnitI1gC-qGMKo"
      }
    ],
    "sha256_b64url": [
      {
        "input": "",
        "utf8_hex": "",
        "sha256_b64url": "47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU"
      },
      {
        "input": "hello",
        "utf8_hex": "68656c6c6f",
        "sha256_b64url": "LPJNul-wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ"
      },
      {
        "input": "hei ✨🎟",
        "utf8_hex": "68656920e29ca8f09f8e9f",
        "sha256_b64url": "O_MlRl5zvl7a-7U9vPXiVhzN3gZXp8UwA1tJdwCocXA"
      }
    ]
  }
}

static mirror of HEAD · about · clone: git clone https://git.ardegazu.ro/social-kit.git