getKeyChainGenerator()->generate(); $this->getKeyChainRepository()->save($keyChain); $this->invalidateKeyChain($keyChain); $this->invalidateJwks(); return $keyChain; } private function invalidateKeyChain(KeyChain $keyChain): void { $this->getCache()->delete( sprintf(CachedPlatformKeyChainRepository::PRIVATE_PATTERN, $keyChain->getIdentifier()) ); $this->getCache()->delete( sprintf(CachedPlatformKeyChainRepository::PUBLIC_PATTERN, $keyChain->getIdentifier()) ); } private function invalidateJwks(): void { $this->getCache()->delete(CachedPlatformJwksRepository::JWKS_KEY); } private function getKeyChainGenerator(): KeyChainGeneratorInterface { return $this->getServiceLocator()->get(KeyChainGenerator::class); } private function getKeyChainRepository(): KeyChainRepositoryInterface { return $this->getServiceLocator()->get(PlatformKeyChainRepository::class); } private function getCache(): CacheInterface { return $this->getServiceLocator()->get(SimpleCache::SERVICE_ID); } }