// Stage 7b against Go, in the other direction: what this library writes, // opened by Go. test/vectors/seal_interop.json holds the recipes of // test/seal_interop_support.dart, the SHA-256 of each file that this // library wrote from them with SeededRandomSource, and the verdict of Go // (tool/seal_interop_go_verdicts.go): the sealed locators open with the // release of their round to the plaintext that was sealed and their // envelopes to the .dkc, the key files read to the key, and the signatures // are those of crypto/ed25519. Here each file is written again and must be // the one that Go read. The vectors come from a Dart constant, so that // this also runs compiled to JavaScript. import 'dart:convert'; import 'package:test/test.dart'; import 'seal_interop_support.dart'; import 'vectors/seal_interop.g.dart'; final Json vectors = jsonDecode(sealInteropJson) as Json; void main() { final samples = listOf(vectors['samples']); test('the recipes are those that the tool writes', () { expect([ for (final s in samples) { for (final e in s.entries) if (e.key != 'files' && e.key != 'verdict') e.key: e.value, }, ], jsonDecode(jsonEncode(interopRecipes()))); }); for (final s in samples) { test('Go reads it: ${s['name']}', () { expect(s['verdict'], 'ok'); expect(interopDigests(interopFiles(s)), s['files']); }); } }