mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
87 lines
1.6 KiB
Templ
87 lines
1.6 KiB
Templ
package state
|
|
|
|
templ NavigatorCredentialsCreate() {
|
|
<script>
|
|
navigator.credentials.create({
|
|
publicKey: {
|
|
rp: {
|
|
name: "Sonr",
|
|
id: "sonr.id",
|
|
},
|
|
user: {
|
|
id: new Uint8Array(0),
|
|
name: "Sonr",
|
|
displayName: "Sonr",
|
|
},
|
|
challenge: new Uint8Array(0),
|
|
pubKeyCredParams: [{
|
|
type: "public-key",
|
|
alg: -7,
|
|
}],
|
|
timeout: 60000,
|
|
excludeCredentials: [],
|
|
authenticatorSelection: {
|
|
requireResidentKey: false,
|
|
userVerification: "discouraged",
|
|
},
|
|
},
|
|
})
|
|
.then((assertion) => {
|
|
console.log("Assertion:", assertion);
|
|
})
|
|
.catch((error) => {
|
|
console.error("Error:", error);
|
|
});
|
|
</script>
|
|
}
|
|
|
|
templ NavigatorCredentialsGet() {
|
|
<script>
|
|
navigator.credentials.get({
|
|
publicKey: {
|
|
challenge: new Uint8Array(0),
|
|
allowCredentials: [],
|
|
timeout: 60000,
|
|
userVerification: "discouraged",
|
|
},
|
|
})
|
|
.then((assertion) => {
|
|
console.log("Assertion:", assertion);
|
|
})
|
|
.catch((error) => {
|
|
console.error("Error:", error);
|
|
});
|
|
</script>
|
|
}
|
|
|
|
templ NavigatorCredentialsGetAll() {
|
|
<script>
|
|
navigator.credentials.getAll({
|
|
publicKey: {
|
|
challenge: new Uint8Array(0),
|
|
allowCredentials: [],
|
|
timeout: 60000,
|
|
userVerification: "discouraged",
|
|
},
|
|
})
|
|
.then((assertion) => {
|
|
console.log("Assertion:", assertion);
|
|
})
|
|
.catch((error) => {
|
|
console.error("Error:", error);
|
|
});
|
|
</script>
|
|
}
|
|
|
|
templ NavigatorCredentialsHasPasskey() {
|
|
<script>
|
|
navigator.credentials.has()
|
|
.then((has) => {
|
|
console.log("Has Passkey:", has);
|
|
})
|
|
.catch((error) => {
|
|
console.error("Error:", error);
|
|
});
|
|
</script>
|
|
}
|