#NEWLINE# def get_device( self , **kwargs ) : #NEWLINE# #INDENT# '\n        Uses the data from the setup step and generated key to recreate device.\n\n        Only used for call / sms -- generator uses other procedure.\n        ' #NEWLINE# method = self . get_method ( ) #NEWLINE# kwargs = ( kwargs or { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# kwargs [ 'name' ] = 'default' #NEWLINE# kwargs [ 'user' ] = self . request . user #NEWLINE# if ( method in ( 'call' , 'sms' ) ) : #NEWLINE# #INDENT# kwargs [ 'method' ] = method #NEWLINE# kwargs [ 'number' ] = self . storage . validated_step_data . get ( method , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . get ( 'number' ) #NEWLINE# return PhoneDevice ( key = self . get_key ( self ) , ** kwargs ) #NEWLINE# #UNINDENT# if ( method == 'yubikey' ) : #NEWLINE# #INDENT# kwargs [ 'public_id' ] = self . storage . validated_step_data . get ( 'yubikey' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . get ( 'token' , '' ) [ : ( - 32 ) ] #NEWLINE# try : #NEWLINE# #INDENT# kwargs [ 'service' ] = ValidationService . objects . get ( name = 'default' ) #NEWLINE# #UNINDENT# except ValidationService . DoesNotExist : #NEWLINE# #INDENT# raise KeyError ( "No ValidationService found with name 'default'" ) #NEWLINE# #UNINDENT# except ValidationService . MultipleObjectsReturned : #NEWLINE# #INDENT# raise KeyError ( "Multiple ValidationService found with name 'default'" ) #NEWLINE# #UNINDENT# return RemoteYubikeyDevice ( ** kwargs )