This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
PublicKeyCredentialCreationOptions.rpPublicKeyCredentialCreationOptions.userPublicKeyCredentialCreationOptions.challengePublicKeyCredentialCreationOptions.pubKeyCredParamsPublicKeyCredentialCreationOptions.timeout Optional
PublicKeyCredentialCreationOptions.excludeCredentials Optional
PublicKeyCredentialCreationOptions.authenticatorSelection Optional
PublicKeyCredentialCreationOptions.attestation Optional
PublicKeyCredentialCreationOptions.extensions Optional
None.
// some examples of COSE algorithms
const cose_alg_ECDSA_w_SHA256 = -7;
const cose_alg_ECDSA_w_SHA512 = -36;
// the PublicKeyCredentialCreationOptions object
var createCredentialOptions = {
    // Format of new credentials is publicKey
    publicKey: {
        // Relying Party
        rp: {
            name: "Acme",
        },
        // User
        user: {
            id: new Uint8Array(16),
            name: "[email protected]",
            displayName: "John P. Smith",
        },
        // Requested format of new keypair
        pubKeyCredParams: [{
            type: "public-key",
            alg: cose_alg_ECDSA_w_SHA256,
        }],
        timeout: 60000 // Timeout after 1 minute
    }
};
// Create the new credential with the options above
navigator.credentials.create(createCredentialOptions);
 | Specification | Status | Comment | 
|---|---|---|
| Web Authentication: An API for accessing Public Key Credentials Level 1 | Candidate Recommendation | Initial definition. | 
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 67 | ? | 60 | ? | ? | ? | 
attestation 
 | 
67 | ? | 60 | ? | ? | ? | 
authenticatorSelection 
 | 
67 | ? | 60 | ? | ? | ? | 
challenge 
 | 
67 | ? | 60 | ? | ? | ? | 
excludeCredentials 
 | 
67 | ? | 60 | ? | ? | ? | 
extensions 
 | 
67 | ? | 60 | ? | ? | ? | 
pubKeyCredParams 
 | 
67 | ? | 60 | ? | ? | ? | 
rp 
 | 
67 | ? | 60 | ? | Yes | ? | 
timeout 
 | 
67 | ? | 60 | ? | ? | ? | 
user 
 | 
67 | ? | 60 | ? | ? | ? | 
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | ? | ? | ? | ? | ? | ? | ? | 
attestation 
 | 
? | ? | ? | ? | ? | ? | ? | 
authenticatorSelection 
 | 
? | ? | ? | ? | ? | ? | ? | 
challenge 
 | 
? | ? | ? | ? | ? | ? | ? | 
excludeCredentials 
 | 
? | ? | ? | ? | ? | ? | ? | 
extensions 
 | 
? | ? | ? | ? | ? | ? | ? | 
pubKeyCredParams 
 | 
? | ? | ? | ? | ? | ? | ? | 
rp 
 | 
? | ? | ? | ? | Yes | ? | ? | 
timeout 
 | 
? | ? | ? | ? | ? | ? | ? | 
user 
 | 
? | ? | ? | ? | ? | ? | ? | 
    © 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
    https://developer.mozilla.org/en-US/docs/Web/API/PublicKeyCredentialCreationOptions