*/ class implementation_server_srp implements interface_server { /** * @author Christian Fraß */ public function __construct( struct_srp_subject $subject, \Closure $registration_handle, \Closure $get_salt_and_verifier, \Closure $state_save, \Closure $state_load ) { $this->subject = $subject; $this->registration_handle = $registration_handle; $this->get_salt_and_verifier = $get_salt_and_verifier; $this->state_save = $state_save; $this->state_load = $state_load; } /** * @implementation * @author Christian Fraß */ public function register( string $username, string $password ) : bool { $proc = srp_server_register( $this->registration_handle ); return $proc($username, $password); } /** * @implementation * @author Christian Fraß */ public function login( string $kind, $parameters ) : bool { switch ($kind) { default: { throw (new \Exception('unhandled')); break; } case 'step1': { $proc = srp_server_login_1( $this->subject, $this->state_save, $this->get_salt_and_verifier ); return $proc($username, $password); break; } case 'step2': { $proc = srp_server_login_1( $this->subject, $this->state_load ); return $proc($username, $password); break; } } } } ?>