@onetokenfe/react-native-nfc-wallet-sdk 0.1.0

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.
Files changed (50) hide show
  1. package/NfcWalletSdk.podspec +22 -0
  2. package/README.md +81 -0
  3. package/android/build.gradle +59 -0
  4. package/android/src/main/AndroidManifest.xml +4 -0
  5. package/android/src/main/java/com/ziancube/reactnativenfcwalletsdk/NfcWalletEngine.kt +486 -0
  6. package/android/src/main/java/com/ziancube/reactnativenfcwalletsdk/NfcWalletSdkModule.kt +268 -0
  7. package/android/src/main/java/com/ziancube/reactnativenfcwalletsdk/NfcWalletSdkPackage.kt +14 -0
  8. package/android/src/main/java/com/ziancube/reactnativenfcwalletsdk/nfc/NfcUtils.kt +24 -0
  9. package/android/src/main/java/com/ziancube/reactnativenfcwalletsdk/utils/HexUtils.kt +24 -0
  10. package/android/src/main/java/com/ziancube/reactnativenfcwalletsdk/wallet/WalletApduClient.kt +495 -0
  11. package/android/src/main/java/com/ziancube/reactnativenfcwalletsdk/wallet/WalletConstants.kt +105 -0
  12. package/android/src/main/java/com/ziancube/reactnativenfcwalletsdk/wallet/WalletNfcController.kt +262 -0
  13. package/android/src/main/java/com/ziancube/reactnativenfcwalletsdk/wallet/WalletNfcTagHolder.kt +74 -0
  14. package/ios/Classes/NfcWalletHexUtils.h +8 -0
  15. package/ios/Classes/NfcWalletHexUtils.m +31 -0
  16. package/ios/Classes/NfcWalletNFCManager.h +58 -0
  17. package/ios/Classes/NfcWalletNFCManager.m +244 -0
  18. package/ios/Classes/NfcWalletSession.h +52 -0
  19. package/ios/Classes/NfcWalletSession.m +1109 -0
  20. package/ios/NfcWalletSdk.h +5 -0
  21. package/ios/NfcWalletSdk.mm +369 -0
  22. package/lib/module/NativeNfcWalletSdk.js +8 -0
  23. package/lib/module/NativeNfcWalletSdk.js.map +1 -0
  24. package/lib/module/constants.js +5 -0
  25. package/lib/module/constants.js.map +1 -0
  26. package/lib/module/index.js +8 -0
  27. package/lib/module/index.js.map +1 -0
  28. package/lib/module/nfc.js +81 -0
  29. package/lib/module/nfc.js.map +1 -0
  30. package/lib/module/package.json +1 -0
  31. package/lib/module/walletOperations.js +68 -0
  32. package/lib/module/walletOperations.js.map +1 -0
  33. package/lib/typescript/package.json +1 -0
  34. package/lib/typescript/src/NativeNfcWalletSdk.d.ts +166 -0
  35. package/lib/typescript/src/NativeNfcWalletSdk.d.ts.map +1 -0
  36. package/lib/typescript/src/constants.d.ts +3 -0
  37. package/lib/typescript/src/constants.d.ts.map +1 -0
  38. package/lib/typescript/src/index.d.ts +7 -0
  39. package/lib/typescript/src/index.d.ts.map +1 -0
  40. package/lib/typescript/src/nfc.d.ts +43 -0
  41. package/lib/typescript/src/nfc.d.ts.map +1 -0
  42. package/lib/typescript/src/walletOperations.d.ts +22 -0
  43. package/lib/typescript/src/walletOperations.d.ts.map +1 -0
  44. package/package.json +90 -0
  45. package/react-native.config.js +10 -0
  46. package/src/NativeNfcWalletSdk.ts +205 -0
  47. package/src/constants.ts +2 -0
  48. package/src/index.tsx +33 -0
  49. package/src/nfc.ts +80 -0
  50. package/src/walletOperations.ts +152 -0
@@ -0,0 +1,52 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import <CoreNFC/CoreNFC.h>
3
+
4
+ NS_ASSUME_NONNULL_BEGIN
5
+
6
+ typedef void (^NfcWalletApduLogBlock)(NSString *message, BOOL isSent, BOOL isSuccess);
7
+
8
+ static NSString *const NfcWalletDefaultEvmPath = @"m/44'/60'/0'/0/0";
9
+ static const uint8_t kNfcWalletP1PubkeySecp256k1 = 0x00;
10
+ static const uint8_t kNfcWalletP1PubkeyEd25519 = 0x01;
11
+
12
+ @interface NfcWalletSession : NSObject
13
+ - (instancetype)initWithTag:(id<NFCISO7816Tag>)tag apduLogBlock:(NfcWalletApduLogBlock _Nullable)apduLogBlock;
14
+ - (NSDictionary *)getWalletInfo;
15
+ - (NSDictionary *)setPin:(NSString *)pin;
16
+ - (NSDictionary *)setPin:(NSString *)pin expectedSerial:(NSString *_Nullable)expectedSerial;
17
+ - (NSDictionary *)changePin:(NSString *)oldPin
18
+ newPin:(NSString *)newPin
19
+ expectedSerial:(NSString *_Nullable)expectedSerial;
20
+ - (NSDictionary *)verifyPin:(NSString *)pin;
21
+ - (NSDictionary *)verifyPin:(NSString *)pin expectedSerial:(NSString *_Nullable)expectedSerial;
22
+ - (NSDictionary *)logout;
23
+ - (NSDictionary *)createWallet;
24
+ - (NSDictionary *)createWalletWithExpectedSerial:(NSString *_Nullable)expectedSerial;
25
+ - (NSDictionary *)createWalletWithSeedHex:(NSString *)seedHex;
26
+ - (NSDictionary *)createWalletWithSeedHex:(NSString *)seedHex
27
+ expectedSerial:(NSString *_Nullable)expectedSerial;
28
+ - (NSDictionary *)getPublicKeyWithPath:(NSString *_Nullable)path curveP1:(uint8_t)curveP1;
29
+ - (NSDictionary *)getXpubMaterialWithPath:(NSString *)path;
30
+ - (NSDictionary *)initializeWalletWithPubkeys:(NSString *)pin
31
+ pathsJson:(NSString *)pathsJson
32
+ seedHex:(NSString *_Nullable)seedHex;
33
+ - (NSDictionary *)initializeWalletWithPubkeys:(NSString *)pin
34
+ pathsJson:(NSString *)pathsJson
35
+ seedHex:(NSString *_Nullable)seedHex
36
+ expectedSerial:(NSString *_Nullable)expectedSerial;
37
+ - (NSDictionary *)signHash:(NSString *)hashHex path:(NSString *_Nullable)path;
38
+ - (NSDictionary *)wipeWallet;
39
+ - (NSDictionary *)wipeWalletWithPin:(NSString *)pin
40
+ expectedSerial:(NSString *)expectedSerial;
41
+ - (NSDictionary *)initializeWallet:(NSString *)pin;
42
+ - (NSDictionary *)initializeWallet:(NSString *)pin seedHex:(NSString *_Nullable)seedHex;
43
+ - (NSDictionary *)unlockAndSignPin:(NSString *)pin hashHex:(NSString *)hashHex path:(NSString *_Nullable)path;
44
+ - (NSDictionary *)runBackupStep:(NSString *)step
45
+ pin:(NSString *_Nullable)pin
46
+ payloadHex:(NSString *_Nullable)payloadHex
47
+ backupCount:(NSInteger)backupCount;
48
+ /** One session: GET_CERT + ATTEST_SIGN. data JSON { serialNumber, certHex, signatureHex }. */
49
+ - (NSDictionary *)attestCardWithChallengeHex:(NSString *)challengeHex;
50
+ @end
51
+
52
+ NS_ASSUME_NONNULL_END