@synonymdev/react-native-pubky 0.7.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -335,6 +335,240 @@ fileprivate struct FfiConverterString: FfiConverter {
335
335
  }
336
336
  }
337
337
 
338
+
339
+ public protocol EventNotifierProtocol {
340
+
341
+ }
342
+
343
+ public class EventNotifier: EventNotifierProtocol {
344
+ fileprivate let pointer: UnsafeMutableRawPointer
345
+
346
+ // TODO: We'd like this to be `private` but for Swifty reasons,
347
+ // we can't implement `FfiConverter` without making this `required` and we can't
348
+ // make it `required` without making it `public`.
349
+ required init(unsafeFromRawPointer pointer: UnsafeMutableRawPointer) {
350
+ self.pointer = pointer
351
+ }
352
+
353
+ deinit {
354
+ try! rustCall { uniffi_pubkymobile_fn_free_eventnotifier(pointer, $0) }
355
+ }
356
+
357
+
358
+
359
+
360
+
361
+ }
362
+
363
+ public struct FfiConverterTypeEventNotifier: FfiConverter {
364
+ typealias FfiType = UnsafeMutableRawPointer
365
+ typealias SwiftType = EventNotifier
366
+
367
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> EventNotifier {
368
+ let v: UInt64 = try readInt(&buf)
369
+ // The Rust code won't compile if a pointer won't fit in a UInt64.
370
+ // We have to go via `UInt` because that's the thing that's the size of a pointer.
371
+ let ptr = UnsafeMutableRawPointer(bitPattern: UInt(truncatingIfNeeded: v))
372
+ if (ptr == nil) {
373
+ throw UniffiInternalError.unexpectedNullPointer
374
+ }
375
+ return try lift(ptr!)
376
+ }
377
+
378
+ public static func write(_ value: EventNotifier, into buf: inout [UInt8]) {
379
+ // This fiddling is because `Int` is the thing that's the same size as a pointer.
380
+ // The Rust code won't compile if a pointer won't fit in a `UInt64`.
381
+ writeInt(&buf, UInt64(bitPattern: Int64(Int(bitPattern: lower(value)))))
382
+ }
383
+
384
+ public static func lift(_ pointer: UnsafeMutableRawPointer) throws -> EventNotifier {
385
+ return EventNotifier(unsafeFromRawPointer: pointer)
386
+ }
387
+
388
+ public static func lower(_ value: EventNotifier) -> UnsafeMutableRawPointer {
389
+ return value.pointer
390
+ }
391
+ }
392
+
393
+
394
+ public func FfiConverterTypeEventNotifier_lift(_ pointer: UnsafeMutableRawPointer) throws -> EventNotifier {
395
+ return try FfiConverterTypeEventNotifier.lift(pointer)
396
+ }
397
+
398
+ public func FfiConverterTypeEventNotifier_lower(_ value: EventNotifier) -> UnsafeMutableRawPointer {
399
+ return FfiConverterTypeEventNotifier.lower(value)
400
+ }
401
+
402
+ fileprivate extension NSLock {
403
+ func withLock<T>(f: () throws -> T) rethrows -> T {
404
+ self.lock()
405
+ defer { self.unlock() }
406
+ return try f()
407
+ }
408
+ }
409
+
410
+ fileprivate typealias UniFFICallbackHandle = UInt64
411
+ fileprivate class UniFFICallbackHandleMap<T> {
412
+ private var leftMap: [UniFFICallbackHandle: T] = [:]
413
+ private var counter: [UniFFICallbackHandle: UInt64] = [:]
414
+ private var rightMap: [ObjectIdentifier: UniFFICallbackHandle] = [:]
415
+
416
+ private let lock = NSLock()
417
+ private var currentHandle: UniFFICallbackHandle = 0
418
+ private let stride: UniFFICallbackHandle = 1
419
+
420
+ func insert(obj: T) -> UniFFICallbackHandle {
421
+ lock.withLock {
422
+ let id = ObjectIdentifier(obj as AnyObject)
423
+ let handle = rightMap[id] ?? {
424
+ currentHandle += stride
425
+ let handle = currentHandle
426
+ leftMap[handle] = obj
427
+ rightMap[id] = handle
428
+ return handle
429
+ }()
430
+ counter[handle] = (counter[handle] ?? 0) + 1
431
+ return handle
432
+ }
433
+ }
434
+
435
+ func get(handle: UniFFICallbackHandle) -> T? {
436
+ lock.withLock {
437
+ leftMap[handle]
438
+ }
439
+ }
440
+
441
+ func delete(handle: UniFFICallbackHandle) {
442
+ remove(handle: handle)
443
+ }
444
+
445
+ @discardableResult
446
+ func remove(handle: UniFFICallbackHandle) -> T? {
447
+ lock.withLock {
448
+ defer { counter[handle] = (counter[handle] ?? 1) - 1 }
449
+ guard counter[handle] == 1 else { return leftMap[handle] }
450
+ let obj = leftMap.removeValue(forKey: handle)
451
+ if let obj = obj {
452
+ rightMap.removeValue(forKey: ObjectIdentifier(obj as AnyObject))
453
+ }
454
+ return obj
455
+ }
456
+ }
457
+ }
458
+
459
+ // Magic number for the Rust proxy to call using the same mechanism as every other method,
460
+ // to free the callback once it's dropped by Rust.
461
+ private let IDX_CALLBACK_FREE: Int32 = 0
462
+ // Callback return codes
463
+ private let UNIFFI_CALLBACK_SUCCESS: Int32 = 0
464
+ private let UNIFFI_CALLBACK_ERROR: Int32 = 1
465
+ private let UNIFFI_CALLBACK_UNEXPECTED_ERROR: Int32 = 2
466
+
467
+ // Declaration and FfiConverters for EventListener Callback Interface
468
+
469
+ public protocol EventListener : AnyObject {
470
+ func onEventOccurred(eventData: String)
471
+
472
+ }
473
+
474
+ // The ForeignCallback that is passed to Rust.
475
+ fileprivate let foreignCallbackCallbackInterfaceEventListener : ForeignCallback =
476
+ { (handle: UniFFICallbackHandle, method: Int32, argsData: UnsafePointer<UInt8>, argsLen: Int32, out_buf: UnsafeMutablePointer<RustBuffer>) -> Int32 in
477
+
478
+
479
+ func invokeOnEventOccurred(_ swiftCallbackInterface: EventListener, _ argsData: UnsafePointer<UInt8>, _ argsLen: Int32, _ out_buf: UnsafeMutablePointer<RustBuffer>) throws -> Int32 {
480
+ var reader = createReader(data: Data(bytes: argsData, count: Int(argsLen)))
481
+ func makeCall() throws -> Int32 {
482
+ try swiftCallbackInterface.onEventOccurred(
483
+ eventData: try FfiConverterString.read(from: &reader)
484
+ )
485
+ return UNIFFI_CALLBACK_SUCCESS
486
+ }
487
+ return try makeCall()
488
+ }
489
+
490
+
491
+ switch method {
492
+ case IDX_CALLBACK_FREE:
493
+ FfiConverterCallbackInterfaceEventListener.drop(handle: handle)
494
+ // Sucessful return
495
+ // See docs of ForeignCallback in `uniffi_core/src/ffi/foreigncallbacks.rs`
496
+ return UNIFFI_CALLBACK_SUCCESS
497
+ case 1:
498
+ let cb: EventListener
499
+ do {
500
+ cb = try FfiConverterCallbackInterfaceEventListener.lift(handle)
501
+ } catch {
502
+ out_buf.pointee = FfiConverterString.lower("EventListener: Invalid handle")
503
+ return UNIFFI_CALLBACK_UNEXPECTED_ERROR
504
+ }
505
+ do {
506
+ return try invokeOnEventOccurred(cb, argsData, argsLen, out_buf)
507
+ } catch let error {
508
+ out_buf.pointee = FfiConverterString.lower(String(describing: error))
509
+ return UNIFFI_CALLBACK_UNEXPECTED_ERROR
510
+ }
511
+
512
+ // This should never happen, because an out of bounds method index won't
513
+ // ever be used. Once we can catch errors, we should return an InternalError.
514
+ // https://github.com/mozilla/uniffi-rs/issues/351
515
+ default:
516
+ // An unexpected error happened.
517
+ // See docs of ForeignCallback in `uniffi_core/src/ffi/foreigncallbacks.rs`
518
+ return UNIFFI_CALLBACK_UNEXPECTED_ERROR
519
+ }
520
+ }
521
+
522
+ // FfiConverter protocol for callback interfaces
523
+ fileprivate struct FfiConverterCallbackInterfaceEventListener {
524
+ private static let initCallbackOnce: () = {
525
+ // Swift ensures this initializer code will once run once, even when accessed by multiple threads.
526
+ try! rustCall { (err: UnsafeMutablePointer<RustCallStatus>) in
527
+ uniffi_pubkymobile_fn_init_callback_eventlistener(foreignCallbackCallbackInterfaceEventListener, err)
528
+ }
529
+ }()
530
+
531
+ private static func ensureCallbackinitialized() {
532
+ _ = initCallbackOnce
533
+ }
534
+
535
+ static func drop(handle: UniFFICallbackHandle) {
536
+ handleMap.remove(handle: handle)
537
+ }
538
+
539
+ private static var handleMap = UniFFICallbackHandleMap<EventListener>()
540
+ }
541
+
542
+ extension FfiConverterCallbackInterfaceEventListener : FfiConverter {
543
+ typealias SwiftType = EventListener
544
+ // We can use Handle as the FfiType because it's a typealias to UInt64
545
+ typealias FfiType = UniFFICallbackHandle
546
+
547
+ public static func lift(_ handle: UniFFICallbackHandle) throws -> SwiftType {
548
+ ensureCallbackinitialized();
549
+ guard let callback = handleMap.get(handle: handle) else {
550
+ throw UniffiInternalError.unexpectedStaleHandle
551
+ }
552
+ return callback
553
+ }
554
+
555
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
556
+ ensureCallbackinitialized();
557
+ let handle: UniFFICallbackHandle = try readInt(&buf)
558
+ return try lift(handle)
559
+ }
560
+
561
+ public static func lower(_ v: SwiftType) -> UniFFICallbackHandle {
562
+ ensureCallbackinitialized();
563
+ return handleMap.insert(obj: v)
564
+ }
565
+
566
+ public static func write(_ v: SwiftType, into buf: inout [UInt8]) {
567
+ ensureCallbackinitialized();
568
+ writeInt(&buf, lower(v))
569
+ }
570
+ }
571
+
338
572
  fileprivate struct FfiConverterSequenceString: FfiConverterRustBuffer {
339
573
  typealias SwiftType = [String]
340
574
 
@@ -367,6 +601,35 @@ public func auth(url: String, secretKey: String) -> [String] {
367
601
  )
368
602
  }
369
603
 
604
+ public func createRecoveryFile(secretKey: String, passphrase: String) -> [String] {
605
+ return try! FfiConverterSequenceString.lift(
606
+ try! rustCall() {
607
+ uniffi_pubkymobile_fn_func_create_recovery_file(
608
+ FfiConverterString.lower(secretKey),
609
+ FfiConverterString.lower(passphrase),$0)
610
+ }
611
+ )
612
+ }
613
+
614
+ public func decryptRecoveryFile(recoveryFile: String, passphrase: String) -> [String] {
615
+ return try! FfiConverterSequenceString.lift(
616
+ try! rustCall() {
617
+ uniffi_pubkymobile_fn_func_decrypt_recovery_file(
618
+ FfiConverterString.lower(recoveryFile),
619
+ FfiConverterString.lower(passphrase),$0)
620
+ }
621
+ )
622
+ }
623
+
624
+ public func deleteFile(url: String) -> [String] {
625
+ return try! FfiConverterSequenceString.lift(
626
+ try! rustCall() {
627
+ uniffi_pubkymobile_fn_func_delete_file(
628
+ FfiConverterString.lower(url),$0)
629
+ }
630
+ )
631
+ }
632
+
370
633
  public func generateSecretKey() -> [String] {
371
634
  return try! FfiConverterSequenceString.lift(
372
635
  try! rustCall() {
@@ -443,6 +706,14 @@ public func put(url: String, content: String) -> [String] {
443
706
  )
444
707
  }
445
708
 
709
+ public func removeEventListener() {
710
+ try! rustCall() {
711
+ uniffi_pubkymobile_fn_func_remove_event_listener($0)
712
+ }
713
+ }
714
+
715
+
716
+
446
717
  public func resolve(publicKey: String) -> [String] {
447
718
  return try! FfiConverterSequenceString.lift(
448
719
  try! rustCall() {
@@ -461,6 +732,24 @@ public func resolveHttps(publicKey: String) -> [String] {
461
732
  )
462
733
  }
463
734
 
735
+ public func session(pubky: String) -> [String] {
736
+ return try! FfiConverterSequenceString.lift(
737
+ try! rustCall() {
738
+ uniffi_pubkymobile_fn_func_session(
739
+ FfiConverterString.lower(pubky),$0)
740
+ }
741
+ )
742
+ }
743
+
744
+ public func setEventListener(listener: EventListener) {
745
+ try! rustCall() {
746
+ uniffi_pubkymobile_fn_func_set_event_listener(
747
+ FfiConverterCallbackInterfaceEventListener.lower(listener),$0)
748
+ }
749
+ }
750
+
751
+
752
+
464
753
  public func signIn(secretKey: String) -> [String] {
465
754
  return try! FfiConverterSequenceString.lift(
466
755
  try! rustCall() {
@@ -507,6 +796,15 @@ private var initializationResult: InitializationResult {
507
796
  if (uniffi_pubkymobile_checksum_func_auth() != 61378) {
508
797
  return InitializationResult.apiChecksumMismatch
509
798
  }
799
+ if (uniffi_pubkymobile_checksum_func_create_recovery_file() != 55903) {
800
+ return InitializationResult.apiChecksumMismatch
801
+ }
802
+ if (uniffi_pubkymobile_checksum_func_decrypt_recovery_file() != 59688) {
803
+ return InitializationResult.apiChecksumMismatch
804
+ }
805
+ if (uniffi_pubkymobile_checksum_func_delete_file() != 57905) {
806
+ return InitializationResult.apiChecksumMismatch
807
+ }
510
808
  if (uniffi_pubkymobile_checksum_func_generate_secret_key() != 63116) {
511
809
  return InitializationResult.apiChecksumMismatch
512
810
  }
@@ -531,12 +829,21 @@ private var initializationResult: InitializationResult {
531
829
  if (uniffi_pubkymobile_checksum_func_put() != 51107) {
532
830
  return InitializationResult.apiChecksumMismatch
533
831
  }
832
+ if (uniffi_pubkymobile_checksum_func_remove_event_listener() != 6794) {
833
+ return InitializationResult.apiChecksumMismatch
834
+ }
534
835
  if (uniffi_pubkymobile_checksum_func_resolve() != 18303) {
535
836
  return InitializationResult.apiChecksumMismatch
536
837
  }
537
838
  if (uniffi_pubkymobile_checksum_func_resolve_https() != 34593) {
538
839
  return InitializationResult.apiChecksumMismatch
539
840
  }
841
+ if (uniffi_pubkymobile_checksum_func_session() != 65177) {
842
+ return InitializationResult.apiChecksumMismatch
843
+ }
844
+ if (uniffi_pubkymobile_checksum_func_set_event_listener() != 19468) {
845
+ return InitializationResult.apiChecksumMismatch
846
+ }
540
847
  if (uniffi_pubkymobile_checksum_func_sign_in() != 21006) {
541
848
  return InitializationResult.apiChecksumMismatch
542
849
  }
@@ -546,6 +853,9 @@ private var initializationResult: InitializationResult {
546
853
  if (uniffi_pubkymobile_checksum_func_sign_up() != 58756) {
547
854
  return InitializationResult.apiChecksumMismatch
548
855
  }
856
+ if (uniffi_pubkymobile_checksum_method_eventlistener_on_event_occurred() != 39865) {
857
+ return InitializationResult.apiChecksumMismatch
858
+ }
549
859
 
550
860
  return InitializationResult.ok
551
861
  }
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.auth = auth;
7
+ exports.createRecoveryFile = createRecoveryFile;
8
+ exports.decryptRecoveryFile = decryptRecoveryFile;
9
+ exports.deleteFile = deleteFile;
7
10
  exports.generateSecretKey = generateSecretKey;
8
11
  exports.get = get;
9
12
  exports.getPublicKeyFromSecretKey = getPublicKeyFromSecretKey;
@@ -12,8 +15,11 @@ exports.parseAuthUrl = parseAuthUrl;
12
15
  exports.publish = publish;
13
16
  exports.publishHttps = publishHttps;
14
17
  exports.put = put;
18
+ exports.removeEventListener = removeEventListener;
15
19
  exports.resolve = resolve;
16
20
  exports.resolveHttps = resolveHttps;
21
+ exports.session = session;
22
+ exports.setEventListener = setEventListener;
17
23
  exports.signIn = signIn;
18
24
  exports.signOut = signOut;
19
25
  exports.signUp = signUp;
@@ -28,6 +34,25 @@ const Pubky = _reactNative.NativeModules.Pubky ? _reactNative.NativeModules.Pubk
28
34
  throw new Error(LINKING_ERROR);
29
35
  }
30
36
  });
37
+ const eventEmitter = new _reactNative.NativeEventEmitter(Pubky);
38
+ async function setEventListener(callback) {
39
+ try {
40
+ await Pubky.setEventListener();
41
+ eventEmitter.addListener('PubkyEvent', callback);
42
+ return (0, _result.ok)(undefined);
43
+ } catch (e) {
44
+ return (0, _result.err)(JSON.stringify(e));
45
+ }
46
+ }
47
+ async function removeEventListener() {
48
+ try {
49
+ //await Pubky.removeEventListener();
50
+ eventEmitter.removeAllListeners('PubkyEvent');
51
+ return (0, _result.ok)(undefined);
52
+ } catch (e) {
53
+ return (0, _result.err)(JSON.stringify(e));
54
+ }
55
+ }
31
56
  async function auth(url, secretKey) {
32
57
  const res = await Pubky.auth(url, secretKey);
33
58
  if (res[0] === 'error') {
@@ -157,6 +182,28 @@ async function list(url) {
157
182
  return (0, _result.err)(JSON.stringify(e));
158
183
  }
159
184
  }
185
+ async function deleteFile(url) {
186
+ try {
187
+ const res = await Pubky.deleteFile(url);
188
+ if (res[0] === 'error') {
189
+ return (0, _result.err)(res[1]);
190
+ }
191
+ return (0, _result.ok)(res[1]);
192
+ } catch (e) {
193
+ return (0, _result.err)(JSON.stringify(e));
194
+ }
195
+ }
196
+ async function session(pubky) {
197
+ try {
198
+ const res = await Pubky.session(pubky);
199
+ if (res[0] === 'error') {
200
+ return (0, _result.err)(res[1]);
201
+ }
202
+ return (0, _result.ok)(JSON.parse(res[1]));
203
+ } catch (e) {
204
+ return (0, _result.err)(JSON.stringify(e));
205
+ }
206
+ }
160
207
  async function generateSecretKey() {
161
208
  try {
162
209
  const res = await Pubky.generateSecretKey();
@@ -179,4 +226,26 @@ async function getPublicKeyFromSecretKey(secretKey) {
179
226
  return (0, _result.err)(JSON.stringify(e));
180
227
  }
181
228
  }
229
+ async function createRecoveryFile(secretKey, passphrase) {
230
+ try {
231
+ const res = await Pubky.createRecoveryFile(secretKey, passphrase);
232
+ if (res[0] === 'error') {
233
+ return (0, _result.err)(res[1]);
234
+ }
235
+ return (0, _result.ok)(res[1]);
236
+ } catch (e) {
237
+ return (0, _result.err)(JSON.stringify(e));
238
+ }
239
+ }
240
+ async function decryptRecoveryFile(recoveryFile, passphrase) {
241
+ try {
242
+ const res = await Pubky.decryptRecoveryFile(recoveryFile, passphrase);
243
+ if (res[0] === 'error') {
244
+ return (0, _result.err)(res[1]);
245
+ }
246
+ return (0, _result.ok)(res[1]);
247
+ } catch (e) {
248
+ return (0, _result.err)(JSON.stringify(e));
249
+ }
250
+ }
182
251
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_result","LINKING_ERROR","Platform","select","ios","default","Pubky","NativeModules","Proxy","get","Error","auth","url","secretKey","res","err","ok","parseAuthUrl","parsed","JSON","parse","e","stringify","publish","recordName","recordContent","resolve","publicKey","signUp","homeserver","signIn","signOut","put","content","publishHttps","target","resolveHttps","list","generateSecretKey","getPublicKeyFromSecretKey"],"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;AAEE,eAAeU,IAAIA,CACxBC,GAAW,EACXC,SAAiB,EACU;EAC3B,MAAMC,GAAG,GAAG,MAAMR,KAAK,CAACK,IAAI,CAACC,GAAG,EAAEC,SAAS,CAAC;E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S,CAACD,CAAC,CAAC,CAAC;EAC/B;AACF","ignoreList":[]}
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,SA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CAACH,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;EAC/B,CAAC,CAAC,OAAOT,CAAC,EAAE;IACV,OAAO,IAAAC,WAAG,EAACC,IAAI,CAACC,SAAS,CAACH,CAAC,CAAC,CAAC;EAC/B;AACF;AAEO,eAAeiC,kBAAkBA,CACtCzB,SAAiB,EACjB0B,UAAkB,EACO;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":[]}
@@ -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();
@@ -162,4 +203,26 @@ export async function getPublicKeyFromSecretKey(secretKey) {
162
203
  return err(JSON.stringify(e));
163
204
  }
164
205
  }
206
+ export async function createRecoveryFile(secretKey, passphrase) {
207
+ try {
208
+ const res = await Pubky.createRecoveryFile(secretKey, passphrase);
209
+ if (res[0] === 'error') {
210
+ return err(res[1]);
211
+ }
212
+ return ok(res[1]);
213
+ } catch (e) {
214
+ return err(JSON.stringify(e));
215
+ }
216
+ }
217
+ export async function decryptRecoveryFile(recoveryFile, passphrase) {
218
+ try {
219
+ const res = await Pubky.decryptRecoveryFile(recoveryFile, passphrase);
220
+ if (res[0] === 'error') {
221
+ return err(res[1]);
222
+ }
223
+ return ok(res[1]);
224
+ } catch (e) {
225
+ return err(JSON.stringify(e));
226
+ }
227
+ }
165
228
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","ok","err","LINKING_ERROR","select","ios","default","Pubky","Proxy","get","Error","auth","url","secretKey","res","parseAuthUrl","parsed","JSON","parse","e","stringify","publish","recordName","recordContent","resolve","publicKey","signUp","homeserver","signIn","signOut","put","content","publishHttps","target","resolveHttps","list","generateSecretKey","getPublicKeyFromSecretKey"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,SAASC,EAAE,EAAEC,GAAG,QAAqB,oBAAoB;AAEzD,MAAMC,aAAa,GACjB,6EAA6E,GAC7EH,QAAQ,CAACI,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,KAAK,GAAGR,aAAa,CAACQ,KAAK,GAC7BR,aAAa,CAACQ,KAAK,GACnB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,OAAO,eAAeQ,IAAIA,CACxBC,GAAW,EACXC,SAAiB,EACU;EAC3B,MAAMC,GAAG,GAAG,MAAMP,KAAK,CAACI,IAAI,CAACC,GAAG,EAAE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,CAACY,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB;IACA,OAAOb,EAAE,CAACgB,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;EAC/B,CAAC,CAAC,OAAOK,CAAC,EAAE;IACV,OAAOjB,GAAG,CAACe,IAAI,CAACG,SAAS,CAACD,CAAC,CAAC,CAAC;EAC/B;AACF;AASA,OAAO,eAAeiB,iBAAiBA,CAAA,EAAwC;EAC7E,IAAI;IACF,MAAMtB,GAAG,GAAG,MAAMP,KAAK,CAAC6B,iBAAiB,CAAC,CAAC;IAC3C,IAAItB,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAOZ,GAAG,CAACY,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB;IACA,OAAOb,EAAE,CAACgB,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;EAC/B,CAAC,CAAC,OAAOK,CAAC,EAAE;IACV,OAAOjB,GAAG,CAACe,IAAI,CAACG,SAAS,CAACD,CAAC,CAAC,CAAC;EAC/B;AACF;AAEA,OAAO,eAAekB,yBAAyBA,CAC7CxB,SAAiB,EACgB;EACjC,IAAI;IACF,MAAMC,GAAG,GAAG,MAAMP,KAAK,CAAC8B,yBAAyB,CAACxB,SAAS,CAAC;IAC5D,IAAIC,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAOZ,GAAG,CAACY,GAAG,CAAC,CAAC,CAAC,CAAC;IACpB;IACA,OAAOb,EAAE,CAACgB,IAAI,CAACC,KAAK,CAACJ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;EAC/B,CAAC,CAAC,OAAOK,CAAC,EAAE;IACV,OAAOjB,GAAG,CAACe,IAAI,CAACG,SAAS,CAACD,CAAC,CAAC,CAAC;EAC/B;AACF","ignoreList":[]}
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,CAACe,IAAI,CAACC,SAAS,CAACF,CAAC,CAAC,CAAC;EAC/B;AACF;AAEA,OAAO,eAAeG,mBAAmBA,CAAA,EAA0B;EACjE,IAAI;IACF;IACAR,YAAY,CAACS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AMzB,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;
@@ -61,5 +69,7 @@ interface IGenerateSecretKey extends IPublicKeyInfo {
61
69
  }
62
70
  export declare function generateSecretKey(): Promise<Result<IGenerateSecretKey>>;
63
71
  export declare function getPublicKeyFromSecretKey(secretKey: string): Promise<Result<IPublicKeyInfo>>;
72
+ export declare function createRecoveryFile(secretKey: string, passphrase: string): Promise<Result<string>>;
73
+ export declare function decryptRecoveryFile(recoveryFile: string, passphrase: string): Promise<Result<string>>;
64
74
  export {};
65
75
  //# sourceMappingURL=index.d.ts.map