-1
packages/consumer/mod.test.ts
-1
packages/consumer/mod.test.ts
+13
-3
packages/consumer/mod.ts
+13
-3
packages/consumer/mod.ts
···
17
LocalKeyPair,
18
} from "./types.ts";
19
20
export async function createConsumer(
21
options: ConsumerOptions,
22
): Promise<Consumer> {
···
29
* Client for generating keys and decoding Cistern memos.
30
*/
31
export class Consumer {
32
did: Did;
33
keypair?: LocalKeyPair;
34
-
rpc: Client<XRPCQueries, XRPCProcedures>;
35
-
manager: CredentialManager;
36
37
constructor(params: ConsumerParams) {
38
this.did = params.miniDoc.did;
···
43
}
44
: undefined;
45
this.rpc = params.rpc;
46
-
this.manager = params.manager;
47
}
48
49
/**
···
17
LocalKeyPair,
18
} from "./types.ts";
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
+
*/
27
export async function createConsumer(
28
options: ConsumerOptions,
29
): Promise<Consumer> {
···
36
* Client for generating keys and decoding Cistern memos.
37
*/
38
export class Consumer {
39
+
/** DID of the user this consumer acts on behalf of */
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 */
46
keypair?: LocalKeyPair;
47
48
constructor(params: ConsumerParams) {
49
this.did = params.miniDoc.did;
···
54
}
55
: undefined;
56
this.rpc = params.rpc;
57
}
58
59
/**