io.ipfs.api.KeyInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-xpx-ipfs-api Show documentation
Show all versions of java-xpx-ipfs-api Show documentation
The ProximaX IPFS Java API is a Java library for interacting IPFS server.
The newest version!
package io.ipfs.api;
import io.ipfs.cid.*;
import io.ipfs.multihash.*;
import java.util.*;
public class KeyInfo {
public final String name;
public final Multihash id;
public KeyInfo(String name, Multihash id) {
this.name = name;
this.id = id;
}
public String toString() {
return name + ": " + id;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
KeyInfo keyInfo = (KeyInfo) o;
if (name != null ? !name.equals(keyInfo.name) : keyInfo.name != null) return false;
return id != null ? id.equals(keyInfo.id) : keyInfo.id == null;
}
@Override
public int hashCode() {
int result = name != null ? name.hashCode() : 0;
result = 31 * result + (id != null ? id.hashCode() : 0);
return result;
}
public static KeyInfo fromJson(Object json) {
Map m = (Map) json;
return new KeyInfo(m.get("Name"), Cid.decode(m.get("Id")));
}
}