mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
PM-19511: Add support for ExcludedCredentials (#14128)
* works * Add mapping * remove the build script * cleanup
This commit is contained in:
@@ -14,6 +14,7 @@ pub struct PasskeyRegistrationRequest {
|
|||||||
user_verification: UserVerification,
|
user_verification: UserVerification,
|
||||||
supported_algorithms: Vec<i32>,
|
supported_algorithms: Vec<i32>,
|
||||||
window_xy: Position,
|
window_xy: Position,
|
||||||
|
excluded_credentials: Vec<Vec<u8>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(uniffi::Record, Serialize, Deserialize)]
|
#[derive(uniffi::Record, Serialize, Deserialize)]
|
||||||
|
|||||||
1
apps/desktop/desktop_native/napi/index.d.ts
vendored
1
apps/desktop/desktop_native/napi/index.d.ts
vendored
@@ -130,6 +130,7 @@ export declare namespace autofill {
|
|||||||
userVerification: UserVerification
|
userVerification: UserVerification
|
||||||
supportedAlgorithms: Array<number>
|
supportedAlgorithms: Array<number>
|
||||||
windowXy: Position
|
windowXy: Position
|
||||||
|
excludedCredentials: Array<Array<number>>
|
||||||
}
|
}
|
||||||
export interface PasskeyRegistrationResponse {
|
export interface PasskeyRegistrationResponse {
|
||||||
rpId: string
|
rpId: string
|
||||||
|
|||||||
@@ -534,6 +534,7 @@ pub mod autofill {
|
|||||||
pub user_verification: UserVerification,
|
pub user_verification: UserVerification,
|
||||||
pub supported_algorithms: Vec<i32>,
|
pub supported_algorithms: Vec<i32>,
|
||||||
pub window_xy: Position,
|
pub window_xy: Position,
|
||||||
|
pub excluded_credentials: Vec<Vec<u8>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[napi(object)]
|
#[napi(object)]
|
||||||
|
|||||||
@@ -299,6 +299,14 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
|
|||||||
UserVerification.discouraged
|
UserVerification.discouraged
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Convert excluded credentials to an array of credential IDs
|
||||||
|
var excludedCredentialIds: [Data] = []
|
||||||
|
if #available(macOSApplicationExtension 15.0, *) {
|
||||||
|
if let excludedCreds = request.excludedCredentials {
|
||||||
|
excludedCredentialIds = excludedCreds.map { $0.credentialID }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let req = PasskeyRegistrationRequest(
|
let req = PasskeyRegistrationRequest(
|
||||||
rpId: passkeyIdentity.relyingPartyIdentifier,
|
rpId: passkeyIdentity.relyingPartyIdentifier,
|
||||||
userName: passkeyIdentity.userName,
|
userName: passkeyIdentity.userName,
|
||||||
@@ -306,7 +314,8 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
|
|||||||
clientDataHash: request.clientDataHash,
|
clientDataHash: request.clientDataHash,
|
||||||
userVerification: userVerification,
|
userVerification: userVerification,
|
||||||
supportedAlgorithms: request.supportedAlgorithms.map{ Int32($0.rawValue) },
|
supportedAlgorithms: request.supportedAlgorithms.map{ Int32($0.rawValue) },
|
||||||
windowXy: self.getWindowPosition()
|
windowXy: self.getWindowPosition(),
|
||||||
|
excludedCredentials: excludedCredentialIds
|
||||||
)
|
)
|
||||||
logger.log("[autofill-extension] prepareInterface(passkey) calling preparePasskeyRegistration")
|
logger.log("[autofill-extension] prepareInterface(passkey) calling preparePasskeyRegistration")
|
||||||
|
|
||||||
|
|||||||
@@ -289,7 +289,10 @@ export class DesktopAutofillService implements OnDestroy {
|
|||||||
alg,
|
alg,
|
||||||
type: "public-key",
|
type: "public-key",
|
||||||
})),
|
})),
|
||||||
excludeCredentialDescriptorList: [],
|
excludeCredentialDescriptorList: request.excludedCredentials.map((credentialId) => ({
|
||||||
|
id: new Uint8Array(credentialId),
|
||||||
|
type: "public-key" as const,
|
||||||
|
})),
|
||||||
requireResidentKey: true,
|
requireResidentKey: true,
|
||||||
requireUserVerification:
|
requireUserVerification:
|
||||||
request.userVerification === "required" || request.userVerification === "preferred",
|
request.userVerification === "required" || request.userVerification === "preferred",
|
||||||
|
|||||||
Reference in New Issue
Block a user