nextcloud/lib/private/Security/PublicPrivateKeyPairs/Model/KeyPair.php
Maxence Lange 4591430c9c feat(ocm): signing ocm requests
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2024-12-04 09:30:55 -01:00

114 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Security\PublicPrivateKeyPairs\Model;
use NCU\Security\PublicPrivateKeyPairs\Model\IKeyPair;
/**
* @inheritDoc
*
* @since 31.0.0
*/
class KeyPair implements IKeyPair {
private string $publicKey = '';
private string $privateKey = '';
private array $options = [];
public function __construct(
private readonly string $app,
private readonly string $name,
) {
}
/**
* @inheritDoc
*
* @return string
* @since 31.0.0
*/
public function getApp(): string {
return $this->app;
}
/**
* @inheritDoc
*
* @return string
* @since 31.0.0
*/
public function getName(): string {
return $this->name;
}
/**
* @inheritDoc
*
* @param string $publicKey
* @return IKeyPair
* @since 31.0.0
*/
public function setPublicKey(string $publicKey): IKeyPair {
$this->publicKey = $publicKey;
return $this;
}
/**
* @inheritDoc
*
* @return string
* @since 31.0.0
*/
public function getPublicKey(): string {
return $this->publicKey;
}
/**
* @inheritDoc
*
* @param string $privateKey
* @return IKeyPair
* @since 31.0.0
*/
public function setPrivateKey(string $privateKey): IKeyPair {
$this->privateKey = $privateKey;
return $this;
}
/**
* @inheritDoc
*
* @return string
* @since 31.0.0
*/
public function getPrivateKey(): string {
return $this->privateKey;
}
/**
* @inheritDoc
*
* @param array $options
* @return IKeyPair
* @since 31.0.0
*/
public function setOptions(array $options): IKeyPair {
$this->options = $options;
return $this;
}
/**
* @inheritDoc
*
* @return array
* @since 31.0.0
*/
public function getOptions(): array {
return $this->options;
}
}