Skip to content

Commit 6ec1097

Browse files
committed
feat: initial commit
0 parents  commit 6ec1097

15 files changed

Lines changed: 6806 additions & 0 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/src/Pixsys.Library.Token.TokenManager/.build/CakeRelease/Semantic/node_modules/
2+
/src/Pixsys.Library.Token.TokenManager/.vs/
3+
/src/Pixsys.Library.Token.TokenManager/Pixsys.Library.Token.TokenManager/bin/
4+
/src/Pixsys.Library.Token.TokenManager/Pixsys.Library.Token.TokenManager/obj/
5+
/src/Pixsys.Library.Token.TokenManager/.config/CakeRelease.settings.json

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
# Token Manager
3+
4+
This manager will generate random or patterned strings depending on your preferences: uppercase letters, lowercase letters, numbers and symbols.
5+
6+
## 1. Installation
7+
8+
### 1.1 Register the service in `Program.cs`
9+
10+
```csharp
11+
using Pixsys.Library.Token.TokenManager;
12+
13+
14+
var builder = WebApplication.CreateBuilder(args);
15+
16+
builder.AddTokenManager();
17+
18+
```
19+
## 2. Usage
20+
21+
### 2.1 Inject the service into your controller
22+
23+
```csharp
24+
private readonly ITokenManager _tokenManager;
25+
26+
public MyController(ITokenManager tokenManager)
27+
{
28+
_tokenManager = tokenManager;
29+
}
30+
```
31+
32+
### 2.2 Manager Methods
33+
34+
```csharp
35+
var randomToken = _tokenManager.Generate(true, false, true, true, 20); // Output example : be(/j&2kg=)-++fi(+m=
36+
var patternedToken = _tokenManager.GenerateFromPattern("LLdd##00"); // Output example : RXvb!#46
37+
```
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
if ! head -1 "$1" | grep -qE "^(build|ci|docs|feat|fix|perf|refactor|test)(\(.+?\))?: .{1,}$"; then
3+
echo "Aborting commit. Your commit message is invalid." >&2
4+
exit 1
5+
fi
6+
if ! head -1 "$1" | grep -qE "^.{1,70}$"; then
7+
echo "Aborting commit. Your commit message is too long." >&2
8+
exit 1
9+
fi
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
while [ $# -gt 0 ]; do
4+
case "$1" in
5+
--token*|-t*)
6+
if [[ "$1" != *=* ]]; then shift; fi # Value is next arg if no `=`
7+
NUGET_TOKEN="${1#*=}"
8+
;;
9+
--source*|-s*)
10+
if [[ "$1" != *=* ]]; then shift; fi
11+
NUGET_SOURCE="${1#*=}"
12+
;;
13+
*)
14+
>&2 printf "Error: Invalid argument\n"
15+
exit 1
16+
;;
17+
esac
18+
shift
19+
done
20+
21+
echo "checking if release must be published to Nuget..."
22+
23+
if [[ $NUGET_TOKEN != "" ]] && [[ $NUGET_TOKEN != "notoken" ]]; then
24+
result=$(dotnet nuget push .\\Artifacts\\*.nupkg -k $NUGET_TOKEN -s https://api.nuget.org/v3/index.json)
25+
echo $result
26+
fi
27+
28+
29+
echo "checking if release must be published to custom Nuget source..."
30+
31+
if [[ $NUGET_SOURCE != "" ]]; then
32+
result=$(dotnet nuget push .\\Artifacts\\*.nupkg -s $NUGET_SOURCE)
33+
echo $result
34+
fi

0 commit comments

Comments
 (0)