Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SMS Retriever API - Generate 11 char hash code for app specific keystore file

I am trying to implement sms retriever api to read OTP code message without having to add read_sms permission.

The help doc here, ask user to generate hash code specific to app.

I have generated the code as required but still

<action android:name="com.google.android.gms.auth.api.phone.SMS_RETRIEVED"/>

broadcast receiver is not firing up.

How can I debug this?

I am testing this by sending a SMS from one mobile to another and I am following the SMS requirement as specified in the document above.

Also, There are various methods mentioned to generated hash code. I have tried them all. Problem is each method generated different hash.

I have tried for both debug and release keystore.

Here are those various methods:

  1. linux command as describe here - help doc
  2. sms_retriever_hash_v9 file as described here
  3. By including AppSignatureHelper from sample app.
like image 256
Sasuke Uchiha Avatar asked Jul 10 '17 06:07

Sasuke Uchiha


People also ask

What is App hash?

About. Hash App lets US retail investors invest both in the US markets, and globally, especially in emerging markets - Investing Without Borders!


1 Answers

The first linux command specifies the alias name as MyAndroidKey but yours might be different. You can find out your alias name by

keytool -list -rfc -keystore $KEYSTORE

where $KEYSTORE is your keystore file.

With the alias name, you can try using the following two commands to verify if the results are the same:

  • keytool -alias MyAndroidKey -exportcert -keystore $KEYSTORE | xxd -p

  • keytool -list -rfc -keystore $KEYSTORE | sed -e '1,/BEGIN/d' | sed -e '/END/,$d' | tr -d ' \n' | base64 --decode | xxd -p

like image 193
Yu-Han Yang Avatar answered Oct 16 '22 17:10

Yu-Han Yang