1export default async function (req: Request): Promise<Response> {
2// Get current time in US/NewYork timezone
3const now = new Date();
ProtoShareauth.ts8 matches
28const auth = new Hono();
2930// Helper functions for WebAuthn
31function generateChallenge(): string {
32const array = new Uint8Array(32);
33crypto.getRandomValues(array);
35}
3637function generateId(): string {
38return crypto.randomUUID();
39}
4041function arrayBufferToBase64(buffer: ArrayBuffer): string {
42const bytes = new Uint8Array(buffer);
43let binary = '';
48}
4950function base64ToArrayBuffer(base64: string): ArrayBuffer {
51const binary = atob(base64.replace(/-/g, '+').replace(/_/g, '/'));
52const bytes = new Uint8Array(binary.length);
5859// Simplified WebAuthn verification (in production, use a proper library)
60async function verifyRegistration(credential: any, challenge: string): Promise<{ verified: boolean; credentialId: string; publicKey: string }> {
61try {
62const clientDataJSON = JSON.parse(new TextDecoder().decode(base64ToArrayBuffer(credential.response.clientDataJSON)));
83}
8485async function verifyAuthentication(credential: any, challenge: string, storedCredential: any): Promise<boolean> {
86try {
87const clientDataJSON = JSON.parse(new TextDecoder().decode(base64ToArrayBuffer(credential.response.clientDataJSON)));
107108// Middleware to check authentication
109async function requireAuth(c: any, next: any) {
110const sessionToken = getCookie(c, 'session');
111if (!sessionToken) {
ProtoShareApp.tsx3 matches
25}
2627export function App() {
28const [user, setUser] = useState<User | null>(null);
29const [pageType, setPageType] = useState<string>('app');
93}
9495function UnauthenticatedView() {
96return (
97<div className="min-h-screen bg-gray-50">
130<p className="text-lg text-gray-600 mb-6">
131This backend receives and stores content shared from iOS devices
132using the Share Sheet functionality.
133</p>
134<div className="grid md:grid-cols-2 gap-6 text-left">
ProtoShareSetup.tsx1 match
20}
2122export function Setup({ user }: SetupProps) {
23const [tokens, setTokens] = useState<BearerToken[]>([]);
24const [selectedToken, setSelectedToken] = useState<string>('');
ProtoShareAdmin.tsx1 match
38}
3940export function Admin({ user }: AdminProps) {
41const [stats, setStats] = useState<AdminStats | null>(null);
42const [users, setUsers] = useState<User[]>([]);
ProtoShareDashboard.tsx1 match
29}
3031export function Dashboard({ user }: DashboardProps) {
32const [content, setContent] = useState<ContentItem[]>([]);
33const [tokens, setTokens] = useState<BearerToken[]>([]);
untitled-5165course.html1 match
166<script>
167// Load course data when page loads
168document.addEventListener('DOMContentLoaded', function() {
169const courseData = window.__COURSE_DATA__;
170
untitled-5165index.html2 matches
642643<script>
644function showCourse(courseId) {
645// Redirect to course page
646window.location.href = `/courses/${courseId}`;
649// Smooth scrolling for anchor links
650document.querySelectorAll('a[href^="#"]').forEach(anchor => {
651anchor.addEventListener('click', function (e) {
652e.preventDefault();
653const target = document.querySelector(this.getAttribute('href'));
56โโโ shared/
57โ โโโ types.ts # TypeScript interfaces and types
58โ โโโ utils.ts # Shared utility functions
59โโโ README.md
60```