- JsonNode pinNode = rootNode.get("registrationLockPin");
- registrationLockPin = pinNode == null || pinNode.isNull() ? null : pinNode.asText();
- JsonNode pinMasterKeyNode = rootNode.get("pinMasterKey");
- pinMasterKey = pinMasterKeyNode == null || pinMasterKeyNode.isNull()
- ? null
- : new MasterKey(Base64.getDecoder().decode(pinMasterKeyNode.asText()));
- JsonNode storageKeyNode = rootNode.get("storageKey");
- storageKey = storageKeyNode == null || storageKeyNode.isNull()
- ? null
- : new StorageKey(Base64.getDecoder().decode(storageKeyNode.asText()));
- if (rootNode.has("signalingKey")) {
- signalingKey = Utils.getNotNullNode(rootNode, "signalingKey").asText();
- }
- if (rootNode.has("preKeyIdOffset")) {
- preKeyIdOffset = Utils.getNotNullNode(rootNode, "preKeyIdOffset").asInt(0);
+ if (rootNode.hasNonNull("registrationLockPin")) {
+ registrationLockPin = rootNode.get("registrationLockPin").asText();
+ }
+ if (rootNode.hasNonNull("pinMasterKey")) {
+ pinMasterKey = new MasterKey(Base64.getDecoder().decode(rootNode.get("pinMasterKey").asText()));
+ }
+ if (rootNode.hasNonNull("storageKey")) {
+ storageKey = new StorageKey(Base64.getDecoder().decode(rootNode.get("storageKey").asText()));
+ }
+ if (rootNode.hasNonNull("signalingKey")) {
+ signalingKey = rootNode.get("signalingKey").asText();
+ if (signalingKey.equals("null")) {
+ // Workaround for load bug in older versions
+ signalingKey = null;
+ }
+ }
+ if (rootNode.hasNonNull("preKeyIdOffset")) {
+ preKeyIdOffset = rootNode.get("preKeyIdOffset").asInt(0);