fix: remove TS annotations from jsx file
This commit is contained in:
parent
ca6f160073
commit
cbc6242613
|
|
@ -23,7 +23,7 @@ export const hasSupabaseConfig = Boolean(supabaseUrl && supabaseAnonKey);
|
||||||
const STORAGE_KEY = "supersam-auth";
|
const STORAGE_KEY = "supersam-auth";
|
||||||
const KEY_KEY = "supersam-ak";
|
const KEY_KEY = "supersam-ak";
|
||||||
|
|
||||||
function _getKey(): string {
|
function _getKey() {
|
||||||
let key = sessionStorage.getItem(KEY_KEY);
|
let key = sessionStorage.getItem(KEY_KEY);
|
||||||
if (!key) {
|
if (!key) {
|
||||||
key = crypto.getRandomValues(new Uint8Array(32)).reduce(
|
key = crypto.getRandomValues(new Uint8Array(32)).reduce(
|
||||||
|
|
@ -35,7 +35,7 @@ function _getKey(): string {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function _obfuscate(value: string): Promise<string> {
|
async function _obfuscate(value) {
|
||||||
const key = _getKey();
|
const key = _getKey();
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
const keyData = enc.encode(key);
|
const keyData = enc.encode(key);
|
||||||
|
|
@ -47,7 +47,7 @@ async function _obfuscate(value: string): Promise<string> {
|
||||||
return btoa(String.fromCharCode(...result));
|
return btoa(String.fromCharCode(...result));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function _deobfuscate(obfuscated: string): Promise<string> {
|
async function _deobfuscate(obfuscated) {
|
||||||
try {
|
try {
|
||||||
const key = _getKey();
|
const key = _getKey();
|
||||||
const enc = new TextEncoder();
|
const enc = new TextEncoder();
|
||||||
|
|
@ -67,7 +67,7 @@ async function _deobfuscate(obfuscated: string): Promise<string> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const secureStorage = {
|
const secureStorage = {
|
||||||
getItem: async (key: string) => {
|
getItem: async (key) => {
|
||||||
const raw = sessionStorage.getItem(STORAGE_KEY);
|
const raw = sessionStorage.getItem(STORAGE_KEY);
|
||||||
if (!raw) return null;
|
if (!raw) return null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -80,8 +80,8 @@ const secureStorage = {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setItem: async (key: string, value: string) => {
|
setItem: async (key, value) => {
|
||||||
let data: Record<string, string>;
|
let data;
|
||||||
try {
|
try {
|
||||||
const raw = sessionStorage.getItem(STORAGE_KEY);
|
const raw = sessionStorage.getItem(STORAGE_KEY);
|
||||||
data = raw ? JSON.parse(raw) : {};
|
data = raw ? JSON.parse(raw) : {};
|
||||||
|
|
@ -91,7 +91,7 @@ const secureStorage = {
|
||||||
data[key] = await _obfuscate(value);
|
data[key] = await _obfuscate(value);
|
||||||
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(data));
|
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(data));
|
||||||
},
|
},
|
||||||
removeItem: async (key: string) => {
|
removeItem: async (key) => {
|
||||||
const raw = sessionStorage.getItem(STORAGE_KEY);
|
const raw = sessionStorage.getItem(STORAGE_KEY);
|
||||||
if (!raw) return;
|
if (!raw) return;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue