# ic-auth
Authentication proof verification and bounded receiver and issuer state. Cryptographic primitives are supplied by IC Platform; callers own authority, time, transactions and certification publication.
## Select storage on fresh installation
Choose storage independently for the receiver and issuer. For example, a host
with both owners and an Ed25519 receiver can use this dependency:
```toml
[dependencies]
ic-auth = { version = "0.49.1", features = ["receiver-stable", "issuer-stable", "ed25519-verification"] }
```
| Receiver | `receiver-memory` · `MemoryReceiver::new_fresh(config, now_ns)` | `receiver-stable` · `StableReceiver::new_fresh(lease, config, now_ns)` |
| Issuer | `issuer-memory` · `MemoryIssuer::new_fresh(config, now_ns)` | `issuer-stable` · `StableIssuer::new_fresh(lease, config, now_ns)` |
Import the receiver types from `ic_auth::receiver_memory` and the issuer types
from `ic_auth::issuer_memory`. Each stable feature includes its memory feature,
so a single build can select either constructor from trusted install configuration.
Use `state()` on a stable owner to run the same operations as its volatile counterpart.
Give each stable owner a dedicated host-owned `ic-storage` lease. Call `seal()`
in pre-upgrade. In post-upgrade, reacquire the same lease and call
`StableReceiver::reopen(lease, config, now_ns)` or
`StableIssuer::reopen(lease, config, now_ns)` with the original configuration
and current trusted time. Trap on failure so the IC rolls back the upgrade.
Each checkpoint holds at most 8 MiB of encoded state. Refresh the receiver's
authenticated enrollment before serving sessions. A volatile installation
that loses its state stays closed.
## Optional permissions within an endpoint
Use `authorize_with_scopes` when a response depends on an additional permission.
Pass the mandatory scopes to the receiver and check optional scopes inside the
callback. For example, a profile endpoint can include private fields only when
the admitted session holds the additional scope.
```rust
load_profile(session.receipt.issuer, session.receipt.subject, include_private)
})
```
See the
[repository](https://github.com/dragginzgame/ic-auth) for design, features and
qualification evidence. Licensed under the included Toko Studios Network Licence.