Example #1
0
def _get_password():
    if op.installed():
        sys.stderr.write(f"1Password CLI found. Using password from item: {op.ITEM}\n")
        passwd = op.get_password()

        if passwd:
            return passwd
        else:
            sys.stderr.write(f"1Password password not found for item: {op.ITEM}. "
                              "Falling back to user input.\n")
            return _input_password()
    else:
        return _input_password()
Example #2
0
    def _get_mfa(self):
        if op.installed():
            sys.stderr.write(f"1Password CLI found. Using OTP from item: {op.ITEM}\n")
            mfa = op.get_totp()

            if mfa:
                return mfa
            else:
                sys.stderr.write(f"1Password OTP not configured for item: {op.ITEM}. "
                                  "Falling back to user input.\n")
                return self._input_mfa()
        else:
            return self._input_mfa()
Example #3
0
def _get_email():
    if op.installed():
        sys.stderr.write(f"1Password CLI found. Using email from item: {op.ITEM}\n")
        email = op.get_email()

        if email:
            return email
        else:
            sys.stderr.write(f"1Password email not found for item: {op.ITEM}. "
                              "Falling back to user input.\n")
            return _input_email()
    else:
        return _input_email()