1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the "php-ipfs" package. |
7
|
|
|
* |
8
|
|
|
* (c) Robert Schönthal <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace IPFS\Api; |
15
|
|
|
|
16
|
|
|
use IPFS\Annotation\Api as Endpoint; |
17
|
|
|
use IPFS\Command\Command; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @author Robert Schönthal <[email protected]> |
21
|
|
|
* @autogenerated |
22
|
|
|
* @codeCoverageIgnore |
23
|
|
|
*/ |
24
|
|
|
final class Key implements Api |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* Create a new keypair. |
28
|
|
|
* |
29
|
|
|
* @Endpoint(name="key:gen") |
30
|
|
|
* |
31
|
|
|
* @param string $arg name of key to create Required: |
32
|
|
|
* @param string $type type of the key to create [rsa, ed25519] |
33
|
|
|
* @param int $size size of the key to generate |
34
|
|
|
* |
35
|
|
|
* @return Command |
36
|
|
|
*/ |
37
|
|
|
public function gen(string $arg, string $type = null, int $size = 0): Command |
38
|
|
|
{ |
39
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* List all local keypairs. |
44
|
|
|
* |
45
|
|
|
* @Endpoint(name="key:list") |
46
|
|
|
* |
47
|
|
|
* @param bool $l show extra information about keys |
48
|
|
|
* |
49
|
|
|
* @return Command |
50
|
|
|
*/ |
51
|
|
|
public function list(bool $l = false): Command |
52
|
|
|
{ |
53
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Rename a keypair. |
58
|
|
|
* |
59
|
|
|
* @Endpoint(name="key:rename") |
60
|
|
|
* |
61
|
|
|
* @param string $arg name of key to rename Required: |
62
|
|
|
* @param string $arg1 new name of the key Required: |
63
|
|
|
* @param bool $force allow to overwrite an existing key |
64
|
|
|
* |
65
|
|
|
* @return Command |
66
|
|
|
*/ |
67
|
|
|
public function rename(string $arg, string $arg1, bool $force = false): Command |
68
|
|
|
{ |
69
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Remove a keypair. |
74
|
|
|
* |
75
|
|
|
* @Endpoint(name="key:rm") |
76
|
|
|
* |
77
|
|
|
* @param string $arg names of keys to remove Required: |
78
|
|
|
* @param bool $l show extra information about keys |
79
|
|
|
* |
80
|
|
|
* @return Command |
81
|
|
|
*/ |
82
|
|
|
public function rm(string $arg, bool $l = false): Command |
83
|
|
|
{ |
84
|
|
|
return new Command(__METHOD__, get_defined_vars()); |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|