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

com.casper.sdk.jackson.deserializer.KeyDeserializer Maven / Gradle / Ivy

Go to download

SDK to streamline the 3rd party Java client integration processes. Such 3rd parties include exchanges & app developers.

The newest version!
package com.casper.sdk.jackson.deserializer;

import com.casper.sdk.exception.NoSuchKeyTagException;
import com.casper.sdk.model.key.Key;
import com.casper.sdk.model.key.KeyTag;

import java.util.Arrays;

/**
 * Customize the mapping of Casper's PublicKey
 *
 * @author Alexandre Carvalho
 * @author Andre Bertolace
 * @since 0.0.1
 */
public class KeyDeserializer extends AbstractSerializedKeyTaggedHexDeserializer {

    @Override
    protected Key getInstanceOf() {
        return new Key();
    }

    @Override
    protected void loadKey(Key key, byte[] bytes) throws NoSuchKeyTagException {
        key.setTag(KeyTag.getByTag(bytes[0]));
        key.setKey(Arrays.copyOfRange(bytes, 1, bytes.length));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy