+12
-2
packages/consumer/client.ts
+12
-2
packages/consumer/client.ts
···
5
5
} from "@cistern/shared";
6
6
import { decryptText, generateKeys } from "@cistern/crypto";
7
7
import { generateRandomName } from "@puregarlic/randimal";
8
-
import { is, parse, type RecordKey } from "@atcute/lexicons";
8
+
import {
9
+
is,
10
+
isResourceUri,
11
+
parse,
12
+
type RecordKey,
13
+
type ResourceUri,
14
+
} from "@atcute/lexicons";
9
15
import { JetstreamSubscription } from "@atcute/jetstream";
10
16
import type { Did } from "@atcute/lexicons/syntax";
11
17
import type { Client } from "@atcute/client";
···
35
41
this.keypair = params.options.keypair
36
42
? {
37
43
privateKey: Uint8Array.fromBase64(params.options.keypair.privateKey),
38
-
publicKey: params.options.keypair.publicKey,
44
+
publicKey: params.options.keypair.publicKey as ResourceUri,
39
45
}
40
46
: undefined;
41
47
this.rpc = params.rpc;
···
214
220
options: ConsumerOptions,
215
221
): Promise<Consumer> {
216
222
const reqs = await produceRequirements(options);
223
+
224
+
if (options.keypair && !isResourceUri(options.keypair.publicKey)) {
225
+
throw new Error("provided public key is not a valid AT URI");
226
+
}
217
227
218
228
return new Consumer(reqs);
219
229
}
+1
-1
packages/consumer/deno.jsonc
+1
-1
packages/consumer/deno.jsonc