···1010import { now } from "@atcute/tid";
1111import { type AppCisternMemo, AppCisternPubkey } from "@cistern/lexicon";
12121313+/**
1414+ * Creates a `Producer` instance with all necessary requirements. This is the recommended way to construct a `Producer`.
1515+ *
1616+ * @description Resolves the user's DID using Slingshot, instantiates an `@atcute/client` instance, creates an initial session, and returns a new `Producer`. If a pubkey record key is provided, it will be resolved and set as the active key.
1717+ * @param {ProducerOptions} options - Information for constructing the underlying XRPC client
1818+ * @returns {Promise<Producer>} A Cistern producer client with an authorized session
1919+ */
1320export async function createProducer(
1421 { publicKey: rkey, ...opts }: ProducerOptions,
1522): Promise<Producer> {
···4653 });
4754}
48555656+/**
5757+ * A client for encrypting and creating Cistern memos.
5858+ */
4959export class Producer {
6060+ /** DID of the user this producer acts on behalf of */
5061 did: Did;
6262+6363+ /** `@atcute/client` instance with credential manager */
5164 rpc: Client;
5252- manager: CredentialManager;
6565+6666+ /** Partial public key record, used for encrypting items */
5367 publicKey?: PublicKeyOption;
54685569 constructor(params: ProducerParams) {
5670 this.did = params.miniDoc.did;
5771 this.rpc = params.rpc;
5858- this.manager = params.manager;
5972 this.publicKey = params.publicKey;
6073 }
61746275 /**
6363- * Creates a memo and saves it as a record in the user's PDS
7676+ * Creates a memo and saves it as a record in the user's PDS.
7777+ * @param {string} text - The contents of the memo you wish to create
6478 */
6579 async createMemo(text: string): Promise<ResourceUri> {
6680 if (!this.publicKey) {
···144158 }
145159146160 /**
147147- * Sets a public key as the main encryption key
161161+ * Sets a public key as the main encryption key. This is not necessary to use if you instantiated the client with a public key.
162162+ * @param {PublicKeyOption} key - The key you want to use for encryption
148163 */
149164 selectPublicKey(key: PublicKeyOption) {
150165 this.publicKey = key;