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 KEY_KEY = "supersam-ak";
|
||||
|
||||
function _getKey(): string {
|
||||
function _getKey() {
|
||||
let key = sessionStorage.getItem(KEY_KEY);
|
||||
if (!key) {
|
||||
key = crypto.getRandomValues(new Uint8Array(32)).reduce(
|
||||
|
|
@ -35,7 +35,7 @@ function _getKey(): string {
|
|||
return key;
|
||||
}
|
||||
|
||||
async function _obfuscate(value: string): Promise<string> {
|
||||
async function _obfuscate(value) {
|
||||
const key = _getKey();
|
||||
const enc = new TextEncoder();
|
||||
const keyData = enc.encode(key);
|
||||
|
|
@ -47,7 +47,7 @@ async function _obfuscate(value: string): Promise<string> {
|
|||
return btoa(String.fromCharCode(...result));
|
||||
}
|
||||
|
||||
async function _deobfuscate(obfuscated: string): Promise<string> {
|
||||
async function _deobfuscate(obfuscated) {
|
||||
try {
|
||||
const key = _getKey();
|
||||
const enc = new TextEncoder();
|
||||
|
|
@ -67,7 +67,7 @@ async function _deobfuscate(obfuscated: string): Promise<string> {
|
|||
}
|
||||
|
||||
const secureStorage = {
|
||||
getItem: async (key: string) => {
|
||||
getItem: async (key) => {
|
||||
const raw = sessionStorage.getItem(STORAGE_KEY);
|
||||
if (!raw) return null;
|
||||
try {
|
||||
|
|
@ -80,8 +80,8 @@ const secureStorage = {
|
|||
return null;
|
||||
}
|
||||
},
|
||||
setItem: async (key: string, value: string) => {
|
||||
let data: Record<string, string>;
|
||||
setItem: async (key, value) => {
|
||||
let data;
|
||||
try {
|
||||
const raw = sessionStorage.getItem(STORAGE_KEY);
|
||||
data = raw ? JSON.parse(raw) : {};
|
||||
|
|
@ -91,7 +91,7 @@ const secureStorage = {
|
|||
data[key] = await _obfuscate(value);
|
||||
sessionStorage.setItem(STORAGE_KEY, JSON.stringify(data));
|
||||
},
|
||||
removeItem: async (key: string) => {
|
||||
removeItem: async (key) => {
|
||||
const raw = sessionStorage.getItem(STORAGE_KEY);
|
||||
if (!raw) return;
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue