File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,15 @@ type GetFrameOptions = {
3535
3636/**
3737 * Extracts frame metadata from the given htmlString.
38+ * Parses the HTML and extracts frame information based on the specified protocol.
3839 *
39- * @returns an object representing the parsing result
40+ * @param options - Configuration options for frame extraction
41+ * @param options.htmlString - The HTML string to parse
42+ * @param options.frameUrl - URL to the frame
43+ * @param options.url - Fallback URL used if post_url is missing
44+ * @param options.specification - The parsing specification (default: 'farcaster')
45+ * @param options.fromRequestMethod - Request method used to fetch the frame (default: 'GET')
46+ * @returns An object representing the parsing result with frame data and any reports
4047 */
4148export async function getFrame ( {
4249 htmlString,
Original file line number Diff line number Diff line change 1+ /**
2+ * Encodes a Buffer to a URL-safe base64 string.
3+ * Replaces '+' with '-', '/' with '_', and removes padding '='.
4+ * @param data - The buffer to encode
5+ * @returns URL-safe base64 encoded string
6+ */
17export function base64urlEncode ( data : Buffer ) : string {
28 // we could use .toString('base64url') on buffer, but that throws in browser
39 return data
@@ -7,6 +13,12 @@ export function base64urlEncode(data: Buffer): string {
713 . replace ( / = / g, "" ) ;
814}
915
16+ /**
17+ * Decodes a URL-safe base64 string back to a Buffer.
18+ * Handles the reverse transformations of base64urlEncode.
19+ * @param encodedData - The URL-safe base64 string to decode
20+ * @returns Decoded buffer
21+ */
1022export function base64urlDecode ( encodedData : string ) : Buffer {
1123 const encodedChunks = encodedData . length % 4 ;
1224 const base64 = encodedData
@@ -17,3 +29,4 @@ export function base64urlDecode(encodedData: string): Buffer {
1729 // we could use base64url on buffer, but that throws in browser
1830 return Buffer . from ( base64 , "base64" ) ;
1931}
32+
You can’t perform that action at this time.
0 commit comments