Commit Graph

37 Commits

Author SHA1 Message Date
Kris Nuttycombe 94c8d8e7ef Return the network type for encoding addresses as part of the network parameters. 2022-06-30 12:09:32 -06:00
Kris Nuttycombe 0e098e1f17 Test correctness of unknown ufvk element roundtrip encoding. 2022-06-29 10:13:22 -06:00
Jack Grigg b52e949bd6 zcash_client_backend: Migrate to correct ZIP 316 UFVK encoding
We also add support for parsing Orchard full viewing keys from encoded
UFVKs (rather than treating them as unknown). `UnifiedSpendingKey` still
does not have Orchard support, so `UnifiedFullViewingKey`s will be
generated without Orchard components.
2022-06-17 10:03:17 +00:00
Jack Grigg 76d015ed11 zcash_client_backend: Fix `UnifiedFullViewingKey` Sapling item type
Per ZIP 316, the Sapling FVK Encoding only includes `(ak, nk, ovk, dk)`
which is a subset of the Sapling `ExtendedFullViewingKey`. We therefore
need to use `DiversifiableFullViewingKey` inside `UnifiedFullViewingKey`
in order to make it parseable from the UFVK string encoding.

`zcash_client_sqlite::wallet::get_extended_full_viewing_keys` has been
removed as a consequence of this change: we can no longer reconstruct
the correct `ExtendedFullViewingKey` from the `UnifiedFullViewingKey`.
2022-06-17 10:03:17 +00:00
Jack Grigg d8b860207d zcash_client_backend: Remove account from `UnifiedFullViewingKey`
The account number is not stored in the ZIP 316 UFVK encoding, and in
general won't necessarily be known (e.g. if a UFVK is being imported
into a wallet).

`zcash_client_sqlite::wallet::init::init_accounts_table` reverts to its
previous behaviour of requiring the provided `&[UnifiedFullViewingKey]`
to be indexed by account number.
2022-06-17 10:03:17 +00:00
Jack Grigg e86ba927af zcash_client_backend: Add a fake UFVK encoding
We can't use the real ZIP 316 encoding until `UnifiedFullViewingKey` has
been altered to not store a Sapling `ExtendedFullViewingKey`. But making
that change first requires fully migrating `zcash_client_sqlite` in the
same commit (as its entire API is built around `ExtendedFullViewingKey`).

Instead, we define a temporary fake encoding, to enable migrating the
`zcash_client_sqlite` APIs more incrementally.
2022-06-14 02:18:25 +00:00
Jack Grigg 555a621a10 Add `UnifiedAddress` generation to `UnifiedFullViewingKey` 2022-06-13 23:04:18 +00:00
Kris Nuttycombe e20de50b84 Make AccountId internal representation private. 2022-02-10 11:30:02 -07:00
Kris Nuttycombe a304c3953b Fix Clippy beta linting complaints. 2022-02-02 16:02:45 -07:00
Kris Nuttycombe 9c2d485c80 Address comments from code review.
Co-authored-by: str4d <jack@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-02-02 10:33:41 -07:00
Kris Nuttycombe 6e11f2d11a Validate ZIP 321 request by roundtrip through the URI format.
Co-authored-by: str4d <jack@electriccoin.co>
2022-01-27 16:08:04 -07:00
Kris Nuttycombe a1e693d15f Remove the Wif type; it should not be used.
We should attempt to avoid passing spending keys back and forth
across the FFI entirely, but in any case this is no longer the
correct type to use at this boundary; we should use the encoding
of the transparent component of a unified spending key instead.
2022-01-27 16:08:04 -07:00
Kris Nuttycombe 6fcdfda69e Derive OVKs from transparent account-level key, not child keys.
This also renames a number of legacy key types to better reflect
their intended use.
2022-01-26 13:36:27 -07:00
Kris Nuttycombe f58d191439 Move transparent account keys to zcash_primitives. 2022-01-25 08:53:51 -07:00
therealyingtong a4c9f53a3a Move ExternalPrivKey, ExternalPubKey to zcash_primitives. 2022-01-22 22:29:45 -07:00
Kris Nuttycombe 15eb5aab50 Fix a minor naming error in AccountPubKey 2022-01-21 19:08:26 -07:00
Kris Nuttycombe 7d873e9d79 Fix test compilation errors related to UFVK construction. 2022-01-21 19:01:32 -07:00
Kris Nuttycombe 574ca4e180 Add accessors to UnifiedSpendingKey 2022-01-21 18:20:12 -07:00
Kris Nuttycombe 281a4d5c16 Add accessors for the ExtendedPrivKey wrapped by AccountPrivKey 2022-01-21 18:07:23 -07:00
Kris Nuttycombe 00aee09662 Add accessors for the ExtendedPubKey wrapped by AccountPubKey 2022-01-21 14:02:51 -07:00
Kris Nuttycombe dec395a5b0 Add unified spending keys. 2022-01-21 13:54:23 -07:00
Kris Nuttycombe 8f408354b9 Remove cyclic dev dependency between zcash_client_backend and zcash_client_sqlite. 2022-01-20 21:50:26 -07:00
Kris Nuttycombe 79bd2f7733 Add missing documentation & rustfmt. 2022-01-20 20:14:44 -07:00
Kris Nuttycombe ffc4d0cefb Add newtypes for transparent keys at the account & external levels.
This updates UnifiedFullViewingKey to conform to ZIP 316, and
adds types that facilitate this support. These types should likely
be factored out from `zcash_client_backend` into `zcash_primitives`
along with the remainder of the existing unified address support.
2022-01-20 20:03:20 -07:00
Kris Nuttycombe 37e6d3a2bc Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: ying tong <yingtong@z.cash>
2022-01-20 16:43:57 -07:00
Kris Nuttycombe cc58a21ad7 Feature-flag transparent functionality in zcash_client_sqlite
This fixes the wasm32-wasi build issues by excluding the
hdwallet dependencies which are not wasm32-wasi compatible.
2021-10-04 16:53:55 -06:00
Kevin Gorham 8e16d93f94 Update accounts table create statement.
This PR makes the opinionated change that T-addrs are required
to be supported when using the zcash_client_sqlite backend.
2021-04-16 14:26:53 -06:00
Kevin Gorham 5595ca225c Add public key derivations and related tests. 2021-04-16 14:26:53 -06:00
Kris Nuttycombe a3bc1e3e63 Rename get_spendable -> get_unspent 2021-04-16 14:23:28 -06:00
Kris Nuttycombe ca3e3a4595 Add WIF derivation for transparent keys.
With @gmale
2021-04-16 14:23:28 -06:00
Kris Nuttycombe 862e221a9b Put transparent dependencies behind a feature flag. 2021-04-16 14:23:26 -06:00
Francisco Gindre cff457ff15 PoC Auto-Shielding
Add retrieval of transparent UTXOs to WalletRead

Co-authored-by: Kris Nuttycombe <kris@electriccoin.co>
Co-authored-by: Kevin Gorham <anothergmale@gmail.com>
2021-04-16 14:22:16 -06:00
Kris Nuttycombe a0c441817a Documentation fixes in zcash_client_backend. 2021-03-25 18:26:57 -06:00
Kris Nuttycombe 1ad9294933 Remove static determination of network state.
In the interest of making the library usable for both
testnet and mainnet without recompilation, static resolution
of network parameters has been replaced with a parameter passed
to the relevant functions. This also moves addres prefix constants
into the network parameters.
2020-09-17 10:34:42 -06:00
Jack Grigg 450087e280
Add test for spending_key panic on short seed 2019-09-17 23:58:14 +01:00
Jack Grigg 9377b78b35
Panic if spending_key is given a seed shorter than 32 bytes
This enforces the MUST requirement in ZIP 32. A panic is used instead of
an error because this should be considered an implementation error.
Ideally the type system would prevent this from occurring at all.

Closes #125.
2019-09-17 21:28:23 +01:00
Jack Grigg 81b2b1b554
Wallet spending key derivation path 2019-06-27 16:19:33 +01:00