# Session 11: Accounts & Directory Store

## Summary

Multi-tenancy account system and directory-based JWT store. Accounts manage per-tenant state including JetStream limits, imports/exports, and user authentication.

## Scope

| Go File | Features | Feature IDs | Go LOC |
|---------|----------|-------------|--------|
| server/accounts.go | 200 | 150–349 | 3,918 |
| server/dirstore.go | 34 | 793–826 | 575 |
| **Total** | **234** | | **4,493** |

## .NET Classes

- `Account` — per-tenant account with limits, imports, exports
- `DirectoryAccountResolver` — file-system-based account resolver
- `CacheDirAccountResolver` — caching resolver wrapper
- `MemoryAccountResolver` — in-memory resolver
- `UriAccountResolver` — HTTP-based resolver
- `DirJwtStore` — JWT file storage
- `DirectoryStore` — directory abstraction
- `ExpirationTracker` — JWT expiration tracking
- `LocalCache` — local account cache
- `ServiceExport`, `ServiceImport`, `ServiceLatency` — service mesh types

## Test Files

| Test File | Tests | Test IDs |
|-----------|-------|----------|
| server/accounts_test.go | 65 | 46–110 |
| server/dirstore_test.go | 19 | 278–296 |
| **Total** | **84** | |

## Dependencies

- Session 01 (Foundation Types)
- Session 02 (Utilities)
- Session 03 (Configuration)
- Session 05 (Subscription Index)
- Session 06 (Auth & JWT)

## .NET Target Location

- `dotnet/src/ZB.MOM.NatsNet.Server/Accounts/`

## Notes

- `Account` is the 4th largest class (4.5K LOC across multiple Go files)
- accounts.go alone has 200 features — will need methodical batching within the session
- Account methods are spread across accounts.go, consumer.go, events.go, jetstream.go, etc. — this session covers only accounts.go features
