Initial work on adding passkeys
Mostly starting to get some javascript set up
This commit is contained in:
parent
c7f5190885
commit
cadd58187a
18 changed files with 256 additions and 212 deletions
36
resources/js/auth.js
Normal file
36
resources/js/auth.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
class Auth {
|
||||
constructor() {}
|
||||
|
||||
async createCredentials() {
|
||||
const publicKeyCredentialCreationOptions = {
|
||||
challenge: Uint8Array.from(
|
||||
'randomStringFromServer',
|
||||
c => c.charCodeAt(0)
|
||||
),
|
||||
rp: {
|
||||
id: 'jonnybarnes.localhost',
|
||||
name: 'JB',
|
||||
},
|
||||
user: {
|
||||
id: Uint8Array.from(
|
||||
'UZSL85T9AFC',
|
||||
c => c.charCodeAt(0)
|
||||
),
|
||||
name: 'jonny@jonnybarnes.uk',
|
||||
displayName: 'Jonny',
|
||||
},
|
||||
pubKeyCredParams: [{alg: -7, type: 'public-key'}],
|
||||
// authenticatorSelection: {
|
||||
// authenticatorAttachment: 'cross-platform',
|
||||
// },
|
||||
timeout: 60000,
|
||||
attestation: 'direct'
|
||||
};
|
||||
|
||||
return await navigator.credentials.create({
|
||||
publicKey: publicKeyCredentialCreationOptions
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { Auth };
|
Loading…
Add table
Add a link
Reference in a new issue