atprotocol stickers
1export interface StickerRecord {
2 uri: string;
3 cid: string;
4 value: {
5 shortname: string;
6 image: {
7 ref: { $link: string };
8 mimeType: string;
9 size?: number;
10 };
11 maskPath?: string;
12 imageWidth?: number;
13 imageHeight?: number;
14 borderColor?: string;
15 borderThickness?: number;
16 createdAt: string;
17 };
18}
19
20export interface StickerWithMeta extends StickerRecord {
21 did: string;
22 pds: string;
23 blobUrl: string;
24}
25
26export function getBlobUrl(pds: string, did: string, cid: string): string {
27 return `${pds}/xrpc/com.atproto.sync.getBlob?did=${encodeURIComponent(did)}&cid=${encodeURIComponent(cid)}`;
28}
29
30export function parseDid(uri: string): string {
31 // at://did:plc:xxx/boo.sky.sticker/tid → did:plc:xxx
32 const match = uri.match(/^at:\/\/(did:[^/]+)\//);
33 return match ? match[1] : '';
34}