blob: 895dda3798ce68b4b900866e21477006b5a63917 [file] [log] [blame]
<input type="text" id="input">
<script>
if (window.internals)
internals.withUserGesture(() => { input.focus(); });
const options = {
publicKey: {
rp: {
name: "localhost",
},
user: {
name: "John Appleseed",
id: new Uint8Array(16),
displayName: "Appleseed",
},
challenge: new Uint8Array(16),
pubKeyCredParams: [{ type: "public-key", alg: -7 }],
timeout: 100,
}
};
navigator.credentials.create(options).then(credential => {
window.webkit.messageHandlers.testHandler.postMessage("Succeeded!");
}, error => {
// The first call will consume the freebie, the second will give the no user gesture error.
navigator.credentials.create(options).then(credential => {
window.webkit.messageHandlers.testHandler.postMessage("Succeeded!");
}, error => {
window.webkit.messageHandlers.testHandler.postMessage(error.message);
});
window.webkit.messageHandlers.testHandler.postMessage(error.message);
});
</script>