@synonymdev/pubky 0.5.0-rc.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@synonymdev/pubky",
3
3
  "type": "module",
4
4
  "description": "Pubky client",
5
- "version": "0.5.0-rc.1",
5
+ "version": "0.5.1",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/pubky.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export function setLogLevel(level: string): void;
3
4
  /**
4
5
  * Create a recovery file of the `keypair`, containing the secret key encrypted
5
6
  * using the `passphrase`.
@@ -10,7 +11,36 @@ export function createRecoveryFile(keypair: Keypair, passphrase: string): Uint8A
10
11
  * using the `passphrase`.
11
12
  */
12
13
  export function decryptRecoveryFile(recovery_file: Uint8Array, passphrase: string): Keypair;
13
- export function setLogLevel(level: string): void;
14
+ /**
15
+ * Pkarr Config
16
+ */
17
+ export interface PkarrConfig {
18
+ /**
19
+ * The list of relays to access the DHT with.
20
+ */
21
+ relays: string[] | null;
22
+ /**
23
+ * The timeout for DHT requests in milliseconds.
24
+ * Default is 2000ms.
25
+ */
26
+ requestTimeout: NonZeroU64 | null;
27
+ }
28
+
29
+ /**
30
+ * Pubky Client Config
31
+ */
32
+ export interface PubkyClientConfig {
33
+ /**
34
+ * Configuration on how to access pkarr packets on the mainline DHT.
35
+ */
36
+ pkarr: PkarrConfig | null;
37
+ /**
38
+ * The maximum age of a record in seconds.
39
+ * If the user pkarr record is older than this, it will be automatically refreshed.
40
+ */
41
+ userMaxRecordAge: NonZeroU64 | null;
42
+ }
43
+
14
44
  export class AuthRequest {
15
45
  private constructor();
16
46
  free(): void;
@@ -32,6 +62,17 @@ export class AuthRequest {
32
62
  }
33
63
  export class Client {
34
64
  free(): void;
65
+ /**
66
+ * Returns a list of Pubky urls (as strings).
67
+ *
68
+ * - `url`: The Pubky url (string) to the directory you want to list its content.
69
+ * - `cursor`: Either a full `pubky://` Url (from previous list response),
70
+ * or a path (to a file or directory) relative to the `url`
71
+ * - `reverse`: List in reverse order
72
+ * - `limit` Limit the number of urls in the response
73
+ * - `shallow`: List directories and files, instead of flat list of files.
74
+ */
75
+ list(url: string, cursor?: string | null, reverse?: boolean | null, limit?: number | null, shallow?: boolean | null): Promise<Array<any>>;
35
76
  /**
36
77
  * Signup to a homeserver and update Pkarr accordingly.
37
78
  *
@@ -88,10 +129,11 @@ export class Client {
88
129
  * manager should always attempt to republish the last known homeserver.
89
130
  */
90
131
  republishHomeserver(keypair: Keypair, host: PublicKey): Promise<void>;
132
+ fetch(url: string, request_init?: any | null): Promise<Promise<any>>;
91
133
  /**
92
- * Create Client with default Settings including default relays
134
+ * Create a new Pubky Client with an optional configuration.
93
135
  */
94
- constructor();
136
+ constructor(config_opt?: PubkyClientConfig | null);
95
137
  /**
96
138
  * Create a client with with configurations appropriate for local testing:
97
139
  * - set Pkarr relays to `["http://localhost:15411"]` instead of default relay.
@@ -99,18 +141,6 @@ export class Client {
99
141
  * and read the homeserver HTTP port from the [reserved service parameter key](pubky_common::constants::reserved_param_keys::HTTP_PORT)
100
142
  */
101
143
  static testnet(): Client;
102
- fetch(url: string, request_init?: any | null): Promise<Promise<any>>;
103
- /**
104
- * Returns a list of Pubky urls (as strings).
105
- *
106
- * - `url`: The Pubky url (string) to the directory you want to list its content.
107
- * - `cursor`: Either a full `pubky://` Url (from previous list response),
108
- * or a path (to a file or directory) relative to the `url`
109
- * - `reverse`: List in reverse order
110
- * - `limit` Limit the number of urls in the response
111
- * - `shallow`: List directories and files, instead of flat list of files.
112
- */
113
- list(url: string, cursor?: string | null, reverse?: boolean | null, limit?: number | null, shallow?: boolean | null): Promise<Array<any>>;
114
144
  }
115
145
  export class Keypair {
116
146
  private constructor();
@@ -137,8 +167,13 @@ export class PublicKey {
137
167
  free(): void;
138
168
  /**
139
169
  * Convert the PublicKey to Uint8Array
170
+ * @deprecated Use `toUint8Array` instead
140
171
  */
141
172
  to_uint8array(): Uint8Array;
173
+ /**
174
+ * Convert the PublicKey to Uint8Array
175
+ */
176
+ toUint8Array(): Uint8Array;
142
177
  /**
143
178
  * Returns the z-base32 encoding of this public key
144
179
  */
@@ -146,7 +181,7 @@ export class PublicKey {
146
181
  /**
147
182
  * @throws
148
183
  */
149
- static from(value: any): PublicKey;
184
+ static from(value: string): PublicKey;
150
185
  }
151
186
  export class Session {
152
187
  private constructor();
package/pubky_bg.wasm CHANGED
Binary file