Skip to content

fix(streaming): wire delegate authorization in withdraw() and document auth model - #329

Merged
Austinaminu2 merged 1 commit into
FlowwStar:mainfrom
Devdave-0x:fix/issue-265-delegate-withdrawal
Jul 25, 2026
Merged

fix(streaming): wire delegate authorization in withdraw() and document auth model#329
Austinaminu2 merged 1 commit into
FlowwStar:mainfrom
Devdave-0x:fix/issue-265-delegate-withdrawal

Conversation

@Devdave-0x

Copy link
Copy Markdown
Contributor

Summary

  • withdraw() previously called stream.recipient.require_auth() unconditionally, ignoring the Delegate(stream_id) storage entry written by set_delegate()
  • Registered delegates could never authorize a withdrawal despite being stored
  • The fix checks Delegate(stream_id) first; when a delegate is present, delegate.require_auth() is called instead — the delegate acts on behalf of the recipient with tokens still sent to the recipient's address
  • When no delegate is registered, the original recipient-auth path is used unchanged
  • Updated the doc-comment to make the exclusive-delegate semantics explicit

Test plan

  • test_auth_delegate_can_withdraw (test_security.rs) — delegate can now authorize a withdrawal
  • test_auth_recipient_cannot_withdraw_without_delegate_auth_when_delegate_set — correctly panics when only recipient auth is provided but a delegate is active
  • All other existing tests continue to pass

Closes #265

…t auth model

Previously withdraw() called stream.recipient.require_auth() unconditionally,
ignoring any delegate registered via set_delegate(). Registered delegates
could never authorize a withdrawal despite being stored.

The fix checks Delegate(stream_id) in persistent storage first; when a
delegate is present the delegate's auth is required (they act on behalf of
the recipient, with tokens still sent to the recipient). When no delegate is
registered the original recipient-auth path is used unchanged.

Clarify the doc-comment to make the exclusive-delegate semantics explicit so
callers understand that setting a delegate transfers withdrawal authority.

Closes FlowwStar#265
@drips-wave

drips-wave Bot commented Jul 25, 2026

Copy link
Copy Markdown

@Devdave-0x Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: delegate withdrawal mechanism is non-functional — withdraw() ignores registered delegates

2 participants