Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,10 @@ class FfiSmokeTest {
* DashPay private contact requests (protocol version 15): the
* `DashpayNative` symbols bind with the descriptors Kotlin declares, and
* bad input surfaces as a mapped [DashSDKException] rather than a crash.
* A null resolver is refused before any wallet lookup, and a shielded
* address that is not 43 bytes never reaches the FFI (which reads
* exactly 43). The explicit private send and private-reply accept are
* exported only by a shielded build, so they are probed only there; the
* sync, the reads and the in-kind accept are exported by every build.
* A null resolver is refused before any wallet lookup. The explicit
* private send and private-reply accept are exported only by a shielded
* build, so they are probed only there; the sync, the reads and the
* in-kind accept are exported by every build.
* The flows themselves need a protocol version 15 network with shielded
* funds; their Rust side is covered by the platform-wallet and
* platform-wallet-ffi tests.
Expand All @@ -112,12 +111,12 @@ class FfiSmokeTest {
assertThrows(DashSDKException::class.java) {
DashpayNative.sendPrivateContactRequest(
0L, ByteArray(32), 0L, 0, ByteArray(32), ByteArray(32),
null, null, null, 0L,
null, null, 0L,
)
}
assertThrows(DashSDKException::class.java) {
DashpayNative.acceptPrivateContactRequest(
0L, ByteArray(32), 0L, 0, 0L, ByteArray(42), 0L,
0L, ByteArray(32), 0L, 0, 0L, 0L,
)
}
}
Expand All @@ -127,7 +126,7 @@ class FfiSmokeTest {
}
assertThrows(DashSDKException::class.java) {
DashpayNative.acceptContactRequestReplyingInKind(
0L, ByteArray(32), 0L, 0, 0L, ByteArray(42), 0L,
0L, ByteArray(32), 0L, 0, 0L, 0L,
)
}
// The private contact read is benign on a miss (null, as Swift's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,10 @@ internal object DashpayNative {
* Send a DashPay private contact request, paid from [account]'s
* shielded notes on [walletId]. [resolverHandle] supplies the Orchard
* spend authority and the DashPay keys; [signerHandle] is the identity
* signer [TokensNative.sendContactRequest] takes. [shieldedAddress]
* must be 43 raw Orchard bytes when set. Needs the `shielded` native
* feature. Returns the created `ContactRequest` handle (destroy via
* signer [TokensNative.sendContactRequest] takes. The wallet derives
* the Orchard address the request carries, one for this contact alone.
* Needs the `shielded` native feature. Returns the created
* `ContactRequest` handle (destroy via
* [TokensNative.contactRequestDestroy]).
* ← Swift `PlatformWalletManager.sendPrivateContactRequest`.
*/
Expand All @@ -312,15 +313,16 @@ internal object DashpayNative {
recipientIdentityId: ByteArray,
accountLabel: String?,
autoAcceptProof: ByteArray?,
shieldedAddress: ByteArray?,
signerHandle: Long,
): Long

/**
* Accept the incoming contact request [requestHandle] with a private
* reply, paid from [account]'s shielded notes. Handles as for
* [sendPrivateContactRequest]. Returns the `EstablishedContact` handle
* (destroy via [TokensNative.establishedContactDestroy]).
* [sendPrivateContactRequest], and the wallet derives the Orchard
* address the reply carries the same way. Returns the
* `EstablishedContact` handle (destroy via
* [TokensNative.establishedContactDestroy]).
* ← Swift `PlatformWalletManager.acceptPrivateContactRequest`.
*/
@Suppress("LongParameterList")
Expand All @@ -330,7 +332,6 @@ internal object DashpayNative {
resolverHandle: Long,
account: Int,
requestHandle: Long,
shieldedAddress: ByteArray?,
signerHandle: Long,
): Long

Expand Down Expand Up @@ -407,7 +408,6 @@ internal object DashpayNative {
resolverHandle: Long,
account: Int,
requestHandle: Long,
shieldedAddress: ByteArray?,
signerHandle: Long,
): Long
}
Original file line number Diff line number Diff line change
Expand Up @@ -2178,9 +2178,10 @@ class PlatformWalletManager(
* The request is signed by this manager's identity signer
* ([signerHandle], the handle the public `Dashpay.sendContactRequest`
* is given) and sealed with DashPay keys derived through this manager's
* resolver, which also supplies the Orchard spend authority.
* [shieldedAddress] is the 43-byte raw Orchard address the contact may
* pay us at privately. Blocks for the Halo 2 proof.
* resolver, which also supplies the Orchard spend authority. The
* request carries an Orchard address the contact may pay us at
* privately, which the wallet derives for this contact alone. Blocks
* for the Halo 2 proof.
*
* Before anything is paid the wallet reads DashPay's private store for
* the sender to its end. Throws
Expand All @@ -2204,7 +2205,6 @@ class PlatformWalletManager(
recipientIdentityId: ByteArray,
accountLabel: String? = null,
autoAcceptProof: ByteArray? = null,
shieldedAddress: ByteArray? = null,
account: Int = 0,
): ContactRequestRef = teardownGate.op {
require(account >= 0) { "account must be non-negative, got $account" }
Expand All @@ -2218,7 +2218,6 @@ class PlatformWalletManager(
recipientIdentityId,
accountLabel,
autoAcceptProof,
shieldedAddress,
signerHandle,
)
}
Expand All @@ -2235,16 +2234,15 @@ class PlatformWalletManager(
* A host accepts with [acceptContactRequestReplyingInKind], which
* picks this reply itself; this explicit accept stays for a host that
* wants a private reply. The reply is signed by this manager's identity
* signer ([signerHandle]).
* [shieldedAddress] is the 43-byte raw Orchard address the contact may
* pay us at privately. Blocks for the Halo 2 proof.
* signer ([signerHandle]). It carries an Orchard address the contact
* may pay us at privately, which the wallet derives for this contact
* alone. Blocks for the Halo 2 proof.
*
* @return the established contact; close it (or `use {}`) when done.
*/
suspend fun acceptPrivateContactRequest(
walletId: ByteArray,
request: ContactRequestRef,
shieldedAddress: ByteArray? = null,
account: Int = 0,
): EstablishedContactRef = teardownGate.op {
require(account >= 0) { "account must be non-negative, got $account" }
Expand All @@ -2255,7 +2253,6 @@ class PlatformWalletManager(
mnemonicResolver.nativeHandle,
account,
request.value,
shieldedAddress,
signerHandle,
)
}
Expand All @@ -2274,9 +2271,9 @@ class PlatformWalletManager(
* [request] is the incoming request (`Dashpay.incomingContactRequest`).
* The reply is signed by this manager's identity signer ([signerHandle]);
* the Orchard spend authority comes from this manager's resolver and is
* derived only for a private reply. [shieldedAddress] is the 43-byte raw
* Orchard address the contact may pay us at privately; a public reply
* ignores it.
* derived only for a private reply. A private reply carries an Orchard
* address the contact may pay us at privately, which the wallet derives
* for this contact alone.
*
* A public or adopted reply needs neither shielded support nor a
* mnemonic read for the payment. Throws
Expand All @@ -2296,7 +2293,6 @@ class PlatformWalletManager(
suspend fun acceptContactRequestReplyingInKind(
walletId: ByteArray,
request: ContactRequestRef,
shieldedAddress: ByteArray? = null,
account: Int = 0,
): EstablishedContactRef = teardownGate.op {
require(account >= 0) { "account must be non-negative, got $account" }
Expand All @@ -2307,7 +2303,6 @@ class PlatformWalletManager(
mnemonicResolver.nativeHandle,
account,
request.value,
shieldedAddress,
signerHandle,
)
}
Expand Down
Loading
Loading