mirror of
https://gitlab.com/TheOneWithTheBraid/dart_pkpass.git
synced 2025-07-06 05:18:47 +00:00
Merge branch 'fix_punycode_webserviceURL' into 'main'
Fix punycode webservice url See merge request TheOneWithTheBraid/dart_pkpass!7
This commit is contained in:
commit
5cd4977306
3 changed files with 29 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
import 'package:punycode_converter/punycode_converter.dart';
|
||||||
|
|
||||||
/// Metadata required for Pass Web Service
|
/// Metadata required for Pass Web Service
|
||||||
///
|
///
|
||||||
/// https://developer.apple.com/library/archive/documentation/PassKit/Reference/PassKit_WebService/WebService.html#//apple_ref/doc/uid/TP40011988
|
/// https://developer.apple.com/library/archive/documentation/PassKit/Reference/PassKit_WebService/WebService.html#//apple_ref/doc/uid/TP40011988
|
||||||
|
@ -29,7 +31,8 @@ class PassWebService {
|
||||||
if (uri == null || uri.scheme != 'https') return null;
|
if (uri == null || uri.scheme != 'https') return null;
|
||||||
return PassWebService(
|
return PassWebService(
|
||||||
authenticationToken: authenticationToken,
|
authenticationToken: authenticationToken,
|
||||||
webServiceURL: uri,
|
// URLs due to IDNA2008
|
||||||
|
webServiceURL: uri.punyEncoded,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ dependencies:
|
||||||
crypto: ^3.0.3
|
crypto: ^3.0.3
|
||||||
http: ^1.0.0
|
http: ^1.0.0
|
||||||
intl: ">=0.17.0 <1.0.0"
|
intl: ">=0.17.0 <1.0.0"
|
||||||
|
punycode_converter: ^0.2.1
|
||||||
|
|
||||||
topics:
|
topics:
|
||||||
- wallet
|
- wallet
|
||||||
|
|
|
@ -126,4 +126,28 @@ void main() {
|
||||||
expect(scaled, 'logo@4x.png');
|
expect(scaled, 'logo@4x.png');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Check Punyc encoding of Domain in Webservice', () {
|
||||||
|
// per default Uri.parse does not punycode!
|
||||||
|
final url = "https://my-äöü-domain.com/endpoint/1234/";
|
||||||
|
final token = "0000000000000000";
|
||||||
|
final webService =
|
||||||
|
PassWebService.maybe(webServiceURL: url, authenticationToken: token);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
webService!.webServiceURL,
|
||||||
|
Uri.parse("https://xn--my--domain-s5a0tyc.com/endpoint/1234"),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
test('Double Check Domain not needed Puny encoding in Webservice', () {
|
||||||
|
final url = "https://my-domain.com/endpoint/1234/";
|
||||||
|
final token = "0000000000000000";
|
||||||
|
final webService =
|
||||||
|
PassWebService.maybe(webServiceURL: url, authenticationToken: token);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
webService!.webServiceURL,
|
||||||
|
Uri.parse("https://my-domain.com/endpoint/1234"),
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue