@synonymdev/pubky 0.1.14 → 0.1.16
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/README.md +79 -17
- package/browser.js +386 -221
- package/index.cjs +272 -187
- package/package.json +1 -1
- package/pubky.d.ts +48 -19
- package/pubky_bg.wasm +0 -0
package/package.json
CHANGED
package/pubky.d.ts
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
+
* Create a recovery file of the `keypair`, containing the secret key encrypted
|
|
5
|
+
* using the `passphrase`.
|
|
6
|
+
* @param {Keypair} keypair
|
|
7
|
+
* @param {string} passphrase
|
|
8
|
+
* @returns {Uint8Array}
|
|
9
|
+
*/
|
|
10
|
+
export function createRecoveryFile(keypair: Keypair, passphrase: string): Uint8Array;
|
|
11
|
+
/**
|
|
12
|
+
* Create a recovery file of the `keypair`, containing the secret key encrypted
|
|
13
|
+
* using the `passphrase`.
|
|
14
|
+
* @param {Uint8Array} recovery_file
|
|
15
|
+
* @param {string} passphrase
|
|
16
|
+
* @returns {Keypair}
|
|
17
|
+
*/
|
|
18
|
+
export function decryptRecoveryFile(recovery_file: Uint8Array, passphrase: string): Keypair;
|
|
19
|
+
/**
|
|
4
20
|
*/
|
|
5
21
|
export class Keypair {
|
|
6
22
|
free(): void;
|
|
@@ -40,22 +56,6 @@ export class PubkyClient {
|
|
|
40
56
|
*/
|
|
41
57
|
static testnet(): PubkyClient;
|
|
42
58
|
/**
|
|
43
|
-
* Create a recovery file of the `keypair`, containing the secret key encrypted
|
|
44
|
-
* using the `passphrase`.
|
|
45
|
-
* @param {Keypair} keypair
|
|
46
|
-
* @param {string} passphrase
|
|
47
|
-
* @returns {Uint8Array}
|
|
48
|
-
*/
|
|
49
|
-
static createRecoveryFile(keypair: Keypair, passphrase: string): Uint8Array;
|
|
50
|
-
/**
|
|
51
|
-
* Create a recovery file of the `keypair`, containing the secret key encrypted
|
|
52
|
-
* using the `passphrase`.
|
|
53
|
-
* @param {Uint8Array} recovery_file
|
|
54
|
-
* @param {string} passphrase
|
|
55
|
-
* @returns {Keypair}
|
|
56
|
-
*/
|
|
57
|
-
static decryptRecoveryFile(recovery_file: Uint8Array, passphrase: string): Keypair;
|
|
58
|
-
/**
|
|
59
59
|
* Set Pkarr relays used for publishing and resolving Pkarr packets.
|
|
60
60
|
*
|
|
61
61
|
* By default, [PubkyClient] will use `["https://relay.pkarr.org"]`
|
|
@@ -74,9 +74,9 @@ export class PubkyClient {
|
|
|
74
74
|
* for example "pubky.o4dksfbqk85ogzdb5osziw6befigbuxmuxkuxq8434q89uj56uyy"
|
|
75
75
|
* @param {Keypair} keypair
|
|
76
76
|
* @param {PublicKey} homeserver
|
|
77
|
-
* @returns {Promise<
|
|
77
|
+
* @returns {Promise<Session>}
|
|
78
78
|
*/
|
|
79
|
-
signup(keypair: Keypair, homeserver: PublicKey): Promise<
|
|
79
|
+
signup(keypair: Keypair, homeserver: PublicKey): Promise<Session>;
|
|
80
80
|
/**
|
|
81
81
|
* Check the current sesison for a given Pubky in its homeserver.
|
|
82
82
|
*
|
|
@@ -93,12 +93,31 @@ export class PubkyClient {
|
|
|
93
93
|
*/
|
|
94
94
|
signout(pubky: PublicKey): Promise<void>;
|
|
95
95
|
/**
|
|
96
|
-
* Signin to a homeserver.
|
|
96
|
+
* Signin to a homeserver using the root Keypair.
|
|
97
97
|
* @param {Keypair} keypair
|
|
98
98
|
* @returns {Promise<void>}
|
|
99
99
|
*/
|
|
100
100
|
signin(keypair: Keypair): Promise<void>;
|
|
101
101
|
/**
|
|
102
|
+
* Return `pubkyauth://` url and wait for the incoming [AuthToken]
|
|
103
|
+
* verifying that AuthToken, and if capabilities were requested, signing in to
|
|
104
|
+
* the Pubky's homeserver and returning the [Session] information.
|
|
105
|
+
*
|
|
106
|
+
* Returns a tuple of [pubkyAuthUrl, Promise<Session>]
|
|
107
|
+
* @param {string} relay
|
|
108
|
+
* @param {string} capabilities
|
|
109
|
+
* @returns {Array<any>}
|
|
110
|
+
*/
|
|
111
|
+
authRequest(relay: string, capabilities: string): Array<any>;
|
|
112
|
+
/**
|
|
113
|
+
* Sign an [pubky_common::auth::AuthToken], encrypt it and send it to the
|
|
114
|
+
* source of the pubkyauth request url.
|
|
115
|
+
* @param {Keypair} keypair
|
|
116
|
+
* @param {string} pubkyauth_url
|
|
117
|
+
* @returns {Promise<void>}
|
|
118
|
+
*/
|
|
119
|
+
sendAuthToken(keypair: Keypair, pubkyauth_url: string): Promise<void>;
|
|
120
|
+
/**
|
|
102
121
|
* Upload a small payload to a given path.
|
|
103
122
|
* @param {string} url
|
|
104
123
|
* @param {Uint8Array} content
|
|
@@ -160,4 +179,14 @@ export class PublicKey {
|
|
|
160
179
|
*/
|
|
161
180
|
export class Session {
|
|
162
181
|
free(): void;
|
|
182
|
+
/**
|
|
183
|
+
* Return the [PublicKey] of this session
|
|
184
|
+
* @returns {PublicKey}
|
|
185
|
+
*/
|
|
186
|
+
pubky(): PublicKey;
|
|
187
|
+
/**
|
|
188
|
+
* Return the capabilities that this session has.
|
|
189
|
+
* @returns {(string)[]}
|
|
190
|
+
*/
|
|
191
|
+
capabilities(): (string)[];
|
|
163
192
|
}
|
package/pubky_bg.wasm
CHANGED
|
Binary file
|