
de.thoffbauer.signal4j.store.serialize.IdentityKeyDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of signal4j Show documentation
Show all versions of signal4j Show documentation
Simple library for using the Signal service
The newest version!
package de.thoffbauer.signal4j.store.serialize;
import java.io.IOException;
import org.whispersystems.libsignal.IdentityKey;
import org.whispersystems.libsignal.InvalidKeyException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import de.thoffbauer.signal4j.util.Base64;
@SuppressWarnings("serial")
public class IdentityKeyDeserializer extends StdDeserializer {
public IdentityKeyDeserializer() {
super(IdentityKey.class);
}
@Override
public IdentityKey deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException, JsonProcessingException {
try {
return new IdentityKey(Base64.decode(p.getValueAsString()), 0);
} catch (InvalidKeyException e) {
throw new RuntimeException(e);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy