Skip to content

Commit 936a9b6

Browse files
committed
hotfix on task payload
1 parent cf60815 commit 936a9b6

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dkn-compute"
3-
version = "0.2.6"
3+
version = "0.2.7"
44
edition = "2021"
55
license = "Apache-2.0"
66
readme = "README.md"

src/payloads/response.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ impl TaskResponsePayload {
3535
preimage.extend_from_slice(task_id.as_ref());
3636
preimage.extend_from_slice(result.as_ref());
3737

38+
let task_id = task_id.to_string();
3839
let signature = sign_bytes_recoverable(&sha256hash(preimage), signing_secret_key);
3940
let ciphertext = encrypt_bytes(result, encrypting_public_key)?;
4041

4142
Ok(TaskResponsePayload {
42-
ciphertext: hex::encode(ciphertext),
43+
task_id,
4344
signature,
44-
task_id: task_id.to_string(),
45+
ciphertext,
4546
})
4647
}
4748
}

src/utils/crypto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub fn sign_bytes_recoverable(message: &[u8; 32], secret_key: &SecretKey) -> Str
4747
/// Returns hexadecimal encoded ciphertext.
4848
#[inline]
4949
pub fn encrypt_bytes(data: impl AsRef<[u8]>, public_key: &PublicKey) -> Result<String> {
50-
ecies::encrypt(public_key.serialize().as_slice(), data.as_ref())
50+
ecies::encrypt(&public_key.serialize(), data.as_ref())
5151
.wrap_err("could not encrypt data")
5252
.map(hex::encode)
5353
}

0 commit comments

Comments
 (0)