-
Notifications
You must be signed in to change notification settings - Fork 8
/
Index.razor
59 lines (51 loc) · 1.62 KB
/
Index.razor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
@page "/"
@using System.Security.Cryptography;
@inject CredentialsService CredentialsService;
<PageTitle>Blazor Web Authentication</PageTitle>
<h2>Blazor Web Authentication</h2>
@if (!isSupported)
{
<p>The Web Authentication browser API is not supported in this browser. Try updating your browser/system or try another browser/device.</p>
return;
}
<p>Here you can try create a credential from your device's native identification mechanism.</p>
<button class="btn btn-success" @onclick="CreateCredential">Create Credentials</button>
<br />
<br />
@if (credential is not null)
{
<b>Type: </b> @type
<br />
<b>Id: </b> @id
<br />
@if (challenge is not null)
{
<b>Challenge: </b> @string.Join(", ", challenge.Select(b => $"{b:X2}"))
<br />
}
@if (publicKey is not null)
{
<b>Public Key: </b> @string.Join(", ", publicKey.Select(b => $"{b:X2}"))
<br />
}
<br />
<button class="btn btn-primary" @onclick="GetCredential">Request Credentials from Id</button>
@if (successfulGettingCredential is {} success)
{
<br />
<br />
<div class="rounded p-2 text-white @(success ? "bg-success": "bg-danger")">
@(success ? "You logged in and validated your credentials" : errorMessage ?? "You were not successful in logging on.")
</div>
@if (signature is not null)
{
<b>Signature: </b> @string.Join(", ", signature.Select(b => $"{b:X2}"))
;
<br />
}
}
}
else if (errorMessage is not null)
{
<div class="rounded p-2 text-white bg-danger">@errorMessage</div>
}