public void Export_Base64() { var psk1 = new PreSharedKey().Generate(); var s = new StringWriter(); psk1.Export(s, "base64"); var psk2 = new PreSharedKey(); psk2.Import(new StringReader(s.ToString())); CollectionAssert.AreEqual(psk1.Value, psk2.Value); }
public void Import_JS_Generated() { var key = "/key/swarm/psk/1.0.0/\n" + "/base16/\n" + "e8d6d31e8e02000010d7d31e8e020000f0d1fc609300000078f0d31e8e020000"; var psk2 = new PreSharedKey(); psk2.Import(new StringReader(key)); var expected = "e8d6d31e8e02000010d7d31e8e020000f0d1fc609300000078f0d31e8e020000".ToHexBuffer(); CollectionAssert.AreEqual(expected, psk2.Value); }