@synonymdev/react-native-pubky 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +42 -3
- package/android/src/main/java/com/pubky/PubkyModule.kt +363 -272
- package/android/src/main/java/uniffi/pubkymobile/pubkymobile.kt +557 -127
- package/android/src/main/jniLibs/arm64-v8a/libpubkymobile.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libpubkymobile.so +0 -0
- package/android/src/main/jniLibs/x86/libpubkymobile.so +0 -0
- package/android/src/main/jniLibs/x86_64/libpubkymobile.so +0 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/Headers/pubkymobileFFI.h +28 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64/libpubkymobile.a +0 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/Headers/pubkymobileFFI.h +28 -0
- package/ios/Frameworks/PubkyMobile.xcframework/ios-arm64-simulator/libpubkymobile.a +0 -0
- package/ios/Pubky-Bridging-Header.h +1 -0
- package/ios/Pubky.mm +16 -1
- package/ios/Pubky.swift +64 -1
- package/ios/pubkymobile.swift +284 -0
- package/lib/commonjs/index.js +45 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +42 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +8 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +54 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_result","LINKING_ERROR","Platform","select","ios","default","Pubky","NativeModules","Proxy","get","Error","
|
1
|
+
{"version":3,"names":["_reactNative","require","_result","LINKING_ERROR","Platform","select","ios","default","Pubky","NativeModules","Proxy","get","Error","eventEmitter","NativeEventEmitter","setEventListener","callback","addListener","ok","undefined","e","err","JSON","stringify","removeEventListener","removeAllListeners","auth","url","secretKey","res","parseAuthUrl","parsed","parse","publish","recordName","recordContent","resolve","publicKey","signUp","homeserver","signIn","signOut","put","content","publishHttps","target","resolveHttps","list","deleteFile","session","pubky","generateSecretKey","getPublicKeyFromSecretKey","createRecoveryFile","passphrase","decryptRecoveryFile","recoveryFile"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,MAAME,aAAa,GACjB,6EAA6E,GAC7EC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,KAAK,GAAGC,0BAAa,CAACD,KAAK,GAC7BC,0BAAa,CAACD,KAAK,GACnB,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAMU,YAAY,GAAG,IAAIC,+BAAkB,CAACN,KAAK,CAAC;AAE3C,eAAeO,gBAAgBA,CACpCC,QAAqC,EACd;EACvB,IAAI;IACF,MAAMR,KAAK,CAACO,gBAAgB,CAAC,CAAC;IAC9BF,YAAY,CAACI,WAAW,CAAC,YAAY,EAAED,QAAQ,CAAC;IAChD,OAAO,IAAAE,UAAE,EAACC,SAAS,CAAC;EACtB,CAAC,CAAC,OAAOC,CAAC,EAAE;IACV,OAAO,IAAAC,WAAG,EAACC,IAAI,CAACC,SAAS,CAACH,CAAC,CAAC,CAAC;EAC/B;AACF;AAEO,eAAeI,mBAAmBA,CAAA,EAA0B;EACjE,IAAI;IACF;IACAX,YAAY,CAACY,kBAAkB,CAAC,YAAY,CAAC;IAC7C,OAAO,IAAAP,UAAE,EAACC,SAAS,CAAC;EACtB,CAAC,CAAC,OAAOC,CAAC,EAAE;IAC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ACO;EACzB,IAAI;IACF,MAAMzB,GAAG,GAAG,MAAMrB,KAAK,CAAC6C,kBAAkB,CAACzB,SAAS,EAAE0B,UAAU,CAAC;IACjE,IAAIzB,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAO,IAAAR,WAAG,EAACQ,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB;IACA,OAAO,IAAAX,UAAE,EAACW,GAAG,CAAC,CAAC,CAAC,CAAC;EACnB,CAAC,CAAC,OAAOT,CAAC,EAAE;IACV,OAAO,IAAAC,WAAG,EAACC,IAAI,CAACC,SAAS,CAACH,CAAC,CAAC,CAAC;EAC/B;AACF;AAEO,eAAemC,mBAAmBA,CACvCC,YAAoB,EACpBF,UAAkB,EACO;EACzB,IAAI;IACF,MAAMzB,GAAG,GAAG,MAAMrB,KAAK,CAAC+C,mBAAmB,CAACC,YAAY,EAAEF,UAAU,CAAC;IACrE,IAAIzB,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAO,IAAAR,WAAG,EAACQ,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB;IACA,OAAO,IAAAX,UAAE,EAACW,GAAG,CAAC,CAAC,CAAC,CAAC;EACnB,CAAC,CAAC,OAAOT,CAAC,EAAE;IACV,OAAO,IAAAC,WAAG,EAACC,IAAI,CAACC,SAAS,CAACH,CAAC,CAAC,CAAC;EAC/B;AACF","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
import { NativeModules, Platform } from 'react-native';
|
3
|
+
import { NativeModules, Platform, NativeEventEmitter } from 'react-native';
|
4
4
|
import { ok, err } from '@synonymdev/result';
|
5
5
|
const LINKING_ERROR = `The package 'react-native-pubky' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
6
6
|
ios: "- You have run 'pod install'\n",
|
@@ -11,6 +11,25 @@ const Pubky = NativeModules.Pubky ? NativeModules.Pubky : new Proxy({}, {
|
|
11
11
|
throw new Error(LINKING_ERROR);
|
12
12
|
}
|
13
13
|
});
|
14
|
+
const eventEmitter = new NativeEventEmitter(Pubky);
|
15
|
+
export async function setEventListener(callback) {
|
16
|
+
try {
|
17
|
+
await Pubky.setEventListener();
|
18
|
+
eventEmitter.addListener('PubkyEvent', callback);
|
19
|
+
return ok(undefined);
|
20
|
+
} catch (e) {
|
21
|
+
return err(JSON.stringify(e));
|
22
|
+
}
|
23
|
+
}
|
24
|
+
export async function removeEventListener() {
|
25
|
+
try {
|
26
|
+
//await Pubky.removeEventListener();
|
27
|
+
eventEmitter.removeAllListeners('PubkyEvent');
|
28
|
+
return ok(undefined);
|
29
|
+
} catch (e) {
|
30
|
+
return err(JSON.stringify(e));
|
31
|
+
}
|
32
|
+
}
|
14
33
|
export async function auth(url, secretKey) {
|
15
34
|
const res = await Pubky.auth(url, secretKey);
|
16
35
|
if (res[0] === 'error') {
|
@@ -140,6 +159,28 @@ export async function list(url) {
|
|
140
159
|
return err(JSON.stringify(e));
|
141
160
|
}
|
142
161
|
}
|
162
|
+
export async function deleteFile(url) {
|
163
|
+
try {
|
164
|
+
const res = await Pubky.deleteFile(url);
|
165
|
+
if (res[0] === 'error') {
|
166
|
+
return err(res[1]);
|
167
|
+
}
|
168
|
+
return ok(res[1]);
|
169
|
+
} catch (e) {
|
170
|
+
return err(JSON.stringify(e));
|
171
|
+
}
|
172
|
+
}
|
173
|
+
export async function session(pubky) {
|
174
|
+
try {
|
175
|
+
const res = await Pubky.session(pubky);
|
176
|
+
if (res[0] === 'error') {
|
177
|
+
return err(res[1]);
|
178
|
+
}
|
179
|
+
return ok(JSON.parse(res[1]));
|
180
|
+
} catch (e) {
|
181
|
+
return err(JSON.stringify(e));
|
182
|
+
}
|
183
|
+
}
|
143
184
|
export async function generateSecretKey() {
|
144
185
|
try {
|
145
186
|
const res = await Pubky.generateSecretKey();
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","ok","err","LINKING_ERROR","select","ios","default","Pubky","Proxy","get","Error","
|
1
|
+
{"version":3,"names":["NativeModules","Platform","NativeEventEmitter","ok","err","LINKING_ERROR","select","ios","default","Pubky","Proxy","get","Error","eventEmitter","setEventListener","callback","addListener","undefined","e","JSON","stringify","removeEventListener","removeAllListeners","auth","url","secretKey","res","parseAuthUrl","parsed","parse","publish","recordName","recordContent","resolve","publicKey","signUp","homeserver","signIn","signOut","put","content","publishHttps","target","resolveHttps","list","deleteFile","session","pubky","generateSecretKey","getPublicKeyFromSecretKey","createRecoveryFile","passphrase","decryptRecoveryFile","recoveryFile"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,EAAEC,kBAAkB,QAAQ,cAAc;AAC1E,SAASC,EAAE,EAAEC,GAAG,QAAqB,oBAAoB;AAEzD,MAAMC,aAAa,GACjB,6EAA6E,GAC7EJ,QAAQ,CAACK,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,KAAK,GAAGT,aAAa,CAACS,KAAK,GAC7BT,aAAa,CAACS,KAAK,GACnB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAMQ,YAAY,GAAG,IAAIX,kBAAkB,CAACO,KAAK,CAAC;AAElD,OAAO,eAAeK,gBAAgBA,CACpCC,QAAqC,EACd;EACvB,IAAI;IACF,MAAMN,KAAK,CAACK,gBAAgB,CAAC,CAAC;IAC9BD,YAAY,CAACG,WAAW,CAAC,YAAY,EAAED,QAAQ,CAAC;IAChD,OAAOZ,EAAE,CAACc,SAAS,CAAC;EACtB,CAAC,CAAC,OAAOC,CAAC,EAAE;IACV,OAAOd,GAAG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AAI,CAACC,SAAS,CAACF,CAAC,CAAC,CAAC;EAC/B;AACF;AAEA,OAAO,eAAegC,kBAAkBA,CACtCzB,SAAiB,EACjB0B,UAAkB,EACO;EACzB,IAAI;IACF,MAAMzB,GAAG,GAAG,MAAMjB,KAAK,CAACyC,kBAAkB,CAACzB,SAAS,EAAE0B,UAAU,CAAC;IACjE,IAAIzB,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAOtB,GAAG,CAACsB,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB;IACA,OAAOvB,EAAE,CAACuB,GAAG,CAAC,CAAC,CAAC,CAAC;EACnB,CAAC,CAAC,OAAOR,CAAC,EAAE;IACV,OAAOd,GAAG,CAACe,IAAI,CAACC,SAAS,CAACF,CAAC,CAAC,CAAC;EAC/B;AACF;AAEA,OAAO,eAAekC,mBAAmBA,CACvCC,YAAoB,EACpBF,UAAkB,EACO;EACzB,IAAI;IACF,MAAMzB,GAAG,GAAG,MAAMjB,KAAK,CAAC2C,mBAAmB,CAACC,YAAY,EAAEF,UAAU,CAAC;IACrE,IAAIzB,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAOtB,GAAG,CAACsB,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB;IACA,OAAOvB,EAAE,CAACuB,GAAG,CAAC,CAAC,CAAC,CAAC;EACnB,CAAC,CAAC,OAAOR,CAAC,EAAE;IACV,OAAOd,GAAG,CAACe,IAAI,CAACC,SAAS,CAACF,CAAC,CAAC,CAAC;EAC/B;AACF","ignoreList":[]}
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import { type Result } from '@synonymdev/result';
|
2
|
+
export declare function setEventListener(callback: (eventData: string) => void): Promise<Result<void>>;
|
3
|
+
export declare function removeEventListener(): Promise<Result<void>>;
|
2
4
|
export declare function auth(url: string, secretKey: string): Promise<Result<string[]>>;
|
3
5
|
type Capability = {
|
4
6
|
path: string;
|
@@ -52,6 +54,12 @@ interface IHttpsResolveResult {
|
|
52
54
|
}
|
53
55
|
export declare function resolveHttps(publicKey: string): Promise<Result<IHttpsResolveResult>>;
|
54
56
|
export declare function list(url: string): Promise<Result<string[]>>;
|
57
|
+
export declare function deleteFile(url: string): Promise<Result<string[]>>;
|
58
|
+
interface SessionInfo {
|
59
|
+
pubky: string;
|
60
|
+
capabilities: string[];
|
61
|
+
}
|
62
|
+
export declare function session(pubky: string): Promise<Result<SessionInfo>>;
|
55
63
|
interface IPublicKeyInfo {
|
56
64
|
public_key: string;
|
57
65
|
uri: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAqB1D,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,GACpC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAQvB;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAQjE;AAED,wBAAsB,IAAI,CACxB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAM3B;AAED,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAsB,YAAY,CAChC,GAAG,EAAE,M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D,UAAU,EAAE,MAAM,CAAC;CACpB;AACD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,CAU7E;AAED,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAUjC;AAED,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAUzB;AAED,wBAAsB,mBAAmB,CACvC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAUzB"}
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import { type Result } from '@synonymdev/result';
|
2
|
+
export declare function setEventListener(callback: (eventData: string) => void): Promise<Result<void>>;
|
3
|
+
export declare function removeEventListener(): Promise<Result<void>>;
|
2
4
|
export declare function auth(url: string, secretKey: string): Promise<Result<string[]>>;
|
3
5
|
type Capability = {
|
4
6
|
path: string;
|
@@ -52,6 +54,12 @@ interface IHttpsResolveResult {
|
|
52
54
|
}
|
53
55
|
export declare function resolveHttps(publicKey: string): Promise<Result<IHttpsResolveResult>>;
|
54
56
|
export declare function list(url: string): Promise<Result<string[]>>;
|
57
|
+
export declare function deleteFile(url: string): Promise<Result<string[]>>;
|
58
|
+
interface SessionInfo {
|
59
|
+
pubky: string;
|
60
|
+
capabilities: string[];
|
61
|
+
}
|
62
|
+
export declare function session(pubky: string): Promise<Result<SessionInfo>>;
|
55
63
|
interface IPublicKeyInfo {
|
56
64
|
public_key: string;
|
57
65
|
uri: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
1
|
+
{"version":3,"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 +1,4 @@
|
|
1
|
-
import { NativeModules, Platform } from 'react-native';
|
1
|
+
import { NativeModules, Platform, NativeEventEmitter } from 'react-native';
|
2
2
|
import { ok, err, type Result } from '@synonymdev/result';
|
3
3
|
|
4
4
|
const LINKING_ERROR =
|
@@ -18,6 +18,30 @@ const Pubky = NativeModules.Pubky
|
|
18
18
|
}
|
19
19
|
);
|
20
20
|
|
21
|
+
const eventEmitter = new NativeEventEmitter(Pubky);
|
22
|
+
|
23
|
+
export async function setEventListener(
|
24
|
+
callback: (eventData: string) => void
|
25
|
+
): Promise<Result<void>> {
|
26
|
+
try {
|
27
|
+
await Pubky.setEventListener();
|
28
|
+
eventEmitter.addListener('PubkyEvent', callback);
|
29
|
+
return ok(undefined);
|
30
|
+
} catch (e) {
|
31
|
+
return err(JSON.stringify(e));
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
export async function removeEventListener(): Promise<Result<void>> {
|
36
|
+
try {
|
37
|
+
//await Pubky.removeEventListener();
|
38
|
+
eventEmitter.removeAllListeners('PubkyEvent');
|
39
|
+
return ok(undefined);
|
40
|
+
} catch (e) {
|
41
|
+
return err(JSON.stringify(e));
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
21
45
|
export async function auth(
|
22
46
|
url: string,
|
23
47
|
secretKey: string
|
@@ -225,6 +249,35 @@ export async function list(url: string): Promise<Result<string[]>> {
|
|
225
249
|
}
|
226
250
|
}
|
227
251
|
|
252
|
+
export async function deleteFile(url: string): Promise<Result<string[]>> {
|
253
|
+
try {
|
254
|
+
const res = await Pubky.deleteFile(url);
|
255
|
+
if (res[0] === 'error') {
|
256
|
+
return err(res[1]);
|
257
|
+
}
|
258
|
+
return ok(res[1]);
|
259
|
+
} catch (e) {
|
260
|
+
return err(JSON.stringify(e));
|
261
|
+
}
|
262
|
+
}
|
263
|
+
|
264
|
+
interface SessionInfo {
|
265
|
+
pubky: string;
|
266
|
+
capabilities: string[];
|
267
|
+
}
|
268
|
+
|
269
|
+
export async function session(pubky: string): Promise<Result<SessionInfo>> {
|
270
|
+
try {
|
271
|
+
const res = await Pubky.session(pubky);
|
272
|
+
if (res[0] === 'error') {
|
273
|
+
return err(res[1]);
|
274
|
+
}
|
275
|
+
return ok(JSON.parse(res[1]));
|
276
|
+
} catch (e) {
|
277
|
+
return err(JSON.stringify(e));
|
278
|
+
}
|
279
|
+
}
|
280
|
+
|
228
281
|
interface IPublicKeyInfo {
|
229
282
|
public_key: string;
|
230
283
|
uri: string;
|