• Resolved karlemilnikka

    (@karlemilnikka)


    Apple has suggested a scheme for adding TOTP secrets to password managers with a simple click. The solution currently works with Apple’s own password manager iCloud Keychain in Safari on iOS 15, iPad OS 15 and macOS Monterey.
    More info: https://developer.apple.com/videos/play/wwdc2021/10105

    I wrote a simple proof-of-concept by adding a method called get_totp_link_ref to the WizardSteps class.

    **
     * Get TOTP link reference (preview)
     * 
     * Returns a TOTP link reference. For use with the iCloud Keychain and
     * other compatible password managers. 
     *
     * 
     * @return  String
     */
    
    public static function get_totp_link_ref() {
        
        // Get URL encoded site name and domain
        $site_name  = urlencode( get_bloginfo( 'name', 'display' ) );
        $site_url = get_site_url();
        $site_domain = parse_url( $site_url )['host'];
        
        // Get user's username and secrect
        $user_username = wp_get_current_user()->user_login;
        $user_secret = self::getUser()->get_totp_decrypted();
        
        // Create TOTP link target
        $totp_link = 'otpauth://totp/' . '$site_name' . ':' . $user_username . '?secret=' . $user_secret . '&digits=6&time=30&issuer=' . $site_domain;
        
        // Return escaped URL
        return esc_url( $totp_link, array( 'otpauth' ) );
    }

    The method returns a string that can be as a reference for a dedicated link or a clickable version of the QR code.

    <div class="qr-code-wrapper">
        <a href="<?php echo esc_html( self::get_totp_link_ref() ); ?>">
            <?php echo $qrCode; ?>
        </a>
    <div>
Viewing 1 replies (of 1 total)
  • Plugin Contributor robertabela

    (@robert681)

    Hello @karlemilnikka

    Thank you very much for this. Indeed, we want to have better integration / support with such systems and it is something we will be looking into later on this year.

    We’ll keep a note of your PoC and will refer to it when the time is right.

    Should there be anything else we can help you with, please do not hesitate to ask.

    To a great 2022.

Viewing 1 replies (of 1 total)
  • The topic ‘Improve compatibility with iCloud Keychain’ is closed to new replies.