Last active
March 9, 2019 05:27
-
-
Save gebogebogebo/591ec8917487fe5b0d8964e578ceba6e to your computer and use it in GitHub Desktop.
WebAuthnぽいことができるWinデスクトップアプリ用ライブラリ WebAuthnModokiDesktopβ ref: https://qiita.com/gebo/items/f6d3024f7e164ac0a195
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var devParam = DevParam.GetDefaultParams(); | |
byte[] challenge = System.Text.Encoding.ASCII.GetBytes("this is challenge"); | |
string pin = "xxxx"; | |
string json = | |
"{" + | |
"rp : {" + | |
"id : 'demo.WebauthnMODOKI.gebogebo.com'," + | |
"}," + | |
"user : {" + | |
"id : 'userid'," + | |
"name :'name_name'," + | |
"displayName :'my name is gebogebo'," + | |
"}," + | |
"pubKeyCredParams: [{type: 'public-key',alg: -7}]," + | |
"timeout: 60000," + | |
"authenticatorSelection : {" + | |
"requireResidentKey : false," + | |
"}," + | |
string.Format($"challenge:[{string.Join(",", challenge)}],") + | |
"}"; | |
var response = await Credentials.Create(devParam,json, pin); | |
if (response.isSuccess == true) { | |
// 成功 | |
// response.attestation ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var devParam = DevParam.GetDefaultParams(); | |
byte[] challenge = System.Text.Encoding.ASCII.GetBytes("this is challenge"); | |
string pin = "xxxx"; | |
byte[] CredentialId= // createでGETしたCredentialIdを指定してください(response.attestation.CredentialId); | |
string json = | |
"{" + | |
"timeout : 60000," + | |
string.Format($"challenge:[{string.Join(",", challenge)}],") + | |
"rpId : 'demo.WebauthnMODOKI.gebogebo.com'," + | |
"allowCredentials : [{" + | |
string.Format($"id : [{string.Join(",", CredentialId)}],") + | |
"type : 'public-key'," + | |
"}]," + | |
"requireUserPresence : 'true'," + | |
"userVerification : 'discouraged'," + | |
"}"; | |
var response = await Credentials.Get(devParam ,json, pin); | |
if (response.isSuccess == true) { | |
// 成功 | |
// response.assertions[0] ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment