1
0
Fork 0
mirror of https://github.com/bitwarden/android.git synced 2025-01-30 19:53:47 +03:00

Apply local patch

This commit is contained in:
Patrick Honkonen 2025-01-17 11:54:08 -05:00
parent 1095b391df
commit 208fca8b7d
No known key found for this signature in database
GPG key ID: B63AF42A5531C877

View file

@ -48,8 +48,9 @@ class Fido2CredentialManagerImpl(
fido2CreateCredentialRequest: Fido2CreateCredentialRequest,
selectedCipherView: CipherView,
): Fido2RegisterCredentialResult {
val requestedFromBrowser = fido2CreateCredentialRequest.callingAppInfo.isOriginPopulated()
val clientData = if (requestedFromBrowser) {
val isRequestFromPrivilegedApp =
fido2CreateCredentialRequest.callingAppInfo.isOriginPopulated()
val clientData = if (isRequestFromPrivilegedApp) {
fido2CreateCredentialRequest
.callingAppInfo
.getAppSigningSignatureFingerprint()
@ -62,28 +63,12 @@ class Fido2CredentialManagerImpl(
.packageName,
)
}
val requestJsonOrigin = fido2CreateCredentialRequest
val assetLinkUrl = fido2CreateCredentialRequest
.origin
?: getOriginUrlFromAttestationOptionsOrNull(fido2CreateCredentialRequest.requestJson)
?: return Fido2RegisterCredentialResult.Error
// val relyingPartyId = json
// .decodeFromStringOrNull<PasskeyAssertionOptions>(fido2CreateCredentialRequest.requestJson)
// ?.relyingPartyId
// ?: return Fido2RegisterCredentialResult.Error
//
// val validateOriginResult = validateOrigin(
// callingAppInfo = fido2CreateCredentialRequest.callingAppInfo,
// relyingPartyId = relyingPartyId,
// )
//
// if(validateOriginResult is Fido2ValidateOriginResult.Error)
// {
// return Fido2RegisterCredentialResult.Error
// }
val origin = if (requestedFromBrowser) {
Origin.Web(requestJsonOrigin)
} else {
val origin = if (!isRequestFromPrivilegedApp) {
Origin.Android(
UnverifiedAssetLink(
packageName = fido2CreateCredentialRequest.packageName,
@ -91,12 +76,14 @@ class Fido2CredentialManagerImpl(
.callingAppInfo
.getSignatureFingerprintAsHexString()
?: return Fido2RegisterCredentialResult.Error,
host = requestJsonOrigin,
assetLinkUrl = null // will be generated
host = assetLinkUrl.toHostOrPathOrNull()
?: return Fido2RegisterCredentialResult.Error,
assetLinkUrl = assetLinkUrl,
),
)
} else {
Origin.Web(assetLinkUrl)
}
return vaultSdkSource
.registerFido2Credential(
request = RegisterFido2CredentialRequest(