Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit b5e48afc authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Fido: Support deprecated Fido2PendingIntent

parent f7bb9128
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ class UsbTransportHandler(private val context: Context, callback: TransportHandl
                if (connection.claimInterface(iface, true)) {
                    val buf = ByteArray(256)
                    val read = connection.controlTransfer(0x81, 0x06, 0x2200, iface.id, buf, buf.size, 5000)
                    Log.d(TAG, "Signature: ${buf.slice(0 until read).toByteArray().toBase64(Base64.NO_WRAP)}")
                    read >= 5 && buf.slice(0 until 5) eq CTAPHID_SIGNATURE
                } else {
                    Log.d(TAG, "Failed claiming interface")
+1 −1
Original line number Diff line number Diff line
@@ -33,5 +33,5 @@ public interface Fido2PendingIntent {
     * @throws IntentSender.SendIntentException If the resolution intent has been canceled or is no longer able to
     *                                          execute the request.
     */
    void launchPendingIntent(Activity activity, int requestCode);
    void launchPendingIntent(Activity activity, int requestCode) throws IntentSender.SendIntentException;
}
+4 −2
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ package org.microg.gms.fido.fido2;

import android.app.Activity;
import android.app.PendingIntent;
import android.content.IntentSender;

import com.google.android.gms.fido.fido2.Fido2PendingIntent;

@@ -23,7 +24,8 @@ public class Fido2PendingIntentImpl implements Fido2PendingIntent {
    }

    @Override
    public void launchPendingIntent(Activity activity, int requestCode) {
        throw new UnsupportedOperationException();
    public void launchPendingIntent(Activity activity, int requestCode) throws IntentSender.SendIntentException {
        if (!hasPendingIntent()) throw new IllegalStateException("No PendingIntent available");
        activity.startIntentSenderForResult(pendingIntent.getIntentSender(), requestCode, null, 0, 0, 0);
    }
}