Commit Graph

2229 Commits

Author SHA1 Message Date
Kris Nuttycombe c72ddb1251
Improve documentation of DiversifierKey#diversifier_index
Co-authored-by: str4d <jack@electriccoin.co>
2021-12-13 13:37:11 -07:00
Kris Nuttycombe 8e934682bb Add decryption of Sapling diversifiers.
Given a diversifier key, decrypts a diversifier to obtain
the diversifier index from which the diversifier was originally
produced.

Co-authored-by: str4d <jack@electriccoin.co>
2021-12-13 13:08:58 -07:00
Kris Nuttycombe 6fb0fbea31
Merge pull request #420 from zcash/unified-viewing-keys
`zcash_address`: Parse unified viewing keys
2021-12-07 14:15:47 -07:00
Kris Nuttycombe fd786f28b7 Ensure unrecognized prefixes map to ParseError::NotZcash 2021-12-07 12:59:41 -07:00
Kris Nuttycombe 4e906508ae Make unified container construction correctly sort items.
Newly constructed unified containers now obey ZIP 316 item
ordering rules, while parsing and reserialization preserve
order.
2021-12-07 11:07:15 -07:00
Kris Nuttycombe e7c57e4a02 Use `from` instead of a possibly-future-incompatible cast 2021-12-07 09:25:50 -07:00
Kris Nuttycombe cc8c2868eb Ensure that unknown typecodes don't duplicate known typecodes. 2021-12-07 09:16:55 -07:00
Kris Nuttycombe cccc493067 Add unknown typecodes to UA proptests. 2021-12-06 11:34:12 -07:00
Kris Nuttycombe e30f4bd094 Fix incorrect ordering of receivers in writing raw encoding. 2021-12-06 08:32:07 -07:00
Kris Nuttycombe 9144aaef0a Ensure shrinking will work properly for ufvk proptests. 2021-12-03 15:27:25 -07:00
Kris Nuttycombe fd300e0061 Apply suggestions from code review
Co-authored-by: str4d <jack@electriccoin.co>
2021-12-03 14:26:02 -07:00
Kris Nuttycombe a6420858f4 Fix clippy lints. 2021-12-03 14:21:40 -07:00
Kris Nuttycombe 76082e4287 Return correct errors for incorrectly encoded unified containers. 2021-12-03 14:15:02 -07:00
Kris Nuttycombe ba3ff42e13 Address comments from code review. 2021-12-03 12:07:26 -07:00
Kris Nuttycombe 8cf43d255f Fix clippy complaints. 2021-12-02 14:44:38 -07:00
Kris Nuttycombe 914363f9b7 Rename "to_bytes" internal method to "to_jumbled_bytes" 2021-12-02 14:44:38 -07:00
Kris Nuttycombe 2ffe5963a1 Fix the byte length of Sapling and Transparent UFVK components. 2021-12-02 14:44:38 -07:00
Kris Nuttycombe 7e629db29f Adds high-level encoding and decoding functions for unified types.
This renames the `FromReceivers` trait to `UnifiedEncoding` and makes
its public methods (as well as the private to_bytes method) function in
terms of network values rather than explicit HRP arguments. It also adds
high-level encoding and decoding methods that handle conversion to and
from the Bech32m-encoded transport format for all supported types, and
then delegates to these from locations that previously used lower-level
utilities.
2021-12-02 14:44:38 -07:00
Kris Nuttycombe 3b70731cc4 Adds `unified::SealedContainer::network_hrp` 2021-12-02 14:44:38 -07:00
Kris Nuttycombe 7d801cf71b Expose unified addresses, IVKs and Fvks 2021-12-02 14:44:38 -07:00
ying tong c8993881ae kind::unified: Make ivk::Ivk, fvk::Fvk available outside the crate.
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2021-12-02 14:44:38 -07:00
therealyingtong c4ceb8e9df Test both Sapling and Orchard receivers in arb_shielded_* proptests. 2021-12-02 14:44:38 -07:00
therealyingtong b4c1ca11c9 Remove P2SH variant for FVK and IVK. 2021-12-02 14:44:38 -07:00
therealyingtong cb06bbcf05 unified::fvk::tests: Add unit tests for parsing UFVK. 2021-12-02 14:44:38 -07:00
therealyingtong 194a790335 unified::fvk: Parse unified full viewing keys. 2021-12-02 14:44:38 -07:00
therealyingtong fc82523e31 unified::ivk::tests: Add unit tests for parsing UIVK. 2021-12-02 14:44:38 -07:00
therealyingtong 7cd12f4ee2 unified::ivk: Parse unified incoming viewing keys. 2021-12-02 14:44:38 -07:00
Kris Nuttycombe 5bb77e9149
Merge pull request #461 from nuttycom/sapling_fvk_address
Factors out sapling address generation from SaplingExtendedFullViewingKey
2021-12-02 14:10:23 -07:00
Kris Nuttycombe 1c32172209
Merge pull request #460 from zcash/unified-encoding-logic
kind::unified: Extract common unified encoding logic.
2021-12-02 12:43:27 -07:00
Kris Nuttycombe 566c973ea7
Fix comment in components/zcash_address/src/kind/unified.rs
Co-authored-by: str4d <jack@electriccoin.co>
2021-12-02 11:35:54 -07:00
Kris Nuttycombe 82be04dfaf Generalize the naming of unified containers and items. 2021-12-02 09:10:03 -07:00
Kris Nuttycombe 75591047f7 Separates raw encoding from jumbling of unified container contents. 2021-12-02 09:04:46 -07:00
Kris Nuttycombe 06bea7f936 Factors out sapling address generation from SaplingExtendedFullViewingKey.
Sapling address generation depends only on an FVK and
a diversifier key. For the purpose of unified full viewing
keys, we need to break the dependence upon Sapling extended
full viewing keys, so this makes the address generation
methods of SaplingExtendedFullViewingKey usable without
coupling them to the ability to derive child full viewing keys.
2021-11-30 20:00:36 -07:00
therealyingtong a6e6f8ace2 kind::unified: Make address::Address available outside the crate. 2021-11-30 09:05:24 -05:00
therealyingtong da1c6224f8 kind::unified: Split Unified trait into FromReceivers, ToReceivers.
This allows us to move to_bytes() into the private::SealedContainer
trait without introducing a circular dependency. This also lets us
move the Receivers type to a public trait.
2021-11-29 14:21:43 -05:00
therealyingtong c31db1b839 Move HRPs into from public Unified trait to SealedContainer trait.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2021-11-29 13:49:24 -05:00
therealyingtong b8ff3d2d48 kind::unified: Introduce private::SealedContainer and Unified traits.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2021-11-28 18:56:24 -05:00
therealyingtong 18393eefa8 kind::unified: Introduce private::SealedReceiver trait.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2021-11-28 18:55:37 -05:00
therealyingtong 406e62e7e5 [move-only] Move Receiver and test code into kind::unified::address.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2021-11-28 17:09:59 -05:00
Kris Nuttycombe 0b9d7e4303 Merge remote-tracking branch 'upstream/master' into autoshield-poc-daa 2021-11-24 15:48:02 -07:00
jarys 0ec7f97c97
Add `#![no_std]` support for zcash_note_encryption (#450)
Co-authored-by: str4d <thestr4d@gmail.com>
2021-11-24 13:58:52 +00:00
ying tong c48bb4def2
Merge pull request #452 from zcash/zcash_note_encryption-batchdomain
Introduce `zcash_note_encryption::BatchDomain` trait
2021-11-17 15:13:43 +01:00
Jack Grigg 5055033c31 zcash_primitives: Migrate to `zcash_note_encryption::BatchDomain` 2021-11-17 12:17:10 +00:00
Jack Grigg 35e7542065 zcash_note_encryption: Move domain batch APIs into a BatchDomain trait
These are the only allocating APIs; this change makes it possible to
make the crate no-std compatible.
2021-11-17 12:14:26 +00:00
jarys 6e39480c58
Add `#![no_std]` support for f4jumble. (#446)
The new `f4jumble_mut` and `f4jumble_inv_mut` functions take a `&mut [u8]`, and return a new `Error` type if the slice has an invalid length.

The original `f4jumble` and `f4jumble_inv` functions are now more efficient as they only allocate once.
2021-11-03 13:46:30 +00:00
Kris Nuttycombe fc0dd8e3eb Merge remote-tracking branch 'upstream/master' into autoshield-poc-daa 2021-10-25 13:24:03 -06:00
Kris Nuttycombe 3d7b9dc9aa
Merge pull request #438 from nuttycom/sapling_try_diversifier
Make it possible for callers to search for valid Sapling diversifiers.
2021-10-15 13:50:53 -06:00
Kris Nuttycombe 48340a4846 Fix doc comment for default address generation. 2021-10-15 13:19:25 -06:00
Kris Nuttycombe 86d4affe73 Add tests for `ExtendedFullViewingKey::address` 2021-10-11 16:34:37 -06:00
Kris Nuttycombe 70e65081c5 Add a test for DiversifierKey::diversifier 2021-10-11 16:34:37 -06:00