Skip to content

Instantly share code, notes, and snippets.

View saltukalakus's full-sized avatar
🐢
Rust & Cryptography

saltukalakus

🐢
Rust & Cryptography
View GitHub Profile
@saltukalakus
saltukalakus / hostedPasswordlessPage.html
Created December 5, 2019 17:16
Print the phone number on console before submit
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Sign In with Auth0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
@saltukalakus
saltukalakus / gist:08efe814847f9a049ce4d07140817c78
Created December 3, 2019 14:15
Encrypt & Decrypt with existing keys
const crypto = require("crypto");
let publicKey = `-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsoykgfqb0VqzTIDDShJ7
Pa7sg6hV4kmBBof7LLPyvmMdNB/2zNZ3mfEr0Dw+qNinmyVXQ5b/DjwbjHvYQpn9
foiFFDS6fP8ErGkICEN/68JvI/MSEJsbfDxKM/rQTwXVfD+0wxEIRblzW1LMYraO
NuCPWgg0UZRmis+8Qcr0vZdf61lyfyaTx0C0bwS/wsJO0yFrIWGMsatYZktbbpPG
IOQwqT2VIWfvcKjMcV8OXHNMoVjG6ni3kqXjSPYKaT1qWl4L73/dWKS0IlJJfdYw
0hpzDsmgwnsug9KBtfzbreNenVPbMfCUXone8VQZ/0+Eb8iO7JwaPuFld+0Czcsu
kG6pmBUwaPk9ISlRNWUkyhUP9q4rUmAzAZgcYPNVWQVZwG/u7X2Jbf7jdsYvvCX3
@saltukalakus
saltukalakus / test.js
Created December 3, 2019 14:08
Encrypt & Decrypt with Node's crypto lib.
const crypto = require("crypto");
crypto.generateKeyPair(
"rsa",
{
modulusLength: 4096,
publicKeyEncoding: {
type: "spki",
format: "pem"
},
@saltukalakus
saltukalakus / hostedPage.html
Last active June 2, 2025 20:36
Passwordless and regular login together with Lock
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Sign In with Auth0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<!--[if IE 8]>
@saltukalakus
saltukalakus / welcome_sent.js
Created November 2, 2019 11:45
Welcome Sent message
function (user, context, callback) {
// If the connection isn't email passwordless return
if (context.connection !== "email") {
return callback(null, user, context);
}
if (user.app_metadata && user.app_metadata.welcomeSent) {
return callback(null, user, context);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">.ExternalClass,.ExternalClass div,.ExternalClass font,.ExternalClass p,.ExternalClass span,.ExternalClass td,img{line-height:100%}#outlook a{padding:0}.ExternalClass,.ReadMsgBody{width:100%}a,blockquote,body,li,p,table,td{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}table,td{mso-table-lspace:0;mso-table-rspace:0}img{-ms-interpolation-mode:bicubic;border:0;height:auto;outline:0;text-decoration:none}table{border-collapse:collapse!important}#bodyCell,#bodyTable,body{height:100%!important;margin:0;padding:0;font-family:ProximaNova,sans-serif}#bodyCell{padding:20px}#bodyTable{width:600px}@font-face{font-family:ProximaNova;src:url(https://cdn.auth0.com/fonts/proxima-nova/proximanova-regular-webfont-webfont.eot);src:url(https://cdn.auth
@saltukalakus
saltukalakus / force_user_email_verification_rule.js
Last active June 2, 2025 20:36
Rule to force email verification only for some applications on the Auth0 dashboard
function (user, context, callback) {
// Bypass this rule for a particular app
if(context.clientName === 'NameOfTheAppToBypass'){
return callback(null, user, context);
}
// Access should only be granted to verified users otherwise.
if (!user.email || !user.email_verified) {
return callback(new UnauthorizedError('Access denied.'));
@saltukalakus
saltukalakus / sample_users_with_id.json
Last active June 2, 2025 20:36
Sample users JSON file to import
[
{
"user_id": "583c3ac3f38e84297c002546",
"email": "[email protected]",
"name": "[email protected]",
"given_name": "Hello",
"family_name": "Test",
"nickname": "test",
"last_ip": "94.121.163.63",
"logins_count": 15,
@saltukalakus
saltukalakus / hostedPage.html
Last active June 2, 2025 20:36
Lock validator function
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Sign In with Auth0</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
@saltukalakus
saltukalakus / silent.js
Created July 19, 2019 03:36
Check is the user is already authenticated on other site.
window.onload = function() {
webAuth = new auth0.WebAuth({
domain: 'saltuk-wordpress.auth0.com',
redirectUri: 'http://dev-auth0-test1.pantheonsite.io/index.php?auth0=1',
clientID: 'SCNHLB4vHvQlTKazudZO87LDikCyrP6s',
responseType: 'token id_token',
});
if (document.cookie.match(/^(.*;)?\s*CheckedSessionCookie\s*=\s*[^;]+(.*)?$/) === null) {