postheroushttp-signatures.ts2 matches
183console.log('Body preview:', body.substring(0, 200) + '...');
184console.log('Digest header (lowercase):', headers["digest"]);
185console.log('Digest header (capitalized):', headers["Digest"]);
186}
187258console.log('- Body preview (first 100 chars):', body.substring(0, 100) + '...');
259
260// Use Web Crypto API to create SHA-256 hash
261const encoder = new TextEncoder();
262const data = encoder.encode(body);
postherousgenerate-keys.ts1 match
24console.log('🔐 Generating RSA key pair for ActivityPub HTTP signatures...');
25
26// Generate RSA key pair using Web Crypto API
27const keyPair = await crypto.subtle.generateKey(
28{
postherousACTIVITYPUB.md1 match
286- [WebFinger Specification](https://tools.ietf.org/html/rfc7033)
287- [ActivityStreams Vocabulary](https://www.w3.org/TR/activitystreams-vocabulary/)
288- [Mastodon API Documentation](https://docs.joinmastodon.org/spec/activitypub/)
289290---
reflect-writeremailHandler.ts3 matches
3import { dedent } from "npm:ts-dedent";
4import { summarizeInputForDailyNote } from "./summarizeInput.ts";
5import * as ReflectApi from "./reflectApi.ts";
67const emailToText = (email: Email): string => {
16async function processEmail(email: Email) {
17// first, create a new note with the contents of the email
18const newNote = await ReflectApi.call("createNote", {
19subject: email.subject,
20content_markdown: email.text,
2526const summary = await summarizeInputForDailyNote(emailToText(email));
27const result = await ReflectApi.call("appendToDailyNote", summary);
28if (result.success === false) {
29throw new Error(result.error);
reflect-writersummarizeInput.ts4 matches
4import { dedent } from "npm:ts-dedent";
56import * as ReflectApi from "./reflectApi.ts";
78const jsonSchema = ReflectApi.endpointJsonSchema("appendToDailyNote");
910export async function summarizeInputForDailyNote(
11text: string,
12): Promise<ReflectApi.EndpointInput<"appendToDailyNote">> {
13const openai = new OpenAI();
1426console.log("OpenAI response:", response);
2728return JSON.parse(response) as ReflectApi.EndpointInput<"appendToDailyNote">;
29}
30
reflect-writerhttpHandler.ts2 matches
2import z from "npm:zod";
34import * as ReflectApi from "./reflectApi.ts";
5import { summarizeInputForDailyNote } from "./summarizeInput.ts";
626try {
27const summary = await summarizeInputForDailyNote(input);
28const result = await ReflectApi.call("appendToDailyNote", summary);
29if (!result.success) {
30return c.json(result, 500);
reflect-writerreflectApi.ts4 matches
2import { toJSONSchema } from "npm:zod";
34type ReflectApiEndpoint = {
5path: string;
6method: "PUT" | "POST";
8};
910const API_BASE_URL = "https://reflect.app/api/";
1112export const endpoints = {
43}),
44},
45} as const satisfies Record<string, ReflectApiEndpoint>;
4647export function endpointJsonSchema(
8990const response = await fetch(
91`${API_BASE_URL}/graphs/${graphId}/${endpoint.path}`,
92{
93method: endpoint.method,
cognitoCallbackCLAUDE.md10 matches
13- Generate code in TypeScript or TSX
14- Add appropriate TypeScript types and interfaces for all data structures
15- Prefer official SDKs or libraries than writing API calls directly
16- Ask the user to supply API or library documentation if you are at all unsure about it
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
23### 1. HTTP Trigger
2425- Create web APIs and endpoints
26- Handle HTTP requests and responses
27- Example structure:
167However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
168If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
169or by making an API request for it.
170171## Val Town Platform Specifics
175- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
176- **Storage:** DO NOT use the Deno KV module for storage
177- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
178- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
179- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
180- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
181- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
182- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
183- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
184- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
218### Backend (Hono) Best Practices
219220- Hono is the recommended API framework
221- Main entry point should be `backend/index.ts`
222- **Static asset serving:** Use the utility functions to read and serve project files:
242});
243```
244- Create RESTful API routes for CRUD operations
245- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
246```ts
279- For files in the project, use `readFile` helpers
2802815. **API Design:**
282- `fetch` handler is the entry point for HTTP vals
283- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
cognitoCallbackindex.ts2 matches
12app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
1314// Add your API routes here
15// app.get("/api/data", c => c.json({ hello: "world" }));
1617// Unwrap and rethrow Hono errors as the original error
2324capturePostHogEvent(
25Deno.env.get("phProjectAPIKey"),
26webhookPayload.sender.login,
27"GitHub Star",