Skip to content

Commit

Permalink
WIP SignIn with identifier (real) or credential (placeholder). KERIAu…
Browse files Browse the repository at this point in the history
…th small-caps;
  • Loading branch information
edeykholt committed Sep 24, 2024
1 parent 18c7d7c commit 4cfb655
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 26 deletions.
2 changes: 1 addition & 1 deletion KeriAuth.BrowserExtension/UI/Layouts/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@ToggleMenuDrawer" Style="padding-left: 5px;" data-testid="menuHamburger" />
<MudButton Href="@RouteToStart" Style="padding: 10px; height:fit-content; align-self:center; border:none; border-radius:16px; background:#00000020;">
<img src="images/512_keri_logo.png" alt="Icon" style="width: 24px; height: 24px;" />
<MudText Style="margin-left:7px; font-size:larger; color:hsl(183deg 100% 50%)">KERI Auth</MudText>
<MudText Style="margin-left:7px; font-size:larger; color:hsl(183deg 100% 50%); font-variant: small-caps;">KeriAuth</MudText>
</MudButton>

<MudSpacer />
Expand Down
47 changes: 27 additions & 20 deletions KeriAuth.BrowserExtension/UI/Pages/RequestSignInPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -339,25 +339,33 @@
this.StateHasChanged();
}

/* SignIn()
// TODO parameterize this to include the Identifier AID (or prefix?) or Credential
/*
// SignIn()
*/
async Task SignIn()
async Task SignIn(SignInMode RequestedSignInMode, string requestId2, string SelectedPrefix)
{
// for Credential
// ReplyMessageData<AuthorizeResult> replyMessageData = new(
// "/signify/reply",
// new AuthorizeResult(new AuthorizeResultCredential("rawraw", "hail cesr"), null), new AuthorizeResultIdentifier("selectedPrefix....")),
// requestId: requestId
// );
// for Identifier
ReplyMessageData<AuthorizeResult> replyMessageData = new(
"/signify/reply",
new AuthorizeResult(null, new AuthorizeResultIdentifier(SelectedPrefix)),
requestId: requestId
);

ReplyMessageData<AuthorizeResult> replyMessageData;
switch (RequestedSignInMode)
{
case SignInMode.Identifier:
logger.LogInformation("SignIn with Identifier: {0}", SelectedPrefix);
replyMessageData = new(
"/signify/reply",
new AuthorizeResult(null, new AuthorizeResultIdentifier(SelectedPrefix)),
requestId: requestId2
);
break;
case SignInMode.Credential:
logger.LogInformation("SignIn with Credential: {0}", "Test from KERI Auth");
replyMessageData = new(
"/signify/reply",
new AuthorizeResult(new AuthorizeResultCredential("rawraw", "Test from KERI Auth"), null),
requestId: requestId2
);
break;
default:
return;
}
await appSwMessagingService.SendToServiceWorkerAsync<AuthorizeResult>(replyMessageData);
UIHelper.CloseWindow();
}
Expand Down Expand Up @@ -480,13 +488,12 @@
<MudStack Row="true" class="bt-button-tray">
<MudSpacer />
<MudButton StartIcon="@Icons.Material.Filled.Cancel" Variant="Variant.Filled" Color="Color.Tertiary" @onclick="Cancel">Cancel</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.Login" Variant="Variant.Filled" Color="Color.Primary" @onclick="SignIn">Sign In</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.Login" Variant="Variant.Filled" Color="Color.Primary" OnClick="async () => await SignIn(RequestedSignInMode, requestId, SelectedPrefix)">Sign In</MudButton>
</MudStack>
</div>

<style>
.mud-select .mud-select-input .mud-input-slot {
height: auto;
}
</style>

</style>
6 changes: 3 additions & 3 deletions KeriAuth.BrowserExtension/UI/Pages/UnlockPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
<div class="d-flex gap-3 bt-main" style="justify-content:center;">
<MudStack Class="d-flex justify-center pa-0" Style="text-align:center;">
<MudImage Style="align-self:center;" Fluid="true" Width="190" Class="mx-11" Src="/images/humans_1.png"></MudImage>
<MudText>
<span style="font-weight:bold">KERI Auth</span>
<MudText Typo="Typo.h5">
<span style="font-weight:bold; font-variant: small-caps;">KeriAuth</span>
</MudText>
<MudText Style="font-style:italic">autonomous and authentic</MudText>
<MudForm @ref="form" @bind-IsValid="@isValid" @bind-Errors="@errors">
Expand All @@ -60,7 +60,7 @@
</MudForm>
<!-- lengh test below is to avoid a minor UI issue of the Unlock button temporarily enabling while entering initial characters -->
<MudButton Disabled="@(!isValid || unlockPasscodeModel.Passcode.Length < 2)" Class="mt-0" Variant="Variant.Filled" Color="Color.Primary" OnClick="async () => await OpenWallet()">Unlock</MudButton>
<MudText>KERI Auth locks after @AppConfig.IdleTimeoutTimeSpanMins minutes of inactivity</MudText>
<MudText><span style="font-variant: small-caps;">KeriAuth</span> locks after @AppConfig.IdleTimeoutTimeSpanMins minutes of inactivity</MudText>
</MudStack>
</div>
<MudStack Row="true" class="bt-button-tray">
Expand Down
2 changes: 1 addition & 1 deletion KeriAuth.BrowserExtension/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<img style="display:block; margin:auto;" src="images/180_keri_logo.png" alt="logo" />
</div>
<div style="position: relative; font-family: 'Roboto'; text-align:center; font-size:18px; top:10px;">
<p><strong>KERI Auth</strong></p>
<p style="font-variant: small-caps;"><strong>KeriAuth</strong></p>
</div>
<div style="position: relative; font-family: 'Roboto'; text-align:center; font-size:18px; top:30px;">
<!-- TODO P2 Any changes to the following line should be coordinated with version and version_name values in manifest.json, the post-build steps in project file, and potentially Azure DevOps pipelines -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,11 @@ function handleWindowMessage(event: MessageEvent<EventData>, portWithSw: chrome.
return;
}
break;
case CsSwMsgType.SELECT_AUTHORIZE_CREDENTIAL:

case CsSwMsgType.CONFIGURE_VENDOR:
console.warn(`KeriAuthCs from page: ${event.data.type} not yet implemented`);
break;
case CsSwMsgType.SELECT_AUTHORIZE_CREDENTIAL:
case CsSwMsgType.SELECT_AUTO_SIGNIN:
case CsSwMsgType.VENDOR_INFO:
case CsSwMsgType.FETCH_RESOURCE:
Expand Down

0 comments on commit 4cfb655

Please sign in to comment.