Thuta Learning
Digital Privacy & Modern Security
BasicSecurityintermediate

Passkeys ဆိုတာ ဘာလဲ

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Passkeys ဆိုတာ ဘာလဲ concept ကို နားလည်ရှင်းပြနိုင်ရန်
  • Diagram/checklist ကို ဖတ်ပြီး threat/control/decision ဘယ်လို ဆက်စပ်နေသလဲ ခြေရာခံနိုင်ရန်
  • ကိုယ့် digital life (သို့) developer workflow မှာ ဘယ်လို အသုံးချသင့်သလဲ ရှင်းပြနိုင်ရန်

နားလည်ထားရမယ့် အချက်

Passkey ဆိုတာ ရိုက်ထည့်ရတဲ့ secret အစား public-key cryptography အပေါ် အခြေခံထားတဲ့ credential တစ်မျိုးပါ။ Passkey ဖန်တီးတဲ့အခါ device က key pair တစ်စုံ generate လုပ်ပါတယ် - public key ကို service ဆီ ပေး၊ private credential ကတော့ device ကနေ ဘယ်တော့မှ မထွက်ပါဘူး။

Cybersecurity Basics နဲ့ ဘာကွာလဲ

Cybersecurity Basics ထဲက authentication method တိုင်းက user ရိုက်ထည့်တဲ့ ဒါမှမဟုတ် ကိုင်ဆောင်ထားတဲ့ secret အပေါ် အခြေခံထားပါတယ်။ Passkey က ဒီ model ကို လုံးဝ ကွဲပြားစွာ ပြောင်းလဲပစ်ပါတယ်။

1. Challenge ပို့

Login ဝင်တဲ့အခါ service က အဲဒီ login attempt အတွက်သာ unique ဖြစ်တဲ့ data (challenge) တစ်ခု ပို့ပါတယ်။

2. Device က sign လုပ်

Device က private credential ကို သုံးပြီး challenge ကို sign လုပ်ပါတယ်, credential ကိုယ်တိုင် ဘယ်တော့မှ မပါဘူး။

3. Signature ပြန်ပို့

Device က signature ကိုသာ service ဆီ ပြန်ပို့ပါတယ်။

4. Service က verify

Service က သူ့ဆီရှိတဲ့ public key နဲ့ signature ကို စစ်ဆေးပြီး ကိုက်ညီရင် authenticate ဖြစ်သွားပါတယ်။

Misconception ပြင်ဆင်ချက်

Private key ကို website ဆီ "ပို့"တယ်ဆိုတာ မှားနေပါတယ်။ Private credential က device ပေါ်မှာ အမြဲတမ်း နေမယ်၊ ကိုင်ဆောင်ထားကြောင်း proof တစ်ခုသာ network ကို ဖြတ်ပါတယ်။

Passkey
Public-key cryptography ကို သုံးထားတဲ့ authentication credential တစ်မျိုးပါ - private credential ဟာ user ရဲ့ device/authenticator ကနေ ဘယ်တော့မှ မထွက်ပါဘူး။
Public-Key Cryptography
Key နှစ်ခု (public key နဲ့ private key) ချိတ်ဆက်ထားတဲ့ system တစ်ခုပါ - private key ကိုင်ဆောင်ထားကြောင်း private key ကိုယ်တိုင် ဖော်ထုတ်စရာမလိုဘဲ mathematically သက်သေပြနိုင်ပါတယ်။
text
PASSKEY CHALLENGE-RESPONSE FLOW
-------------------------------
PASSKEY CHALLENGE-RESPONSE FLOW
--------------------------------

  SERVICE                          DEVICE
  (stores PUBLIC key)              (protects PRIVATE credential)

     |                                    |
     |  1. login request                  |
     |----------------------------------->|
     |                                    |
     |  2. sends CHALLENGE                |
     |----------------------------------->|
     |                                    |
     |                       3. signs challenge
     |                          with PRIVATE credential
     |                          (never leaves device)
     |                                    |
     |  4. returns SIGNATURE only         |
     |<-----------------------------------|
     |                                    |
     5. verifies signature
        using PUBLIC key
     |
     6. ACCESS GRANTED (or denied)

လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်

အောက်က code က plain string hashing ကို သုံးပြီး challenge-response authentication ရဲ့ ပုံသဏ္ဌာန်ကို simulate လုပ်ပြထားတာပါ, real public-key math မဟုတ်ပါဘူး။ Teaching illustration တစ်ခုသာ ဖြစ်ပါတယ်။

Registration

Device က private credential ကို တစ်ကြိမ်တည်း hash လုပ်ပြီး service ကို derive လုပ်ထားတဲ့ verifier ကိုသာ ပေးပါတယ်။

Login

Service က challenge ပို့ပြီး device က challenge နဲ့ secret ကို ပေါင်းစပ်ပြီး response ထုတ်ပါတယ်, secret ကိုယ်တိုင် မပို့ဘူး။

Verification

Service က သိမ်းထားတဲ့ verifier တစ်ခုတည်းကို သုံးပြီး valid response ဘယ်လိုဖြစ်သင့်သလဲ ကိုယ်တိုင် ပြန်တွက်ပြီး ယှဉ်ကြည့်ပါတယ်။

Simulation ကို နှစ်ကြိမ် run ကြည့်ပါ - မှန်ကန်တဲ့ credential နဲ့ တစ်ကြိမ်၊ impostor တစ်ယောက်နဲ့ တစ်ကြိမ်။ Legitimate device ကတော့ verify အောင်မြင်ပြီး impostor ကတော့ မအောင်မြင်ပါဘူး။

အတူတူ စမ်းရေးကြည့်မယ်

javascript
// SIMPLIFIED ILLUSTRATION ONLY -- not real cryptography.
// Real passkeys use asymmetric (public/private key) math; this toy uses
// plain string hashing just to show the SHAPE of challenge-response:
// the device never transmits its secret, only a response to a challenge.

function simpleHash(text) {
  let hash = 0;
  for (let i = 0; i < text.length; i++) {
    hash = (hash * 31 + text.charCodeAt(i)) >>> 0;
  }
  return hash.toString(16);
}

function registerDevice(privateCredential) {
  return simpleHash(privateCredential);
}

function deviceRespond(privateCredential, challenge) {
  const provisionalVerifier = simpleHash(privateCredential);
  return simpleHash(challenge + provisionalVerifier);
}

function serviceVerify(storedVerifier, challenge, deviceResponse) {
  const expected = simpleHash(challenge + storedVerifier);
  return expected === deviceResponse;
}

const privateCredential = "device-secret-9f3a";
const storedVerifier = registerDevice(privateCredential);
const challenge = "login-challenge-001";

const response = deviceRespond(privateCredential, challenge);
const legitimateLoginValid = serviceVerify(storedVerifier, challenge, response);

const impostorResponse = deviceRespond("wrong-guess", challenge);
const impostorLoginValid = serviceVerify(storedVerifier, challenge, impostorResponse);

console.log(JSON.stringify({
  storedVerifier,
  challenge,
  deviceResponse: response,
  secretWasTransmitted: false,
  legitimateLoginValid,
  impostorLoginValid
}, null, 2));
You should see
Simulation ကို run ကြည့်ရင် legitimate device ရဲ့ response က verify အောင်မြင်ပြီး (`legitimateLoginValid: true`), secret မှားနေတဲ့ impostor ကတော့ verify မအောင်မြင်ပါဘူး (`impostorLoginValid: false`), နှစ်ခုစလုံးမှာ secret ကိုယ်တိုင် ဘယ်တော့မှ မပါဝင်ပါဘူး။ Output အတိအကျမှာ:
{
  "storedVerifier": "c0bc4ea1",
  "challenge": "login-challenge-001",
  "deviceResponse": "b6bf07f2",
  "secretWasTransmitted": false,
  "legitimateLoginValid": true,
  "impostorLoginValid": false
}

၅ မိနစ် စမ်းကြည့်

`challenge` ကို "login-challenge-002" လို့ ပြောင်းပြီး ပြန် run ကြည့်ပါ။ `storedVerifier` က မပြောင်းဘဲ `deviceResponse` ကတော့ ပြောင်းသွားတာ သတိထားပါ - challenge တစ်ခုစီအတွက် response က ထူးခြားနေရမှာပါ။

သတိလေးတစ်ချက်

ဒီ code ကို real cryptography လို့ ထင်ပြီး တကယ့် production system တွေမှာ သုံးဖို့ ကြိုးစားတာ

Private key ကို website ဆီ တကယ် "ပို့"တယ်လို့ ဆက်ယုံကြည်နေတာ

FIDO Alliance — PasskeysDigital Privacy & Modern Security

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • ဒီ code ကို real cryptography လို့ ထင်ပြီး တကယ့် production system တွေမှာ သုံးဖို့ ကြိုးစားတာ
  • Private key ကို website ဆီ တကယ် "ပို့"တယ်လို့ ဆက်ယုံကြည်နေတာ
  • ဒီ course က Cybersecurity Basics course အသစ် မဟုတ်ပါ — password/2FA/phishing/malware/encryption/backup အခြေခံကို Cybersecurity tutorial ကနေ လေ့လာပြီးသားလို့ ယူဆထားပါတယ်။ ဒီ course က Passkeys, Public Wi-Fi/VPN, Browser Security, Privacy, developer-focused Auth/API security, AI security လို အသစ်ထပ်ဖြည့်တဲ့ အပိုင်းကိုသာ သင်ပေးပါတယ်။

လေ့ကျင့်ခန်း

`challenge` ကို "login-challenge-002" လို့ ပြောင်းပြီး ပြန် run ကြည့်ပါ။ `storedVerifier` က မပြောင်းဘဲ `deviceResponse` ကတော့ ပြောင်းသွားတာ သတိထားပါ - challenge တစ်ခုစီအတွက် response က ထူးခြားနေရမှာပါ။

You'll know it worked when: Simulation ကို run ကြည့်ရင် legitimate device ရဲ့ response က verify အောင်မြင်ပြီး (`legitimateLoginValid: true`), secret မှားနေတဲ့ impostor ကတော့ verify မအောင်မြင်ပါဘူး (`impostorLoginValid: false`), နှစ်ခုစလုံးမှာ secret ကိုယ်တိုင် ဘယ်တော့မှ မပါဝင်ပါဘူး။ Output အတိအကျမှာ: { "storedVerifier": "c0bc4ea1", "challenge": "login-challenge-001", "deviceResponse": "b6bf07f2", "secretWasTransmitted": false, "legitimateLoginValid": true, "impostorLoginValid": false }