Skip to content

Added signing request for blinded keys #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions library/src/main/cpp/blinded_key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,28 @@ Java_network_loki_messenger_libsession_1util_util_BlindKeyAPI_blindVersionSign(J
auto bytes = session::blind_version_sign(util::ustring_from_bytes(env, ed25519_secret_key), session::Platform::android, timestamp);
return util::bytes_from_ustring(env, bytes);
});
}

extern "C"
JNIEXPORT jbyteArray JNICALL
Java_network_loki_messenger_libsession_1util_util_BlindKeyAPI_blindVersionSignRequest(JNIEnv *env,
jobject thiz,
jbyteArray ed25519_secret_key,
jlong timestamp,
jstring method,
jstring path,
jbyteArray body) {
return jni_utils::run_catching_cxx_exception_or_throws<jbyteArray>(env, [=] {
auto methodC = util::string_from_jstring(env, method);
auto pathC = util::string_from_jstring(env, path);

auto bytes = session::blind_version_sign_request(
util::ustring_from_bytes(env, ed25519_secret_key),
timestamp,
methodC,
pathC,
body ? std::optional(util::ustring_from_bytes(env, body)) : std::nullopt
);
return util::bytes_from_ustring(env, bytes);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ object BlindKeyAPI {

external fun blindVersionKeyPair(ed25519SecretKey: ByteArray): KeyPair
external fun blindVersionSign(ed25519SecretKey: ByteArray, timestamp: Long): ByteArray
external fun blindVersionSignRequest(
ed25519SecretKey: ByteArray,
timestamp: Long,
method: String,
path: String,
body: ByteArray?): ByteArray
}
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ dependencyResolutionManagement {
}
}

rootProject.name = "libsession-util Android"
rootProject.name = "libsession-util-android"
include(":library")

Loading