// Puts together the body of the post request for a OTP encrypted key,
    //  returns a string[] with the did, the signature, and the body of the
    //  post request.
    public static string[] makePost(byte[] encryptedKey)
    {
        byte[] vk = new byte[32];
        byte[] sk = new byte[64];
        string dateTime;
        string body;
        string did;
        string signature;
        string keyString = Convert.ToBase64String(encryptedKey);

        int signed_bytes = LibSodiumManager.nacl_crypto_sign_BYTES();

        LibSodiumManager.nacl_crypto_sign_keypair(vk, sk);
        did = makeDid(vk);

        dateTime = DateTime.Now.ToString("yyyy-MM-ddTHH\\:mm\\:ss.ffffffzzz");
        body     = "{\"id\":\"" + did + "\",\"blob\":\"" + keyString + "\",\"changed\":\"" + dateTime + "\"}";

        byte[] bodyByte = new byte[body.Length];
        bodyByte = Encoding.UTF8.GetBytes(body);

        byte[] sm = new byte[signed_bytes + bodyByte.Length];

        signature = signResource(sm, bodyByte, (ulong)bodyByte.Length, sk, vk);
        signature = "signer=\"" + signature + "\"";

        string[] data = new string[3];
        data[0] = did;
        data[1] = signature;
        data[2] = body;

        return(data);
    }
    // Create signature to use in the header of POST and PUT requests to didery
    public static string signResource(byte[] sm, byte[] m, ulong mlen, byte[] sk, byte[] vk)
    {
        LibSodiumManager.nacl_crypto_sign(sm, m, mlen, sk);
        byte[] sig = new byte[LibSodiumManager.nacl_crypto_sign_BYTES()];
        for (int i = 0; i < sig.Length; i++)
        {
            sig[i] = sm[i];
        }

        byte[] usm     = new byte[m.Length];
        int    success = LibSodiumManager.nacl_crypto_sign_open(usm, sm, (ulong)sm.Length, vk);

        if (success == 0)
        {
            Debug.Log("Signing successful");
        }
        else
        {
            Debug.Log("Signing unsuccessful: " + success);
        }

        string signature = Convert.ToBase64String(sig).Replace('+', '-').Replace('/', '_');

        return(signature);
    }