// Generated, do not edit. sha256:e7b97bfa74b04b9522e509df409b4fa237f564c7b1fc8cdbe64c7eb87d1cb4dd import { CONFIG } from '../../shared/config.js'; import { marketServiceUrl, marketSupportMessages, marketSupportSend, marketSupportAttachment } from '../market-service.mjs'; const S = CONFIG.LICENSE.SUPPORT; const ATTACHMENT_ID = /^[0-9a-f]{32}$/; function assertSignature(signature) { if (!/^Nostr [A-Za-z0-9+/=]+$/.test(String(signature ?? ''))) throw new Error('A support call carries an "Authorization: Nostr " header.'); } export async function supportInfo() { return { serviceUrl: await marketServiceUrl(), maxText: S.MAX_TEXT, maxAttachmentBytes: S.MAX_ATTACHMENT_BYTES, attachmentTypes: [...S.ATTACHMENT_TYPES], nostr: { pubkey: S.RECIPIENT, name: S.RECIPIENT_NAME }, }; } export async function supportMessages(signature) { assertSignature(signature); return marketSupportMessages(signature); } export async function sendSupport(signature, body) { assertSignature(signature); if (typeof body !== 'string') throw new Error('The body of a support message is the signed JSON text.'); return marketSupportSend(signature, body); } export async function supportAttachment(signature, id) { assertSignature(signature); if (!ATTACHMENT_ID.test(String(id))) throw new Error('An attachment id is 32 hex characters.'); return marketSupportAttachment(signature, id); }