The session function may be used to get or set session values:
<?php $value = session('key');
<?php     public function store()

    {

        $this->password = request('password');

        $this->tokenData = session('statamic:protect:password.tokens.'.request('token'));



        if (! $this->tokenData) {

            return back()->withErrors(['token' => 'Invalid or expired token.'], 'passwordProtect');
<?php     protected function storePassword()

    {

        session()->put(

            "statamic:protect:password.passwords.{$this->getScheme()}",

            $this->password

        );
<?php     {

        $token = request('token');



        session()->forget("statamic:protect:password.tokens.$token");



        return $this;

    }
<?php     public function hasEnteredValidPassword()

    {

        return (new Guard($this->scheme))->check(

            session("statamic:protect:password.passwords.{$this->scheme}")

        );

    }
<?php     {

        $token = Token::generate();



        session()->put("statamic:protect:password.tokens.$token", [

            'scheme' => $this->scheme,

            'url' => $this->url,

        ]);
<?php         $html .= '<input type="hidden" name="token" value="'.$token.'" />';



        $errors = session('errors', new ViewErrorBag)->passwordProtect;



        $html .= $this->parse([

            'errors' => $errors->toArray(),
<?php     protected function sendResetLinkResponse(Request $request, $response)

    {

        session()->flash('user.forgot_password.success', __(Password::RESET_LINK_SENT));



        $redirect = $request->has('_redirect')

            ? redirect($request->input('_redirect'))
<?php             'errors' => [],

        ];



        if (session('success')) {

            return $this->parse(['success' => true]);

        }
<?php             return $this->parse(['success' => true]);

        }



        if (session('errors')) {

            $data['errors'] = session('errors')->all();

        }
<?php         }



        if (session('errors')) {

            $data['errors'] = session('errors')->all();

        }



        $knownParams = ['redirect'];
<?php         $formHasErrors = session()->has('errors')

            ? $this->getFormSession($handle)['errors']

            : false;
<?php         $errors = [];



        foreach (session('errors')->getBag('form.'.$formset)->all() as $error) {

            $errors[]['value'] = $error;

        }
<?php         return session()->has("form.{$formset}.success");

    }
<?php     public function submission()

    {

        if ($this->success()) {

            return session('submission')->toArray();

        }

    }
<?php     protected function success($message, $text = null)

    {

        session()->flash('success', $message);



        if ($text) {

            session()->flash('success_text', $text);