All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.whispersystems.signalservice.internal.push.ByteArrayDeserializerBase64.kt Maven / Gradle / Ivy

There is a newer version: 2.15.3_unofficial_107
Show newest version
/*
 * Copyright 2024 Signal Messenger, LLC
 * SPDX-License-Identifier: AGPL-3.0-only
 */

package org.whispersystems.signalservice.internal.push

import com.fasterxml.jackson.core.JsonParser
import com.fasterxml.jackson.databind.DeserializationContext
import com.fasterxml.jackson.databind.JsonDeserializer
import org.signal.core.util.Base64

/**
 * Deserializes any valid base64 (regardless of padding or url-safety) into a ByteArray.
 */
class ByteArrayDeserializerBase64 : JsonDeserializer() {
  override fun deserialize(p: JsonParser, ctxt: DeserializationContext): ByteArray {
    return Base64.decode(p.valueAsString)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy