Skip to content

Commit d416df5

Browse files
committed
Rust fmt
1 parent bd4b551 commit d416df5

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

native/src/api256.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -256,16 +256,15 @@ pub fn api256_schnorr_verify(mut cx: FunctionContext) -> JsResult<JsBoolean> {
256256

257257
let augmented_private_key = {
258258
//Ignore both null or undefined as values are passed for augmented private key
259-
if augmented_private_key_buffer.is_a::<JsUndefined, _>(&mut cx) || augmented_private_key_buffer.is_a::<JsNull, _>(&mut cx) {
259+
if augmented_private_key_buffer.is_a::<JsUndefined, _>(&mut cx)
260+
|| augmented_private_key_buffer.is_a::<JsNull, _>(&mut cx)
261+
{
260262
None
261263
} else {
262264
let casted_private_key_buffer = augmented_private_key_buffer
263-
.downcast::<JsBuffer, _>(&mut cx)
264-
.unwrap();
265-
Some(util::buffer_to_private_key(
266-
&cx,
267-
casted_private_key_buffer
268-
))
265+
.downcast::<JsBuffer, _>(&mut cx)
266+
.unwrap();
267+
Some(util::buffer_to_private_key(&cx, casted_private_key_buffer))
269268
}
270269
};
271270

native/src/lib.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,21 @@ fn main(mut cx: ModuleContext) -> NeonResult<()> {
1515
// Api256 member functions
1616
cx.export_function("createApi256", api256::api256_create_recrypt_api_256)?;
1717
cx.export_function("generateKeyPair", api256::api256_generate_key_pair)?;
18-
cx.export_function("generateEd25519KeyPair", api256::api256_generate_ed25519_key_pair)?;
18+
cx.export_function(
19+
"generateEd25519KeyPair",
20+
api256::api256_generate_ed25519_key_pair,
21+
)?;
1922
cx.export_function("ed25519Sign", api256::api256_ed25519_sign)?;
2023
cx.export_function("ed25519Verify", api256::api256_ed25519_verify)?;
21-
cx.export_function("computeEd25519PublicKey", api256::api256_compute_ed25519_public_key)?;
24+
cx.export_function(
25+
"computeEd25519PublicKey",
26+
api256::api256_compute_ed25519_public_key,
27+
)?;
2228
cx.export_function("generatePlaintext", api256::api256_generate_plaintext)?;
23-
cx.export_function("generateTransformKey", api256::api256_generate_transform_key)?;
29+
cx.export_function(
30+
"generateTransformKey",
31+
api256::api256_generate_transform_key,
32+
)?;
2433
cx.export_function("computePublicKey", api256::api256_compute_public_key)?;
2534
cx.export_function("deriveSymmetricKey", api256::api256_derive_symmetric_key)?;
2635
cx.export_function("encrypt", api256::api256_encrypt)?;

native/src/util.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,16 @@ pub fn js_object_to_public_key<'a, T: Context<'a>>(
7272
cx: &mut T,
7373
object: Handle<JsObject>,
7474
) -> PublicKey {
75-
let x = object.get(cx, "x").unwrap().downcast::<JsBuffer, _>(cx).unwrap();
76-
let y = object.get(cx, "y").unwrap().downcast::<JsBuffer, _>(cx).unwrap();
75+
let x = object
76+
.get(cx, "x")
77+
.unwrap()
78+
.downcast::<JsBuffer, _>(cx)
79+
.unwrap();
80+
let y = object
81+
.get(cx, "y")
82+
.unwrap()
83+
.downcast::<JsBuffer, _>(cx)
84+
.unwrap();
7785

7886
PublicKey::new((
7987
buffer_to_fixed_32_bytes(cx, x, "publicKey.x"),

0 commit comments

Comments
 (0)