Skip to content

V3 rewrite#31

Merged
prjseal merged 6 commits into
dev/v3from
claude/package-v3-documentation-F5dOd
May 24, 2026
Merged

V3 rewrite#31
prjseal merged 6 commits into
dev/v3from
claude/package-v3-documentation-F5dOd

Conversation

@prjseal
Copy link
Copy Markdown
Owner

@prjseal prjseal commented May 24, 2026

No description provided.

claude added 6 commits May 24, 2026 16:42
Replace biased/static randomness and error-string returns with a fail-loud,
unbiased, instance-scoped design:

- Add IRandomSource + CryptoRandomSource (rejection sampling, no modulo bias,
  no off-by-one; instance-based and disposable) (§5.2, §5.3, §5.6)
- Delete the Guid shuffle and dead GetRngCryptoSeed; use crypto Fisher-Yates
  via IRandomSource (§5.5, §5.7)
- Guarantee included classes by construction (seed one per class, fill, shuffle)
  and drop the validate-and-retry loop / "Try again" string
- Next() throws ArgumentException on invalid config; add TryNext(out string);
  validate empty custom special set up front (§5.1, §5.8)
- Expose IPasswordSettings.CharacterGroups; make Password IDisposable
- Update tests to expect exceptions; add Phase1CorrectnessTests

All 32 tests pass (run on net8 since netcoreapp2.2 is EOL); library and
netcoreapp2.2 test build both succeed.

https://claude.ai/code/session_01NNRvLbK1UWy49i4Yg43QEd
- Multi-target netstandard2.0;net8.0 with nullable enabled; net8 uses
  RandomNumberGenerator.GetInt32, netstandard2.0 keeps rejection sampling
- Migrate tests to net8.0 + NUnit 4 (constraint-model asserts), dropping the
  EOL netcoreapp2.2 target and its vulnerable Microsoft.NETCore.App 2.2.0
- Add edge-case/property tests (uniqueness, custom-pool exclusivity, length
  boundaries, no-classes, null random source)
- Add a BenchmarkDotNet project (single vs batch, sizes 1/100/1000/10000,
  MemoryDiagnoser) and wire it into the solution
- Bump AppVeyor image to Visual Studio 2022 for the net8 SDK
- Tighten .gitignore for bin/obj/artifacts and BenchmarkDotNet output

39/39 tests pass on net8; both library TFMs and the full solution build with
no nullable warnings.

https://claude.ai/code/session_01NNRvLbK1UWy49i4Yg43QEd
- Add IPasswordGenerator (Next/TryNext/NextAsync/Generate/GenerateAsync);
  Password implements it alongside IPassword. Async honours CancellationToken
- Keep sync methods fully supported (no [Obsolete]): generation is CPU-bound,
  so obsoleting sync in favour of async would be an anti-pattern
- Add opt-in DI: AddPasswordGenerator(Action<PasswordOptions>) and
  AddPasswordGenerator(IConfiguration) in the core package, taking
  Microsoft.Extensions.DependencyInjection.Abstractions and
  Configuration.Binder dependencies; new vs DI behave identically
- Add PasswordOptions for code/appSettings configuration
- Remove the [Obsolete] PasswordGenerator/PasswordGeneratorSettings wrappers
  and their tests, clearing all 5 CS0108 warnings
- Enable nullable in the test project; add Phase3Tests (async, cancellation,
  batch, DI binding + equivalence)

Library builds with 0 warnings/0 errors; 39/39 tests pass on net8; pack
declares the new dependencies per target framework.

https://claude.ai/code/session_01NNRvLbK1UWy49i4Yg43QEd
- Custom pools: WithCharacters(string) and WithAllAscii() alongside Include*
- ExcludeAmbiguous() strips look-alike characters (CharacterFilter) from the
  pool and per-class groups
- RequireAtLeast(CharacterClass, count): generalises the one-per-class
  guarantee; auto-enables the class; validated against length
- IEntropyEstimator/PoolEntropyEstimator and Password.EstimateEntropyBits()
  (length * log2(effective pool size))
- Presets ForOwasp/ForNist/ForOtp/ForApiKey/ForEnvironmentName (static
  factories over the fluent builder) and ForPassphrase backed by a small
  built-in word list (PassphraseGenerator)
- Batch: parameterless Generate()/GenerateAsync() driven by a configurable
  DefaultBatchCount; kept Generate(count) (no .Count(n) chaining)
- appSettings precedence via AddPasswordGenerator(IConfiguration, Action):
  code-configure > appSettings > default; PasswordOptions gains
  ExcludeAmbiguous and DefaultBatchCount

Library builds with 0 warnings/0 errors; 55/55 tests pass on net8
(16 new Phase 4 tests).

https://claude.ai/code/session_01NNRvLbK1UWy49i4Yg43QEd
- Delete stale PasswordGenerator.nuspec (2.0.5); csproj is now the single
  source of version truth, bumped to 3.0.0
- Replace PackageIconUrl with PackageIcon (clears NU5048) and add
  PackageReadmeFile (root Readme.md packed as README.md)
- Add SourceLink (Microsoft.SourceLink.GitHub), deterministic build,
  CI build flag, symbol package (.snupkg), embedded untracked sources
- Refresh Description/ReleaseNotes/Tags/Copyright for v3
- appveyor: bump build version label to 3.0, capture .snupkg artifact,
  keep deploy: off

dotnet pack -c Release produces PasswordGenerator.3.0.0.nupkg + .snupkg with
no NU5048 / no missing-readme warnings; 55/55 tests still pass.

https://claude.ai/code/session_01NNRvLbK1UWy49i4Yg43QEd
- Add docs/v3-target/migration-v2-to-v3.md: error-string->exception/TryNext
  breaking change, opt-in DI/async/batch, OWASP/NIST preset mapping, and the
  broader use cases (OTP/API key/identifier/passphrase)
- Add root CHANGELOG.md with the 3.0.0 entry
- Refresh root Readme.md: fix the stale 8-128 length claim (actual 4-256),
  replace ```javascript fences with ```csharp, document presets, quality
  controls, error handling, async/batch and DI; link docs + changelog
- Mark current-state/ docs as historical (issues resolved in v3) and link the
  migration guide from docs/README.md
- Back Readme/migration snippets with DocumentationSnippetTests

59/59 tests pass.

https://claude.ai/code/session_01NNRvLbK1UWy49i4Yg43QEd
@prjseal prjseal merged commit 4c437e1 into dev/v3 May 24, 2026
@prjseal prjseal deleted the claude/package-v3-documentation-F5dOd branch May 24, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants