Encrypted, ephemeral, private memos on atproto

fix(shared): relax public types

Use `string` instead of `Handle`, and validate when used

graham.systems e81acb6c cda61a39

verified
Changed files
+7 -2
packages
+1 -1
packages/shared/deno.jsonc
··· 1 1 { 2 2 "name": "@cistern/shared", 3 - "version": "1.0.1", 3 + "version": "1.0.2", 4 4 "license": "MIT", 5 5 "exports": { 6 6 ".": "./mod.ts"
+5
packages/shared/produce-requirements.ts
··· 1 1 import { Client, CredentialManager } from "@atcute/client"; 2 2 import { resolveMiniDoc } from "./resolve-did.ts"; 3 3 import type { BaseClientOptions, ClientRequirements } from "./types.ts"; 4 + import { isHandle } from "@atcute/lexicons/syntax"; 4 5 5 6 export async function produceRequirements<Options extends BaseClientOptions>( 6 7 options: Options, 7 8 ): Promise<ClientRequirements<Options>> { 9 + if (!isHandle(options.handle)) { 10 + throw new Error("provided handle is not valid"); 11 + } 12 + 8 13 const miniDoc = await resolveMiniDoc(options.handle); 9 14 const manager = new CredentialManager({ service: miniDoc.pds }); 10 15 const rpc = new Client({ handler: manager });
+1 -1
packages/shared/types.ts
··· 15 15 } 16 16 17 17 export interface BaseClientOptions { 18 - handle: Handle; 18 + handle: string; 19 19 appPassword: string; 20 20 } 21 21