1<?php 2/** 3 * Created by IntelliJ IDEA. 4 * User: samuel 5 * Date: 09/12/2016 6 * Time: 15:14 7 */ 8 9namespace Samyoul\U2F\U2FServer; 10 11 12class SignRequest implements \JsonSerializable 13{ 14 /** Protocol version */ 15 protected $version = U2FServer::VERSION; 16 17 /** Authentication challenge */ 18 protected $challenge; 19 20 /** Key handle of a registered authenticator */ 21 protected $keyHandle; 22 23 /** Application id */ 24 protected $appId; 25 26 public function __construct(array $parameters) 27 { 28 $this->challenge = $parameters['challenge']; 29 $this->keyHandle = $parameters['keyHandle']; 30 $this->appId = $parameters['appId']; 31 } 32 33 /** 34 * @return string 35 */ 36 public function version() 37 { 38 return $this->version; 39 } 40 41 /** 42 * @return string 43 */ 44 public function challenge() 45 { 46 return $this->challenge; 47 } 48 49 /** 50 * @return string 51 */ 52 public function keyHandle() 53 { 54 return $this->keyHandle; 55 } 56 57 /** 58 * @return string 59 */ 60 public function appId() 61 { 62 return $this->appId; 63 } 64 65 public function jsonSerialize() 66 { 67 return [ 68 'version' => $this->version, 69 'challenge' => $this->challenge, 70 'keyHandle' => $this->keyHandle, 71 'appId' => $this->appId, 72 ]; 73 } 74 75}