@algocare/react-native-code-push 12.6.3 → 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 (292) 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 +67 -41
  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/CONTRIBUTING.md +0 -134
  152. package/CodePush.js +0 -972
  153. package/SECURITY.md +0 -41
  154. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +0 -37
  155. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +0 -12
  156. package/android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +0 -17
  157. package/android/codepush.gradle +0 -162
  158. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  159. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  160. package/android/gradlew +0 -164
  161. package/android/gradlew.bat +0 -90
  162. package/babel.config.js +0 -3
  163. package/cli/commands/bundleCommand/bundleCodePush.js +0 -57
  164. package/cli/commands/bundleCommand/index.js +0 -55
  165. package/cli/commands/common.js +0 -245
  166. package/cli/commands/createHistoryCommand/createReleaseHistory.js +0 -42
  167. package/cli/commands/createHistoryCommand/createReleaseHistoryList.js +0 -52
  168. package/cli/commands/createHistoryCommand/index.js +0 -95
  169. package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +0 -34
  170. package/cli/commands/createPullRequestHistoryCommand/index.js +0 -29
  171. package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +0 -74
  172. package/cli/commands/createPullRequestReleaseCommand/createPullRequestRelease.js +0 -91
  173. package/cli/commands/createPullRequestReleaseCommand/index.js +0 -68
  174. package/cli/commands/getPackageHashCommand/index.js +0 -42
  175. package/cli/commands/releaseCommand/addToReleaseHistory.js +0 -85
  176. package/cli/commands/releaseCommand/index.js +0 -151
  177. package/cli/commands/releaseCommand/release.js +0 -121
  178. package/cli/commands/removePullRequestHistoryCommand/index.js +0 -28
  179. package/cli/commands/removePullRequestHistoryCommand/removePullRequestHistory.js +0 -23
  180. package/cli/commands/showHistoryCommand/index.js +0 -88
  181. package/cli/commands/updateHistoryCommand/index.js +0 -123
  182. package/cli/commands/updateHistoryCommand/updateReleaseHistory.js +0 -69
  183. package/cli/constant.js +0 -8
  184. package/cli/index.js +0 -63
  185. package/cli/utils/datetime.js +0 -22
  186. package/cli/utils/fsUtils.js +0 -64
  187. package/cli/utils/version.js +0 -26
  188. package/code-push.config.example.supabase.ts +0 -114
  189. package/code-push.config.js +0 -229
  190. package/code-push.config.ts +0 -175
  191. package/docs/api-android.md +0 -83
  192. package/docs/api-ios.md +0 -31
  193. package/docs/api-js.md +0 -592
  194. package/docs/multi-deployment-testing-android.md +0 -148
  195. package/docs/multi-deployment-testing-ios.md +0 -59
  196. package/docs/setup-android.md +0 -482
  197. package/docs/setup-ios.md +0 -280
  198. package/eslint.config.mjs +0 -32
  199. package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +0 -34
  200. package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +0 -252
  201. package/ios/CodePush/Base64/README.md +0 -47
  202. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +0 -69
  203. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +0 -16
  204. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +0 -51
  205. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +0 -15
  206. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +0 -55
  207. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +0 -24
  208. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +0 -41
  209. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +0 -28
  210. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +0 -205
  211. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +0 -103
  212. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +0 -322
  213. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +0 -37
  214. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +0 -145
  215. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +0 -35
  216. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +0 -551
  217. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +0 -23
  218. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +0 -43
  219. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +0 -230
  220. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +0 -31
  221. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +0 -113
  222. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +0 -38
  223. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +0 -500
  224. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +0 -18
  225. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +0 -214
  226. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +0 -23
  227. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +0 -29
  228. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +0 -19
  229. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +0 -68
  230. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +0 -18
  231. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +0 -72
  232. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +0 -67
  233. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +0 -111
  234. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +0 -119
  235. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +0 -307
  236. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +0 -94
  237. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +0 -619
  238. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +0 -164
  239. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +0 -514
  240. package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +0 -24
  241. package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +0 -11
  242. package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +0 -52
  243. package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +0 -5
  244. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +0 -28
  245. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +0 -70
  246. package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +0 -22
  247. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +0 -34
  248. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +0 -73
  249. package/ios/CodePush/JWT/LICENSE +0 -19
  250. package/ios/CodePush/JWT/README.md +0 -489
  251. package/ios/CodePush/SSZipArchive/Common.h +0 -81
  252. package/ios/CodePush/SSZipArchive/aes/aes.h +0 -198
  253. package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +0 -541
  254. package/ios/CodePush/SSZipArchive/aes/aescrypt.c +0 -294
  255. package/ios/CodePush/SSZipArchive/aes/aeskey.c +0 -548
  256. package/ios/CodePush/SSZipArchive/aes/aesopt.h +0 -739
  257. package/ios/CodePush/SSZipArchive/aes/aestab.c +0 -391
  258. package/ios/CodePush/SSZipArchive/aes/aestab.h +0 -173
  259. package/ios/CodePush/SSZipArchive/aes/brg_endian.h +0 -126
  260. package/ios/CodePush/SSZipArchive/aes/brg_types.h +0 -219
  261. package/ios/CodePush/SSZipArchive/aes/entropy.c +0 -54
  262. package/ios/CodePush/SSZipArchive/aes/entropy.h +0 -16
  263. package/ios/CodePush/SSZipArchive/aes/fileenc.c +0 -144
  264. package/ios/CodePush/SSZipArchive/aes/fileenc.h +0 -121
  265. package/ios/CodePush/SSZipArchive/aes/hmac.c +0 -145
  266. package/ios/CodePush/SSZipArchive/aes/hmac.h +0 -103
  267. package/ios/CodePush/SSZipArchive/aes/prng.c +0 -155
  268. package/ios/CodePush/SSZipArchive/aes/prng.h +0 -82
  269. package/ios/CodePush/SSZipArchive/aes/pwd2key.c +0 -103
  270. package/ios/CodePush/SSZipArchive/aes/pwd2key.h +0 -57
  271. package/ios/CodePush/SSZipArchive/aes/sha1.c +0 -258
  272. package/ios/CodePush/SSZipArchive/aes/sha1.h +0 -73
  273. package/ios/CodePush/SSZipArchive/minizip/crypt.h +0 -130
  274. package/ios/CodePush/SSZipArchive/minizip/ioapi.c +0 -369
  275. package/ios/CodePush/SSZipArchive/minizip/ioapi.h +0 -175
  276. package/ios/CodePush/SSZipArchive/minizip/mztools.c +0 -284
  277. package/ios/CodePush/SSZipArchive/minizip/mztools.h +0 -31
  278. package/ios/CodePush/SSZipArchive/minizip/unzip.c +0 -1839
  279. package/ios/CodePush/SSZipArchive/minizip/unzip.h +0 -248
  280. package/ios/CodePush/SSZipArchive/minizip/zip.c +0 -1910
  281. package/ios/CodePush/SSZipArchive/minizip/zip.h +0 -202
  282. package/scripts/generateBundledResourcesHash.js +0 -125
  283. package/scripts/getFilesInFolder.js +0 -19
  284. package/scripts/recordFilesBeforeBundleCommand.js +0 -41
  285. package/tsconfig.json +0 -20
  286. package/tslint.json +0 -32
  287. /package/{logging.js → src/logging.js} +0 -0
  288. /package/{versioning → src/versioning}/BaseVersioning.test.js +0 -0
  289. /package/{versioning → src/versioning}/IncrementalVersioning.js +0 -0
  290. /package/{versioning → src/versioning}/IncrementalVersioning.test.js +0 -0
  291. /package/{versioning → src/versioning}/SemverVersioning.js +0 -0
  292. /package/{versioning → src/versioning}/index.js +0 -0
@@ -1,214 +0,0 @@
1
- //
2
- // JWTClaim.m
3
- // JWT
4
- //
5
- // Created by Lobanov Dmitry on 13.02.16.
6
- // Copyright © 2016 Karma. All rights reserved.
7
- //
8
-
9
- #import "JWTClaim.h"
10
-
11
- // TODO(3.0): Claim aud should check include in collection?
12
- // Add claims specification tests.
13
- // "iss" (Issuer) Claim
14
- // "sub" (Subject) Claim
15
- // "aud" (Audience) Claim
16
- // "exp" (Expiration Time) Claim
17
- // "nbf" (Not Before) Claim
18
- // "iat" (Issued At) Claim
19
- // "jti" (JWT ID) Claim
20
- // "typ" (Type) Claim
21
- // "scope" (Scope) Claim
22
-
23
- @interface JWTClaimIssuer : JWTClaim
24
-
25
- @end
26
-
27
- @implementation JWTClaimIssuer
28
-
29
- + (NSString *)name {
30
- return @"iss";
31
- }
32
-
33
- + (BOOL)verifyValue:(NSString *)value withTrustedValue:(NSString *)trustedValue {
34
- return [trustedValue isEqualToString:value];
35
- }
36
-
37
- @end
38
-
39
- @interface JWTClaimSubject : JWTClaim
40
-
41
- @end
42
-
43
- @implementation JWTClaimSubject
44
-
45
- + (NSString *)name {
46
- return @"sub";
47
- }
48
-
49
- + (BOOL)verifyValue:(NSString *)value withTrustedValue:(NSString *)trustedValue {
50
- return [trustedValue isEqualToString:value];
51
- }
52
-
53
- @end
54
-
55
- @interface JWTClaimAudience : JWTClaim
56
-
57
- @end
58
-
59
- // TODO: add array support later
60
- @implementation JWTClaimAudience
61
-
62
- + (NSString *)name {
63
- return @"aud";
64
- }
65
-
66
- + (BOOL)verifyValue:(NSString *)value withTrustedValue:(NSString *)trustedValue {
67
- return [trustedValue isEqualToString:value];
68
- }
69
-
70
- @end
71
-
72
- @interface JWTClaimExpirationTime : JWTClaim
73
-
74
- @end
75
-
76
- @implementation JWTClaimExpirationTime
77
-
78
- + (NSString *)name {
79
- return @"exp";
80
- }
81
-
82
- + (BOOL)verifyValue:(NSDate *)value withTrustedValue:(NSDate *)trustedValue {
83
- // trustedValue - current date
84
- // value - expiration date
85
- // trustedValue < value, so
86
- return [trustedValue compare:value] == NSOrderedAscending;
87
- }
88
-
89
- @end
90
-
91
- @interface JWTClaimNotBefore : JWTClaim
92
-
93
- @end
94
-
95
- @implementation JWTClaimNotBefore
96
-
97
- + (NSString *)name {
98
- return @"nbf";
99
- }
100
-
101
- + (BOOL)verifyValue:(NSDate *)value withTrustedValue:(NSDate *)trustedValue {
102
- // trustedValue - current date
103
- // value - start date
104
- // value <= trustedValue, so
105
- // trustedValue >= value, which means:
106
- // !(trustedValue < value) or NOT OrderedAscending
107
- return [trustedValue compare:value] != NSOrderedAscending;
108
- }
109
-
110
- @end
111
-
112
- @interface JWTClaimIssuedAt : JWTClaim
113
-
114
- @end
115
-
116
- @implementation JWTClaimIssuedAt
117
-
118
- + (NSString *)name {
119
- return @"iat";
120
- }
121
-
122
- + (BOOL)verifyValue:(NSDate *)value withTrustedValue:(NSDate *)trustedValue {
123
- // trustedValue - current date
124
- // value - issued at date
125
- // value < trustedValue, so
126
- // trustedValue > value
127
- return [trustedValue compare:value] == NSOrderedDescending;
128
- }
129
-
130
- @end
131
-
132
- @interface JWTClaimJWTID : JWTClaim
133
-
134
- @end
135
-
136
- @implementation JWTClaimJWTID
137
-
138
- + (NSString *)name {
139
- return @"jti";
140
- }
141
-
142
- + (BOOL)verifyValue:(NSString *)value withTrustedValue:(NSString *)trustedValue {
143
- return [trustedValue isEqualToString:value];
144
- }
145
-
146
- @end
147
-
148
- @interface JWTClaimType : JWTClaim
149
-
150
- @end
151
-
152
- @implementation JWTClaimType
153
-
154
- + (NSString *)name {
155
- return @"typ";
156
- }
157
-
158
- + (BOOL)verifyValue:(NSString *)value withTrustedValue:(NSString *)trustedValue {
159
- return [trustedValue isEqualToString:value];
160
- }
161
-
162
- @end
163
-
164
- @interface JWTClaimScope : JWTClaim
165
-
166
- @end
167
-
168
- @implementation JWTClaimScope
169
-
170
- + (NSString *)name {
171
- return @"scope";
172
- }
173
-
174
- + (BOOL)verifyValue:(NSString *)value withTrustedValue:(NSString *)trustedValue {
175
- return [trustedValue isEqualToString:value];
176
- }
177
-
178
- @end
179
-
180
-
181
- @implementation JWTClaim
182
- + (NSString *)name {
183
- return @"";
184
- }
185
-
186
- + (NSDictionary *)claimsAndNames {
187
- static NSDictionary *dictionary = nil;
188
- return dictionary ? dictionary : (dictionary = @{
189
- [JWTClaimIssuer name] : [JWTClaimIssuer new],
190
- [JWTClaimSubject name] : [JWTClaimSubject new],
191
- [JWTClaimAudience name] : [JWTClaimAudience new],
192
- [JWTClaimExpirationTime name] : [JWTClaimExpirationTime new],
193
- [JWTClaimNotBefore name] : [JWTClaimNotBefore new],
194
- [JWTClaimIssuedAt name] : [JWTClaimIssuedAt new],
195
- [JWTClaimJWTID name] : [JWTClaimJWTID new],
196
- [JWTClaimType name] : [JWTClaimType new],
197
- [JWTClaimScope name] : [JWTClaimScope new]
198
- }, dictionary);
199
- }
200
-
201
- + (instancetype)claimByName:(NSString *)name {
202
- return [self claimsAndNames][name];
203
- }
204
-
205
- + (BOOL)verifyValue:(NSObject *)value withTrustedValue:(NSObject *)trustedValue {
206
- return NO;
207
- }
208
-
209
- - (BOOL)verifyValue:(NSObject *)value withTrustedValue:(NSObject *)trustedValue {
210
- return [self.class verifyValue:value withTrustedValue:trustedValue];
211
- }
212
-
213
- @end
214
-
@@ -1,23 +0,0 @@
1
- //
2
- // JWTClaimsSet.h
3
- // JWT
4
- //
5
- // Created by Klaas Pieter Annema on 31-05-13.
6
- // Copyright (c) 2013 Karma. All rights reserved.
7
- //
8
-
9
- #import <Foundation/Foundation.h>
10
-
11
- @interface JWTClaimsSet : NSObject<NSCopying>
12
-
13
- @property (nonatomic, readwrite, copy) NSString *issuer;
14
- @property (nonatomic, readwrite, copy) NSString *subject;
15
- @property (nonatomic, readwrite, copy) NSString *audience;
16
- @property (nonatomic, readwrite, copy) NSDate *expirationDate;
17
- @property (nonatomic, readwrite, copy) NSDate *notBeforeDate;
18
- @property (nonatomic, readwrite, copy) NSDate *issuedAt;
19
- @property (nonatomic, readwrite, copy) NSString *identifier;
20
- @property (nonatomic, readwrite, copy) NSString *type;
21
- @property (nonatomic, readwrite, copy) NSString *scope;
22
-
23
- @end
@@ -1,29 +0,0 @@
1
- //
2
- // JWTClaimsSet.m
3
- // JWT
4
- //
5
- // Created by Klaas Pieter Annema on 31-05-13.
6
- // Copyright (c) 2013 Karma. All rights reserved.
7
- //
8
-
9
- #import "JWTClaimsSet.h"
10
-
11
- @implementation JWTClaimsSet
12
-
13
- - (id)copyWithZone:(NSZone *)zone {
14
- JWTClaimsSet *newClaimsSet = [[self.class alloc] init];
15
-
16
- newClaimsSet.issuer = self.issuer;
17
- newClaimsSet.subject = self.subject;
18
- newClaimsSet.audience = self.audience;
19
- newClaimsSet.expirationDate = self.expirationDate;
20
- newClaimsSet.notBeforeDate = self.notBeforeDate;
21
- newClaimsSet.issuedAt = self.issuedAt;
22
- newClaimsSet.identifier = self.identifier;
23
- newClaimsSet.type = self.type;
24
- newClaimsSet.scope = self.scope;
25
-
26
- return newClaimsSet;
27
- }
28
-
29
- @end
@@ -1,19 +0,0 @@
1
- //
2
- // JWTClaimsSetSerializer.h
3
- // JWT
4
- //
5
- // Created by Klaas Pieter Annema on 31-05-13.
6
- // Copyright (c) 2013 Karma. All rights reserved.
7
- //
8
-
9
- #import <Foundation/Foundation.h>
10
-
11
- #import "JWTClaimsSet.h"
12
-
13
- @interface JWTClaimsSetSerializer : NSObject
14
-
15
- + (NSArray *)claimsSetKeys;
16
- + (NSDictionary *)dictionaryWithClaimsSet:(JWTClaimsSet *)theClaimsSet;
17
- + (JWTClaimsSet *)claimsSetWithDictionary:(NSDictionary *)theDictionary;
18
-
19
- @end
@@ -1,68 +0,0 @@
1
- //
2
- // JWTClaimsSetSerializer.m
3
- // JWT
4
- //
5
- // Created by Klaas Pieter Annema on 31-05-13.
6
- // Copyright (c) 2013 Karma. All rights reserved.
7
- //
8
-
9
- #import "JWTClaimsSetSerializer.h"
10
-
11
- @implementation JWTClaimsSetSerializer
12
-
13
- + (NSArray *)claimsSetKeys
14
- {
15
- return @[@"iss", @"sub", @"aud", @"exp", @"nbf", @"iat", @"jti", @"typ", @"scope"];
16
- }
17
-
18
- + (NSDictionary *)dictionaryWithClaimsSet:(JWTClaimsSet *)theClaimsSet;
19
- {
20
- NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
21
- [self dictionary:dictionary setObjectIfNotNil:theClaimsSet.issuer forKey:@"iss"];
22
- [self dictionary:dictionary setObjectIfNotNil:theClaimsSet.subject forKey:@"sub"];
23
- [self dictionary:dictionary setObjectIfNotNil:theClaimsSet.audience forKey:@"aud"];
24
- [self dictionary:dictionary setDateIfNotNil:theClaimsSet.expirationDate forKey:@"exp"];
25
- [self dictionary:dictionary setDateIfNotNil:theClaimsSet.notBeforeDate forKey:@"nbf"];
26
- [self dictionary:dictionary setDateIfNotNil:theClaimsSet.issuedAt forKey:@"iat"];
27
- [self dictionary:dictionary setObjectIfNotNil:theClaimsSet.identifier forKey:@"jti"];
28
- [self dictionary:dictionary setObjectIfNotNil:theClaimsSet.type forKey:@"typ"];
29
- [self dictionary:dictionary setObjectIfNotNil:theClaimsSet.scope forKey:@"scope"];
30
-
31
- return [dictionary copy];
32
- }
33
-
34
- + (JWTClaimsSet *)claimsSetWithDictionary:(NSDictionary *)theDictionary;
35
- {
36
- JWTClaimsSet *claimsSet = [[JWTClaimsSet alloc] init];
37
- claimsSet.issuer = [theDictionary objectForKey:@"iss"];
38
- claimsSet.subject = [theDictionary objectForKey:@"sub"];
39
- claimsSet.audience = [theDictionary objectForKey:@"aud"];
40
- claimsSet.expirationDate = [NSDate dateWithTimeIntervalSince1970:[[theDictionary objectForKey:@"exp"] doubleValue]];
41
- claimsSet.notBeforeDate = [NSDate dateWithTimeIntervalSince1970:[[theDictionary objectForKey:@"nbf"] doubleValue]];
42
- claimsSet.issuedAt = [NSDate dateWithTimeIntervalSince1970:[[theDictionary objectForKey:@"iat"] doubleValue]];
43
- claimsSet.identifier = [theDictionary objectForKey:@"jti"];
44
- claimsSet.type = [theDictionary objectForKey:@"typ"];
45
- claimsSet.scope = [theDictionary objectForKey:@"scope"];
46
-
47
- return claimsSet;
48
- }
49
-
50
- + (void)dictionary:(NSMutableDictionary *)theDictionary setObjectIfNotNil:(id)theObject forKey:(id<NSCopying>)theKey;
51
- {
52
- if (!theObject)
53
- return;
54
-
55
- [theDictionary setObject:theObject forKey:theKey];
56
- }
57
-
58
- + (void)dictionary:(NSMutableDictionary *)theDictionary setDateIfNotNil:(NSDate*)date forKey:(id<NSCopying>)theKey;
59
- {
60
- if (!date)
61
- return;
62
- NSNumber* value = @((unsigned long)[date timeIntervalSince1970]);
63
-
64
- [theDictionary setObject:value forKey:theKey];
65
- }
66
-
67
-
68
- @end
@@ -1,18 +0,0 @@
1
- //
2
- // JWTClaimsSetVerifier.h
3
- // JWT
4
- //
5
- // Created by Lobanov Dmitry on 13.02.16.
6
- // Copyright © 2016 Karma. All rights reserved.
7
- //
8
-
9
- #import <Foundation/Foundation.h>
10
- #import "JWTClaimsSet.h"
11
-
12
- @interface JWTClaimsSetVerifier : NSObject
13
-
14
- + (BOOL)verifyClaimsSet:(JWTClaimsSet *)theClaimsSet withTrustedClaimsSet:(JWTClaimsSet *)trustedClaimsSet;
15
-
16
- + (BOOL)verifyClaimsSetDictionary:(NSDictionary *)theClaimsSetDictionary withTrustedClaimsSet:(JWTClaimsSet *)trustedClaimsSet;
17
-
18
- @end
@@ -1,72 +0,0 @@
1
- //
2
- // JWTClaimsSetVerifier.m
3
- // JWT
4
- //
5
- // Created by Lobanov Dmitry on 13.02.16.
6
- // Copyright © 2016 Karma. All rights reserved.
7
- //
8
-
9
- #import "JWTClaimsSetVerifier.h"
10
- #import "JWTClaimsSetSerializer.h"
11
- #import "JWTClaim.h"
12
-
13
- @implementation JWTClaimsSetVerifier
14
-
15
- + (BOOL)verifyDictionary:(NSDictionary *)dictionary withTrustedDictionary:(NSDictionary *)trustedDictionary byKey:(NSString *)key {
16
- NSObject *value = dictionary[key];
17
- NSObject *trustedValue = trustedDictionary[key];
18
-
19
- BOOL result = YES;
20
-
21
- if (trustedValue) {
22
- result = [[JWTClaim claimByName:key] verifyValue:value withTrustedValue:trustedValue];
23
- }
24
-
25
- return result;
26
- }
27
-
28
- + (BOOL)verifyClaimsSetDictionary:(NSDictionary *)theClaimsSetDictionary withTrustedClaimsSetDictionary:(NSDictionary *)trustedClaimsSetDictionary {
29
-
30
- NSArray *claimsSets = [JWTClaimsSetSerializer claimsSetKeys];
31
-
32
- if (!trustedClaimsSetDictionary) {
33
- return YES;
34
- }
35
-
36
- if (!theClaimsSetDictionary) {
37
- return NO;
38
- }
39
-
40
- BOOL result = YES;
41
-
42
- for (NSString *key in claimsSets) {
43
- result = result && [self verifyDictionary:theClaimsSetDictionary withTrustedDictionary:trustedClaimsSetDictionary byKey:key];
44
- }
45
-
46
- return result;
47
- }
48
-
49
-
50
- + (BOOL)verifyClaimsSet:(JWTClaimsSet *)theClaimsSet withTrustedClaimsSet:(JWTClaimsSet *)trustedClaimsSet {
51
-
52
- NSDictionary *dictionary = [JWTClaimsSetSerializer dictionaryWithClaimsSet:theClaimsSet];
53
-
54
- NSDictionary *trustedDictionary = [JWTClaimsSetSerializer dictionaryWithClaimsSet:trustedClaimsSet];
55
-
56
- NSArray *claimsSets = [JWTClaimsSetSerializer claimsSetKeys];
57
-
58
- BOOL result = YES;
59
- for (NSString *key in claimsSets) {
60
- result = result && [self verifyDictionary:dictionary withTrustedDictionary:trustedDictionary byKey:key];
61
- }
62
-
63
- return result;
64
- }
65
-
66
- + (BOOL)verifyClaimsSetDictionary:(NSDictionary *)theClaimsSetDictionary withTrustedClaimsSet:(JWTClaimsSet *)trustedClaimsSet {
67
- NSDictionary *trustedDictionary = [JWTClaimsSetSerializer dictionaryWithClaimsSet:trustedClaimsSet];
68
-
69
- return [self verifyClaimsSetDictionary:theClaimsSetDictionary withTrustedClaimsSetDictionary:trustedDictionary];
70
- }
71
-
72
- @end
@@ -1,67 +0,0 @@
1
- //
2
- // JWTCoding+ResultTypes.h
3
- // JWT
4
- //
5
- // Created by Lobanov Dmitry on 30.11.16.
6
- // Copyright © 2016 JWTIO. All rights reserved.
7
- //
8
-
9
- #import <JWTCoding.h>
10
- @class JWTClaimsSet;
11
-
12
- extern NSString *JWTCodingResultHeaders;
13
- extern NSString *JWTCodingResultPayload;
14
-
15
- @interface JWT (ResultTypes) @end
16
-
17
- /*
18
- ResultType
19
- /\
20
- / \
21
- / \
22
- Success Error
23
-
24
- Protocols: Mutable and Immutable (?!?)
25
- */
26
-
27
- // Public
28
- @protocol JWTCodingResultTypeSuccessEncodedProtocol <NSObject>
29
- @property (copy, nonatomic, readonly) NSString *encoded;
30
- - (instancetype)initWithEncoded:(NSString *)encoded;
31
- @property (copy, nonatomic, readonly) NSString *token;
32
- - (instancetype)initWithToken:(NSString *)token;
33
- @end
34
-
35
- // Public
36
- @protocol JWTCodingResultTypeSuccessDecodedProtocol <NSObject>
37
- @property (copy, nonatomic, readonly) NSDictionary *headers;
38
- @property (copy, nonatomic, readonly) NSDictionary *payload;
39
-
40
- // dictionary @{
41
- // JWTCodingResultHeaders : self.headers,
42
- // JWTCodingResultPayload : self.payload
43
- //}
44
- @property (copy, nonatomic, readonly) NSDictionary *headerAndPayloadDictionary;
45
-
46
- @property (nonatomic, readonly) JWTClaimsSet *claimsSet;
47
- - (instancetype)initWithHeaders:(NSDictionary *)headers withPayload:(NSDictionary *)payload;
48
- - (instancetype)initWithClaimsSet:(JWTClaimsSet *)claimsSet;
49
- @end
50
-
51
- // Public
52
- @interface JWTCodingResultTypeSuccess : NSObject <JWTCodingResultTypeSuccessEncodedProtocol,JWTCodingResultTypeSuccessDecodedProtocol> @end
53
-
54
- // Public
55
- @protocol JWTCodingResultTypeErrorProtocol <NSObject>
56
- @property (copy, nonatomic, readonly) NSError *error;
57
- - (instancetype)initWithError:(NSError *)error;
58
- @end
59
-
60
- @interface JWTCodingResultTypeError : NSObject <JWTCodingResultTypeErrorProtocol> @end
61
-
62
- @interface JWTCodingResultType : NSObject
63
- - (instancetype)initWithSuccessResult:(JWTCodingResultTypeSuccess *)success;
64
- - (instancetype)initWithErrorResult:(JWTCodingResultTypeError *)error;
65
- @property (strong, nonatomic, readonly) JWTCodingResultTypeSuccess *successResult;
66
- @property (strong, nonatomic, readonly) JWTCodingResultTypeError *errorResult;
67
- @end
@@ -1,111 +0,0 @@
1
- //
2
- // JWTCoding+ResultTypes.m
3
- // JWT
4
- //
5
- // Created by Lobanov Dmitry on 30.11.16.
6
- // Copyright © 2016 JWTIO. All rights reserved.
7
- //
8
-
9
- #import "JWTCoding+ResultTypes.h"
10
-
11
- NSString *JWTCodingResultHeaders = @"header";
12
- NSString *JWTCodingResultPayload = @"payload";
13
-
14
- @implementation JWT (ResultTypes) @end
15
-
16
- // Protected?
17
- @protocol JWTMutableCodingResultTypeSuccessEncodedProtocol <JWTCodingResultTypeSuccessEncodedProtocol>
18
- @property (copy, nonatomic, readwrite) NSString *encoded;
19
- @property (copy, nonatomic, readwrite) NSString *token;
20
- @end
21
-
22
- // Protected?
23
- @protocol JWTMutableCodingResultTypeSuccessDecodedProtocol <JWTCodingResultTypeSuccessDecodedProtocol>
24
- @property (copy, nonatomic, readwrite) NSDictionary *headers;
25
- @property (copy, nonatomic, readwrite) NSDictionary *payload;
26
- @property (nonatomic, readwrite) JWTClaimsSet *claimsSet;
27
- @end
28
-
29
- // Protected?
30
- @protocol JWTMutableCodingResultTypeErrorProtocol <JWTCodingResultTypeErrorProtocol>
31
- @property (copy, nonatomic, readwrite) NSError *error;
32
- @end
33
-
34
- @interface JWTCodingResultTypeSuccess () <JWTMutableCodingResultTypeSuccessEncodedProtocol, JWTMutableCodingResultTypeSuccessDecodedProtocol> @end
35
-
36
- @implementation JWTCodingResultTypeSuccess
37
- @synthesize encoded = _encoded;
38
- @synthesize headers = _headers;
39
- @synthesize payload = _payload;
40
- @synthesize claimsSet = _claimsSet;
41
- //Not used yet. Could be replacement for _encoded.
42
- @synthesize token = _token;
43
-
44
- - (NSDictionary *)headerAndPayloadDictionary {
45
- if (self.headers && self.payload) {
46
- return @{
47
- JWTCodingResultHeaders: self.headers,
48
- JWTCodingResultPayload: self.payload
49
- };
50
- }
51
- return nil;
52
- }
53
- - (instancetype)initWithEncoded:(NSString *)encoded {
54
- if (self = [super init]) {
55
- self.encoded = encoded;
56
- }
57
- return self;
58
- }
59
- - (instancetype)initWithToken:(NSString *)token {
60
- if (self = [super init]) {
61
- self.token = token;
62
- }
63
- return self;
64
- }
65
- - (instancetype)initWithHeaders:(NSDictionary *)headers withPayload:(NSDictionary *)payload {
66
- if (self = [super init]) {
67
- self.headers = headers;
68
- self.payload = payload;
69
- }
70
- return self;
71
- }
72
- - (instancetype)initWithClaimsSet:(JWTClaimsSet *)claimsSet {
73
- if (self = [super init]) {
74
- self.claimsSet = claimsSet;
75
- }
76
- return self;
77
- }
78
- @end
79
-
80
- @interface JWTCodingResultTypeError () <JWTMutableCodingResultTypeErrorProtocol> @end
81
-
82
- @implementation JWTCodingResultTypeError
83
- @synthesize error = _error;
84
- - (instancetype)initWithError:(NSError *)error {
85
- if (self = [super init]) {
86
- self.error = error;
87
- }
88
- return self;
89
- }
90
- @end
91
-
92
- @interface JWTCodingResultType ()
93
- @property (strong, nonatomic, readwrite) JWTCodingResultTypeSuccess *successResult;
94
- @property (strong, nonatomic, readwrite) JWTCodingResultTypeError *errorResult;
95
- @end
96
-
97
- @implementation JWTCodingResultType
98
- - (instancetype)initWithSuccessResult:(JWTCodingResultTypeSuccess *)success {
99
- if (self = [super init]) {
100
- self.successResult = success;
101
- }
102
- return self;
103
- }
104
- - (instancetype)initWithErrorResult:(JWTCodingResultTypeError *)error {
105
- if (self = [super init]) {
106
- self.errorResult = error;
107
- }
108
- return self;
109
- }
110
-
111
- @end