mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-07 13:34:55 +08:00
Improve the code to get key hash
This commit is contained in:
parent
4a79a5e6e1
commit
981daa06b3
1 changed files with 6 additions and 1 deletions
|
@ -37,8 +37,13 @@ defmodule Livebook.Teams.Org do
|
|||
@doc """
|
||||
Generates a hash key.
|
||||
"""
|
||||
@spec key_hash(%{teams_key: String.t()}) :: String.t()
|
||||
@spec key_hash(%{teams_key: String.t()} | String.t()) :: String.t()
|
||||
|
||||
def key_hash(%{teams_key: teams_key}) do
|
||||
key_hash(teams_key)
|
||||
end
|
||||
|
||||
def key_hash(teams_key) do
|
||||
hash = :crypto.hash(:sha256, teams_key)
|
||||
Base.url_encode64(hash, padding: false)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue