Upload scripts/generate-secrets.ps1 with huggingface_hub
Browse files- scripts/generate-secrets.ps1 +30 -0
scripts/generate-secrets.ps1
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
function New-Base64Secret {
|
| 2 |
+
param([int] $ByteLength = 48)
|
| 3 |
+
|
| 4 |
+
$bytes = [byte[]]::new($ByteLength)
|
| 5 |
+
$rng = [System.Security.Cryptography.RNGCryptoServiceProvider]::new()
|
| 6 |
+
try {
|
| 7 |
+
$rng.GetBytes($bytes)
|
| 8 |
+
}
|
| 9 |
+
finally {
|
| 10 |
+
$rng.Dispose()
|
| 11 |
+
}
|
| 12 |
+
[Convert]::ToBase64String($bytes)
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
function New-HexSecret {
|
| 16 |
+
param([int] $ByteLength = 32)
|
| 17 |
+
|
| 18 |
+
$bytes = [byte[]]::new($ByteLength)
|
| 19 |
+
$rng = [System.Security.Cryptography.RNGCryptoServiceProvider]::new()
|
| 20 |
+
try {
|
| 21 |
+
$rng.GetBytes($bytes)
|
| 22 |
+
}
|
| 23 |
+
finally {
|
| 24 |
+
$rng.Dispose()
|
| 25 |
+
}
|
| 26 |
+
-join ($bytes | ForEach-Object { $_.ToString("x2") })
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
"JWT_SECRET=$(New-Base64Secret)"
|
| 30 |
+
"TOTP_ENCRYPTION_KEY=$(New-HexSecret)"
|