36 $store = new \fpoirotte\Pssht\KeyStore();
57 public function load($user, $file)
59 if (!is_string($user)) {
60 throw new \InvalidArgumentException();
63 if (!is_string($file)) {
64 throw new \InvalidArgumentException();
67 $logging = \Plop\Plop::getInstance();
70 if ($lines ===
false) {
72 'Ignoring unreadable file "%(file)s"',
83 $this->store->add($user, Putty::loadPublic(implode(
'', $lines)));
85 }
catch (\InvalidArgumentException $e) {
86 foreach ($lines as $line) {
89 if (trim($line) ===
'' || $line[0] ===
'#') {
92 $this->store->add($user, Openssh::loadPublic(rtrim($line)));
97 'Imported %(count)d identities for "%(user)s" from "%(file)s"',
121 foreach ($bulk as $user => $files) {
122 if (!is_string($user)) {
123 throw new \InvalidArgumentException();
126 if (!is_array($files) && !is_string($files)) {
127 throw new \InvalidArgumentException();
130 $files = (array) $files;
131 foreach ($files as $file) {
132 $this->
load($user, $file);
__construct(\fpoirotte\Pssht\KeyStore $store=null)
$store
Storage object for the keys.