2022-05-15 15:36:30 +00:00
|
|
|
#import <React/RCTEventEmitter.h>
|
2022-05-10 23:42:15 +00:00
|
|
|
#import <React/RCTBridgeModule.h>
|
|
|
|
|
2022-05-15 15:36:30 +00:00
|
|
|
@interface RCT_EXTERN_MODULE(ReactNative, RCTEventEmitter)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(supportedEvents)
|
2022-05-10 23:42:15 +00:00
|
|
|
|
2022-05-12 23:41:31 +00:00
|
|
|
RCT_EXTERN_METHOD(defaultPubsubTopic:
|
|
|
|
(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(newNode:(NSString *)config
|
2022-05-10 23:42:15 +00:00
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
2022-05-12 23:41:31 +00:00
|
|
|
RCT_EXTERN_METHOD(start:
|
|
|
|
(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
2022-05-10 23:42:15 +00:00
|
|
|
|
2022-05-12 23:41:31 +00:00
|
|
|
RCT_EXTERN_METHOD(stop:
|
|
|
|
(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(peerID:
|
|
|
|
(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(relayEnoughPeers:(NSString *)topic
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(listenAddresses:
|
2022-05-10 23:42:15 +00:00
|
|
|
(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
2022-05-12 23:41:31 +00:00
|
|
|
RCT_EXTERN_METHOD(connect:(NSString *)address
|
|
|
|
withMs:(nonnull NSNumber *)ms
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(peerCnt:
|
|
|
|
(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(peers:
|
|
|
|
(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(relaySubscribe:(NSString *)topic
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(relayUnsubscribe:(NSString *)topic
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(relayPublish:(NSString *)msg
|
|
|
|
withTopic:(NSString *)topic
|
|
|
|
withMs:(nonnull NSNumber *)ms
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(relayPublishEncodeAsymmetric:(NSString *)msg
|
|
|
|
withTopic:(NSString *)topic
|
|
|
|
withPublicKey:(NSString *)publicKey
|
|
|
|
withOptionalSigningKey:(NSString *)optionalSigningKey
|
|
|
|
withMs:(nonnull NSNumber *)ms
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(relayPublishEncodeSymmetric:(NSString *)msg
|
|
|
|
withTopic:(NSString *)topic
|
|
|
|
withSymmetricKey:(NSString *)symmetricKey
|
|
|
|
withOptionalSigningKey:(NSString *)optionalSigningKey
|
|
|
|
withMs:(nonnull NSNumber *)ms
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(addPeer:(NSString *)addr
|
|
|
|
withProtocol:(NSString *)proto
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(connectPeerID:(NSString *)peerID
|
|
|
|
withMs:(nonnull NSNumber *)ms
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(disconnect:(NSString *)peerID
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(lightpushPublish:(NSString *)msg
|
|
|
|
withTopic:(NSString *)topic
|
|
|
|
withPeerID:(NSString *)peerID
|
|
|
|
withMs:(nonnull NSNumber *)ms
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(lightpushPublishEncodeAsymmetric:(NSString *)msg
|
|
|
|
withTopic:(NSString *)topic
|
|
|
|
withPeerID:(NSString *)peerID
|
|
|
|
withPublicKey:(NSString *)publicKey
|
|
|
|
withOptionalSigningKey:(NSString *)optionalSigningKey
|
|
|
|
withMs:(nonnull NSNumber *)ms
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(lightpushPublishEncodeSymmetric:(NSString *)msg
|
|
|
|
withTopic:(NSString *)topic
|
|
|
|
withPeerID:(NSString *)peerID
|
|
|
|
withSymmetricKey:(NSString *)symmetricKey
|
|
|
|
withOptionalSigningKey:(NSString *)optionalSigningKey
|
|
|
|
withMs:(nonnull NSNumber *)ms
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(decodeSymmetric:(NSString *)msg
|
|
|
|
withSymmetricKey:(NSString *)symmetricKey
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
|
|
|
RCT_EXTERN_METHOD(decodeAsymmetric:(NSString *)msg
|
|
|
|
withPrivateKey:(NSString *)privateKey
|
|
|
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
|
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
|
|
|
2022-05-10 23:42:15 +00:00
|
|
|
@end
|