ic-auth 0.39.0

Portable authentication, delegation proof verification and local session machinery
Documentation
# IC Auth

Independent application authentication protocol libraries for the Internet
Computer, with a wallet-authentication service planned.

The implementation owns IC signature/proof contracts, portable credential
admission and caller-bound local sessions. Canic consumes these libraries through
host adapters; applications such as Toko retain account and resource policy.
Wallet-backed identities and their service are planned, not current endpoints.
No Auth library or future service may depend on either project.

## Status

Release history is in the [changelog](CHANGELOG.md). The libraries implement
portable certified and enrolled Ed25519 verification, one local session engine,
replay/revocation bookkeeping and explicit protected authority/work budgets. See the [session contract](docs/protocol/sessions.md)
and [current handoff](docs/status/current.md) for implementation and validation.

Protocol types and Wire release together as **Protocol**; `ic-auth` releases
independently as **Engine**. Engine-only changes preserve Protocol's Rust package
identity. See [release selection](docs/development/setup.md#releases-and-publication).

The existing [signature](docs/protocol/signatures.md), [delegation](docs/protocol/delegation.md),
[signature preparation](docs/performance/signature-preparation.md),
[certificate issuance](docs/protocol/certificate-issuance.md) and
[chain-key](docs/protocol/chain-key-signatures.md) helpers remain reusable primitives.
Application resource permissions and IC ingress delegation remain separate.

The private [browser client](docs/protocol/browser-client.md) supplies one portable
admission coordinator, a durable logout journal, guarded SDK identity and HTTP
logout transport. Its Rust-owned IC Wire contracts are in `crates/ic-auth-wire/`.
The former token prepare/retrieve client and stores are retired: the maintainer
confirmed no deployed old records or unresolved old issuance. New portable
journals still preserve uncertainty. The separate Rust delegated-token API is
also retired after explicit confirmation of no deployed users or unresolved issuance. Production issuer/enrollment and consumer
integration remain pending; reference qualification is separate from adoption.

**Production issuer/enrollment lifecycle, wallet login and Canic's per-operation
persistent session adapter remain unimplemented.** The reference receiver uses
volatile state, with a separate fixture checkpoint for upgrade qualification.
The [IC Testkit fixture](docs/development/testkit-qualification.md) exercises actual
certification, portable sessions, upgrades and signed ingress; it is not a
production wallet service or evidence of completed consumer adoption.
The unpublished native utility in `crates/ic-auth-tooling/` delegates file operations to
IC Host and package-lock subset admission to IC Build; release identity and
publication/retry policy remain here.

Canic is adopting the shared libraries; its complete runtime verifier and durable
host integration remain consumer work. The
[Canic adoption contract](docs/integration/canic-adoption.md) maps the published libraries
to its feature, authority, storage and certification boundaries; implementation
and acceptance belong in [Canic #491](https://github.com/dragginzgame/canic/issues/491).

- [Architecture and ownership]docs/design/extraction.md
- [Current handoff]docs/status/current.md
- [Developer setup and commands]docs/development/setup.md
- [Portable browser client and consumer boundary]docs/protocol/browser-client.md
- [Minimum Rust compiler and package qualification]docs/development/msrv.md
- [Shared maintenance task catalog]https://github.com/dragginzgame/toko-tooling/blob/12459b6029115b830b8477879d3bea2f030b6e63/tasks/README.md
- [Canic source review and incorporation boundary]docs/design/canic-source-review.md
- [Extraction and Canic adoption tracker]https://github.com/dragginzgame/canic/issues/491
- [Agent instructions]AGENTS.md

## Application authentication

The accepted application flow is **portable proof admission → caller-bound local session
→ scoped session checks**. Each receiving canister admits the credential under its
protected fleet, role and scope policy. Ordinary application calls use the
authenticated ingress caller and the local session; they do not carry a token.
Portable credential verification and atomic admission share one session engine.
Application resource permissions and IC ingress signatures remain distinct.

This is the coordinated portable consumer contract, not a claim that Canic/Toko have
completed the cut. Their guards, Wire endpoints and frontend calls must change
together under the [adoption contract](docs/integration/canic-adoption.md).

## Workspace

```text
Cargo.toml                     # Virtual workspace and dependency catalog
Cargo.lock                     # One selected Rust dependency graph
crates/
  ic-auth-protocol-types/      # Passive auth contracts and validated identifiers
  ic-auth-wire/                # Bounded transport and generated browser codecs
  ic-auth/                     # Encoding, proof verification and session machinery
apps/
  tooling/                     # Unpublished native release/publication file utility
  qualification/               # Internal Wasm host and IC Testkit/IC-agent tests
packages/
  client/                      # Private browser lifecycle client and generated contracts
```

The types package is `ic-auth-protocol-types` (Rust import
`ic_auth_protocol_types`). The unrelated [`ic_auth_types`](https://docs.rs/crate/ic_auth_types/0.1.1)
package belongs to another IC-Auth project and does not implement our application
token/proof contracts. Crates.io treats hyphens and underscores as colliding
names, so changing only the punctuation cannot resolve that conflict.

The public domain types depend directly on canonical `ic-platform-types`
identities. Auth's engine selects Types' `principal-self-authenticating`
for browser-key hashing, with byte-preserving conversions at external
Agent/Testkit/crypto boundaries. Default/session, wallet-signature and passive
contracts exclude Candid/raw IC0. Certificate capabilities and the reference
Wasm admit Platform's upstream certificate dependencies under a scoped
exception; native Agent/Testkit also retain their required Candid dependencies.
Platform supplies signature creation/verification; `ic-platform-runtime` supplies
the Candid-free runtime. Auth retains admission limits, protected authority and session policy. See the
[Platform migration](docs/integration/canic-adoption.md#platform-015-migration) and
[dependency boundary](docs/development/setup.md#ic-platform-boundary).

Application endpoints, generated TypeScript, private fixture controls and upgrade
checkpoints use bounded native Serde IC Wire contracts. The root dependency
catalog owns the selected Wire and Types versions; consumers exchanging Rust
types align those identities. Qualify frame bytes and method IDs when changing
those suppliers.
The Auth 0.15 admission cut uses a new method identity; update its receiver and client
together. Credential/read/logout frames, signed material and retained production
records keep their formats. The unpublished finite-Wire checkpoint is retired;
no implicit browser or production storage reset is permitted. See the
[consumer transport contract](docs/integration/canic-adoption.md#wire-transport).

A future wallet service would be a Rust package under `crates/`. No accepting
wallet endpoint is created before its complete proof verification and service
contracts; this repository contains no Canic fleet.

With the [declared tools](docs/development/setup.md) prepared, run the focused checks:

```sh
make test-types
make test-protocol
make test-chain-key-signatures
make test-signatures
make test-signature-store
make test-certified-proofs
make test-sessions
make test-qualification
make check-wasm
```

Planned wallet authentication uses custom Solana/Ethereum login challenges without
SIWS or SIWE, with established signature primitives and wallet message signing.
Wallet adapters remain unimplemented; see the [wallet design](docs/design/0.6-portable-authentication.md#wallet-account-authentication).
NFTs remain in their application's ledger. This service does not mint, index,
bridge or custody wallet assets.

Canic integration uses local library calls. It must not add a remote authentication
request to every protected application call.

## Ownership and dependencies

| Owner | Capability and integration boundary |
| --- | --- |
| IC Auth | Checked protocol types, signed byte contracts, proof/certificate semantics, session/replay/revocation transitions, bounded Auth transport layouts and the private admission/logout client. |
| IC Wire | Canonical transport codec, bounded schema/derive and TypeScript generator. Auth projects its own domain types and generates client artifacts through this dependency. |
| IC Host / IC Build | Native file/process operations and generic Cargo lock admission. Auth supplies paths, byte budgets, package isolation and release policy. |
| IC Testkit | Native canister transport, server selection and lifecycle support. Auth retains its authentication-specific integration assertions. |
| IC Memory / CDK | Memory-backed checkpoint and canister runtime support in the unpublished qualification fixture. Neither enters the published Auth library graph. |
| Canic | Fleet authority, issuer enrollment/renewal, endpoint guards, caller/clock, certification publication and atomic production storage. |
| Toko | User/account linking, project permissions, frontend custody and application assets. |

Signed claims, bounded transport and checked stored records serve different trust
boundaries; their independent validation is intentional. Production wallet/issuer
and durable host acceptance remain explicit unfinished work, not alternative
authentication flows. The [current handoff](docs/status/current.md) records
current qualification; the [accepted design](docs/design/extraction.md) owns the
extraction boundaries. Superseded handoff journals remain in Git history.

## License and contributions

See the canonical [Toko Studios Network Licence](LICENSE.md) and
[contribution policy](CONTRIBUTING.md).

## Source origin notice

The Canic-derived source is identified in the
[source review](docs/design/canic-source-review.md). Its required notice follows.

MIT License

Copyright (c) 2024 Canic contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.