Encrypted, ephemeral, private memos on atproto

docs(consumer): add typedocs

graham.systems 4e4d4e46 e22034a8

verified
Changed files
+13 -4
packages
consumer
-1
packages/consumer/mod.test.ts
··· 51 51 expect(consumer.did).toEqual("did:plc:test123"); 52 52 expect(consumer.keypair).toBeUndefined(); 53 53 expect(consumer.rpc).toBeDefined(); 54 - expect(consumer.manager).toBeDefined(); 55 54 }, 56 55 }); 57 56
+13 -3
packages/consumer/mod.ts
··· 17 17 LocalKeyPair, 18 18 } from "./types.ts"; 19 19 20 + /** 21 + * Creates a `Consumer` instance with all necessary requirements. This is the recommended way to construct a `Consumer`. 22 + * 23 + * @description Resolves the user's DID using Slingshot, instantiates an `@atcute/client` instance, creates an initial session, and then returns a new Consumer. 24 + * @param {ConsumerOptions} options - Information for constructing the underlying XRPC client 25 + * @returns {Promise<Consumer>} A Cistern consumer client with an authorized session 26 + */ 20 27 export async function createConsumer( 21 28 options: ConsumerOptions, 22 29 ): Promise<Consumer> { ··· 29 36 * Client for generating keys and decoding Cistern memos. 30 37 */ 31 38 export class Consumer { 39 + /** DID of the user this consumer acts on behalf of */ 32 40 did: Did; 41 + 42 + /** `@atcute/client` instance with credential manager */ 43 + rpc: Client<XRPCQueries, XRPCProcedures>; 44 + 45 + /** Private key used for decrypting and the AT URI of its associated public key */ 33 46 keypair?: LocalKeyPair; 34 - rpc: Client<XRPCQueries, XRPCProcedures>; 35 - manager: CredentialManager; 36 47 37 48 constructor(params: ConsumerParams) { 38 49 this.did = params.miniDoc.did; ··· 43 54 } 44 55 : undefined; 45 56 this.rpc = params.rpc; 46 - this.manager = params.manager; 47 57 } 48 58 49 59 /**