| 1 |
|
defmodule WalletAuth.TestSupport do |
| 2 |
|
@moduledoc "Test helpers for wallet_auth tests." |
| 3 |
|
|
| 4 |
|
@test_kid "test_key_v1" |
| 5 |
|
@test_key "test_signing_key_32bytes_for_hmac!" |
| 6 |
|
|
| 7 |
|
@doc "Configures a deterministic test signing key and returns {kid, key}." |
| 8 |
|
def setup_signing_key do |
| 9 |
27 |
Application.put_env(:wallet_auth, :active_kid, @test_kid) |
| 10 |
27 |
Application.put_env(:wallet_auth, :secrets, %{ |
| 11 |
|
"jwt_signing_key_#{@test_kid}" => @test_key, |
| 12 |
|
"jwt_signing_key_key_v1" => @test_key |
| 13 |
|
}) |
| 14 |
27 |
Application.put_env(:wallet_auth, :jwks_keys, [ |
| 15 |
|
%{kid: @test_kid, algorithm: :HS256, status: :active, activated_at: ~U[2026-03-11 00:00:00Z]} |
| 16 |
|
]) |
| 17 |
|
{@test_kid, @test_key} |
| 18 |
|
end |
| 19 |
|
end |