mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-23 09:56:23 +03:00
Only modify name
if issuer
is null.
This commit is contained in:
parent
87b463f4e8
commit
91f236a414
@ -189,19 +189,19 @@ class CredentialData with _$CredentialData {
|
|||||||
// Convert parsed credential values into CredentialData objects
|
// Convert parsed credential values into CredentialData objects
|
||||||
return splitCreds(base64.decode(uri.queryParameters['data']!))
|
return splitCreds(base64.decode(uri.queryParameters['data']!))
|
||||||
.map((values) {
|
.map((values) {
|
||||||
String? issuer;
|
String? issuer = values[3] != null
|
||||||
|
? utf8.decode(values[3], allowMalformed: true)
|
||||||
|
: null;
|
||||||
String name = utf8.decode(values[2], allowMalformed: true);
|
String name = utf8.decode(values[2], allowMalformed: true);
|
||||||
final nameIndex = name.indexOf(':');
|
final nameIndex = name.indexOf(':');
|
||||||
if (nameIndex >= 0) {
|
if (nameIndex >= 0 && issuer == null) {
|
||||||
issuer = name.substring(0, nameIndex);
|
issuer = name.substring(0, nameIndex);
|
||||||
name = name.substring(nameIndex + 1);
|
name = name.substring(nameIndex + 1);
|
||||||
}
|
}
|
||||||
return CredentialData(
|
return CredentialData(
|
||||||
secret: base32.encode(values[1]),
|
secret: base32.encode(values[1]),
|
||||||
name: name,
|
name: name,
|
||||||
issuer: values[3] != null
|
issuer: issuer,
|
||||||
? utf8.decode(values[3], allowMalformed: true)
|
|
||||||
: issuer,
|
|
||||||
hashAlgorithm: switch (values[4]) {
|
hashAlgorithm: switch (values[4]) {
|
||||||
2 => HashAlgorithm.sha256,
|
2 => HashAlgorithm.sha256,
|
||||||
3 => HashAlgorithm.sha512,
|
3 => HashAlgorithm.sha512,
|
||||||
|
Loading…
Reference in New Issue
Block a user