# Quickstart: SDK Publish-Ready Documentation

**Feature**: 001-sdk-publish-ready
**Date**: 2026-01-17

## Overview

This quickstart guides you through preparing the LastID Rust SDK for public release by addressing the identified issues.

## Prerequisites

- Rust 1.85+ installed
- Repository cloned and on branch `001-sdk-publish-ready`
- Editor with Rust support

## Step 1: Fix Test Compilation (Critical)

The `tests/contract_idp_client.rs` file has test functions calling `request_credential` with 2 arguments, but the trait now requires 3 arguments (policy, bearer_token, dpop_proof).

**Fix**: Update all `request_credential` calls to include the bearer token:

```rust
// Before (broken)
mock.request_credential(policy, "dpop_proof").await;

// After (fixed)
mock.request_credential(policy, "test_bearer_token", "dpop_proof").await;
```

**Affected functions** (5 total):
- `contract_request_credential_returns_response_on_success`
- `contract_request_credential_returns_400_for_invalid_policy`
- `contract_request_credential_returns_401_for_invalid_dpop`
- `contract_request_credential_returns_rate_limited_for_429`
- `contract_request_credential_returns_network_error_for_failures`

**Verify**:
```bash
cargo test --all-features
```

## Step 2: Fix Clippy Warnings (Important)

Run clippy to see all warnings:
```bash
cargo clippy --all-features 2>&1 | grep "warning:"
```

**Common fixes**:

1. **Unnested or-patterns**:
   ```rust
   // Before
   Foo::A | Foo::B | Foo::C => {}
   // After
   Foo::A | Foo::B | Foo::C => {}  // Usually fine, check context
   ```

2. **Clone::clone() inefficiency**:
   ```rust
   // Before
   let x = Clone::clone(&y);
   // After
   let x = y.clone();
   ```

3. **Format string variables**:
   ```rust
   // Before
   format!("{}", x)
   // After
   format!("{x}")
   ```

4. **Redundant continue**:
   ```rust
   // Before
   if cond { continue; }
   // After
   if !cond { /* body */ }
   ```

5. **Missing backticks in docs**:
   ```rust
   // Before
   /// Returns a LastIDError on failure
   // After
   /// Returns a [`LastIDError`] on failure
   ```

**Verify**:
```bash
cargo clippy --all-features -- -D warnings
```

## Step 3: Create CHANGELOG.md (Critical)

Create `CHANGELOG.md` in repository root:

```markdown
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0] - 2026-01-17

### Added

- Initial release of LastID Rust SDK
- Type-safe policy builders for 8 credential types:
  - `BaseCredentialPolicy` - Basic identity verification
  - `PersonaPolicy` - Selective persona field disclosure
  - `VerifiedEmailPolicy` - Email verification with domain constraints
  - `VerifiedPhonePolicy` - Phone number verification
  - `VerifiedPersonaPolicy` - Identity document verification
  - `EmploymentPolicy` - Employment status verification
  - `TrustPolicy` - Trust network verification
  - `AgeProofPolicy` - Age verification with comparison operators
- DPoP authentication (RFC 9449) for proof-of-possession
- Trust registry validation with 60-second caching
- Cross-platform support:
  - Native: Linux, macOS, Windows, iOS, Android
  - Web: WASM via `wasm` feature
- Async-first design using tokio runtime
- Comprehensive error types with actionable messages
- Configuration via TOML files or environment variables
```

## Step 4: Create CONTRIBUTING.md (Critical)

Create `CONTRIBUTING.md` in repository root:

```markdown
# Contributing to LastID Rust SDK

Thank you for your interest in contributing!

## Getting Started

### Prerequisites

- Rust 1.85+ (see `rust-version` in Cargo.toml)
- cargo with llvm-cov for coverage

### Building

```bash
cargo build --all-features
```

### Testing

```bash
# Run all tests
cargo test --all-features

# Run with coverage
cargo llvm-cov --all-features

# Run WASM tests (requires wasm-pack)
wasm-pack test --headless
```

## Code Style

This project follows strict quality standards defined in [`.specify/memory/constitution.md`](.specify/memory/constitution.md).

### Required

- **95% test coverage** - PRs that drop coverage will not be merged
- **Zero clippy warnings** - Run `cargo clippy --all-features -- -D warnings`
- **Formatted code** - Run `cargo fmt` before committing
- **No unsafe code** - The crate uses `#![forbid(unsafe_code)]`
- **Documentation** - All public items must have rustdoc

### Recommended

- Functions under 50 lines
- Modules under 500 lines
- Meaningful commit messages

## Pull Request Process

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/my-feature`)
3. Make your changes
4. Add tests for new functionality
5. Update documentation for public API changes
6. Run the full CI check locally:
   ```bash
   cargo fmt --check
   cargo clippy --all-features -- -D warnings
   cargo test --all-features
   cargo doc --no-deps --all-features
   ```
7. Commit with a descriptive message
8. Push and create a Pull Request

## Reporting Issues

Please use GitHub Issues with:
- Clear description of the problem
- Steps to reproduce
- Expected vs actual behavior
- SDK version and Rust version

## License

Contributions are dual-licensed under MIT and Apache-2.0.
```

## Step 5: Fix Example Warnings (Important)

Run examples and note warnings:
```bash
cargo build --examples 2>&1 | grep "warning:"
```

Fix any unused variable, unused import, or similar warnings in:
- `examples/employment_verification.rs`
- `examples/age_verification.rs`
- `examples/trust_credential.rs`

**Verify**:
```bash
cargo build --examples 2>&1 | grep -c "warning:"
# Should output: 0
```

## Step 6: Final Verification

Run the complete CI check:

```bash
# Format check
cargo fmt --check

# Clippy (must pass with zero warnings)
cargo clippy --all-features -- -D warnings

# Tests (must pass)
cargo test --all-features

# Doc build (must have zero warnings)
cargo doc --no-deps --all-features

# Examples (must compile cleanly)
cargo build --examples
```

## Step 7: Documentation Preview

Preview documentation locally:
```bash
cargo doc --no-deps --all-features --open
```

Check:
- [ ] lib.rs overview is clear and complete
- [ ] Quick Start example is visible and correct
- [ ] All modules are linked and documented
- [ ] Feature flags table is accurate
- [ ] No broken intra-doc links

## Success Criteria

- [ ] All tests pass
- [ ] Zero clippy warnings
- [ ] Zero doc warnings
- [ ] CHANGELOG.md exists with 0.1.0 entry
- [ ] CONTRIBUTING.md exists with guidelines
- [ ] All examples compile without warnings
- [ ] Documentation renders correctly

## Next Step

After completing this quickstart, run `/speckit.tasks` to generate the implementation task list.
