/** * Create a JSON Web Token string * * @param string $keyName name of the key to use to sign the token * @param array|Traversable $payload traversable set of claims, claim => value * @param int $expirationOffset seconds from now that token will expire. If not specified, * an "exp" claim will not be added or updated * * @return string a token string returned from JsonWebToken::create() * * @throws \DomainException; * @throws \InvalidArgumentException; * @throws \UnexpectedValueException; */ public static function build($keyName, $payload, $expirationOffset = 0) { $token = new JsonWebToken(KeyFactory::build($keyName)); return $token->create($payload, $expirationOffset); }