Packages
Native Elixir authentication compatible with datadeft-auth Rust.
Current section
Files
Jump to
Current section
Files
datadeft_auth
PORT-CUTOVER.md
PORT-CUTOVER.md
# Moving from the old Elixir Port binding
The 0.8 package is not a drop-in replacement for the old `DatadeftAuth` process.
Remove the Port child specification and its executable. The Hex package
requires neither a Rust toolchain nor a child process. Do not run the old and
new implementations as Mix dependencies in the same application; they use the
same OTP application name.
| Old Port operation | Native API |
| --- | --- |
| `start_link`, `status` | Construct the application's repository/delivery adapters, load keys and validate service configuration at setup. Use application-owned health checks. |
| `request_link` | `MagicLink.Service.Request.request/5`, or the optional `MagicLink.Plug` request handler. |
| `landing`, `flow_state`, `confirm` | `MagicLink.Service.Flow.land/2`, `read_state/2`, `confirm/4`; keep scanner GET and same-origin confirmation POST separate. |
| `validate_session`, `logout` | `MagicLink.Service.Session.validate/3`; use `validate_for_logout/2` followed by `Session.revoke/2`, or the optional Plug logout handler. |
| `get_user` | `MagicLink.Service.Admin.get_user/2` for authorized admin workflows; for normal authenticated requests use the validated session record. |
| `pow_challenge`, `pow_verify`, `pow_admit` | `PoW.Flow.create/4`, `verify/6`, `admit/5`, or the independent `PoW.Plug` helpers. |
| `fake_last_magic_link` | Use the Bandit example's private local mailbox in development; never provide a mailbox or token retrieval endpoint in production. |
Module names in the table are relative to `DatadeftAuth`. Use [USAGE.md](USAGE.md)
and the [Bandit example](../examples/bandit_magic_link/README.md) for wiring.
## Deployment checklist
1. Inventory the existing DynamoDB schema, cookies, key IDs, active/previous
keys, policy and trusted edge configuration. Mixed operation is tested
against the Rust **0.7** contract. Do not assume older Port-only deployments
or storage shapes are compatible. Rehearse with synthetic data and require
a fresh sign-in when old credentials cannot be validated.
2. Construct the new services with the same purpose-separated key material and
intended shared table. Migrate keyed email lookups and finish the storage
rotation window before retiring the previous key. Use a shared proof budget
across all serving nodes; do not reset it during cutover.
3. Match origin/cookie scope, confirmation URLs and request policies. Configure
the credential source and delivery using [AWS-INTEGRATION.md](AWS-INTEGRATION.md).
Never send test links or write test accounts against production data.
4. Rehearse scanner-safe landing, explicit confirmation, revocation/logout,
and a disable/re-enable sequence. Monitor aggregate refusal counters only;
do not log cookie, challenge, email, or authorization values.
5. Remap the application's error handling. A storage timeout during confirm
can be indeterminate. Do not blindly replay the confirmation with a new
attempt; offer a fresh sign-in link as needed. Check that any rollback can
still verify active cookies and read the shared data before routing traffic.
This is migration guidance, not release acceptance. See
[RELEASE-READINESS.md](RELEASE-READINESS.md) for gates still pending.