WifExporter { public WifExporter addIdentity(BitmessageAddress identity) { Profile.Section section = ini.add(identity.getAddress()); section.add("label", identity.getAlias()); section.add("enabled", true); section.add("decoy", false); if (identity.isChan()) { section.add("chan", identity.isChan()); } section.add("noncetrialsperbyte", identity.getPubkey().getNonceTrialsPerByte()); section.add("payloadlengthextrabytes", identity.getPubkey().getExtraBytes()); section.add("privsigningkey", exportSecret(identity.getPrivateKey().getPrivateSigningKey())); section.add("privencryptionkey", exportSecret(identity.getPrivateKey().getPrivateEncryptionKey())); return this; } WifExporter(BitmessageContext ctx); WifExporter addAll(); WifExporter addAll(Collection<BitmessageAddress> identities); WifExporter addIdentity(BitmessageAddress identity); void write(File file); void write(OutputStream out); @Override String toString();  }
@Test public void testAddIdentity() throws Exception { String expected = "[BM-2DAjcCFrqFrp88FUxExhJ9kPqHdunQmiyn]" + System.lineSeparator() + "label = Nuked Address" + System.lineSeparator() + "enabled = true" + System.lineSeparator() + "decoy = false" + System.lineSeparator() + "noncetrialsperbyte = 320" + System.lineSeparator() + "payloadlengthextrabytes = 14000" + System.lineSeparator() + "privsigningkey = 5KU2gbe9u4rKJ8PHYb1rvwMnZnAJj4gtV5GLwoYckeYzygWUzB9" + System.lineSeparator() + "privencryptionkey = 5KHd4c6cavd8xv4kzo3PwnVaYuBgEfg7voPQ5V97aZKgpYBXGck" + System.lineSeparator() + System.lineSeparator(); importer = new WifImporter(ctx, expected); exporter.addIdentity(importer.getIdentities().get(0)); assertEquals(expected, exporter.toString()); }