Compare commits
No commits in common. "7c5d4cf99fa11961a27e3c9c954a73d4778f9640" and "e00cf2170994245d2a664364bd2e59e74ad3a28c" have entirely different histories.
7c5d4cf99f
...
e00cf21709
5 changed files with 1 additions and 67 deletions
|
@ -5,10 +5,6 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [0.5.4.0]
|
|
||||||
|
|
||||||
- Function to decode Orchard actions with a spending key
|
|
||||||
|
|
||||||
## [0.5.3.0]
|
## [0.5.3.0]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -852,47 +852,6 @@ pub extern "C" fn rust_wrapper_orchard_note_decrypt(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern "C" fn rust_wrapper_orchard_note_decrypt_sk(
|
|
||||||
key: *const u8,
|
|
||||||
key_len: usize,
|
|
||||||
note: *const u8,
|
|
||||||
note_len: usize,
|
|
||||||
external: bool,
|
|
||||||
out: *mut u8,
|
|
||||||
out_len: &mut usize
|
|
||||||
){
|
|
||||||
let sk_input: Vec<u8> = marshall_from_haskell_var(key, key_len, RW);
|
|
||||||
let note_input: Haction = marshall_from_haskell_var(note, note_len, RW);
|
|
||||||
let action: Action<Signature<SpendAuth>> = Action::from_parts(
|
|
||||||
Nullifier::from_bytes(&to_array(note_input.nf.bytes)).unwrap(),
|
|
||||||
VerificationKey::try_from(to_array(note_input.rk.bytes)).unwrap(),
|
|
||||||
ExtractedNoteCommitment::from_bytes(&to_array(note_input.cmx.bytes)).unwrap(),
|
|
||||||
TransmittedNoteCiphertext {epk_bytes: to_array(note_input.eph_key.bytes), enc_ciphertext: to_array(note_input.enc_txt.bytes), out_ciphertext: to_array(note_input.out_txt.bytes)},
|
|
||||||
ValueCommitment::from_bytes(&to_array(note_input.cv.bytes)).unwrap(),
|
|
||||||
Signature::from(to_array(note_input.auth.bytes)));
|
|
||||||
let sk_array = to_array(sk_input);
|
|
||||||
let domain = OrchardDomain::for_nullifier(*action.nullifier());
|
|
||||||
let dec_sk = SpendingKey::from_bytes(sk_array).unwrap();
|
|
||||||
let fvk = FullViewingKey::from(&dec_sk);
|
|
||||||
let ivk = if external {
|
|
||||||
fvk.to_ivk(Scope::External)
|
|
||||||
} else {
|
|
||||||
fvk.to_ivk(Scope::Internal)
|
|
||||||
};
|
|
||||||
let pivk = PreparedIncomingViewingKey::new(&ivk);
|
|
||||||
let result = zcash_note_encryption::try_note_decryption(&domain, &pivk, &action);
|
|
||||||
match result {
|
|
||||||
Some((n, r, m)) => {
|
|
||||||
let hn = Hnote {note: n.value().inner(), recipient: r.to_raw_address_bytes().to_vec(), memo: m.to_vec()};
|
|
||||||
marshall_to_haskell_var(&hn, out, out_len, RW);
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
let hn0 = Hnote { note: 0, recipient: vec![0], memo: vec![0]};
|
|
||||||
marshall_to_haskell_var(&hn0, out, out_len, RW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn rust_wrapper_tx_read(
|
pub extern "C" fn rust_wrapper_tx_read(
|
||||||
|
|
|
@ -126,14 +126,6 @@ import ZcashHaskell.Types
|
||||||
-> `()'
|
-> `()'
|
||||||
#}
|
#}
|
||||||
|
|
||||||
{# fun unsafe rust_wrapper_orchard_note_decrypt_sk as rustWrapperOrchardNoteDecodeSK
|
|
||||||
{ toBorshVar* `BS.ByteString'&
|
|
||||||
, toBorshVar* `OrchardAction'&
|
|
||||||
, `Bool'
|
|
||||||
, getVarBuffer `Buffer DecodedNote'&
|
|
||||||
}
|
|
||||||
-> `()'
|
|
||||||
#}
|
|
||||||
{# fun unsafe rust_wrapper_tx_parse as rustWrapperTxParse
|
{# fun unsafe rust_wrapper_tx_parse as rustWrapperTxParse
|
||||||
{ toBorshVar* `BS.ByteString'&
|
{ toBorshVar* `BS.ByteString'&
|
||||||
, getVarBuffer `Buffer [BS.ByteString]'&
|
, getVarBuffer `Buffer [BS.ByteString]'&
|
||||||
|
|
|
@ -22,7 +22,6 @@ import C.Zcash
|
||||||
, rustWrapperGenOrchardSpendKey
|
, rustWrapperGenOrchardSpendKey
|
||||||
, rustWrapperOrchardCheck
|
, rustWrapperOrchardCheck
|
||||||
, rustWrapperOrchardNoteDecode
|
, rustWrapperOrchardNoteDecode
|
||||||
, rustWrapperOrchardNoteDecodeSK
|
|
||||||
, rustWrapperUADecode
|
, rustWrapperUADecode
|
||||||
, rustWrapperUfvkDecode
|
, rustWrapperUfvkDecode
|
||||||
)
|
)
|
||||||
|
@ -154,15 +153,3 @@ decryptOrchardAction key encAction =
|
||||||
decodedAction =
|
decodedAction =
|
||||||
withPureBorshVarBuffer $
|
withPureBorshVarBuffer $
|
||||||
rustWrapperOrchardNoteDecode (o_key key) encAction
|
rustWrapperOrchardNoteDecode (o_key key) encAction
|
||||||
|
|
||||||
-- | Attemtps to decode the given @OrchardAction@ using the given @OrchardSpendingKey@
|
|
||||||
decryptOrchardActionSK ::
|
|
||||||
OrchardSpendingKey -> Scope -> OrchardAction -> Maybe DecodedNote
|
|
||||||
decryptOrchardActionSK sk scope oa =
|
|
||||||
case a_value decodedAction of
|
|
||||||
0 -> Nothing
|
|
||||||
_ -> Just decodedAction
|
|
||||||
where
|
|
||||||
decodedAction =
|
|
||||||
withPureBorshVarBuffer $
|
|
||||||
rustWrapperOrchardNoteDecodeSK (getBytes sk) oa (scope == External)
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ cabal-version: 3.0
|
||||||
-- see: https://github.com/sol/hpack
|
-- see: https://github.com/sol/hpack
|
||||||
|
|
||||||
name: zcash-haskell
|
name: zcash-haskell
|
||||||
version: 0.5.4.0
|
version: 0.5.3.0
|
||||||
synopsis: Utilities to interact with the Zcash blockchain
|
synopsis: Utilities to interact with the Zcash blockchain
|
||||||
description: Please see the README on the repo at <https://git.vergara.tech/Vergara_Tech/zcash-haskell#readme>
|
description: Please see the README on the repo at <https://git.vergara.tech/Vergara_Tech/zcash-haskell#readme>
|
||||||
category: Blockchain
|
category: Blockchain
|
||||||
|
|
Loading…
Reference in a new issue