public function getToken() : string {
        if (($this->token === null) || ($this->token->isExpired())) {
            $jwtBuilder = new Builder();
            $jwtBuilder->set('iss', $this->credentialPublicKey);
            $jwtBuilder->set('sub', $this->userName);

            $this->token = $jwtBuilder
                ->sign(new Sha256(), $this->credentialPrivateKey)
                ->getToken();
        }

        return (string) $this->token;
    }