generateUrl method

String generateUrl ({String issuer, String account })
inherited

Generate a url with OTP instance.

Use issuer and account parameters to specify the token information. All the remaining OTP fields will be exported.

Implementation

String generateUrl({String issuer, String account}) {
  final _secret = this.secret;
  final _type = OTPUtil.otpTypeValue(type: type);
  final _account = Uri.encodeComponent(account ?? '');
  final _issuer = Uri.encodeQueryComponent(issuer ?? '');

  final _algorithm = AlgorithmUtil.rawValue(algorithm: algorithm);
  final _extra = extraUrlProperties
      .map((key, value) => MapEntry(key, "$key=$value"))
      .values
      .join('&');

  return 'otpauth://$_type/$_account?secret=$_secret&issuer=$_issuer&digits=$digits&algorithm=$_algorithm&$_extra';
}