mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-03 09:51:39 +00:00
feat: add passkey creation functionality
This commit is contained in:
@@ -113,17 +113,20 @@ templ CredentialsScripts() {
|
||||
.replace(/\//g, '_')
|
||||
.replace(/=/g, '');
|
||||
}
|
||||
// Function to create a passkey
|
||||
function createPasskey(button) {
|
||||
const passkey = window.crypto.getRandomValues(new Uint8Array(32)).join('');
|
||||
// Assuming there is a hidden input field to store the passkey
|
||||
const hiddenInput = button.closest('form').querySelector('input[name="passkey"]');
|
||||
if (hiddenInput) {
|
||||
hiddenInput.value = passkey;
|
||||
}
|
||||
console.log('Passkey generated:', passkey);
|
||||
}
|
||||
</script>
|
||||
}
|
||||
}
|
||||
|
||||
script CreatePasskey(id string) {
|
||||
function createPasskey(id) {
|
||||
const passkey = document.getElementById(id);
|
||||
passkey.value = window.crypto.getRandomValues(new Uint8Array(32)).join('');
|
||||
}
|
||||
}
|
||||
|
||||
// Template for creating credentials
|
||||
templ CreateCredential(options *RegisterOptions) {
|
||||
@CredentialsScripts()
|
||||
|
||||
Reference in New Issue
Block a user