Initial work on adding passkeys

Mostly starting to get some javascript set up
This commit is contained in:
Jonny Barnes 2023-08-18 17:03:38 +01:00
parent c7f5190885
commit cadd58187a
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
18 changed files with 256 additions and 212 deletions

View file

@ -8,6 +8,9 @@ indent_style = space
insert_final_newline = true insert_final_newline = true
trim_trailing_whitespace = true trim_trailing_whitespace = true
[*.{js,css}]
indent_size = 2
[*.md] [*.md]
trim_trailing_whitespace = false trim_trailing_whitespace = false

View file

@ -1,5 +1,6 @@
parserOptions: parserOptions:
sourceType: 'module' sourceType: 'module'
ecmaVersion: 8
extends: 'eslint:recommended' extends: 'eslint:recommended'
env: env:
browser: true browser: true
@ -9,7 +10,7 @@ ignorePatterns:
rules: rules:
indent: indent:
- error - error
- 4 - 2
linebreak-style: linebreak-style:
- error - error
- unix - unix

View file

@ -1,7 +1,3 @@
{ {
"extends": ["stylelint-config-standard"], "extends": ["stylelint-config-standard"]
"rules": {
"indentation": 4,
"import-notation": "string"
}
} }

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -1,6 +1,6 @@
@import "variables.css"; @import url('variables.css');
@import "fonts.css"; @import url('fonts.css');
@import "layout.css"; @import url('layout.css');
@import "colours.css"; @import url('colours.css');
@import "code.css"; @import url('code.css');
@import "content.css"; @import url('content.css');

View file

@ -1,5 +1,4 @@
@import "posse.css"; @import url('h-card.css');
@import "h-card.css";
.h-entry { .h-entry {
border-inline-start: 1px solid var(--color-primary); border-inline-start: 1px solid var(--color-primary);

View file

@ -1,3 +0,0 @@
.p-bridgy-twitter-content {
display: none;
}

View file

@ -14,9 +14,9 @@
--font-size-xxxl: 2.25rem; /* 36px */ --font-size-xxxl: 2.25rem; /* 36px */
/* Colours */ /* Colours */
--color-primary: oklch(36.8% 0.1 125.505); --color-primary: oklch(36.8% 0.1 125.505deg);
--color-secondary: oklch(96.3% 0.1 125.505); --color-secondary: oklch(96.3% 0.1 125.505deg);
--color-link: oklch(48.09% 0.146 241.41); --color-link: oklch(48.09% 0.146 241.41deg);
--color-link-visited: oklch(70.44% 0.21 304.41); --color-link-visited: oklch(70.44% 0.21 304.41deg);
--color-primary-shadow: oklch(19.56% 0.054 125.505 / 40%); --color-primary-shadow: oklch(19.56% 0.054 125.505deg / 40%);
} }

View file

@ -1 +1,10 @@
import '../css/app.css'; import '../css/app.css';
// import { Auth } from './auth.js';
//
// let auth = new Auth();
// auth.createCredentials().then((credentials) => {
// // eslint-disable-next-line no-console
// console.log(credentials);
// });

36
resources/js/auth.js Normal file
View 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 };

View file

@ -51,4 +51,9 @@
<p> <p>
Edit your <a href="/admin/bio">bio</a>. Edit your <a href="/admin/bio">bio</a>.
</p> </p>
<h2>Passkeys</h2>
<p>
List passkeys here?
</p>
@stop @stop