librustzcash/rustdoc/latest/zcash_transparent/keys/trait.IncomingViewingKey.html

28 lines
12 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Trait representing a transparent “incoming viewing key”."><title>IncomingViewingKey in zcash_transparent::keys - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-84e720fa.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="zcash_transparent" data-themes="" data-resource-suffix="" data-rustdoc-version="1.89.0-nightly (99e7c15e8 2025-06-01)" data-channel="nightly" data-search-js="search-f7877310.js" data-settings-js="settings-5514c975.js" ><script src="../../static.files/storage-4e99c027.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-fd3af306.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-32bb7600.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../zcash_transparent/index.html">zcash_<wbr>transparent</a><span class="version">0.3.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Incoming<wbr>Viewing<wbr>Key</a></h2><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.default_address" title="default_address">default_address</a></li><li><a href="#method.derive_address" title="derive_address">derive_address</a></li><li><a href="#method.deserialize" title="deserialize">deserialize</a></li><li><a href="#method.serialize" title="serialize">serialize</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In zcash_<wbr>transparent::<wbr>keys</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">zcash_transparent</a>::<wbr><a href="index.html">keys</a></div><h1>Trait <span class="trait">IncomingViewingKey</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/zcash_transparent/keys.rs.html#473-526">Source</a> </span></div><pre class="rust item-decl"><code>pub trait IncomingViewingKey: SealedChangeLevelKey + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
// Provided methods
fn <a href="#method.derive_address" class="fn">derive_address</a>(
&amp;self,
address_index: <a class="struct" href="struct.NonHardenedChildIndex.html" title="struct zcash_transparent::keys::NonHardenedChildIndex">NonHardenedChildIndex</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="../address/enum.TransparentAddress.html" title="enum zcash_transparent::address::TransparentAddress">TransparentAddress</a>, Error&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.default_address" class="fn">default_address</a>(&amp;self) -&gt; (<a class="enum" href="../address/enum.TransparentAddress.html" title="enum zcash_transparent::address::TransparentAddress">TransparentAddress</a>, <a class="struct" href="struct.NonHardenedChildIndex.html" title="struct zcash_transparent::keys::NonHardenedChildIndex">NonHardenedChildIndex</a>) { ... }
<span class="item-spacer"></span> fn <a href="#method.serialize" class="fn">serialize</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt; <a href="#" class="tooltip" data-notable-ty="Vec&lt;u8&gt;"></a> { ... }
<span class="item-spacer"></span> fn <a href="#method.deserialize" class="fn">deserialize</a>(data: &amp;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">65</a>]) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, Error&gt; { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait representing a transparent “incoming viewing key”.</p>
<p>Unlike the Sapling and Orchard shielded protocols (which have viewing keys built into
their key trees and bound to specific spending keys), the transparent protocol has no
“viewing key” concept. Transparent viewing keys are instead emulated by making two
observations:</p>
<ul>
<li><a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki">BIP32</a> hierarchical derivation is structured as a tree.</li>
<li>The <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki">BIP44</a> key paths use non-hardened derivation below the account level.</li>
</ul>
<p>A transparent viewing key for an account is thus defined as the root of a specific
non-hardened subtree underneath the accounts path.</p>
</div></details><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.derive_address" class="method"><a class="src rightside" href="../../src/zcash_transparent/keys.rs.html#476-482">Source</a><h4 class="code-header">fn <a href="#method.derive_address" class="fn">derive_address</a>(
&amp;self,
address_index: <a class="struct" href="struct.NonHardenedChildIndex.html" title="struct zcash_transparent::keys::NonHardenedChildIndex">NonHardenedChildIndex</a>,
) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="../address/enum.TransparentAddress.html" title="enum zcash_transparent::address::TransparentAddress">TransparentAddress</a>, Error&gt;</h4></section></summary><div class="docblock"><p>Derives a transparent address at the provided child index.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.default_address" class="method"><a class="src rightside" href="../../src/zcash_transparent/keys.rs.html#487-501">Source</a><h4 class="code-header">fn <a href="#method.default_address" class="fn">default_address</a>(&amp;self) -&gt; (<a class="enum" href="../address/enum.TransparentAddress.html" title="enum zcash_transparent::address::TransparentAddress">TransparentAddress</a>, <a class="struct" href="struct.NonHardenedChildIndex.html" title="struct zcash_transparent::keys::NonHardenedChildIndex">NonHardenedChildIndex</a>)</h4></section></summary><div class="docblock"><p>Searches the space of child indexes for an index that will
generate a valid transparent address, and returns the resulting
address and the index at which it was generated.</p>
</div></details><section id="method.serialize" class="method"><a class="src rightside" href="../../src/zcash_transparent/keys.rs.html#503-508">Source</a><h4 class="code-header">fn <a href="#method.serialize" class="fn">serialize</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt; <a href="#" class="tooltip" data-notable-ty="Vec&lt;u8&gt;"></a></h4></section><section id="method.deserialize" class="method"><a class="src rightside" href="../../src/zcash_transparent/keys.rs.html#510-525">Source</a><h4 class="code-header">fn <a href="#method.deserialize" class="fn">deserialize</a>(data: &amp;[<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.array.html">65</a>]) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, Error&gt;</h4></section></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/nightly/reference/items/traits.html#dyn-compatibility">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-IncomingViewingKey-for-ExternalIvk" class="impl"><a class="src rightside" href="../../src/zcash_transparent/keys.rs.html#552">Source</a><a href="#impl-IncomingViewingKey-for-ExternalIvk" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.IncomingViewingKey.html" title="trait zcash_transparent::keys::IncomingViewingKey">IncomingViewingKey</a> for <a class="struct" href="struct.ExternalIvk.html" title="struct zcash_transparent::keys::ExternalIvk">ExternalIvk</a></h3></section><section id="impl-IncomingViewingKey-for-InternalIvk" class="impl"><a class="src rightside" href="../../src/zcash_transparent/keys.rs.html#579">Source</a><a href="#impl-IncomingViewingKey-for-InternalIvk" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.IncomingViewingKey.html" title="trait zcash_transparent::keys::IncomingViewingKey">IncomingViewingKey</a> for <a class="struct" href="struct.InternalIvk.html" title="struct zcash_transparent::keys::InternalIvk">InternalIvk</a></h3></section></div><script src="../../trait.impl/zcash_transparent/keys/trait.IncomingViewingKey.js" async></script><script type="text/json" id="notable-traits-data">{"Vec<u8>":"<h3>Notable traits for <code><a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>, A&gt;</code></h3><pre><code><div class=\"where\">impl&lt;A&gt; <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/io/trait.Write.html\" title=\"trait std::io::Write\">Write</a> for <a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html\" title=\"struct alloc::vec::Vec\">Vec</a>&lt;<a class=\"primitive\" href=\"https://doc.rust-lang.org/nightly/std/primitive.u8.html\">u8</a>, A&gt;<div class=\"where\">where\n A: <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/alloc/trait.Allocator.html\" title=\"trait core::alloc::Allocator\">Allocator</a>,</div></div>"}</script></section></div></main></body></html>