Skip to content

Commit

Permalink
Dev (#12)
Browse files Browse the repository at this point in the history
+ Added `KdfArgon2IdOptions.DefaultParallelism/MemoryLimit`
+ Added `NaClCryptoAppConfig`
  • Loading branch information
nd1012 authored Mar 2, 2024
1 parent 1f26c74 commit 2e9f46f
Show file tree
Hide file tree
Showing 26 changed files with 1,962 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docfx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:
- name: Copy README
run: cp README.md "./src/wan24-Crypto-NaCl Docs/index.md"
- name: Build docs
run: docfx "./src/wan24-Crypto-NaCl Docs/docfx.json"
run: docfx "./src/wan24-Crypto-NaCl Docs/docfx.json" -t default,templates/singulinkfx
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v5
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,45 @@ NaClHelper.SetDefaults();
Per default the current `wan24-Crypto` default will be set as counter
algorithms to `HybridAlgorithmHelper`.

### JSON configuration

You could implement a JSON configuration file using the `AppConfig` logic from
`wan24-Core`, and the `NaClCryptoAppConfig`. There it's possible to define
disabled algorithms, which makes it possible to react to an unwanted algorithm
very fast, at any time and without having to update your app, for example. If
you use an `AppConfig`, it could look like this:

```cs
public class YourAppConfig : AppConfig
{
public YourAppConfig() : base() { }

[AppConfig(AfterBootstrap = true, Priority = 20)]
public CryptoAppConfig? Crypto { get; set; }

[AppConfig(AfterBootstrap = true, Priority = 10)]
public NaClCryptoAppConfig? NaCl { get; set; }
}

await AppConfig.LoadAsync<YourAppConfig>();
```

**NOTE**: A `NaClCryptoAppConfig` should be applied before a `CryptoAppConfig`.
For this reason the example defines a priority in the `AppConfigAttribute`.

In the `config.json` in your app root folder:

```json
{
"NaCl":{
...
}
}
```

Anyway, you could also place and load a `NaClCryptoAppConfig` in any
configuration which supports using that custom type.

## Argon2id

A simple KDF operation example:
Expand Down
10 changes: 8 additions & 2 deletions src/wan24-Crypto-NaCl Docs/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,19 @@
"globalMetadata": {
"_appTitle": "wan24-Crypto-NaCl",
"_appFooter": "(c) 2023 Andreas Zimmermann, wan24.de",
"_copyrightFooter": "(c) 2023 Andreas Zimmermann, wan24.de",
//"_appLogoPath": "custom/logo.png",
//"_appFaviconPath": "custom/favicon.ico",
"_enableNewTab": true
"_enableSearch": true,
"_disableSideFilter": false,
"_enableNewTab": true,
"_disableContribution": false,
"_disableBreadcrumb": false,
},
"fileMetadataFiles": [],
"template": [
"default"
"default",
"templates/singulinkfx"
],
"postProcessors": [],
"markdownEngineName": "markdig",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}
{{!include(/^styles/.*/)}}
{{!include(/^fonts/.*/)}}
{{!include(favicon.ico)}}
{{!include(logo.svg)}}
{{!include(search-stopwords.json)}}
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
{{>partials/head}}

<body>
<!-- Header required for docfx anchor scroll to work -->
<header id="head"></header>
<div class="top-navbar">
<a class="burger-icon" onclick="toggleMenu()">
<svg name="Hamburger"
style="vertical-align: middle;"
width="34" height="34" viewBox="0 0 24 24"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M20 6H4V9H20V6ZM4 10.999H20V13.999H4V10.999ZM4 15.999H20V18.999H4V15.999Z"></path></svg>
</a>

{{>partials/logo}}
</div>

<div class="body-content">
<div id="blackout" class="blackout" onclick="toggleMenu()"></div>

<nav id="sidebar" role="navigation">
<div class="sidebar">
{{>partials/navbar}}
<div class="sidebar-item-separator"></div>
{{^_disableToc}}
{{>partials/toc}}
{{/_disableToc}}
</div>
{{>partials/footer}}
</nav>

<main class="main-panel">
{{#_enableSearch}}
{{>partials/searchResults}}
{{/_enableSearch}}



<div role="main" class="hide-when-search" >
{{^_disableBreadcrumb}}
{{>partials/breadcrumb}}
{{/_disableBreadcrumb}}

{{^_disableContribution}}
<div id="contribution">
{{#docurl}}
<a href="{{docurl}}" class="contribution-link">{{__global.improveThisDoc}}</a>
{{/docurl}}
</div>
{{/_disableContribution}}

<article class="content wrap" id="_content" data-uid="{{uid}}">
{{!body}}
</article>
</div>

{{#_copyrightFooter}}
<div class="copyright-footer">
<span>{{_copyrightFooter}}</span>
</div>
{{/_copyrightFooter}}
</main>
</div>

{{>partials/scripts}}
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div class="footer">
{{{_appFooter}}}
{{^_appFooter}}<strong><a href='https://dotnet.github.io/docfx/'>DocFX</a> + <a href='https://www.singulink.com'>Singulink</a> = ♥</strong>{{/_appFooter}}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}</title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}">
<meta name="generator" content="docfx {{_docfxVersion}}">
{{#_description}}<meta name="description" content="{{_description}}">{{/_description}}
<link rel="shortcut icon" href="{{_rel}}{{{_appFaviconPath}}}{{^_appFaviconPath}}favicon.ico{{/_appFaviconPath}}">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/night-owl.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css" integrity="sha384-EvBWSlnoFgZlXJvpzS+MAUEjvN7+gcCwH+qh7GRFOGgZO0PuwOFro7qPOJnLfe7l" crossorigin="anonymous">
<link rel="stylesheet" href="{{_rel}}styles/config.css">
<link rel="stylesheet" href="{{_rel}}styles/singulink.css">
<link rel="stylesheet" href="{{_rel}}styles/main.css">
<meta property="docfx:navrel" content="{{_navRel}}">
<meta property="docfx:tocrel" content="{{_tocRel}}">
{{#_noindex}}<meta name="searchOption" content="noindex">{{/_noindex}}
{{#_enableSearch}}<meta property="docfx:rel" content="{{_rel}}">{{/_enableSearch}}
{{#_enableNewTab}}<meta property="docfx:newtab" content="true">{{/_enableNewTab}}
</head>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<ul class="nav level{{level}}">
{{#items}}
{{^dropdown}}
<li>
{{^leaf}}
<span class="expand-stub"></span>
{{/leaf}}
{{#topicHref}}
<a href="{{topicHref}}" class="sidebar-item" name="{{tocHref}}" title="{{name}}">{{name}}</a>
{{/topicHref}}
{{^topicHref}}
<a>{{{name}}}</a>
{{/topicHref}}

{{^leaf}}
{{>partials/li}}
{{/leaf}}
</li>
{{/dropdown}}
{{#dropdown}}
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">{{name}} <span class="caret"></span></a>
<ul class="dropdown-menu level{{level}}">
{{>partials/dd-li}}
</ul>
</li>
{{/dropdown}}
{{/items}}
</ul>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<a class="brand" href="{{_rel}}index.html">
<img src="{{_rel}}{{{_appLogoPath}}}{{^_appLogoPath}}logo.svg{{/_appLogoPath}}" alt="{{_appName}}" class="logomark">
<span class="brand-title">{{_appName}}</span>
</a>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<h1 id="{{id}}" data-uid="{{uid}}" class="text-break">{{>partials/title}}</h1>
<div class="markdown level0 summary">{{{summary}}}</div>
<div class="markdown level0 conceptual">{{{conceptual}}}</div>
<div class="markdown level0 remarks">{{{remarks}}}</div>
{{#children}}
<h3 id="{{id}}">{{>partials/namespaceSubtitle}}</h3>
{{#children}}
<h5><xref uid="{{uid}}" altProperty="fullName" displayProperty="name"/></h5>
<section>{{{summary}}}</section>
{{/children}}
{{/children}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<div>
<div class="mobile-hide">
{{>partials/logo}}
</div>

{{#_enableSearch}}
<div class="sidesearch">
<form id="search" role="search" class="search">
<i class="bi bi-search search-icon"></i>
<input type="text" id="search-query" placeholder="{{__global.search}}" autocomplete="off">
</form>
</div>
{{/_enableSearch}}

<div id="navbar">
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js" integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script>
<script type="text/javascript" src="{{_rel}}styles/jquery.twbsPagination.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mark.js@8.11.1/dist/jquery.mark.min.js"></script>
<script type="text/javascript" src="{{_rel}}styles/url.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/anchor-js@5.0.0/anchor.min.js"></script>
<script type="text/javascript" src="{{_rel}}styles/docfx.js"></script>
<script type="text/javascript" src="{{_rel}}styles/main.js"></script>
<script type="text/javascript" src="{{_rel}}styles/singulink.js"></script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<div id="search-results" style="display: none;">
<h1 class="search-list">{{__global.searchResults}} <span></span></h1>
<div class="sr-items">
<p><i class="bi bi-hourglass-split index-loading"></i></p>
</div>
<ul id="pagination" data-first={{__global.pageFirst}} data-prev={{__global.pagePrev}} data-next={{__global.pageNext}} data-last={{__global.pageLast}}></ul>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<div id="sidetoggle">
<div id="sidetoc"></div>
</div>
Loading

0 comments on commit 2e9f46f

Please sign in to comment.