4 Commits

Author SHA1 Message Date
8f24bb3cc1 Simplified code to demonstrate issue with comma 2023-09-07 08:45:43 -04:00
fe8ea62a98 Merge pull request #6 from enxoco/features/akeyless-encryption
Added akeyless api integration
2023-08-31 21:18:31 -04:00
3b7f4d025d Merge pull request #5 from enxoco/features/docker
Added docker config
2023-08-31 21:18:14 -04:00
80737a2927 Added akeyless api integration 2023-08-31 17:14:13 -04:00
9 changed files with 39 additions and 19 deletions

3
.env.example Normal file
View File

@ -0,0 +1,3 @@
VITE_AKEYLESS_ACCESS_ID=""
VITE_AKEYLESS_ACCESS_KEY=""
VITE_AKEYLESS_KEY_PATH=""

2
.gitignore vendored
View File

@ -22,4 +22,4 @@ dist-ssr
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?
tokens.ts .env

View File

@ -2,7 +2,4 @@ import "./style.css";
import { tokenList } from "./tokenList"; import { tokenList } from "./tokenList";
import rootDiv from "./utils/root"; import rootDiv from "./utils/root";
rootDiv!.innerHTML = await tokenList();
rootDiv!.innerHTML = `
${tokenList()}
`;

View File

@ -2,6 +2,11 @@ export function toast(element: HTMLDivElement, message: string) {
// Target our predefined DIV that will hold toast messages. // Target our predefined DIV that will hold toast messages.
const toastDiv = element.getElementsByClassName('toast') const toastDiv = element.getElementsByClassName('toast')
const interval = setInterval(() => {
toastDiv[0].remove()
clearInterval(interval)
}, 5000)
// If we currently have a toast displayed, let's remove it from the DOM. // If we currently have a toast displayed, let's remove it from the DOM.
if (toastDiv && toastDiv.length != 0) { if (toastDiv && toastDiv.length != 0) {
for (const el of toastDiv){ for (const el of toastDiv){

View File

@ -1,7 +1,6 @@
import totp from 'totp-generator' import totp from 'totp-generator'
const period = 30 const period = 30
const digits = 6 const digits = 6
export function displayToken(secret: string) { export function displayToken(secret: string) {
const token = totp(secret.replace(/ /g, '').trim(), { const token = totp(secret.replace(/ /g, '').trim(), {
digits, digits,

View File

@ -1,8 +1,9 @@
import { displayTokenListItem } from "./tokenListItem"; import { displayTokenListItem } from "./tokenListItem";
import { tokens } from "./tokens"; import { tokens } from "./tokens";
import { Token } from "./utils/types";
export function tokenList() { console.log('tokens', tokens)
return `<form id="tokens">${tokens.map((token) => export async function tokenList() {
return `<form id="tokens">${tokens.map((token: Token) =>
displayTokenListItem(token.account, token.secret) displayTokenListItem(token.account, token.secret)
)}</form>`; )}</form>`;
} }

View File

@ -1,10 +0,0 @@
export const tokens = [
{
account: 'Github',
secret: 'AFDAFDAFAFFD',
},
{
account: 'Gmail',
secret: 'AFDJKADFJsddfsKLAFSJLK',
},
]

10
src/tokens.ts Normal file
View File

@ -0,0 +1,10 @@
export const tokens = [
{
"account": "Github",
"secret": "AFDAFDAFAFFD"
},
{
"account": "Gmail",
"secret": "AFDJKADFJsddfsKLAFSJLK"
}
]

15
src/utils/types.ts Normal file
View File

@ -0,0 +1,15 @@
import { tokens } from "../tokens";
export interface TokenResponse {
token: string;
creds: null;
}
export interface Token {
account: string;
secret: string;
}
export interface GenericAPIResponse {
result: string;
}