Skip to content

Commit 908a89a

Browse files
authored
Merge pull request #10170 from u3s/kuba/ssh/doc_fixes_09_05
Kuba/ssh/doc fixes 09 05
2 parents 2ac34e0 + 29cb9f2 commit 908a89a

1 file changed

Lines changed: 23 additions & 40 deletions

File tree

lib/ssh/src/ssh_file.erl

Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,18 @@ handler.
4545
Such another callback module could be used by setting the option
4646
[`key_cb`](`t:ssh:key_cb_common_option/0`) when starting a client or a server
4747
(with for example [ssh:connect](`ssh:connect/3`), [ssh:daemon](`ssh:daemon/2`)
48-
of [ssh:shell](`ssh:shell/1`) ).
48+
or [ssh:shell](`ssh:shell/1`) ).
4949

50-
> #### Note {: .info }
50+
> #### Callbacks {: .info }
51+
>
52+
> The callback functions (`host_key/2`, `is_auth_key/3`, `user_key/2`,
53+
> `is_host_key/5`, `add_host_key/4`) are called by the SSH application
54+
> internally. They are documented here to show which files and options
55+
> the default implementation uses. See `m:ssh_server_key_api` and
56+
> `m:ssh_client_key_api` for the callback specifications.
5157
>
52-
> The functions are _Callbacks_ for the SSH app. They are not intended to be
53-
> called from the user's code\!
58+
> The public API functions are `decode/2`, `encode/2`, and
59+
> `extract_public_key/1`.
5460
5561
## Files, directories and who uses them
5662

@@ -263,10 +269,7 @@ call that initiates an ssh connection.
263269
264270
%%%---------------- SERVER API ------------------------------------
265271
-doc """
266-
**Types and description**
267-
268-
See the api description in
269-
[ssh_server_key_api, Module:host_key/2](`c:ssh_server_key_api:host_key/2`).
272+
Implements `c:ssh_server_key_api:host_key/2`.
270273
271274
**Options**
272275
@@ -280,7 +283,7 @@ See the api description in
280283
- [`SYSDIR/ssh_host_ed25519_key`](`m:ssh_file#FILE-ssh_host_ed25519_key`)
281284
- [`SYSDIR/ssh_host_ed448_key`](`m:ssh_file#FILE-ssh_host_ed448_key`)
282285
""".
283-
-doc(#{since => <<"OTP 21.2">>}).
286+
-doc(#{since => <<"OTP 21.2">>, group => <<"Callback Implementations">>}).
284287
-spec host_key(Algorithm, Options) -> Result when
285288
Algorithm :: ssh:pubkey_alg(),
286289
Result :: {ok, public_key:private_key()} | {error, term()},
@@ -291,10 +294,7 @@ host_key(Algorithm, Opts) ->
291294
292295
%%%................................................................
293296
-doc """
294-
**Types and description**
295-
296-
See the api description in
297-
[ssh_server_key_api: Module:is_auth_key/3](`c:ssh_server_key_api:is_auth_key/3`).
297+
Implements `c:ssh_server_key_api:is_auth_key/3`.
298298
299299
**Options**
300300
@@ -309,7 +309,7 @@ See the api description in
309309
This functions discards all options in the beginning of the lines of thoose
310310
files when reading them.
311311
""".
312-
-doc(#{since => <<"OTP 21.2">>}).
312+
-doc(#{since => <<"OTP 21.2">>, group => <<"Callback Implementations">>}).
313313
-spec is_auth_key(Key, User, Options) -> boolean() when
314314
Key :: public_key:public_key(),
315315
User :: string(),
@@ -327,10 +327,7 @@ is_auth_key(Key0, User, Opts) ->
327327
328328
%%%---------------- CLIENT API ------------------------------------
329329
-doc """
330-
**Types and description**
331-
332-
See the api description in
333-
[ssh_client_key_api, Module:user_key/2](`c:ssh_client_key_api:user_key/2`).
330+
Implements `c:ssh_client_key_api:user_key/2`.
334331
335332
**Options**
336333
@@ -349,7 +346,7 @@ Note that EdDSA passhrases (Curves 25519 and 448) are not implemented.
349346
- [`USERDIR/id_ed25519`](`m:ssh_file#FILE-id_ed25519`)
350347
- [`USERDIR/id_ed448`](`m:ssh_file#FILE-id_ed448`)
351348
""".
352-
-doc(#{since => <<"OTP 21.2">>}).
349+
-doc(#{since => <<"OTP 21.2">>, group => <<"Callback Implementations">>}).
353350
-spec user_key(Algorithm, Options) -> Result when
354351
Algorithm :: ssh:pubkey_alg(),
355352
Result :: {ok, public_key:private_key()} |
@@ -362,17 +359,10 @@ user_key(Algorithm, Opts) ->
362359
%%%................................................................
363360
%%% New style (with port number)
364361
-doc """
365-
**Types and description**
366-
367-
See the api description in
368-
[ssh_client_key_api, Module:is_host_key/5](`c:ssh_client_key_api:is_host_key/5`).
362+
Implements `c:ssh_client_key_api:is_host_key/5`.
369363
370364
[](){: #is_host_key-4 }
371365
372-
Note that the alternative, the old
373-
[Module:is_host_key/4](`c:ssh_client_key_api:is_host_key/4`) is no longer
374-
supported by `ssh_file`.
375-
376366
**Option**
377367
378368
- [user_dir](`t:user_dir_common_option/0`)
@@ -381,7 +371,7 @@ supported by `ssh_file`.
381371
382372
- [`USERDIR/known_hosts`](`m:ssh_file#FILE-known_hosts`)
383373
""".
384-
-doc(#{since => <<"OTP 23.0">>}).
374+
-doc(#{since => <<"OTP 23.0">>, group => <<"Callback Implementations">>}).
385375
-spec is_host_key(Key, Host, Port, Algorithm, Options) -> Result when
386376
Key :: public_key:public_key(),
387377
Host :: inet:ip_address() | inet:hostname() | [inet:ip_address() | inet:hostname()],
@@ -401,17 +391,10 @@ is_host_key(Key0, Hosts0, Port, Algorithm, Opts) ->
401391
402392
%%%----------------------------------------------------------------
403393
-doc """
404-
**Types and description**
405-
406-
See the api description in
407-
[ssh_client_key_api, Module:add_host_key/4](`c:ssh_client_key_api:add_host_key/4`).
394+
Implements `c:ssh_client_key_api:add_host_key/4`.
408395
409396
[](){: #add_host_key-3 }
410397
411-
Note that the alternative, the old
412-
[Module:add_host_key/3](`c:ssh_client_key_api:add_host_key/3`) is no longer
413-
supported by `ssh_file`.
414-
415398
**Option**
416399
417400
- [user_dir](`t:user_dir_common_option/0`)
@@ -420,7 +403,7 @@ supported by `ssh_file`.
420403
421404
- [`USERDIR/known_hosts`](`m:ssh_file#FILE-known_hosts`)
422405
""".
423-
-doc(#{since => <<"OTP 23.0">>}).
406+
-doc(#{since => <<"OTP 23.0">>, group => <<"Callback Implementations">>}).
424407
-spec add_host_key(Host, Port, Key, Options) -> Result when
425408
Host :: inet:ip_address() | inet:hostname()
426409
| [inet:ip_address() | inet:hostname()],
@@ -461,7 +444,7 @@ OpenSSH public key.
461444
>
462445
> The implementation of the `openssh_key_v1` format is still experimental.
463446
""".
464-
-doc(#{since => <<"OTP 24.0">>}).
447+
-doc(#{since => <<"OTP 24.0">>, group => <<"API">>}).
465448
-spec decode(SshBin, Type) -> Decoded | {error,term()}
466449
when SshBin :: binary(),
467450
Type :: ssh2_pubkey
@@ -614,7 +597,7 @@ Encodes a list of SSH file entries (public keys and attributes) to a binary.
614597
>
615598
> The implementation of the `openssh_key_v1` format is still experimental.
616599
""".
617-
-doc(#{since => <<"OTP 24.0">>}).
600+
-doc(#{since => <<"OTP 24.0">>, group => <<"API">>}).
618601
-spec encode(InData, Type) -> binary() | {error,term()}
619602
when Type :: ssh2_pubkey
620603
| openssh_key
@@ -700,7 +683,7 @@ encode(_KeyBin, _Type) ->
700683
%%%----------------------------------------------------------------
701684
702685
-doc "Fetches the public key from a private key.".
703-
-doc(#{since => <<"OTP 25.0">>}).
686+
-doc(#{since => <<"OTP 25.0">>, group => <<"API">>}).
704687
-spec extract_public_key(PrivKey) -> PubKey
705688
when PrivKey :: public_key:private_key(),
706689
PubKey :: public_key:public_key().

0 commit comments

Comments
 (0)