Skip to content

Commit 5b9c493

Browse files
author
Taras Tyshko
committed
alias Plug.Crypto.KeyGenerator for clarity
1 parent bd6520d commit 5b9c493

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/support/utils.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ defmodule NervesHub.Support.Utils do
44
alias NervesHub.Accounts.UserToken
55
alias NervesHub.Repo
66
alias NervesHub.Utils.Base62
7-
alias Plug.Crypto.KeyGenerator
7+
alias Plug.Crypto.KeyGenerator, as: CryptoKeyGenerator
88

99
def create_v1_user_token!(user) do
1010
secret =
1111
<<user.name::binary, user.email::binary, DateTime.to_unix(DateTime.utc_now())::32>>
1212

13-
<<initial::160>> = KeyGenerator.generate(secret, "user-#{user.id}", length: 20)
13+
<<initial::160>> = CryptoKeyGenerator.generate(secret, "user-#{user.id}", length: 20)
1414
<<rand::30-bytes, _::binary>> = Base62.encode(initial) |> String.pad_leading(30, "0")
1515
crc = :erlang.crc32(rand) |> Base62.encode() |> String.pad_leading(6, "0")
1616
token = "nhu_#{rand}#{crc}"

0 commit comments

Comments
 (0)