2022-07-15 05:38:33 +02:00
@using BTCPayServer.Abstractions.Models
2024-03-14 10:25:40 +01:00
@using BTCPayServer.Client
@using Microsoft.AspNetCore.Mvc.TagHelpers
2020-11-05 22:09:43 +09:00
@model TokensViewModel
2017-09-13 23:50:36 +09:00
@{
2024-10-25 15:48:53 +02:00
ViewData.SetActivePage(StoreNavPages.Tokens, StringLocalizer["Access Tokens"], Context.GetStoreData().Id);
2017-09-13 23:50:36 +09:00
}
2019-01-18 19:15:31 +09:00
@if (Model.StoreNotConfigured)
{
2020-07-22 15:29:58 +02:00
<div class="alert alert-warning alert-dismissible mb-5" role="alert">
2024-10-25 15:48:53 +02:00
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="@StringLocalizer["Close"]">
2021-05-19 04:39:27 +02:00
<vc:icon symbol="close" />
</button>
2024-10-17 15:51:40 +02:00
<span text-translate="true">Warning: No wallet has been linked to your BTCPay Server Store.</span><br/>
2021-07-06 10:35:42 +02:00
See <a href="https://docs.btcpayserver.org/WalletSetup/" target="_blank" class="alert-link" rel="noreferrer noopener">this link</a> for more information on how to connect your store and wallet.
2019-01-18 19:15:31 +09:00
</div>
}
2024-06-19 15:23:10 +02:00
<div class="sticky-header">
<h2 class="my-1">
2024-10-17 15:51:40 +02:00
<span text-translate="true">Greenfield API Keys</span>
2024-10-25 15:48:53 +02:00
<a href="/docs" target="_blank" rel="noreferrer noopener" title="@StringLocalizer["More information..."]">
2024-06-19 15:23:10 +02:00
<vc:icon symbol="info"/>
</a>
</h2>
</div>
2021-04-08 15:32:42 +02:00
2024-06-19 15:23:10 +02:00
<partial name="_StatusMessage" />
2018-04-29 18:28:04 +09:00
<div class="row">
2022-01-27 03:56:46 +01:00
<div class="col-xxl-constrain col-xl-8">
2024-10-17 15:51:40 +02:00
<p>
<span text-translate="true">To generate Greenfield API keys, please</span>
<a asp-controller="UIManage" asp-action="APIKeys" text-translate="true">click here</a>.
</p>
2024-01-03 02:33:54 -08:00
<div class="d-flex align-items-center justify-content-between mt-5 mb-3">
2024-10-17 15:51:40 +02:00
<h3 class="mb-0" text-translate="true">@ViewData["Title"]</h3>
<a id="CreateNewToken" asp-action="CreateToken" class="btn btn-primary" role="button" asp-route-storeId="@Context.GetRouteValue("storeId")" permission="@Policies.CanModifyStoreSettings" text-translate="true">
2021-12-27 22:54:31 -08:00
Create Token
2021-04-08 15:32:42 +02:00
</a>
</div>
2024-10-17 15:51:40 +02:00
<p>
<span text-translate="true">Authorize a public key to access Bitpay compatible Invoice API.</span>
2024-10-25 15:48:53 +02:00
<a href="https://support.bitpay.com/hc/en-us/articles/115003001183-How-do-I-pair-my-client-and-create-a-token-" target="_blank" rel="noreferrer noopener" title="@StringLocalizer["More information..."]">
2024-10-17 15:51:40 +02:00
<vc:icon symbol="info" />
2021-04-08 15:32:42 +02:00
</a>
</p>
2020-07-22 15:29:58 +02:00
@if (Model.Tokens.Any())
{
2024-06-19 15:23:10 +02:00
<div class="table-responsive-md">
<table class="table table-hover">
<thead>
<tr>
2024-10-17 15:51:40 +02:00
<th text-translate="true">Label</th>
<th class="text-end" permission="@Policies.CanModifyStoreSettings" text-translate="true">Actions</th>
2024-06-19 15:23:10 +02:00
</tr>
</thead>
<tbody>
@foreach (var token in Model.Tokens)
{
2018-04-29 18:28:04 +09:00
<tr>
<td>@token.Label</td>
2024-03-14 10:25:40 +01:00
<td class="text-end" permission="@Policies.CanModifyStoreSettings">
2024-10-17 15:51:40 +02:00
<a asp-action="ShowToken" asp-route-storeId="@Context.GetRouteValue("storeId")" asp-route-tokenId="@token.Id" text-translate="true">See information</a> -
<a asp-action="RevokeToken" asp-route-storeId="@Context.GetRouteValue("storeId")" asp-route-tokenId="@token.Id" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-description="The access token with the label <strong>@Html.Encode(token.Label)</strong> will be revoked." data-confirm-input="REVOKE" text-translate="true">Revoke</a>
2018-04-29 18:28:04 +09:00
</td>
</tr>
2024-06-19 15:23:10 +02:00
}
</tbody>
</table>
</div>
2020-07-22 15:29:58 +02:00
}
2021-04-08 15:32:42 +02:00
else
{
2024-10-17 15:51:40 +02:00
<p class="text-secondary mt-3" text-translate="true">
2021-11-18 01:04:20 -08:00
No access tokens yet.
2021-04-08 15:32:42 +02:00
</p>
}
2018-04-29 18:28:04 +09:00
2024-10-17 15:51:40 +02:00
<h3 class="mt-5 mb-3" text-translate="true">Legacy API Keys</h3>
<p text-translate="true">Alternatively, you can use the invoice API by including the following HTTP Header in your requests:</p>
2021-04-08 15:32:42 +02:00
<p><code>Authorization: Basic @Model.EncodedApiKey</code></p>
2024-03-14 10:25:40 +01:00
<form method="post" asp-action="GenerateAPIKey" asp-route-storeId="@Context.GetRouteValue("storeId")" permission="@Policies.CanModifyStoreSettings">
2018-04-29 18:28:04 +09:00
<div class="form-group">
2021-05-19 04:39:27 +02:00
<label asp-for="ApiKey" class="form-label"></label>
2021-11-18 01:04:20 -08:00
<div class="d-flex">
2020-02-21 05:40:00 +01:00
<input asp-for="ApiKey" readonly class="form-control"/>
@if (string.IsNullOrEmpty(Model.ApiKey))
{
2024-10-17 15:51:40 +02:00
<button class="btn btn-primary ms-3" type="submit" text-translate="true">Generate</button>
2020-02-21 05:40:00 +01:00
}
else
{
2024-10-17 15:51:40 +02:00
<button class="btn btn-danger ms-3" type="submit" name="command" value="revoke" text-translate="true">Revoke</button>
<button class="btn btn-primary ms-3" type="submit" text-translate="true">Regenerate</button>
2020-02-21 05:40:00 +01:00
}
2020-06-11 16:09:33 +02:00
</div>
2018-04-29 18:28:04 +09:00
</div>
</form>
</div>
</div>
2021-09-07 04:55:53 +02:00
2024-03-14 10:25:40 +01:00
<partial name="_Confirm" model="@(new ConfirmModel("Revoke access token", "The access token will be revoked. Do you wish to continue?", "Revoke"))" permission="@Policies.CanModifyStoreSettings" />