32 return wfMessage(
'oathauth-module-totp-label' );
41 public function newKey( array $data ) {
42 if ( !isset( $data[
'secret'] ) || !isset( $data[
'scratch_tokens'] ) ) {
43 throw new MWException(
'oathauth-invalid-data-format' );
45 if ( is_string( $data[
'scratch_tokens' ] ) ) {
46 $data[
'scratch_tokens'] = explode(
',', $data[
'scratch_tokens'] );
49 return TOTPKey::newFromArray( $data );
59 if ( !( $key instanceof
TOTPKey ) ) {
60 throw new MWException(
'oathauth-invalid-key-type' );
63 'keys' => [ $key->jsonSerialize() ]
81 if ( !isset( $data[
'token'] ) ) {
85 if ( !( $key instanceof
TOTPKey ) ) {
88 return $key->verify( $data, $user );
108 $isEnabledForUser = $user->
getModule() instanceof
self;
129 return wfMessage(
'oathauth-totp-description' );
136 return wfMessage(
'oathauth-totp-disable-warning' );
wfMessage( $key,... $params)
This is the function for getting translated interface messages.