@@ -213,6 +213,7 @@ namespace ReactNativeLibsodium
213213 jsiRuntime.global ().setProperty (jsiRuntime, " jsi_crypto_kdf_hkdf_sha256_BYTES_MAX" , static_cast <int >(crypto_kdf_hkdf_sha256_BYTES_MAX));
214214 jsiRuntime.global ().setProperty (jsiRuntime, " jsi_crypto_kdf_hkdf_sha256_BYTES_MIN" , static_cast <int >(crypto_kdf_hkdf_sha256_BYTES_MIN));
215215 jsiRuntime.global ().setProperty (jsiRuntime, " jsi_crypto_kdf_hkdf_sha256_KEYBYTES" , static_cast <int >(crypto_kdf_hkdf_sha256_KEYBYTES));
216+ jsiRuntime.global ().setProperty (jsiRuntime, " jsi_crypto_pwhash_ALG_ARGON2ID13" , static_cast <int >(crypto_pwhash_ALG_ARGON2ID13));
216217
217218 auto jsi_from_base64_to_arraybuffer = jsi::Function::createFromHostFunction (
218219 jsiRuntime,
@@ -1196,6 +1197,33 @@ namespace ReactNativeLibsodium
11961197
11971198 jsiRuntime.global ().setProperty (jsiRuntime, " jsi_crypto_pwhash" , std::move (jsi_crypto_pwhash));
11981199
1200+ auto jsi_crypto_sign_ed25519_pk_to_curve25519 = jsi::Function::createFromHostFunction (
1201+ jsiRuntime,
1202+ jsi::PropNameID::forUtf8 (jsiRuntime, " jsi_crypto_sign_ed25519_pk_to_curve25519" ),
1203+ 1 ,
1204+ [](jsi::Runtime &runtime, const jsi::Value &thisValue, const jsi::Value *arguments, size_t count) -> jsi::Value
1205+ {
1206+ const std::string functionName = " crypto_sign_ed25519_pk_to_curve25519" ;
1207+
1208+ std::string publicKeyArgumentName = " publicKey" ;
1209+ unsigned int publicKeyArgumentPosition = 0 ;
1210+ validateIsArrayBuffer (functionName, runtime, arguments[publicKeyArgumentPosition], publicKeyArgumentName, true );
1211+
1212+ auto publicKeyArrayBuffer = arguments[publicKeyArgumentPosition].asObject (runtime).getArrayBuffer (runtime);
1213+
1214+ std::vector<uint8_t > publicKey (crypto_sign_PUBLICKEYBYTES);
1215+ int result = -1 ;
1216+
1217+ result = crypto_sign_ed25519_pk_to_curve25519 (
1218+ publicKey.data (),
1219+ publicKeyArrayBuffer.data (runtime));
1220+
1221+ throwOnBadResult (functionName, runtime, result);
1222+ return arrayBufferAsObject (runtime, publicKey);
1223+ });
1224+
1225+ jsiRuntime.global ().setProperty (jsiRuntime, " jsi_crypto_sign_ed25519_pk_to_curve25519" , std::move (jsi_crypto_sign_ed25519_pk_to_curve25519));
1226+
11991227 auto jsi_crypto_kdf_derive_from_key = jsi::Function::createFromHostFunction (
12001228 jsiRuntime,
12011229 jsi::PropNameID::forUtf8 (jsiRuntime, " jsi_crypto_kdf_derive_from_key" ),
0 commit comments