# `VideoInterop.AbandonmentGuard`
[🔗](https://github.com/emerge-elixir/video_interop/blob/v0.1.0/lib/video_interop/abandonment_guard.ex#L1)

Authenticated producer-native fallback attached to one lease holder.

The BEAM represents both ordinary references and native resource references as
references, so `is_reference/1` cannot prove that a value has a destructor.
This envelope names the producer authority that registered the native
resource. A transport can call `valid?/1` before accepting it. The authority
must decode its own Rustler resource type and return `true`.

Authorities are trusted local code, not a sandbox boundary. The callback must
return quickly without blocking or taking a lock. If its module is unavailable
during a code upgrade, validation returns `false`.
The envelope remains opaque to native consumers, which save the complete term
until the corresponding claim retires.

# `t`

```elixir
@type t() :: %VideoInterop.AbandonmentGuard{
  authority: module(),
  resource: reference()
}
```

# `video_interop_abandonment_guard?`

```elixir
@callback video_interop_abandonment_guard?(term()) :: boolean()
```

# `new`

```elixir
@spec new(reference(), module()) :: t()
```

Builds an authority envelope around a producer-native resource.

# `valid?`

```elixir
@spec valid?(term()) :: boolean()
```

Verifies the resource through its producer-specific authority.

Missing modules/functions, exceptions, exits, throws, non-boolean replies,
bare references, and malformed envelopes are rejected.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
