Prepare release
This commit is contained in:
parent
0dd9680158
commit
76d42c46d4
5 changed files with 963 additions and 18 deletions
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -5,12 +5,23 @@ 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/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
## [0.1.0] - 2023-06-14
|
||||
|
||||
### Added
|
||||
|
||||
- Function `decodeHexText`
|
||||
- Function `decodeBech32`
|
||||
- Function `f4Jumble`
|
||||
- Function `isValidUnifiedAddress`
|
||||
- Function `f4UnJumble`
|
||||
- Function `isValidShieldedAddress`
|
||||
- Function `decodeBech32`
|
||||
- Function `isValidSaplingViewingKey`
|
||||
- Function `matchSaplingAddress`
|
||||
- Function `isValidUnifiedAddress`
|
||||
- Function `decodeUfvk`
|
||||
- Function `decryptOrchardAction`
|
||||
- Type `RawData`
|
||||
- Type `ShieldedOutput`
|
||||
- Type `OrchardAction`
|
||||
- Type `OrchardDecodedAction`
|
||||
- Type `UnifiedFullViewingKey`
|
||||
|
||||
|
|
876
librustzcash-wrapper/Cargo.lock
generated
876
librustzcash-wrapper/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -16,9 +16,24 @@ use haskell_ffi::{
|
|||
FromHaskell, HaskellSize, ToHaskell
|
||||
};
|
||||
|
||||
use zcash_primitives:: sapling::{
|
||||
use zcash_primitives::{
|
||||
zip32::Scope as SaplingScope,
|
||||
transaction::components::sapling::{
|
||||
GrothProofBytes,
|
||||
OutputDescription,
|
||||
CompactOutputDescription
|
||||
},
|
||||
sapling::{
|
||||
value::ValueCommitment as SaplingValueCommitment,
|
||||
keys::FullViewingKey as SaplingViewingKey,
|
||||
PaymentAddress
|
||||
note_encryption::SaplingDomain,
|
||||
PaymentAddress,
|
||||
note::ExtractedNoteCommitment as SaplingExtractedNoteCommitment
|
||||
},
|
||||
consensus::{
|
||||
MainNetwork,
|
||||
BlockHeight
|
||||
}
|
||||
};
|
||||
|
||||
use zcash_address::{
|
||||
|
@ -38,7 +53,7 @@ use orchard::{
|
|||
value::ValueCommitment
|
||||
};
|
||||
|
||||
use zcash_note_encryption;
|
||||
use zcash_note_encryption::EphemeralKeyBytes;
|
||||
|
||||
use bech32::{
|
||||
decode,
|
||||
|
@ -71,6 +86,23 @@ impl<RW> ToHaskell<RW> for RawData {
|
|||
//}
|
||||
//}
|
||||
|
||||
#[derive(BorshSerialize, BorshDeserialize)]
|
||||
pub struct HshieldedOutput {
|
||||
cv: Vec<u8>,
|
||||
cmu: Vec<u8>,
|
||||
eph_key: Vec<u8>,
|
||||
enc_txt: Vec<u8>,
|
||||
out_txt: Vec<u8>,
|
||||
proof: Vec<u8>
|
||||
}
|
||||
|
||||
impl<RW> FromHaskell<RW> for HshieldedOutput {
|
||||
fn from_haskell(buf: &mut &[u8], _tag: PhantomData<RW>) -> Result<Self> {
|
||||
let x = HshieldedOutput::deserialize(buf)?;
|
||||
Ok(x)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(BorshSerialize, BorshDeserialize)]
|
||||
pub struct Haction {
|
||||
nf: Vec<u8>,
|
||||
|
@ -279,6 +311,36 @@ pub extern "C" fn rust_wrapper_ufvk_decode(
|
|||
}
|
||||
}
|
||||
|
||||
//#[no_mangle]
|
||||
//pub extern "C" fn rust_wrapper_sapling_note_decrypt(
|
||||
//key: *const u8,
|
||||
//key_len: usize,
|
||||
//note: *const u8,
|
||||
//note_len: usize,
|
||||
//out: *mut u8,
|
||||
//out_len: &mut usize
|
||||
//){
|
||||
//let evk: Vec<u8> = marshall_from_haskell_var(key, key_len, RW);
|
||||
//let note_input: HshieldedOutput = marshall_from_haskell_var(note,note_len,RW);
|
||||
//let svk = ExtendedFullViewingKey::read(&*evk);
|
||||
//match svk {
|
||||
//Ok(k) => {
|
||||
//let domain = SaplingDomain::for_height(MainNetwork, BlockHeight::from_u32(2000000));
|
||||
//let action: CompactOutputDescription = CompactOutputDescription {
|
||||
//ephemeral_key: EphemeralKeyBytes(to_array(note_input.eph_key)),
|
||||
//cmu: SaplingExtractedNoteCommitment::from_bytes(&to_array(note_input.cmu)).unwrap(),
|
||||
//enc_ciphertext: to_array(note_input.enc_txt)
|
||||
//};
|
||||
//let fvk = k.to_diversifiable_full_viewing_key().to_ivk(SaplingScope::External);
|
||||
//let result = zcash_note_encryption::try_note_decryption(&domain, &ivk, &action);
|
||||
//}
|
||||
//Err(_e) => {
|
||||
//let hn0 = Hnote { note: 0, recipient: vec![0], memo: vec![0] };
|
||||
//marshall_to_haskell_var(&hn0, out, out_len, RW);
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn rust_wrapper_orchard_note_decrypt(
|
||||
key: *const u8,
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
{-# LANGUAGE DerivingStrategies #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE DerivingVia #-}
|
||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
|
||||
module ZcashHaskell.Types where
|
||||
|
@ -33,6 +31,20 @@ data UnifiedFullViewingKey =
|
|||
deriving anyclass (Data.Structured.Show)
|
||||
deriving (BorshSize, ToBorsh, FromBorsh) via AsStruct UnifiedFullViewingKey
|
||||
|
||||
data ShieldedOutput =
|
||||
ShieldedOutput
|
||||
{ s_cv :: BS.ByteString
|
||||
, s_cmu :: BS.ByteString
|
||||
, s_ephKey :: BS.ByteString
|
||||
, s_encCipherText :: BS.ByteString
|
||||
, s_outCipherText :: BS.ByteString
|
||||
, s_proof :: BS.ByteString
|
||||
}
|
||||
deriving stock (Eq, Prelude.Show, GHC.Generic)
|
||||
deriving anyclass (SOP.Generic, SOP.HasDatatypeInfo)
|
||||
deriving anyclass (Data.Structured.Show)
|
||||
deriving (BorshSize, ToBorsh, FromBorsh) via AsStruct ShieldedOutput
|
||||
|
||||
data OrchardAction =
|
||||
OrchardAction
|
||||
{ nf :: BS.ByteString
|
||||
|
|
|
@ -253,7 +253,7 @@ main = do
|
|||
let rawSa = decodeBech32 sa
|
||||
let rawSa' = decodeBech32 sa'
|
||||
it "is mainnet" $ do hrp rawKey `shouldBe` "zxviews"
|
||||
it "is valid Sapling raw key" $ do
|
||||
it "is valid Sapling extended full viewing key" $ do
|
||||
isValidSaplingViewingKey (bytes rawKey) `shouldBe` True
|
||||
it "matches the right Sapling address" $ do
|
||||
matchSaplingAddress (bytes rawKey) (bytes rawSa) `shouldBe` True
|
||||
|
|
Loading…
Reference in a new issue