Skip to content

Instantly share code, notes, and snippets.

@ritou
ritou / passkey_works.md
Created October 20, 2023 05:12
ぱすきーっちゅーの!
すきっちゅーの!
ぱすきーっちゅーの!
好きになっちゃダメっつーの?
すきっちゅーの!
ぱすきっちゅーの!
パスワードとかいらんちゅーのchu!

顔だ!指紋だ!という貴方
面と向かってそれ言えます?
  1. HTTP Client module
  defmodule Your.HttpClient do
    @behaviour Scratcher.HttpClient
    def request(method, url, body, headers, http_opts) do

      # use hackney, httpoison, httpotion...

 {:ok, %{status_code: 200, body: "..."}}
iex(1)> Application.ensure_all_started(:hackney)
{:ok,
 [:unicode_util_compat, :idna, :mimerl, :certifi, :syntax_tools, :parse_trans,
  :ssl_verify_fun, :metrics, :hackney]}
  
iex(2)> :hackney.request(:get, "https://example.com", [], "", [:with_body])
{:ok, 200,
 [
   {"Accept-Ranges", "bytes"},
iex(1)> JOSE.crypto_fallback(true)
:ok
iex(2)> JOSE.JWK.generate_key({:okp, :Ed25519})
%JOSE.JWK{
  fields: %{},
  keys: :undefined,
  kty: {:jose_jwk_kty_okp_ed25519,
   <<162, 30, 40, 233, 122, 159, 105, 49, 218, 101, 29, 205, 178, 236, 20, 132,
     14, 29, 119, 147, 44, 162, 49, 141, 96, 128, 117, 109, 21, 56, 64, 160, 4,

Application State

{
  "next_url":"/account/settings",
  ...
  "foo":"bar"
}

ChromeのFIDO CTAP2 PIN support動作確認メモ

Web Authentication API: FIDO CTAP2 PIN support
This feature extends Chrome's implementation of the Web Authentication API to support local user authorization of security key operations via a user-defined PIN for keys that implement the FIDO CTAP2 protocol. Web sites using web authentication can request or require such authorization via the API's user verification mechanisms.

Registration

@ritou
ritou / WebAuthnKit_vs_WebAuthnLite.md
Created November 24, 2018 16:19
Interop result with WebAuthnKit and WebAuthnLite

Interop result with WebAuthnKit and WebAuthnLite. parameters is from https://github.com/lyokato/WebAuthnKit/blob/develop/utils/interop/go_koesie10_webauthn/main.go

iex(1)> origin = "https://example.org"
"https://example.org"
iex(2)> challenge = "rtnHiVQ7"
"rtnHiVQ7"
iex(3)> encoded_registration_client_data_json = "eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmdlIjoicnRuSGlWUTciLCJvcmlnaW4iOiJodHRwczpcL1wvZXhhbXBsZS5vcmcifQ"
"eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmdlIjoicnRuSGlWUTciLCJvcmlnaW4iOiJodHRwczpcL1wvZXhhbXBsZS5vcmcifQ"
# JOSE.JWK を用いて鍵を作成
iex(1)> jwk = JOSE.JWK.generate_key(:secp256r1)
%JOSE.JWK{
  fields: %{},
  keys: :undefined,
  kty: {:jose_jwk_kty_ec,
   {:ECPrivateKey, 1,
    <<37, 161, 110, 23, 211, 111, 64, 142, 98, 207, 153, 90, 139, 91, 212, 33,