code: func WriteQRFile(ctx context.Context, otp twofactor.OTP, label, file string) error {
  	var qr []byte
  	var err error
  	switch otp.Type() {
  	case twofactor.OATH_HOTP:
  		hotp := otp.(*twofactor.HOTP)
  		qr, err = hotp.QR(label)
  	case twofactor.OATH_TOTP:
  		totp := otp.(*twofactor.TOTP)
  		qr, err = totp.QR(label)
  	default:
  		err = errors.New("QR codes can only be generated for OATH OTPs")
  	}
  	if err != nil {
  		return errors.Wrapf(err, "%s", err)
  	}
  
  	if err := ioutil.WriteFile(file, qr, 0600); err != nil {
  		return errors.Wrapf(err, "failed to write QR code: %s", err)
  	}
  	return nil
  }
docs: // WriteQRFile writes the given OTP code as a QR image to disk