@@ -19,6 +19,7 @@ public enum PinType {all, direct, indirect, recursive}
19
19
public final String host ;
20
20
public final int port ;
21
21
private final String version ;
22
+ public final Key key = new Key ();
22
23
public final Pin pin = new Pin ();
23
24
public final Repo repo = new Repo ();
24
25
public final IPFSObject object = new IPFSObject ();
@@ -181,6 +182,14 @@ public List<MultiAddress> update(Multihash existing, Multihash modified, boolean
181
182
}
182
183
}
183
184
185
+ /* 'ipfs repo' is a plumbing command used to manipulate the repo.
186
+ */
187
+ public class Key {
188
+ public Object gen (String name , Optional <String > type , Optional <String > size ) throws IOException {
189
+ return retrieveAndParse ("key/gen?arg=" + name + type .map (t -> "&type=" + t ).orElse ("" ) + size .map (s -> "&size=" + s ).orElse ("" ));
190
+ }
191
+ }
192
+
184
193
/* 'ipfs repo' is a plumbing command used to manipulate the repo.
185
194
*/
186
195
public class Repo {
@@ -299,11 +308,11 @@ public MerkleNode patch(Multihash base, String command, Optional<byte[]> data, O
299
308
300
309
public class Name {
301
310
public Map publish (Multihash hash ) throws IOException {
302
- return publish (Optional .empty (), hash );
311
+ return publish (hash , Optional .empty ());
303
312
}
304
313
305
- public Map publish (Optional <String > id , Multihash hash ) throws IOException {
306
- return retrieveMap ("name/publish?arg=" + ( id .isPresent () ? id + "&arg =" : "" ) + "/ipfs/" + hash );
314
+ public Map publish (Multihash hash , Optional <String > id ) throws IOException {
315
+ return retrieveMap ("name/publish?arg=/ipfs/ " + hash + id .map ( name -> "&key =" + name ). orElse ( "" ) );
307
316
}
308
317
309
318
public String resolve (Multihash hash ) throws IOException {
0 commit comments