com.ibm.security.access.mobile.authentication

Class OtpQRScanResult

  • java.lang.Object
    • com.ibm.security.access.mobile.authentication.OtpQRScanResult
  • All Implemented Interfaces:
    android.os.Parcelable, IQRScanResult


    public final class OtpQRScanResult
    extends java.lang.Object
    implements IQRScanResult
    The OtpQRScanResult handles one-time password data scanned from a QR code.
    Since:
    1.2.0
    Version:
    1.2.8
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface android.os.Parcelable

        android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T>
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static android.os.Parcelable.Creator<OtpQRScanResult> CREATOR 
      • Fields inherited from interface android.os.Parcelable

        CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int describeContents()
      Returns a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
      HmacAlgorithm getAlgorithm()
      Returns the algorithm used to calculate the one-time password.
      int getCounter()
      Returns the counter that is required for use with hotp.
      int getDigits()
      Returns the length of the one-time password to be displayed.
      java.lang.String getIssuer()
      Returns the name of the issuer providing the service.
      int getPeriod()
      Returns the period a totp code will be valid for, in seconds.
      java.lang.String getSecret()
      Returns the secret value encoded in Base32.
      java.lang.String getType()
      Returns the type of the QR scanned.
      java.lang.String getUsername()
      Returns the username associated with the service.
      OtpQRScanResult parse(java.lang.String value)
      Parses the incoming data from the QR code.
      void writeToParcel(android.os.Parcel dest, int flags)
      Writes the object into a parcel.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CREATOR

        public static final android.os.Parcelable.Creator<OtpQRScanResult> CREATOR
    • Constructor Detail

      • OtpQRScanResult

        public OtpQRScanResult()
        Returns an instance of a new OtpQRScanResult object.
      • OtpQRScanResult

        public OtpQRScanResult(java.lang.String type,
                               java.lang.String issuer,
                               java.lang.String secret,
                               java.lang.String username,
                               HmacAlgorithm algorithm,
                               int digits,
                               int counter_or_period)
        Returns an instance of a new OtpQRScanResult object.
        Parameters:
        type - the type of the QR scanned. Has to be either hotp or totp. Otherwise, no value will be set.
        issuer - the name of the issuer providing the service
        secret - the secret value encoded in Base32
        username - the user associated with the service
        algorithm - the algorithm used to calculate the one-time password. the default is `HmacAlgorithm.SHA1`.
        digits - the length of the one-time password to be displayed. The default is 6.
        counter_or_period - the counter is required for use with HotpChallenge. It will set the initial counter value. The period is required to use with TotpChallenge. It represents the time, the code will be valid for. The default value is 30.
        Throws:
        java.lang.IllegalArgumentException - if any parameter is null
        java.security.InvalidParameterException - if 'type' is neither 'hotp' nor 'totp'
      • OtpQRScanResult

        public OtpQRScanResult(java.util.Map<java.lang.String,java.lang.String> data)
        Returns an instance of a new OtpQRScanResult object.
        Parameters:
        data - the hashmap of one-time passsord attributes
        Throws:
        java.lang.IllegalArgumentException - if parameter is null
    • Method Detail

      • parse

        public OtpQRScanResult parse(java.lang.String value)
        Parses the incoming data from the QR code.
        Specified by:
        parse in interface IQRScanResult
        Parameters:
        value - the incoming value from the QR code scan
        Returns:
        An instance of IQRScanResult if parameter can be parsed, otherwise null.
      • getType

        public java.lang.String getType()
        Returns the type of the QR scanned. Value must be either hotp or totp.
        Returns:
        the type of the QR scanned
      • getIssuer

        public java.lang.String getIssuer()
        Returns the name of the issuer providing the service.
        Returns:
        the name of the issuer providing the service
      • getSecret

        public java.lang.String getSecret()
        Returns the secret value encoded in Base32.
        Returns:
        the secret value encoded in Base32
      • getUsername

        public java.lang.String getUsername()
        Returns the username associated with the service.
        Returns:
        the username associated with the service
      • getAlgorithm

        public HmacAlgorithm getAlgorithm()
        Returns the algorithm used to calculate the one-time password. the default is HmacAlgorithm.SHA1.
        Returns:
        the algorithm used to calculate the one-time password
      • getDigits

        public int getDigits()
        Returns the length of the one-time password to be displayed. The default is 6.
        Returns:
        the length of the one-time password to be displayed
      • getCounter

        public int getCounter()
        Returns the counter that is required for use with hotp. It will set the initial counter value.
        Returns:
        the counter that is required for use with hotp
      • getPeriod

        public int getPeriod()
        Returns the period a totp code will be valid for, in seconds. The default value is 30.
        Returns:
        the period a totp code will be valid for, in seconds
      • describeContents

        public int describeContents()
        Returns a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
        Specified by:
        describeContents in interface android.os.Parcelable
        Returns:
        bitmask indicating the set of special object types
      • writeToParcel

        public void writeToParcel(android.os.Parcel dest,
                                  int flags)
        Writes the object into a parcel.
        Specified by:
        writeToParcel in interface android.os.Parcelable
        Parameters:
        dest - the parcel where the object is written into
        flags - flags about how the object should be written