chore(authn): better function name
This commit is contained in:
parent
f6d7739f01
commit
0fe300575e
|
@ -666,7 +666,7 @@ generate_filename(Key) ->
|
|||
<<"certfile">> -> "cert-";
|
||||
<<"cacertfile">> -> "cacert-"
|
||||
end,
|
||||
to_bin(filename:join([emqx:get_config([node, data_dir]), "certs/authn", Prefix ++ emqx_misc:gen() ++ ".pem"])).
|
||||
to_bin(filename:join([emqx:get_config([node, data_dir]), "certs/authn", Prefix ++ emqx_misc:gen_id() ++ ".pem"])).
|
||||
|
||||
diff_certs(NewSSLOpts, OldSSLOpts) ->
|
||||
Keys = [<<"cacertfile">>, <<"certfile">>, <<"keyfile">>],
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
, index_of/2
|
||||
, maybe_parse_ip/1
|
||||
, ipv6_probe/1
|
||||
, gen/0
|
||||
, gen/1
|
||||
, gen_id/0
|
||||
, gen_id/1
|
||||
]).
|
||||
|
||||
-export([ bin2hexstr_A_F/1
|
||||
|
@ -302,12 +302,12 @@ hexchar2int(I) when I >= $0 andalso I =< $9 -> I - $0;
|
|||
hexchar2int(I) when I >= $A andalso I =< $F -> I - $A + 10;
|
||||
hexchar2int(I) when I >= $a andalso I =< $f -> I - $a + 10.
|
||||
|
||||
-spec(gen() -> list()).
|
||||
gen() ->
|
||||
gen(?SHORT).
|
||||
-spec(gen_id() -> list()).
|
||||
gen_id() ->
|
||||
gen_id(?SHORT).
|
||||
|
||||
-spec(gen(integer()) -> list()).
|
||||
gen(Len) ->
|
||||
-spec(gen_id(integer()) -> list()).
|
||||
gen_id(Len) ->
|
||||
BitLen = Len * 4,
|
||||
<<R:BitLen>> = crypto:strong_rand_bytes(Len div 2),
|
||||
int_to_hex(R, Len).
|
||||
|
|
Loading…
Reference in New Issue