| 1 | using System.Text; |
| 2 | using OutWit.Database.Core.BouncyCastle; |
| 3 | using OutWit.Database.Core.Builder; |
| 4 | |
| 5 | BouncyCastleProviderRegistration.EnsureRegistered(); |
| 6 | |
| 7 | if (args.Length < 1) |
| 8 | { |
| 9 | Console.Error.WriteLine("usage: WitDbFixtures <output-dir>"); |
| 10 | return 1; |
| 11 | } |
| 12 | |
| 13 | var outDir = Path.GetFullPath(args[0]); |
| 14 | Directory.CreateDirectory(outDir); |
| 15 | |
| 16 | WriteT1a(Path.Combine(outDir, "t1a-plain-btree.witdb")); |
| 17 | WriteT1b(Path.Combine(outDir, "t1b-aes-intercom-like.witdb")); |
| 18 | |
| 19 | Console.WriteLine($"fixtures written to {outDir}"); |
| 20 | return 0; |
| 21 | |
| 22 | static void WriteT1a(string path) |
| 23 | { |
| 24 | if (File.Exists(path)) |
| 25 | { |
| 26 | File.Delete(path); |
| 27 | } |
| 28 | |
| 29 | using var db = WitDatabase.Create(path); |
| 30 | db.Put(Encoding.UTF8.GetBytes("contract:t1a"), Encoding.UTF8.GetBytes("plain-btree")); |
| 31 | } |
| 32 | |
| 33 | static void WriteT1b(string path) |
| 34 | { |
| 35 | if (File.Exists(path)) |
| 36 | { |
| 37 | File.Delete(path); |
| 38 | } |
| 39 | |
| 40 | const string password = "fixture-secret"; |
| 41 | using var db = WitDatabase.Create(path, password); |
| 42 | db.Put(Encoding.UTF8.GetBytes("contract:t1b"), Encoding.UTF8.GetBytes("aes-gcm")); |
| 43 | } |
| 44 | |
View only · write via MCP/CIDE