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