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

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[2.2.0]

  • Reject strategy-provided machine IDs outside 0..511; an invalid ID fails startup immediately.
  • Use the :name option as the NoNoncense.MachineId supervisor child ID, allowing multiple named instances under one supervisor. Existing supervisor references to named children must use their configured names.
  • Reduce the columns fetched when acquiring a SqlLease.
  • Clarify that the SqlLease migration must run before starting a machine ID supervisor using that strategy.
  • Protect SqlLease and RedisLease ID reuse against clock skew by recording the lease holder's local expiry and requiring the successor's local clock to pass that cutoff. Lease strategies and nonce factories share a fixed clock offset.
  • Quarantine released IDs for one second before reuse; clock-skew protection may delay reuse further.
  • Report confirmed lease ownership loss as :not_owner instead of :expired in SqlLease and RedisLease, including lease-loss callbacks and telemetry.
  • Limit conflict-guard broadcasts to the resolved machine ID and start timestamp.

[2.1.0]

Machine ID lease management has been substantially reworked to better withstand coordinator failures, slow callbacks, and lease loss while protecting nonce uniqueness.

  • Enforce local lease expiry independently of strategy callbacks, disabling factories on lease loss, expiry, or store shutdown. Release locally rejected leases on a best-effort basis.
  • Add :callback_timeout to bound acquisition, renewal, and release calls.
  • Remove internal LeaseManager.machine_id/0,1, LeaseManager.lease_lost/0,1,2, and LeaseCache APIs. Direct use was not a supported integration; the supported NoNoncense.MachineId supervision API is unchanged.
  • Require strategy release/2 callbacks to be idempotent and ignore stale leases; they may run after a replacement is acquired.
  • SqlLease prevents delayed renewals from reviving released leases.
  • Prevent duplicate nonces when a factory is reinitialized shortly after lease loss.
  • Rename telemetry :source value :cache to :store and add :loss.
  • Fix an off-by-one timestamp overflow check.
  • RedisLease and SqlLease now attempt acquisition of up to 512 IDs (possibly pre-empted by the callback timeout), shuffled after the first three (so they still prefer the lowest available).

[2.0.0]

[1.3.1]

  • Use bitwise operations to process atomics
  • Fix sortable nonce initialization (this did not cause problems in practice but was technically incorrect)

[1.3.0]

  • Formulate an explicit support policy.
  • Support Elixir 1.20 and Erlang/OTP 29.
  • Drop support for Elixir 1.14, minimal supported version is now 1.15 (with OTP 25).

[1.2.0]

Changed

  • Internal refactor: State is now stored in a typed record (NoNoncense.State) for improved maintainability.
  • Performance: 64-bit counter is initialized with the startup timestamp, eliminating a redundant addition on each nonce/2 call.
  • Performance: Minor optimization in the nonce/2 hot path.

Other

  • Updated dependencies.

[1.1.3]

  • Fixed documentation typos.
  • Added link to Speck Rust crate docs.

[1.1.2]

  • Improved documentation.
  • Extended CI to run on Windows and macOS.

[1.1.1]

  • Updated documentation to reflect that legacy ciphers (Blowfish, 3DES) are unavailable on Windows and macOS.

[1.1.0]

  • Add encrypt/2, decrypt/2 and encrypted_nonce/3.

[1.0.0]

Breaking Changes

  • Encryption key management: Encryption keys must now be provided at initialization via NoNoncense.init/1 using the :base_key option (or individual :key64, :key96, :key128 options). Keys are no longer passed to encrypted_nonce/2.
  • Default encryption algorithm changed: The default encryption algorithm for 64-bit and 96-bit nonces has been changed from :des3 to :blowfish for better performance and security.
  • Function signature change: encrypted_nonce/3 signature changed from encrypted_nonce(name \\ __MODULE__, bit_size, key) to encrypted_nonce(name \\ __MODULE__, bit_size).

Added

  • Speck cipher support: Added optional support for the Speck cipher family via the speck_ex dependency, providing native block sizes for 64-bit, 96-bit, and 128-bit nonces with excellent performance.
  • Algorithm selection: New options :cipher64, :cipher96, and :cipher128 in NoNoncense.init/1 allow choosing encryption algorithms per nonce size.
    • 64/96 bits: :blowfish (default), :des3 and :speck
    • 128 bits: :aes (default) and :speck
  • Key derivation: Automatic key derivation from :base_key using PBKDF2-HMAC-SHA256, eliminating the need to manage separate keys for each nonce size.

Changed

  • Performance improvement: Pre-initialization of encryption ciphers at startup provides huge performance gains.
  • Default algorithms: 64-bit and 96-bit nonces now default to :blowfish instead of :des3 for better performance and security.

Migration Guide

See MIGRATION.md for detailed migration instructions.

[0.0.1 - 0.0.7]

Initial releases, changes were mainly performance improvements.