# `Lather.Auth.WSSecurity`
[🔗](https://github.com/awksedgreep/lather/blob/v1.0.49/lib/lather/auth/ws_security.ex#L1)

WS-Security implementation for SOAP authentication.

This module provides WS-Security authentication mechanisms including:
- UsernameToken authentication
- Timestamp elements
- Nonce generation
- Password digest generation

# `timestamp`

```elixir
@spec timestamp(keyword()) :: map()
```

Creates a WS-Security timestamp header.

## Parameters

  * `options` - Options for the timestamp
    * `:ttl` - Time to live in seconds (default: 300)

## Examples

    iex> Lather.Auth.WSSecurity.timestamp()
    %{
      "Security" => %{
        "Timestamp" => %{
          "Created" => "2023-01-01T12:00:00Z",
          "Expires" => "2023-01-01T12:05:00Z"
        }
      }
    }

# `username_token`

```elixir
@spec username_token(String.t(), String.t(), keyword()) :: map()
```

Creates a WS-Security UsernameToken header.

## Parameters

  * `username` - The username for authentication
  * `password` - The password for authentication
  * `options` - Additional options
    * `:password_type` - `:digest` or `:text` (default: `:text`)
    * `:include_nonce` - Whether to include a nonce (default: `true` for digest)
    * `:include_created` - Whether to include timestamp (default: `true`)

## Examples

    iex> Lather.Auth.WSSecurity.username_token("admin", "password")
    %{
      "Security" => %{
        "UsernameToken" => %{
          "Username" => "admin",
          "Password" => %{"#text" => "password", "@Type" => "...PasswordText"}
        }
      }
    }

# `username_token_with_timestamp`

```elixir
@spec username_token_with_timestamp(String.t(), String.t(), keyword()) :: map()
```

Creates a combined WS-Security header with both UsernameToken and Timestamp.

## Parameters

  * `username` - The username for authentication
  * `password` - The password for authentication
  * `options` - Combined options for both UsernameToken and Timestamp

## Examples

    iex> Lather.Auth.WSSecurity.username_token_with_timestamp("admin", "password")
    %{
      "Security" => %{
        "UsernameToken" => %{...},
        "Timestamp" => %{...}
      }
    }

---

*Consult [api-reference.md](api-reference.md) for complete listing*
