@@ -14,7 +14,7 @@ defmodule SSHClientKeyAPI do
1414 ```
1515 key = File.open!("path/to/keyfile")
1616 known_hosts = File.open!("path/to/known_hosts")
17- cb = SSHClientKeyAPI.with_options(identity: key, known_hosts: known_hosts, accept_hosts: false )
17+ cb = SSHClientKeyAPI.with_options(identity: key, known_hosts: known_hosts, silently_accept_hosts: true )
1818 ```
1919
2020 The result can be passed as an option when creating an `SSHKit.SSH.Connection`:
@@ -25,7 +25,7 @@ defmodule SSHClientKeyAPI do
2525
2626 - `identity`: `IO.device` providing the ssh key (required)
2727 - `known_hosts`: `IO.device` providing the known hosts list. If providing a File IO, it should have been opened in `:write` mode (required)
28- - `accept_hosts `: `boolean` silently accept and add new hosts to the known hosts. By default only known hosts will be accepted.
28+ - `silently_accept_hosts `: `boolean` silently accept and add new hosts to the known hosts. By default only known hosts will be accepted.
2929 """
3030
3131 @ spec with_options ( opts :: list ) :: { atom , list }
@@ -36,7 +36,7 @@ defmodule SSHClientKeyAPI do
3636
3737 - `identity`: `IO.device` providing the ssh key (required)
3838 - `known_hosts`: `IO.device` providing the known hosts list. If providing a File IO, it should have been opened in `:write` mode (required)
39- - `accept_hosts `: `boolean` silently accept and add new hosts to the known hosts. By default only known hosts will be accepted.
39+ - `silently_accept_hosts `: `boolean` silently accept and add new hosts to the known hosts. By default only known hosts will be accepted.
4040
4141 by default it will use the the files found in `System.user_home!`
4242
@@ -45,7 +45,7 @@ defmodule SSHClientKeyAPI do
4545 ```
4646 key = File.open!("path/to/keyfile")
4747 known_hosts = File.open!("path/to/known_hosts")
48- cb = SSHClientKeyAPI.with_options(identity: key, known_hosts: known_hosts, accept_hosts: false )
48+ cb = SSHClientKeyAPI.with_options(identity: key, known_hosts: known_hosts)
4949 SSHKit.SSH.connect("example.com", key_cb: cb)
5050 ```
5151
@@ -60,7 +60,7 @@ defmodule SSHClientKeyAPI do
6060 end
6161
6262 def add_host_key ( hostname , key , opts ) do
63- case accept_hosts ( opts ) do
63+ case silently_accept_hosts ( opts ) do
6464 true ->
6565 opts
6666 |> known_hosts_data
@@ -73,14 +73,14 @@ defmodule SSHClientKeyAPI do
7373 """
7474 Error: unknown fingerprint found for #{ inspect hostname } #{ inspect key } .
7575 You either need to add a known good fingerprint to your known hosts file for this host,
76- *or* pass the accept_hosts option to your client key callback
76+ *or* pass the silently_accept_hosts option to your client key callback
7777 """
7878 { :error , message }
7979 end
8080 end
8181
8282 def is_host_key ( key , hostname , alg , opts ) when alg in @ key_algorithms do
83- accept_hosts ( opts ) || opts
83+ silently_accept_hosts ( opts ) || opts
8484 |> known_hosts_data
8585 |> to_string
8686 |> :public_key . ssh_decode ( :known_hosts )
@@ -112,8 +112,8 @@ defmodule SSHClientKeyAPI do
112112 cb_opts ( opts ) [ :identity_data ]
113113 end
114114
115- defp accept_hosts ( opts ) do
116- cb_opts ( opts ) [ :accept_hosts ]
115+ defp silently_accept_hosts ( opts ) do
116+ cb_opts ( opts ) [ :silently_accept_hosts ]
117117 end
118118
119119 defp known_hosts ( opts ) do
@@ -152,7 +152,7 @@ defmodule SSHClientKeyAPI do
152152 opts
153153 |> Keyword . put_new_lazy ( :identity , & default_identity / 0 )
154154 |> Keyword . put_new_lazy ( :known_hosts , & default_known_hosts / 0 )
155- |> Keyword . put_new ( :accept_hosts , true )
155+ |> Keyword . put_new ( :silently_accept_hosts , false )
156156 end
157157
158158end
0 commit comments