The PublicKeyCredential interface provides information about a public key / private key pair, which is a credential for logging in to a service using an un-phishable and data-breach resistant asymmetric key pair instead of a password. It inherits from Credential, and is part of the Web Authentication API extension to the Credential Management API.
Note: This API is restricted to top-level contexts. Use from within an <iframe> element will not have any effect.
An ArrayBuffer that holds the globally unique identifier for this PublicKeyCredential. This identifier can be used to look up credentials for future calls to navigator.credentials.get().
const requestCredentialOptions ={challenge:newUint8Array([/* bytes sent from the server */]),};
navigator.credentials
.get({ requestCredentialOptions }).then((credentialInfoAssertion)=>{// send assertion response back to the server// to proceed with the control of the credential}).catch((err)=>{
console.error(err);});