+19
packages/consumer/types.ts
+19
packages/consumer/types.ts
···
1
1
import type { BaseClientOptions, ClientRequirements } from "@cistern/shared";
2
2
import type { ResourceUri, Tid } from "@atcute/lexicons";
3
3
4
+
/**
5
+
* A locally-stored key pair suitable for storage
6
+
*/
4
7
export interface InputLocalKeyPair {
8
+
/** An X-Wing private key, encoded in base64 */
5
9
privateKey: string;
10
+
11
+
/** An AT URI to the `app.cistern.pubkey` record derived from this private key */
6
12
publicKey: ResourceUri;
7
13
}
8
14
15
+
/**
16
+
* InputLocalKeyPair, with `privateKey` decoded to a Uint8Array
17
+
*/
9
18
export interface LocalKeyPair {
19
+
/** An X-Wing private key in raw byte format */
10
20
privateKey: Uint8Array;
21
+
22
+
/** An AT URI to the `app.cistern.pubkey` record derived from this private key */
11
23
publicKey: ResourceUri;
12
24
}
13
25
26
+
/** Credentials and optional keypair for creating a Consumer client */
14
27
export interface ConsumerOptions extends BaseClientOptions {
28
+
/** Optional input keypair. If you do not provide this here, you will need to generate one after the client is instantiated */
15
29
keypair?: InputLocalKeyPair;
16
30
}
17
31
32
+
/** Asynchronously-acquired parameters required to construct a Client. `createConsumer` will translate from `ConsumerOptions` to `ConsumerParams` for you */
18
33
export type ConsumerParams = ClientRequirements<ConsumerOptions>;
19
34
35
+
/** A simplified, encrypted memo */
20
36
export interface DecryptedMemo {
37
+
/** TID for when the memo was created */
21
38
tid: Tid;
39
+
40
+
/** The original, decrypted contents of the memo */
22
41
text: string;
23
42
}