Skip to content

Instantly share code, notes, and snippets.

Avatar
🙃
Chop-chop passwords...

Ackermann Yuriy herrjemand

🙃
Chop-chop passwords...
View GitHub Profile
View usernameless.MakeCredential.js
document.getElementById('register').addEventListener('submit', function(event) {
event.preventDefault();
let username = this.username.value;
let displayName = this.displayName.value;
startPasswordlessEnrolment({username, displayName})
.then((serverResponse) => {
if(serverResponse.status !== 'startFIDOEnrolmentRK')
throw new Error('Error registering user! Server returned: ' + serverResponse.errorMessage);
View password.MakeCred.direct.js
document.getElementById('register').addEventListener('submit', function(event) {
event.preventDefault();
let username = this.username.value;
let password = this.password.value;
let displayName = this.displayName.value;
registerPassword({username, password, displayName})
.then((serverResponse) => {
if(serverResponse.status !== 'startFIDOEnrollment')
View password.GetAssertion.basic.js
document.getElementById('login').addEventListener('submit', function(event) {
event.preventDefault();
let username = this.username.value;
let password = this.password.value;
loginPassword({username, password})
.then((serverResponse) => {
if(serverResponse.status !== 'startFIDOAuthentication')
throw new Error('Error logging in! Server returned: ' + serverResponse.errorMessage);
return getGetAssertionChallenge()
})
View password.register.basic.js
document.getElementById('register').addEventListener('submit', function(event) {
event.preventDefault();
let username = this.username.value;
let password = this.password.value;
let displayName = this.displayName.value;
registerPassword({username, password, displayName})
.then((serverResponse) => {
if(serverResponse.status !== 'startFIDOEnrollment')
View publickeycred.sample.get.js
var publicKey = {
challenge: challenge,
allowCredentials: [
{ type: "public-key", id: credentialId }
]
}
navigator.credentials.get({ 'publicKey': publicKey })
.then((getAssertionResponse) => {
View publickeycred.direct.sample.create.js
var challenge = new Uint8Array(32);
window.crypto.getRandomValues(challenge);
var userID = 'Kosv9fPtkDoh4Oz7Yq/pVgWHS8HhdlCto5cR0aBoVMw='
var id = Uint8Array.from(window.atob(userID), c=>c.charCodeAt(0))
var publicKey = {
'challenge': challenge,
'rp': {
View publickeycred.sample.create.js
var challenge = new Uint8Array(32);
window.crypto.getRandomValues(challenge);
var userID = 'Kosv9fPtkDoh4Oz7Yq/pVgWHS8HhdlCto5cR0aBoVMw='
var id = Uint8Array.from(window.atob(userID), c=>c.charCodeAt(0))
var publicKey = {
'challenge': challenge,
'rp': {
View passwordcred.sample.get.js
navigator.credentials.get({ 'password': true })
.then((credential) => {
if(!credential)
throw new Error('No credential found')
// sendServer(credential) // PasswordCredential {iconURL: "", name: "", password: "VeryRandomPassword123456", id: "alice", type: "password"}
})
View passwordcred.sample.store.js
var passwordcred = new PasswordCredential({
'type': 'password',
'id': 'alice',
'password': 'VeryRandomPassword123456'
})
navigator.credentials.store(passwordcred)
View androidkey.attestation.root.pem
-----BEGIN CERTIFICATE-----
MIICizCCAjKgAwIBAgIJAKIFntEOQ1tXMAoGCCqGSM49BAMCMIGYMQswCQYDVQQG
EwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmll
dzEVMBMGA1UECgwMR29vZ2xlLCBJbmMuMRAwDgYDVQQLDAdBbmRyb2lkMTMwMQYD
VQQDDCpBbmRyb2lkIEtleXN0b3JlIFNvZnR3YXJlIEF0dGVzdGF0aW9uIFJvb3Qw
HhcNMTYwMTExMDA0MzUwWhcNMzYwMTA2MDA0MzUwWjCBmDELMAkGA1UEBhMCVVMx
EzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFTAT
BgNVBAoMDEdvb2dsZSwgSW5jLjEQMA4GA1UECwwHQW5kcm9pZDEzMDEGA1UEAwwq
QW5kcm9pZCBLZXlzdG9yZSBTb2Z0d2FyZSBBdHRlc3RhdGlvbiBSb290MFkwEwYH
KoZIzj0CAQYIKoZIzj0DAQcDQgAE7l1ex+HA220Dpn7mthvsTWpdamguD/9/SQ59