@algocare/react-native-code-push 12.6.4 → 13.0.0-rc.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 (296) hide show
  1. package/CodePush.podspec +6 -8
  2. package/README.md +343 -586
  3. package/android/app/build.gradle +2 -1
  4. package/android/app/proguard-rules.pro +14 -0
  5. package/android/app/src/debug/AndroidManifest.xml +9 -0
  6. package/android/app/src/main/AndroidManifest.xml +1 -2
  7. package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +14 -139
  8. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +0 -3
  9. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +108 -63
  10. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +2 -33
  11. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +13 -109
  12. package/android/build.gradle +3 -0
  13. package/app.plugin.js +1 -0
  14. package/bin/code-push.js +6 -0
  15. package/cli/commands/bundleCommand/bundleCodePush.ts +118 -0
  16. package/cli/commands/bundleCommand/index.ts +34 -0
  17. package/cli/commands/createHistoryCommand/createReleaseHistory.ts +37 -0
  18. package/cli/commands/createHistoryCommand/createReleaseHistoryList.ts +40 -0
  19. package/cli/commands/createHistoryCommand/index.ts +44 -0
  20. package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.ts +33 -0
  21. package/cli/commands/createPullRequestHistoryCommand/index.ts +31 -0
  22. package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.ts +71 -0
  23. package/cli/commands/createPullRequestReleaseCommand/createPullRequestRelease.ts +75 -0
  24. package/cli/commands/createPullRequestReleaseCommand/index.ts +74 -0
  25. package/cli/commands/getPackageHashCommand/index.ts +45 -0
  26. package/cli/commands/initCommand/index.ts +14 -0
  27. package/cli/commands/initCommand/initAndroid.ts +91 -0
  28. package/cli/commands/initCommand/initIos.ts +123 -0
  29. package/cli/commands/initCommand/test/initAndroid.test.ts +128 -0
  30. package/cli/commands/initCommand/test/initIos.test.ts +99 -0
  31. package/cli/commands/releaseCommand/addToReleaseHistory.ts +57 -0
  32. package/cli/commands/releaseCommand/index.ts +90 -0
  33. package/cli/commands/releaseCommand/release.ts +105 -0
  34. package/cli/commands/removePullRequestHistoryCommand/index.ts +37 -0
  35. package/cli/commands/removePullRequestHistoryCommand/removePullRequestHistory.ts +28 -0
  36. package/cli/commands/showHistoryCommand/index.ts +31 -0
  37. package/cli/commands/updateHistoryCommand/index.ts +55 -0
  38. package/cli/commands/updateHistoryCommand/updateReleaseHistory.ts +42 -0
  39. package/cli/constant.ts +4 -0
  40. package/cli/dist/commands/bundleCommand/bundleCodePush.js +65 -0
  41. package/cli/dist/commands/bundleCommand/index.js +15 -0
  42. package/cli/dist/commands/createHistoryCommand/createReleaseHistory.js +25 -0
  43. package/cli/dist/commands/createHistoryCommand/createReleaseHistoryList.js +27 -0
  44. package/cli/dist/commands/createHistoryCommand/index.js +20 -0
  45. package/cli/dist/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +23 -0
  46. package/cli/dist/commands/createPullRequestHistoryCommand/index.js +15 -0
  47. package/cli/dist/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +51 -0
  48. package/cli/dist/commands/createPullRequestReleaseCommand/createPullRequestRelease.js +39 -0
  49. package/cli/dist/commands/createPullRequestReleaseCommand/index.js +35 -0
  50. package/cli/dist/commands/getPackageHashCommand/index.js +26 -0
  51. package/cli/dist/commands/initCommand/index.js +12 -0
  52. package/cli/dist/commands/initCommand/initAndroid.js +73 -0
  53. package/cli/dist/commands/initCommand/initIos.js +108 -0
  54. package/cli/dist/commands/initCommand/test/initAndroid.test.js +113 -0
  55. package/cli/dist/commands/initCommand/test/initIos.test.js +95 -0
  56. package/cli/dist/commands/releaseCommand/addToReleaseHistory.js +35 -0
  57. package/cli/dist/commands/releaseCommand/index.js +45 -0
  58. package/cli/dist/commands/releaseCommand/release.js +62 -0
  59. package/cli/dist/commands/removePullRequestHistoryCommand/index.js +19 -0
  60. package/cli/dist/commands/removePullRequestHistoryCommand/removePullRequestHistory.js +18 -0
  61. package/cli/dist/commands/showHistoryCommand/index.js +15 -0
  62. package/cli/dist/commands/updateHistoryCommand/index.js +31 -0
  63. package/cli/dist/commands/updateHistoryCommand/updateReleaseHistory.js +28 -0
  64. package/cli/dist/constant.js +4 -0
  65. package/cli/dist/functions/getReactTempDir.js +10 -0
  66. package/cli/{functions → dist/functions}/makeCodePushBundle.js +5 -11
  67. package/cli/{functions → dist/functions}/prepareToBundleJS.js +2 -5
  68. package/cli/dist/functions/runExpoBundleCommand.js +35 -0
  69. package/cli/{functions → dist/functions}/runHermesEmitBinaryCommand.js +36 -71
  70. package/cli/{functions → dist/functions}/runReactNativeBundleCommand.js +19 -24
  71. package/cli/dist/index.js +54 -0
  72. package/cli/dist/utils/datetime.js +17 -0
  73. package/cli/dist/utils/file-utils.js +19 -0
  74. package/cli/dist/utils/fsUtils.js +44 -0
  75. package/cli/{utils → dist/utils}/hash-utils.js +19 -130
  76. package/cli/{utils → dist/utils}/promisfied-fs.js +5 -16
  77. package/cli/dist/utils/showLogo.js +21 -0
  78. package/cli/dist/utils/unzip.js +41 -0
  79. package/cli/{utils → dist/utils}/zip.js +15 -51
  80. package/cli/functions/{getReactTempDir.js → getReactTempDir.ts} +2 -6
  81. package/cli/functions/makeCodePushBundle.ts +26 -0
  82. package/cli/functions/prepareToBundleJS.ts +10 -0
  83. package/cli/functions/runExpoBundleCommand.ts +45 -0
  84. package/cli/functions/runHermesEmitBinaryCommand.ts +203 -0
  85. package/cli/functions/runReactNativeBundleCommand.ts +67 -0
  86. package/cli/index.ts +68 -0
  87. package/cli/package.json +35 -0
  88. package/cli/utils/datetime.ts +19 -0
  89. package/cli/utils/{file-utils.js → file-utils.ts} +4 -21
  90. package/cli/utils/fsUtils.ts +50 -0
  91. package/cli/utils/hash-utils.ts +143 -0
  92. package/cli/utils/promisfied-fs.ts +19 -0
  93. package/cli/utils/{showLogo.js → showLogo.ts} +4 -6
  94. package/cli/utils/unzip.ts +46 -0
  95. package/cli/utils/zip.ts +65 -0
  96. package/expo/plugin/withCodePush.js +14 -0
  97. package/expo/plugin/withCodePushAndroid.js +92 -0
  98. package/expo/plugin/withCodePushIos.js +143 -0
  99. package/ios/CodePush/CodePush.h +0 -16
  100. package/ios/CodePush/CodePush.m +30 -20
  101. package/ios/CodePush/CodePushConfig.m +1 -11
  102. package/ios/CodePush/CodePushPackage.m +12 -69
  103. package/ios/CodePush/CodePushUpdateUtils.m +1 -91
  104. package/ios/CodePush/SSZipArchive/Info.plist +26 -0
  105. package/ios/CodePush/SSZipArchive/README.md +1 -1
  106. package/ios/CodePush/SSZipArchive/SSZipArchive.h +129 -27
  107. package/ios/CodePush/SSZipArchive/SSZipArchive.m +1119 -314
  108. package/ios/CodePush/SSZipArchive/SSZipCommon.h +71 -0
  109. package/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +23 -0
  110. package/ios/CodePush/SSZipArchive/include/ZipArchive.h +25 -0
  111. package/ios/CodePush/SSZipArchive/minizip/LICENSE +17 -0
  112. package/ios/CodePush/SSZipArchive/minizip/mz.h +273 -0
  113. package/ios/CodePush/SSZipArchive/minizip/mz_compat.c +1306 -0
  114. package/ios/CodePush/SSZipArchive/minizip/mz_compat.h +346 -0
  115. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +187 -0
  116. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +65 -0
  117. package/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +526 -0
  118. package/ios/CodePush/SSZipArchive/minizip/mz_os.c +348 -0
  119. package/ios/CodePush/SSZipArchive/minizip/mz_os.h +176 -0
  120. package/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +350 -0
  121. package/ios/CodePush/SSZipArchive/minizip/mz_strm.c +556 -0
  122. package/ios/CodePush/SSZipArchive/minizip/mz_strm.h +132 -0
  123. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +383 -0
  124. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +42 -0
  125. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +269 -0
  126. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +48 -0
  127. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +40 -0
  128. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +203 -0
  129. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +334 -0
  130. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +46 -0
  131. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +429 -0
  132. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +43 -0
  133. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +360 -0
  134. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +46 -0
  135. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +389 -0
  136. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +43 -0
  137. package/ios/CodePush/SSZipArchive/minizip/mz_zip.c +2782 -0
  138. package/ios/CodePush/SSZipArchive/minizip/mz_zip.h +262 -0
  139. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +1942 -0
  140. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +285 -0
  141. package/ios/CodePush.xcodeproj/project.pbxproj +244 -453
  142. package/ios/PrivacyInfo.xcprivacy +31 -0
  143. package/package.json +68 -42
  144. package/react-native.config.js +1 -1
  145. package/{AlertAdapter.js → src/AlertAdapter.js} +5 -5
  146. package/src/CodePush.js +947 -0
  147. package/{package-mixins.js → src/package-mixins.js} +1 -1
  148. package/{versioning → src/versioning}/BaseVersioning.js +12 -1
  149. package/{versioning → src/versioning}/SemverVersioning.test.js +78 -0
  150. package/typings/react-native-code-push.d.ts +559 -495
  151. package/.claude/commands/release.md +0 -78
  152. package/.claude/skills/npm-release/SKILL.md +0 -89
  153. package/CLAUDE.md +0 -83
  154. package/CONTRIBUTING.md +0 -134
  155. package/CodePush.js +0 -972
  156. package/SECURITY.md +0 -41
  157. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +0 -37
  158. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +0 -12
  159. package/android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +0 -17
  160. package/android/codepush.gradle +0 -162
  161. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  162. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  163. package/android/gradlew +0 -164
  164. package/android/gradlew.bat +0 -90
  165. package/babel.config.js +0 -3
  166. package/cli/commands/bundleCommand/bundleCodePush.js +0 -57
  167. package/cli/commands/bundleCommand/index.js +0 -55
  168. package/cli/commands/common.js +0 -245
  169. package/cli/commands/createHistoryCommand/createReleaseHistory.js +0 -42
  170. package/cli/commands/createHistoryCommand/createReleaseHistoryList.js +0 -52
  171. package/cli/commands/createHistoryCommand/index.js +0 -95
  172. package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +0 -34
  173. package/cli/commands/createPullRequestHistoryCommand/index.js +0 -29
  174. package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +0 -74
  175. package/cli/commands/createPullRequestReleaseCommand/createPullRequestRelease.js +0 -91
  176. package/cli/commands/createPullRequestReleaseCommand/index.js +0 -68
  177. package/cli/commands/getPackageHashCommand/index.js +0 -42
  178. package/cli/commands/releaseCommand/addToReleaseHistory.js +0 -85
  179. package/cli/commands/releaseCommand/index.js +0 -151
  180. package/cli/commands/releaseCommand/release.js +0 -121
  181. package/cli/commands/removePullRequestHistoryCommand/index.js +0 -28
  182. package/cli/commands/removePullRequestHistoryCommand/removePullRequestHistory.js +0 -23
  183. package/cli/commands/showHistoryCommand/index.js +0 -88
  184. package/cli/commands/updateHistoryCommand/index.js +0 -123
  185. package/cli/commands/updateHistoryCommand/updateReleaseHistory.js +0 -69
  186. package/cli/constant.js +0 -8
  187. package/cli/index.js +0 -63
  188. package/cli/utils/datetime.js +0 -22
  189. package/cli/utils/fsUtils.js +0 -64
  190. package/cli/utils/version.js +0 -26
  191. package/code-push.config.example.supabase.ts +0 -114
  192. package/code-push.config.js +0 -229
  193. package/code-push.config.ts +0 -175
  194. package/docs/api-android.md +0 -83
  195. package/docs/api-ios.md +0 -31
  196. package/docs/api-js.md +0 -592
  197. package/docs/multi-deployment-testing-android.md +0 -148
  198. package/docs/multi-deployment-testing-ios.md +0 -59
  199. package/docs/setup-android.md +0 -482
  200. package/docs/setup-ios.md +0 -280
  201. package/eslint.config.mjs +0 -32
  202. package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +0 -34
  203. package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +0 -252
  204. package/ios/CodePush/Base64/README.md +0 -47
  205. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +0 -69
  206. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +0 -16
  207. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +0 -51
  208. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +0 -15
  209. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +0 -55
  210. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +0 -24
  211. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +0 -41
  212. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +0 -28
  213. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +0 -205
  214. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +0 -103
  215. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +0 -322
  216. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +0 -37
  217. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +0 -145
  218. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +0 -35
  219. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +0 -551
  220. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +0 -23
  221. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +0 -43
  222. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +0 -230
  223. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +0 -31
  224. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +0 -113
  225. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +0 -38
  226. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +0 -500
  227. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +0 -18
  228. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +0 -214
  229. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +0 -23
  230. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +0 -29
  231. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +0 -19
  232. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +0 -68
  233. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +0 -18
  234. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +0 -72
  235. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +0 -67
  236. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +0 -111
  237. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +0 -119
  238. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +0 -307
  239. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +0 -94
  240. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +0 -619
  241. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +0 -164
  242. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +0 -514
  243. package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +0 -24
  244. package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +0 -11
  245. package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +0 -52
  246. package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +0 -5
  247. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +0 -28
  248. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +0 -70
  249. package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +0 -22
  250. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +0 -34
  251. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +0 -73
  252. package/ios/CodePush/JWT/LICENSE +0 -19
  253. package/ios/CodePush/JWT/README.md +0 -489
  254. package/ios/CodePush/SSZipArchive/Common.h +0 -81
  255. package/ios/CodePush/SSZipArchive/aes/aes.h +0 -198
  256. package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +0 -541
  257. package/ios/CodePush/SSZipArchive/aes/aescrypt.c +0 -294
  258. package/ios/CodePush/SSZipArchive/aes/aeskey.c +0 -548
  259. package/ios/CodePush/SSZipArchive/aes/aesopt.h +0 -739
  260. package/ios/CodePush/SSZipArchive/aes/aestab.c +0 -391
  261. package/ios/CodePush/SSZipArchive/aes/aestab.h +0 -173
  262. package/ios/CodePush/SSZipArchive/aes/brg_endian.h +0 -126
  263. package/ios/CodePush/SSZipArchive/aes/brg_types.h +0 -219
  264. package/ios/CodePush/SSZipArchive/aes/entropy.c +0 -54
  265. package/ios/CodePush/SSZipArchive/aes/entropy.h +0 -16
  266. package/ios/CodePush/SSZipArchive/aes/fileenc.c +0 -144
  267. package/ios/CodePush/SSZipArchive/aes/fileenc.h +0 -121
  268. package/ios/CodePush/SSZipArchive/aes/hmac.c +0 -145
  269. package/ios/CodePush/SSZipArchive/aes/hmac.h +0 -103
  270. package/ios/CodePush/SSZipArchive/aes/prng.c +0 -155
  271. package/ios/CodePush/SSZipArchive/aes/prng.h +0 -82
  272. package/ios/CodePush/SSZipArchive/aes/pwd2key.c +0 -103
  273. package/ios/CodePush/SSZipArchive/aes/pwd2key.h +0 -57
  274. package/ios/CodePush/SSZipArchive/aes/sha1.c +0 -258
  275. package/ios/CodePush/SSZipArchive/aes/sha1.h +0 -73
  276. package/ios/CodePush/SSZipArchive/minizip/crypt.h +0 -130
  277. package/ios/CodePush/SSZipArchive/minizip/ioapi.c +0 -369
  278. package/ios/CodePush/SSZipArchive/minizip/ioapi.h +0 -175
  279. package/ios/CodePush/SSZipArchive/minizip/mztools.c +0 -284
  280. package/ios/CodePush/SSZipArchive/minizip/mztools.h +0 -31
  281. package/ios/CodePush/SSZipArchive/minizip/unzip.c +0 -1839
  282. package/ios/CodePush/SSZipArchive/minizip/unzip.h +0 -248
  283. package/ios/CodePush/SSZipArchive/minizip/zip.c +0 -1910
  284. package/ios/CodePush/SSZipArchive/minizip/zip.h +0 -202
  285. package/scripts/generateBundledResourcesHash.js +0 -125
  286. package/scripts/getFilesInFolder.js +0 -19
  287. package/scripts/recordFilesBeforeBundleCommand.js +0 -41
  288. package/scripts/release.sh +0 -86
  289. package/tsconfig.json +0 -20
  290. package/tslint.json +0 -32
  291. /package/{logging.js → src/logging.js} +0 -0
  292. /package/{versioning → src/versioning}/BaseVersioning.test.js +0 -0
  293. /package/{versioning → src/versioning}/IncrementalVersioning.js +0 -0
  294. /package/{versioning → src/versioning}/IncrementalVersioning.test.js +0 -0
  295. /package/{versioning → src/versioning}/SemverVersioning.js +0 -0
  296. /package/{versioning → src/versioning}/index.js +0 -0
@@ -1,551 +0,0 @@
1
- //
2
- // JWTAlgorithmRSBase.m
3
- // JWT
4
- //
5
- // Created by Lobanov Dmitry on 13.03.16.
6
- // Copyright © 2016 Karma. All rights reserved.
7
- //
8
-
9
- #import "JWTAlgorithmRSBase.h"
10
- #import "JWTBase64Coder.h"
11
- #import "JWTCryptoSecurity.h"
12
- #import "JWTCryptoKeyExtractor.h"
13
- #import "JWTCryptoKey.h"
14
- #import "JWTAlgorithmFactory.h"
15
- #import <CommonCrypto/CommonCrypto.h>
16
- /*
17
- * * Possible inheritence *
18
- *
19
- *
20
- * RSBase (Public + Create-category)
21
- * / \
22
- * / \
23
- * RSBaseMac RSBaseIOS
24
- * \ ifdef /
25
- * \ /
26
- * RSFamilyMember
27
- * |
28
- * RSFamilyMemberMutable
29
- *
30
- */
31
-
32
- NSString *const JWTAlgorithmNameRS256 = @"RS256";
33
- NSString *const JWTAlgorithmNameRS384 = @"RS384";
34
- NSString *const JWTAlgorithmNameRS512 = @"RS512";
35
-
36
- @interface JWTAlgorithmRSBase()
37
- @property (nonatomic, readonly) id <JWTCryptoKeyExtractorProtocol> keyExtractor;
38
- @end
39
-
40
- @implementation JWTAlgorithmRSBase
41
-
42
- #pragma mark - NSCopying
43
- - (id)copyWithZone:(NSZone *)zone {
44
- // create new.
45
- id <JWTRSAlgorithm> algorithm = (id<JWTRSAlgorithm>)[JWTAlgorithmFactory algorithmByName:[self name]];
46
- algorithm.privateKeyCertificatePassphrase = self.privateKeyCertificatePassphrase;
47
- algorithm.keyExtractorType = self.keyExtractorType;
48
- algorithm.signKey = self.signKey;
49
- algorithm.verifyKey = self.verifyKey;
50
- return algorithm;
51
- }
52
-
53
- @synthesize privateKeyCertificatePassphrase;
54
- @synthesize keyExtractorType;
55
- @synthesize signKey;
56
- @synthesize verifyKey;
57
- - (id<JWTCryptoKeyExtractorProtocol>) keyExtractor {
58
- return [JWTCryptoKeyExtractor createWithType:self.keyExtractorType];
59
- }
60
- #pragma mark - Override
61
- - (size_t)ccSHANumberDigestLength {
62
- @throw [[NSException alloc] initWithName:NSInternalInconsistencyException reason:@"ccSHANumberDigestLength property should be overriden" userInfo:nil];
63
- }
64
-
65
- - (uint32_t)secPaddingPKCS1SHANumber {
66
- @throw [[NSException alloc] initWithName:NSInternalInconsistencyException reason:@"secPaddingPKCS1SHANumber property should be overriden" userInfo:nil];
67
- }
68
-
69
- - (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(CC_LONG)len withHashBytes:(unsigned char *)hashBytes {
70
- return nil;
71
- }
72
-
73
- - (NSString *)name {
74
- return @"RSBase";
75
- }
76
-
77
- #pragma mark - JWTAlgorithm
78
- - (NSData *)signHash:(NSData *)hash key:(NSData *)key error:(NSError *__autoreleasing *)error {
79
- NSData *result = nil;
80
- if (self.signKey || self.keyExtractor) {
81
- NSError *extractKeyError = nil;
82
- id <JWTCryptoKeyProtocol> keyItem = self.signKey ?: [self.keyExtractor keyFromData:key parameters:@{ [JWTCryptoKeyExtractor parametersKeyCertificatePassphrase] : self.privateKeyCertificatePassphrase ?: [NSNull null] } error:&extractKeyError];
83
-
84
- if (extractKeyError || keyItem == nil) {
85
- // tell about error
86
- if (extractKeyError && error) {
87
- *error = extractKeyError;
88
- }
89
- NSError *removeError = nil;
90
- [JWTCryptoSecurity removeKeyByTag:keyItem.tag error:&removeError];
91
- if (removeError && error) {
92
- *error = removeError;
93
- }
94
- }
95
- else {
96
- result = [self signData:hash withKey:keyItem.key];
97
- }
98
- }
99
- else {
100
- SecIdentityRef identity = nil;
101
- SecTrustRef trust = nil;
102
-
103
- // [JWTCryptoSecurity extractIdentityAndTrustFromPKCS12:inPKCS12Data password:keyPassword identity:outIdentity trust:outTrust];
104
- [JWTCryptoSecurity extractIdentityAndTrustFromPKCS12:(__bridge CFDataRef)(key) password: (__bridge CFStringRef)(self.privateKeyCertificatePassphrase) identity:&identity trust:&trust];
105
-
106
- if (identity && trust) {
107
- SecKeyRef privateKey;
108
- SecIdentityCopyPrivateKey(identity, &privateKey);
109
- result = [self signData:hash withKey:privateKey];
110
-
111
- if (privateKey) {
112
- CFRelease(privateKey);
113
- }
114
- }
115
-
116
- if (identity) {
117
- CFRelease(identity);
118
- }
119
-
120
- if (trust) {
121
- CFRelease(trust);
122
- }
123
- }
124
- return result;
125
- }
126
- - (BOOL)verifyHash:(NSData *)hash signature:(NSData *)signature key:(NSData *)key error:(NSError *__autoreleasing *)error {
127
- if (self.verifyKey || self.keyExtractor) {
128
- NSError *extractKeyError = nil;
129
- id<JWTCryptoKeyProtocol> keyItem = self.verifyKey?: [self.keyExtractor keyFromData:key parameters:nil error:&extractKeyError];
130
- BOOL verified = NO;
131
-
132
- if (extractKeyError || keyItem == nil) {
133
- // error while getting key.
134
- // cleanup.
135
- // tell about error
136
- if (extractKeyError && error) {
137
- *error = extractKeyError;
138
- }
139
- NSError *removeError = nil;
140
- [JWTCryptoSecurity removeKeyByTag:keyItem.tag error:&removeError];
141
- if (removeError && error) {
142
- //???
143
- *error = removeError;
144
- }
145
- return verified;
146
- }
147
- else {
148
- verified = [self verifyData:hash witSignature:signature withKey:keyItem.key];
149
- }
150
-
151
- NSError *removeError = nil;
152
- [JWTCryptoSecurity removeKeyByTag:keyItem.tag error:&removeError];
153
-
154
- if (error && removeError) {
155
- *error = removeError;
156
- }
157
-
158
- return verified;
159
- }
160
- else {
161
- SecKeyRef publicKey = [JWTCryptoSecurity publicKeyFromCertificate:key];
162
- // TODO: special error handling here.
163
- // add error handling later?
164
- if (publicKey != NULL) {
165
- BOOL verified = [self verifyData:hash witSignature:signature withKey:publicKey];
166
- CFRelease(publicKey);
167
- return verified;
168
- }
169
- }
170
- return NO;
171
- }
172
-
173
- - (NSData *)encodePayload:(NSString *)theString withSecret:(NSString *)theSecret {
174
- return [self encodePayloadData:[theString dataUsingEncoding:NSUTF8StringEncoding] withSecret:[JWTBase64Coder dataWithBase64UrlEncodedString:theSecret]];
175
- }
176
- - (NSData *)encodePayloadData:(NSData *)theStringData withSecret:(NSData *)theSecretData {
177
- return [self signHash:theStringData key:theSecretData error:nil];
178
- }
179
- - (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature verificationKey:(NSString *)verificationKey {
180
- NSData *certificateData = [JWTBase64Coder dataWithBase64UrlEncodedString:verificationKey];
181
- return [self verifySignedInput:input withSignature:signature verificationKeyData:certificateData];
182
- }
183
- - (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature verificationKeyData:(NSData *)verificationKeyData {
184
- return [self verifyHash:[input dataUsingEncoding:NSUTF8StringEncoding] signature:[JWTBase64Coder dataWithBase64UrlEncodedString:signature] key:verificationKeyData error:nil];
185
- }
186
-
187
- #pragma mark - Private ( Override-part depends on platform )
188
- - (BOOL)verifyData:(NSData *)plainData witSignature:(NSData *)signature withKey:(SecKeyRef) publicKey {
189
- return NO;
190
- }
191
-
192
- - (NSData *)signData:(NSData *)plainData withKey:(SecKeyRef)privateKey {
193
- return nil;
194
- }
195
- @end
196
-
197
- #if TARGET_OS_MAC && TARGET_OS_IPHONE
198
- @interface JWTAlgorithmRSBaseIOS : JWTAlgorithmRSBase @end
199
- @implementation JWTAlgorithmRSBaseIOS
200
- - (BOOL)verifyData:(NSData *)plainData witSignature:(NSData *)signature withKey:(SecKeyRef) publicKey {
201
- size_t signedHashBytesSize = SecKeyGetBlockSize(publicKey);
202
- const void* signedHashBytes = [signature bytes];
203
-
204
- size_t hashBytesSize = self.ccSHANumberDigestLength;
205
- uint8_t* hashBytes = malloc(hashBytesSize);
206
- if (![self CC_SHANumberWithData:[plainData bytes] withLength:(CC_LONG)[plainData length] withHashBytes:hashBytes]) {
207
- return false;
208
- }
209
-
210
- OSStatus status = SecKeyRawVerify(publicKey,
211
- self.secPaddingPKCS1SHANumber,
212
- hashBytes,
213
- hashBytesSize,
214
- signedHashBytes,
215
- signedHashBytesSize);
216
-
217
- return status == errSecSuccess;
218
- }
219
-
220
- - (NSData *)signData:(NSData *)plainData withKey:(SecKeyRef)privateKey {
221
- size_t signedHashBytesSize = SecKeyGetBlockSize(privateKey);
222
- uint8_t* signedHashBytes = malloc(signedHashBytesSize);
223
- memset(signedHashBytes, 0x0, signedHashBytesSize);
224
-
225
- size_t hashBytesSize = self.ccSHANumberDigestLength;
226
- uint8_t* hashBytes = malloc(hashBytesSize);
227
-
228
- // ([plainData bytes], (CC_LONG)[plainData length], hashBytes)
229
- unsigned char *str = [self CC_SHANumberWithData:[plainData bytes] withLength:(CC_LONG)[plainData length] withHashBytes:hashBytes];
230
-
231
- if (!str) {
232
- return nil;
233
- }
234
-
235
- SecKeyRawSign(privateKey,
236
- self.secPaddingPKCS1SHANumber,
237
- hashBytes,
238
- hashBytesSize,
239
- signedHashBytes,
240
- &signedHashBytesSize);
241
-
242
- NSData* signedHash = [NSData dataWithBytes:signedHashBytes
243
- length:(NSUInteger)signedHashBytesSize];
244
-
245
- if (hashBytes) {
246
- free(hashBytes);
247
- }
248
-
249
- if (signedHashBytes) {
250
- free(signedHashBytes);
251
- }
252
-
253
- return signedHash;
254
- }
255
- @end
256
- #endif
257
-
258
- #if TARGET_OS_MAC && !TARGET_OS_IPHONE
259
- @interface JWTAlgorithmRSBaseMac : JWTAlgorithmRSBase
260
- @end
261
-
262
- @implementation JWTAlgorithmRSBaseMac
263
- - (NSData *)executeTransform:(SecTransformRef)transform withInput:(NSData *)input withDigestType:(CFStringRef)type withDigestLength:(NSNumber *)length withFalseResult:(CFTypeRef)falseResultRef {
264
- CFErrorRef errorRef = NULL;
265
-
266
- CFTypeRef resultRef = NULL;
267
- NSData *resultData = nil;
268
-
269
-
270
- BOOL success = transform != NULL;
271
- //TODO: after import algorithm by pem, this code seems not working well.
272
- //error: Error Domain=com.apple.security.transforms.error Code=6 "Invalid digest algorithm for RSA signature, choose one of: SHA1, SHA2 (512bits, 348bits, 256bits, or 224 bits), MD2, or MD5"
273
- //TODO: add error inout parameter to this method.
274
- if (success) {
275
- // setup digest type
276
- success = SecTransformSetAttribute(transform, kSecDigestTypeAttribute, type, &errorRef);
277
- }
278
-
279
- if (success) {
280
- // digest length
281
- success = SecTransformSetAttribute(transform, kSecDigestLengthAttribute, (__bridge CFNumberRef)length, &errorRef);
282
- }
283
-
284
- if (success) {
285
- // set input
286
- success = SecTransformSetAttribute(transform, kSecTransformInputAttributeName, (__bridge CFDataRef)input, &errorRef);
287
- }
288
-
289
- if (success) {
290
- // execute
291
- resultRef = SecTransformExecute(transform, &errorRef);
292
- success = (resultRef != falseResultRef);
293
- }
294
-
295
- BOOL positiveResult = success; // resultRef != falseResultRef
296
-
297
- // error
298
- if (errorRef != NULL) {
299
- NSLog(@"%@ error: %@", self.debugDescription, (__bridge NSError *)errorRef);
300
- }
301
- else {
302
- if (positiveResult) {
303
- resultData = (__bridge NSData *)resultRef;
304
- }
305
- }
306
-
307
- // release
308
- if (transform != NULL) {
309
- CFRelease(transform);
310
- }
311
-
312
- if (errorRef != NULL) {
313
- CFRelease(errorRef);
314
- }
315
-
316
- if (resultRef != NULL) {
317
- CFRelease(resultRef);
318
- }
319
-
320
- return resultData;
321
- }
322
- - (BOOL)verifyData:(NSData *)plainData witSignature:(NSData *)signature withKey:(SecKeyRef) publicKey {
323
-
324
- size_t signedHashBytesSize = SecKeyGetBlockSize(publicKey);
325
- //const void* signedHashBytes = [signature bytes];
326
-
327
- size_t hashBytesSize = self.ccSHANumberDigestLength;
328
- uint8_t* hashBytes = malloc(hashBytesSize);
329
- if (![self CC_SHANumberWithData:[plainData bytes] withLength:(CC_LONG)[plainData length] withHashBytes:hashBytes]) {
330
- return false;
331
- }
332
-
333
- // verify for iOS
334
- // OSStatus status = SecKeyRawVerify(publicKey,
335
- // self.secPaddingPKCS1SHANumber,
336
- // hashBytes,
337
- // hashBytesSize,
338
- // signedHashBytes,
339
- // signedHashBytesSize);
340
- // return status == errSecSuccess;
341
-
342
- CFErrorRef errorRef = NULL;
343
- SecTransformRef transform = SecVerifyTransformCreate(publicKey, (__bridge CFDataRef)signature, &errorRef);
344
-
345
- // verification. false result is kCFBooleanFalse
346
- BOOL result = [self executeTransform:transform withInput:plainData withDigestType:kSecDigestSHA2 withDigestLength:@(signedHashBytesSize) withFalseResult:kCFBooleanFalse] != nil;
347
-
348
- if (errorRef != NULL) {
349
- CFRelease(errorRef);
350
- }
351
-
352
- return result;
353
- }
354
-
355
- - (NSData *)signData:(NSData *)plainData withKey:(SecKeyRef)privateKey {
356
- size_t signedHashBytesSize = SecKeyGetBlockSize(privateKey);
357
- //uint8_t* signedHashBytes = malloc(signedHashBytesSize);
358
- //memset(signedHashBytes, 0x0, signedHashBytesSize);
359
-
360
- size_t hashBytesSize = self.ccSHANumberDigestLength;
361
- uint8_t* hashBytes = malloc(hashBytesSize);
362
-
363
- /**
364
- for sha256
365
- CC_SHANumberWithData() is CC_SHA256()
366
- self.secPaddingPKCS1SHANumber = kSecPaddingPKCS1SHA256
367
- self.ccSHANumberDigestLength = CC_SHA256_DIGEST_LENGTH
368
- */
369
- unsigned char *str = [self CC_SHANumberWithData:[plainData bytes] withLength:(CC_LONG)[plainData length] withHashBytes:hashBytes];
370
-
371
- if (!str) {
372
- return nil;
373
- }
374
-
375
- CFErrorRef errorRef = NULL;
376
-
377
- SecTransformRef transform = SecSignTransformCreate(privateKey, &errorRef);
378
-
379
- /** iOS
380
- SecKeyRawSign(privateKey,
381
- self.secPaddingPKCS1SHANumber,
382
- hashBytes,
383
- hashBytesSize,
384
- signedHashBytes,
385
- &signedHashBytesSize);
386
-
387
- NSData* signedHash = [NSData dataWithBytes:signedHashBytes
388
- length:(NSUInteger)signedHashBytesSize];
389
-
390
- */
391
-
392
- NSData *resultData = nil;
393
- // signing: false result is NULL.
394
- // it will release error.
395
- resultData = [self executeTransform:transform withInput:plainData withDigestType:kSecDigestSHA2 withDigestLength:@(signedHashBytesSize) withFalseResult:NULL];
396
-
397
- if (errorRef != NULL) {
398
- CFRelease(errorRef);
399
- }
400
-
401
- return resultData;
402
- }
403
- @end
404
- #endif
405
-
406
-
407
- // MacOS OR iOS is Base
408
- #if TARGET_OS_MAC && !TARGET_OS_IPHONE
409
- @interface JWTAlgorithmRSFamilyMember : JWTAlgorithmRSBaseMac @end
410
- #else
411
- @interface JWTAlgorithmRSFamilyMember : JWTAlgorithmRSBaseIOS @end
412
- #endif
413
-
414
- @interface JWTAlgorithmRS256 : JWTAlgorithmRSFamilyMember @end
415
- @interface JWTAlgorithmRS384 : JWTAlgorithmRSFamilyMember @end
416
- @interface JWTAlgorithmRS512 : JWTAlgorithmRSFamilyMember @end
417
-
418
- @implementation JWTAlgorithmRSFamilyMember
419
- - (uint32_t)secPaddingPKCS1SHANumber {
420
- return 0;
421
- }
422
- @end
423
-
424
- @implementation JWTAlgorithmRS256
425
-
426
- - (size_t)ccSHANumberDigestLength {
427
- return CC_SHA256_DIGEST_LENGTH;
428
- }
429
-
430
- #if TARGET_OS_MAC && TARGET_OS_IPHONE
431
- - (uint32_t)secPaddingPKCS1SHANumber {
432
- return kSecPaddingPKCS1SHA256;
433
- }
434
- #endif
435
-
436
- - (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(CC_LONG)len withHashBytes:(unsigned char *)hashBytes {
437
- return CC_SHA256(data, len, hashBytes);
438
- }
439
-
440
- - (NSString *)name {
441
- return JWTAlgorithmNameRS256;
442
- }
443
-
444
- @end
445
-
446
- @implementation JWTAlgorithmRS384
447
-
448
- - (size_t)ccSHANumberDigestLength {
449
- return CC_SHA384_DIGEST_LENGTH;
450
- }
451
-
452
- #if TARGET_OS_MAC && TARGET_OS_IPHONE
453
- - (uint32_t)secPaddingPKCS1SHANumber {
454
- return kSecPaddingPKCS1SHA384;
455
- }
456
- #endif
457
-
458
- - (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(CC_LONG)len withHashBytes:(unsigned char *)hashBytes {
459
- return CC_SHA384(data, len, hashBytes);
460
- }
461
-
462
- - (NSString *)name {
463
- return JWTAlgorithmNameRS384;
464
- }
465
-
466
- @end
467
-
468
- @implementation JWTAlgorithmRS512
469
-
470
- - (size_t)ccSHANumberDigestLength {
471
- return CC_SHA512_DIGEST_LENGTH;
472
- }
473
-
474
- #if TARGET_OS_MAC && TARGET_OS_IPHONE
475
- - (uint32_t)secPaddingPKCS1SHANumber {
476
- return kSecPaddingPKCS1SHA512;
477
- }
478
- #endif
479
-
480
- - (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(CC_LONG)len withHashBytes:(unsigned char *)hashBytes {
481
- return CC_SHA512(data, len, hashBytes);
482
- }
483
-
484
- - (NSString *)name {
485
- return JWTAlgorithmNameRS512;
486
- }
487
-
488
- @end
489
-
490
-
491
- @interface JWTAlgorithmRSFamilyMemberMutable : JWTAlgorithmRSFamilyMember
492
-
493
- @property (assign, nonatomic, readwrite) size_t ccSHANumberDigestLength;
494
- @property (assign, nonatomic, readwrite) uint32_t secPaddingPKCS1SHANumber;
495
- @property (copy, nonatomic, readwrite) unsigned char * (^ccShaNumberWithData)(const void *data, CC_LONG len, unsigned char *hashBytes);
496
- @property (copy, nonatomic, readwrite) NSString *name;
497
- @end
498
-
499
- @implementation JWTAlgorithmRSFamilyMemberMutable
500
-
501
- @synthesize ccSHANumberDigestLength = _ccSHANumberDigestLength;
502
- @synthesize secPaddingPKCS1SHANumber = _secPaddingPKCS1SHANumber;
503
- @synthesize name = _name;
504
-
505
- - (size_t)ccSHANumberDigestLength {
506
- return _ccSHANumberDigestLength;
507
- }
508
-
509
- - (uint32_t)secPaddingPKCS1SHANumber {
510
- return _secPaddingPKCS1SHANumber;
511
- }
512
-
513
- - (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(uint32_t)len withHashBytes:(unsigned char *)hashBytes {
514
- unsigned char *result = [super CC_SHANumberWithData:data withLength:len withHashBytes:hashBytes];
515
- if (!result && self.ccShaNumberWithData) {
516
- result = self.ccShaNumberWithData(data, len, hashBytes);
517
- }
518
- return result;
519
- }
520
-
521
- @end
522
-
523
-
524
- @implementation JWTAlgorithmRSBase (Create)
525
-
526
- + (instancetype)algorithm256 {
527
- return [JWTAlgorithmRS256 new];
528
- }
529
-
530
- + (instancetype)algorithm384 {
531
- return [JWTAlgorithmRS384 new];
532
- }
533
-
534
- + (instancetype)algorithm512 {
535
- return [JWTAlgorithmRS512 new];
536
- }
537
-
538
- + (instancetype)mutableAlgorithm {
539
- JWTAlgorithmRSFamilyMemberMutable *base = [JWTAlgorithmRSFamilyMemberMutable new];
540
- base.ccSHANumberDigestLength = CC_SHA256_DIGEST_LENGTH;
541
-
542
- //set to something ok
543
- //base.secPaddingPKCS1SHANumber = kSecPaddingPKCS1SHA256;
544
- base.ccShaNumberWithData = ^unsigned char *(const void *data, CC_LONG len, unsigned char *hashBytes){
545
- return CC_SHA256(data, len, hashBytes);
546
- };
547
- base.name = @"RS256";
548
- return base;
549
- }
550
-
551
- @end
@@ -1,23 +0,0 @@
1
- //
2
- // Created by Marcelo Schroeder on 12/03/2016.
3
- // Copyright (c) 2016 Karma. All rights reserved.
4
- //
5
-
6
- #import <Foundation/Foundation.h>
7
- #import "JWTAlgorithm.h"
8
- @protocol JWTCryptoKeyProtocol;
9
-
10
- @protocol JWTAsymmetricKeysAlgorithm <JWTAlgorithm>
11
-
12
- @optional
13
- @property(nonatomic, readwrite, copy) NSString *keyExtractorType;
14
- @property(nonatomic, readwrite, strong) id<JWTCryptoKeyProtocol> signKey;
15
- @property(nonatomic, readwrite, strong) id<JWTCryptoKeyProtocol> verifyKey;
16
-
17
- @end
18
-
19
- @protocol JWTRSAlgorithm <JWTAsymmetricKeysAlgorithm, NSCopying>
20
-
21
- @required
22
- @property(nonatomic, readwrite, copy) NSString *privateKeyCertificatePassphrase;
23
- @end
@@ -1,43 +0,0 @@
1
- //
2
- // JWTCryptoKey.h
3
- // JWT
4
- //
5
- // Created by Lobanov Dmitry on 04.02.17.
6
- // Copyright © 2017 JWTIO. All rights reserved.
7
- //
8
-
9
- #import <Foundation/Foundation.h>
10
- #import <Security/Security.h>
11
-
12
- @protocol JWTCryptoKeyProtocol <NSObject>
13
- @property (copy, nonatomic, readonly) NSString *tag;
14
- @property (assign, nonatomic, readonly) SecKeyRef key;
15
- @property (copy, nonatomic, readonly) NSData *rawKey;
16
- @end
17
-
18
- @interface JWTCryptoKeyBuilder : NSObject
19
- @property (assign, nonatomic, readonly) NSString *keyType;
20
- - (instancetype)keyTypeRSA;
21
- - (instancetype)keyTypeEC;
22
- @end
23
-
24
- @interface JWTCryptoKey : NSObject<JWTCryptoKeyProtocol>
25
- - (instancetype)initWithData:(NSData *)data parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; //NS_DESIGNATED_INITIALIZER
26
- - (instancetype)initWithBase64String:(NSString *)base64String parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error;
27
- - (instancetype)initWithPemEncoded:(NSString *)encoded parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error;
28
- - (instancetype)initWithPemAtURL:(NSURL *)url parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error;
29
- @end
30
-
31
- @interface JWTCryptoKey (Parameters)
32
- + (NSString *)parametersKeyBuilder;
33
- @end
34
-
35
- @interface JWTCryptoKeyPublic : JWTCryptoKey
36
- - (instancetype)initWithCertificateData:(NSData *)certificateData parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; //NS_DESIGNATED_INITIALIZER;
37
- - (instancetype)initWithCertificateBase64String:(NSString *)certificateString parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error;
38
- @end
39
-
40
- @interface JWTCryptoKeyPrivate : JWTCryptoKey
41
- - (instancetype)initWithP12Data:(NSData *)p12Data withPassphrase:(NSString *)passphrase parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; //NS_DESIGNATED_INITIALIZER;
42
- - (instancetype)initWithP12AtURL:(NSURL *)url withPassphrase:(NSString *)passphrase parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error;
43
- @end