From 229961b0528b68ed864ea8233c0479efff12d04d Mon Sep 17 00:00:00 2001 From: Hebert Date: Mon, 27 Apr 2026 10:35:01 -0300 Subject: [PATCH 1/7] Remove JWT implementation and related files - Deleted the JWTCoding.h and JWTCoding.m files, which contained the main JWT interface for encoding and decoding. - Removed JWT.h, Map.modulemap, JWTBase64Coder.h, JWTBase64Coder.m, JWTDeprecations.h, JWTErrorDescription.h, and JWTErrorDescription.m files, which included various supplementary functionalities and error handling for JWT. - Eliminated the LICENSE and README.md files associated with the JWT library. - Updated package.json to add a script for pod installation in the iOS project directory. --- ios/CodePush.xcodeproj/project.pbxproj | 367 ++--------- .../Base64/Base64/MF_Base64Additions.h | 34 - .../Base64/Base64/MF_Base64Additions.m | 252 ------- ios/CodePush/Base64/README.md | 47 -- ios/CodePush/CodePushUpdateUtils.m | 7 + .../JWT/Core/Algorithms/Base/JWTAlgorithm.h | 69 -- .../Algorithms/Base/JWTAlgorithmFactory.h | 16 - .../Algorithms/Base/JWTAlgorithmFactory.m | 51 -- .../Core/Algorithms/Base/JWTAlgorithmNone.h | 15 - .../Core/Algorithms/Base/JWTAlgorithmNone.m | 55 -- .../Algorithms/ESFamily/JWTAlgorithmESBase.h | 24 - .../Algorithms/ESFamily/JWTAlgorithmESBase.m | 41 -- .../Algorithms/HSFamily/JWTAlgorithmHSBase.h | 28 - .../Algorithms/HSFamily/JWTAlgorithmHSBase.m | 205 ------ .../Holders/JWTAlgorithmDataHolder.h | 103 --- .../Holders/JWTAlgorithmDataHolder.m | 322 --------- .../Holders/JWTAlgorithmDataHolderChain.h | 37 -- .../Holders/JWTAlgorithmDataHolderChain.m | 145 ---- .../Algorithms/RSFamily/JWTAlgorithmRSBase.h | 35 - .../Algorithms/RSFamily/JWTAlgorithmRSBase.m | 551 ---------------- .../Core/Algorithms/RSFamily/JWTRSAlgorithm.h | 23 - .../Algorithms/RSFamily/RSKeys/JWTCryptoKey.h | 43 -- .../Algorithms/RSFamily/RSKeys/JWTCryptoKey.m | 230 ------- .../RSFamily/RSKeys/JWTCryptoKeyExtractor.h | 31 - .../RSFamily/RSKeys/JWTCryptoKeyExtractor.m | 113 ---- .../RSFamily/RSKeys/JWTCryptoSecurity.h | 38 -- .../RSFamily/RSKeys/JWTCryptoSecurity.m | 500 -------------- ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h | 18 - ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m | 214 ------ ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h | 23 - ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m | 29 - .../Core/ClaimSet/JWTClaimsSetSerializer.h | 19 - .../Core/ClaimSet/JWTClaimsSetSerializer.m | 68 -- .../JWT/Core/ClaimSet/JWTClaimsSetVerifier.h | 18 - .../JWT/Core/ClaimSet/JWTClaimsSetVerifier.m | 72 -- .../JWT/Core/Coding/JWTCoding+ResultTypes.h | 67 -- .../JWT/Core/Coding/JWTCoding+ResultTypes.m | 111 ---- .../JWT/Core/Coding/JWTCoding+VersionOne.h | 119 ---- .../JWT/Core/Coding/JWTCoding+VersionOne.m | 307 --------- .../JWT/Core/Coding/JWTCoding+VersionThree.h | 94 --- .../JWT/Core/Coding/JWTCoding+VersionThree.m | 619 ------------------ .../JWT/Core/Coding/JWTCoding+VersionTwo.h | 164 ----- .../JWT/Core/Coding/JWTCoding+VersionTwo.m | 514 --------------- ios/CodePush/JWT/Core/Coding/JWTCoding.h | 24 - ios/CodePush/JWT/Core/Coding/JWTCoding.m | 11 - .../JWT/Core/FrameworkSupplement/JWT.h | 52 -- .../Core/FrameworkSupplement/Map.modulemap | 5 - .../JWT/Core/Supplement/JWTBase64Coder.h | 28 - .../JWT/Core/Supplement/JWTBase64Coder.m | 70 -- .../JWT/Core/Supplement/JWTDeprecations.h | 22 - .../JWT/Core/Supplement/JWTErrorDescription.h | 34 - .../JWT/Core/Supplement/JWTErrorDescription.m | 73 --- ios/CodePush/JWT/LICENSE | 19 - ios/CodePush/JWT/README.md | 489 -------------- package.json | 3 +- 55 files changed, 49 insertions(+), 6619 deletions(-) delete mode 100644 ios/CodePush/Base64/Base64/MF_Base64Additions.h delete mode 100644 ios/CodePush/Base64/Base64/MF_Base64Additions.m delete mode 100644 ios/CodePush/Base64/README.md delete mode 100644 ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h delete mode 100644 ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h delete mode 100644 ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m delete mode 100644 ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h delete mode 100644 ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m delete mode 100644 ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h delete mode 100644 ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m delete mode 100644 ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h delete mode 100644 ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m delete mode 100644 ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h delete mode 100644 ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m delete mode 100644 ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h delete mode 100644 ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m delete mode 100644 ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h delete mode 100644 ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m delete mode 100644 ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h delete mode 100644 ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h delete mode 100644 ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m delete mode 100644 ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h delete mode 100644 ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m delete mode 100644 ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h delete mode 100644 ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m delete mode 100644 ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h delete mode 100644 ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m delete mode 100644 ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h delete mode 100644 ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m delete mode 100644 ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h delete mode 100644 ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m delete mode 100644 ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h delete mode 100644 ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m delete mode 100644 ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h delete mode 100644 ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m delete mode 100644 ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h delete mode 100644 ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m delete mode 100644 ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h delete mode 100644 ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m delete mode 100644 ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h delete mode 100644 ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m delete mode 100644 ios/CodePush/JWT/Core/Coding/JWTCoding.h delete mode 100644 ios/CodePush/JWT/Core/Coding/JWTCoding.m delete mode 100644 ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h delete mode 100644 ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap delete mode 100644 ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h delete mode 100644 ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m delete mode 100644 ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h delete mode 100644 ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h delete mode 100644 ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m delete mode 100644 ios/CodePush/JWT/LICENSE delete mode 100644 ios/CodePush/JWT/README.md diff --git a/ios/CodePush.xcodeproj/project.pbxproj b/ios/CodePush.xcodeproj/project.pbxproj index 3010ff503..ac799b7c1 100644 --- a/ios/CodePush.xcodeproj/project.pbxproj +++ b/ios/CodePush.xcodeproj/project.pbxproj @@ -97,54 +97,6 @@ 81D51F3A1B6181C2000DA084 /* CodePushConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 81D51F391B6181C2000DA084 /* CodePushConfig.m */; }; 8482F84C1E24C58300F793DB /* CodePush.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13BE3DEC1AC21097009241FE /* CodePush.h */; }; 8482F84E1E24C66300F793DB /* CodePush.h in Headers */ = {isa = PBXBuildFile; fileRef = 13BE3DEC1AC21097009241FE /* CodePush.h */; }; - F85736761F4F03BF00C9C00A /* MF_Base64Additions.h in Headers */ = {isa = PBXBuildFile; fileRef = F85736731F4F03BF00C9C00A /* MF_Base64Additions.h */; }; - F85736771F4F03BF00C9C00A /* MF_Base64Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = F85736741F4F03BF00C9C00A /* MF_Base64Additions.m */; }; - F886644D1F4AD1EE0036D01B /* JWTAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664151F4AD1EE0036D01B /* JWTAlgorithm.h */; }; - F886644E1F4AD1EE0036D01B /* JWTAlgorithmFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664161F4AD1EE0036D01B /* JWTAlgorithmFactory.h */; }; - F886644F1F4AD1EE0036D01B /* JWTAlgorithmFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = F88664171F4AD1EE0036D01B /* JWTAlgorithmFactory.m */; }; - F88664501F4AD1EE0036D01B /* JWTAlgorithmNone.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664181F4AD1EE0036D01B /* JWTAlgorithmNone.h */; }; - F88664511F4AD1EE0036D01B /* JWTAlgorithmNone.m in Sources */ = {isa = PBXBuildFile; fileRef = F88664191F4AD1EE0036D01B /* JWTAlgorithmNone.m */; }; - F88664521F4AD1EE0036D01B /* JWTAlgorithmESBase.h in Headers */ = {isa = PBXBuildFile; fileRef = F886641B1F4AD1EE0036D01B /* JWTAlgorithmESBase.h */; }; - F88664531F4AD1EE0036D01B /* JWTAlgorithmESBase.m in Sources */ = {isa = PBXBuildFile; fileRef = F886641C1F4AD1EE0036D01B /* JWTAlgorithmESBase.m */; }; - F88664541F4AD1EE0036D01B /* JWTAlgorithmDataHolder.h in Headers */ = {isa = PBXBuildFile; fileRef = F886641E1F4AD1EE0036D01B /* JWTAlgorithmDataHolder.h */; }; - F88664551F4AD1EE0036D01B /* JWTAlgorithmDataHolder.m in Sources */ = {isa = PBXBuildFile; fileRef = F886641F1F4AD1EE0036D01B /* JWTAlgorithmDataHolder.m */; }; - F88664561F4AD1EE0036D01B /* JWTAlgorithmDataHolderChain.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664201F4AD1EE0036D01B /* JWTAlgorithmDataHolderChain.h */; }; - F88664571F4AD1EE0036D01B /* JWTAlgorithmDataHolderChain.m in Sources */ = {isa = PBXBuildFile; fileRef = F88664211F4AD1EE0036D01B /* JWTAlgorithmDataHolderChain.m */; }; - F88664581F4AD1EE0036D01B /* JWTAlgorithmHSBase.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664231F4AD1EE0036D01B /* JWTAlgorithmHSBase.h */; }; - F88664591F4AD1EE0036D01B /* JWTAlgorithmHSBase.m in Sources */ = {isa = PBXBuildFile; fileRef = F88664241F4AD1EE0036D01B /* JWTAlgorithmHSBase.m */; }; - F886645A1F4AD1EE0036D01B /* JWTAlgorithmRSBase.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664261F4AD1EE0036D01B /* JWTAlgorithmRSBase.h */; }; - F886645B1F4AD1EE0036D01B /* JWTAlgorithmRSBase.m in Sources */ = {isa = PBXBuildFile; fileRef = F88664271F4AD1EE0036D01B /* JWTAlgorithmRSBase.m */; }; - F886645C1F4AD1EE0036D01B /* JWTRSAlgorithm.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664281F4AD1EE0036D01B /* JWTRSAlgorithm.h */; }; - F886645D1F4AD1EE0036D01B /* JWTCryptoKey.h in Headers */ = {isa = PBXBuildFile; fileRef = F886642A1F4AD1EE0036D01B /* JWTCryptoKey.h */; }; - F886645E1F4AD1EE0036D01B /* JWTCryptoKey.m in Sources */ = {isa = PBXBuildFile; fileRef = F886642B1F4AD1EE0036D01B /* JWTCryptoKey.m */; }; - F886645F1F4AD1EE0036D01B /* JWTCryptoKeyExtractor.h in Headers */ = {isa = PBXBuildFile; fileRef = F886642C1F4AD1EE0036D01B /* JWTCryptoKeyExtractor.h */; }; - F88664601F4AD1EE0036D01B /* JWTCryptoKeyExtractor.m in Sources */ = {isa = PBXBuildFile; fileRef = F886642D1F4AD1EE0036D01B /* JWTCryptoKeyExtractor.m */; }; - F88664611F4AD1EE0036D01B /* JWTCryptoSecurity.h in Headers */ = {isa = PBXBuildFile; fileRef = F886642E1F4AD1EE0036D01B /* JWTCryptoSecurity.h */; }; - F88664621F4AD1EE0036D01B /* JWTCryptoSecurity.m in Sources */ = {isa = PBXBuildFile; fileRef = F886642F1F4AD1EE0036D01B /* JWTCryptoSecurity.m */; }; - F88664631F4AD1EE0036D01B /* JWTClaim.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664311F4AD1EE0036D01B /* JWTClaim.h */; }; - F88664641F4AD1EE0036D01B /* JWTClaim.m in Sources */ = {isa = PBXBuildFile; fileRef = F88664321F4AD1EE0036D01B /* JWTClaim.m */; }; - F88664651F4AD1EE0036D01B /* JWTClaimsSet.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664331F4AD1EE0036D01B /* JWTClaimsSet.h */; }; - F88664661F4AD1EE0036D01B /* JWTClaimsSet.m in Sources */ = {isa = PBXBuildFile; fileRef = F88664341F4AD1EE0036D01B /* JWTClaimsSet.m */; }; - F88664671F4AD1EE0036D01B /* JWTClaimsSetSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664351F4AD1EE0036D01B /* JWTClaimsSetSerializer.h */; }; - F88664681F4AD1EE0036D01B /* JWTClaimsSetSerializer.m in Sources */ = {isa = PBXBuildFile; fileRef = F88664361F4AD1EE0036D01B /* JWTClaimsSetSerializer.m */; }; - F88664691F4AD1EE0036D01B /* JWTClaimsSetVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664371F4AD1EE0036D01B /* JWTClaimsSetVerifier.h */; }; - F886646A1F4AD1EE0036D01B /* JWTClaimsSetVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = F88664381F4AD1EE0036D01B /* JWTClaimsSetVerifier.m */; }; - F886646B1F4AD1EE0036D01B /* JWTCoding+ResultTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = F886643A1F4AD1EE0036D01B /* JWTCoding+ResultTypes.h */; }; - F886646C1F4AD1EE0036D01B /* JWTCoding+ResultTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = F886643B1F4AD1EE0036D01B /* JWTCoding+ResultTypes.m */; }; - F886646D1F4AD1EE0036D01B /* JWTCoding+VersionOne.h in Headers */ = {isa = PBXBuildFile; fileRef = F886643C1F4AD1EE0036D01B /* JWTCoding+VersionOne.h */; }; - F886646E1F4AD1EE0036D01B /* JWTCoding+VersionOne.m in Sources */ = {isa = PBXBuildFile; fileRef = F886643D1F4AD1EE0036D01B /* JWTCoding+VersionOne.m */; }; - F886646F1F4AD1EE0036D01B /* JWTCoding+VersionThree.h in Headers */ = {isa = PBXBuildFile; fileRef = F886643E1F4AD1EE0036D01B /* JWTCoding+VersionThree.h */; }; - F88664701F4AD1EE0036D01B /* JWTCoding+VersionThree.m in Sources */ = {isa = PBXBuildFile; fileRef = F886643F1F4AD1EE0036D01B /* JWTCoding+VersionThree.m */; }; - F88664711F4AD1EE0036D01B /* JWTCoding+VersionTwo.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664401F4AD1EE0036D01B /* JWTCoding+VersionTwo.h */; }; - F88664721F4AD1EE0036D01B /* JWTCoding+VersionTwo.m in Sources */ = {isa = PBXBuildFile; fileRef = F88664411F4AD1EE0036D01B /* JWTCoding+VersionTwo.m */; }; - F88664731F4AD1EE0036D01B /* JWTCoding.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664421F4AD1EE0036D01B /* JWTCoding.h */; }; - F88664741F4AD1EE0036D01B /* JWTCoding.m in Sources */ = {isa = PBXBuildFile; fileRef = F88664431F4AD1EE0036D01B /* JWTCoding.m */; }; - F88664751F4AD1EE0036D01B /* JWT.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664451F4AD1EE0036D01B /* JWT.h */; }; - F88664761F4AD1EE0036D01B /* JWTBase64Coder.h in Headers */ = {isa = PBXBuildFile; fileRef = F88664481F4AD1EE0036D01B /* JWTBase64Coder.h */; }; - F88664771F4AD1EE0036D01B /* JWTBase64Coder.m in Sources */ = {isa = PBXBuildFile; fileRef = F88664491F4AD1EE0036D01B /* JWTBase64Coder.m */; }; - F88664781F4AD1EE0036D01B /* JWTDeprecations.h in Headers */ = {isa = PBXBuildFile; fileRef = F886644A1F4AD1EE0036D01B /* JWTDeprecations.h */; }; - F88664791F4AD1EE0036D01B /* JWTErrorDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = F886644B1F4AD1EE0036D01B /* JWTErrorDescription.h */; }; - F886647A1F4AD1EF0036D01B /* JWTErrorDescription.m in Sources */ = {isa = PBXBuildFile; fileRef = F886644C1F4AD1EE0036D01B /* JWTErrorDescription.m */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -220,58 +172,7 @@ 54FFEDDF1BF550630061DD23 /* CodePushDownloadHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushDownloadHandler.m; path = CodePush/CodePushDownloadHandler.m; sourceTree = ""; }; 810D4E6C1B96935000B397E9 /* CodePushPackage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushPackage.m; path = CodePush/CodePushPackage.m; sourceTree = ""; }; 81D51F391B6181C2000DA084 /* CodePushConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushConfig.m; path = CodePush/CodePushConfig.m; sourceTree = ""; }; - F85736731F4F03BF00C9C00A /* MF_Base64Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MF_Base64Additions.h; sourceTree = ""; }; - F85736741F4F03BF00C9C00A /* MF_Base64Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MF_Base64Additions.m; sourceTree = ""; }; - F85736751F4F03BF00C9C00A /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; - F85736791F4F155300C9C00A /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; - F857367A1F4F155300C9C00A /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; - F88664151F4AD1EE0036D01B /* JWTAlgorithm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTAlgorithm.h; sourceTree = ""; }; - F88664161F4AD1EE0036D01B /* JWTAlgorithmFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTAlgorithmFactory.h; sourceTree = ""; }; - F88664171F4AD1EE0036D01B /* JWTAlgorithmFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTAlgorithmFactory.m; sourceTree = ""; }; - F88664181F4AD1EE0036D01B /* JWTAlgorithmNone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTAlgorithmNone.h; sourceTree = ""; }; - F88664191F4AD1EE0036D01B /* JWTAlgorithmNone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTAlgorithmNone.m; sourceTree = ""; }; - F886641B1F4AD1EE0036D01B /* JWTAlgorithmESBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTAlgorithmESBase.h; sourceTree = ""; }; - F886641C1F4AD1EE0036D01B /* JWTAlgorithmESBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTAlgorithmESBase.m; sourceTree = ""; }; - F886641E1F4AD1EE0036D01B /* JWTAlgorithmDataHolder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTAlgorithmDataHolder.h; sourceTree = ""; }; - F886641F1F4AD1EE0036D01B /* JWTAlgorithmDataHolder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTAlgorithmDataHolder.m; sourceTree = ""; }; - F88664201F4AD1EE0036D01B /* JWTAlgorithmDataHolderChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTAlgorithmDataHolderChain.h; sourceTree = ""; }; - F88664211F4AD1EE0036D01B /* JWTAlgorithmDataHolderChain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTAlgorithmDataHolderChain.m; sourceTree = ""; }; - F88664231F4AD1EE0036D01B /* JWTAlgorithmHSBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTAlgorithmHSBase.h; sourceTree = ""; }; - F88664241F4AD1EE0036D01B /* JWTAlgorithmHSBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTAlgorithmHSBase.m; sourceTree = ""; }; - F88664261F4AD1EE0036D01B /* JWTAlgorithmRSBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTAlgorithmRSBase.h; sourceTree = ""; }; - F88664271F4AD1EE0036D01B /* JWTAlgorithmRSBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTAlgorithmRSBase.m; sourceTree = ""; }; - F88664281F4AD1EE0036D01B /* JWTRSAlgorithm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTRSAlgorithm.h; sourceTree = ""; }; - F886642A1F4AD1EE0036D01B /* JWTCryptoKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTCryptoKey.h; sourceTree = ""; }; - F886642B1F4AD1EE0036D01B /* JWTCryptoKey.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTCryptoKey.m; sourceTree = ""; }; - F886642C1F4AD1EE0036D01B /* JWTCryptoKeyExtractor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTCryptoKeyExtractor.h; sourceTree = ""; }; - F886642D1F4AD1EE0036D01B /* JWTCryptoKeyExtractor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTCryptoKeyExtractor.m; sourceTree = ""; }; - F886642E1F4AD1EE0036D01B /* JWTCryptoSecurity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTCryptoSecurity.h; sourceTree = ""; }; - F886642F1F4AD1EE0036D01B /* JWTCryptoSecurity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTCryptoSecurity.m; sourceTree = ""; }; - F88664311F4AD1EE0036D01B /* JWTClaim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTClaim.h; sourceTree = ""; }; - F88664321F4AD1EE0036D01B /* JWTClaim.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTClaim.m; sourceTree = ""; }; - F88664331F4AD1EE0036D01B /* JWTClaimsSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTClaimsSet.h; sourceTree = ""; }; - F88664341F4AD1EE0036D01B /* JWTClaimsSet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTClaimsSet.m; sourceTree = ""; }; - F88664351F4AD1EE0036D01B /* JWTClaimsSetSerializer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTClaimsSetSerializer.h; sourceTree = ""; }; - F88664361F4AD1EE0036D01B /* JWTClaimsSetSerializer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTClaimsSetSerializer.m; sourceTree = ""; }; - F88664371F4AD1EE0036D01B /* JWTClaimsSetVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTClaimsSetVerifier.h; sourceTree = ""; }; - F88664381F4AD1EE0036D01B /* JWTClaimsSetVerifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTClaimsSetVerifier.m; sourceTree = ""; }; - F886643A1F4AD1EE0036D01B /* JWTCoding+ResultTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JWTCoding+ResultTypes.h"; sourceTree = ""; }; - F886643B1F4AD1EE0036D01B /* JWTCoding+ResultTypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "JWTCoding+ResultTypes.m"; sourceTree = ""; }; - F886643C1F4AD1EE0036D01B /* JWTCoding+VersionOne.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JWTCoding+VersionOne.h"; sourceTree = ""; }; - F886643D1F4AD1EE0036D01B /* JWTCoding+VersionOne.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "JWTCoding+VersionOne.m"; sourceTree = ""; }; - F886643E1F4AD1EE0036D01B /* JWTCoding+VersionThree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JWTCoding+VersionThree.h"; sourceTree = ""; }; - F886643F1F4AD1EE0036D01B /* JWTCoding+VersionThree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "JWTCoding+VersionThree.m"; sourceTree = ""; }; - F88664401F4AD1EE0036D01B /* JWTCoding+VersionTwo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JWTCoding+VersionTwo.h"; sourceTree = ""; }; - F88664411F4AD1EE0036D01B /* JWTCoding+VersionTwo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "JWTCoding+VersionTwo.m"; sourceTree = ""; }; - F88664421F4AD1EE0036D01B /* JWTCoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTCoding.h; sourceTree = ""; }; - F88664431F4AD1EE0036D01B /* JWTCoding.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTCoding.m; sourceTree = ""; }; - F88664451F4AD1EE0036D01B /* JWT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWT.h; sourceTree = ""; }; F88664461F4AD1EE0036D01B /* Map.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = Map.modulemap; sourceTree = ""; }; - F88664481F4AD1EE0036D01B /* JWTBase64Coder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTBase64Coder.h; sourceTree = ""; }; - F88664491F4AD1EE0036D01B /* JWTBase64Coder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTBase64Coder.m; sourceTree = ""; }; - F886644A1F4AD1EE0036D01B /* JWTDeprecations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTDeprecations.h; sourceTree = ""; }; - F886644B1F4AD1EE0036D01B /* JWTErrorDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWTErrorDescription.h; sourceTree = ""; }; - F886644C1F4AD1EE0036D01B /* JWTErrorDescription.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWTErrorDescription.m; sourceTree = ""; }; F886647B1F4ADB500036D01B /* libCodePush.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCodePush.a; sourceTree = BUILT_PRODUCTS_DIR; }; FF90DEF92C5A808600CA8692 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; /* End PBXFileReference section */ @@ -386,8 +287,6 @@ 540D20111C7684FE00D6EF41 /* CodePushUpdateUtils.m */, 1B23B9131BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m */, 1BCC09A61CC19EB700DDC0DD /* RCTConvert+CodePushUpdateState.m */, - F85736711F4F03BF00C9C00A /* Base64 */, - F88664111F4AD1EE0036D01B /* JWT */, 3221E4282C8ABE1300268379 /* SSZipArchive */, 134814211AA4EA7D00B7C361 /* Products */, C31BB4D5018A48D5288C5137 /* Frameworks */, @@ -402,178 +301,6 @@ name = Frameworks; sourceTree = ""; }; - F85736711F4F03BF00C9C00A /* Base64 */ = { - isa = PBXGroup; - children = ( - F85736721F4F03BF00C9C00A /* Base64 */, - F85736751F4F03BF00C9C00A /* README.md */, - ); - name = Base64; - path = CodePush/Base64; - sourceTree = ""; - }; - F85736721F4F03BF00C9C00A /* Base64 */ = { - isa = PBXGroup; - children = ( - F85736731F4F03BF00C9C00A /* MF_Base64Additions.h */, - F85736741F4F03BF00C9C00A /* MF_Base64Additions.m */, - ); - path = Base64; - sourceTree = ""; - }; - F88664111F4AD1EE0036D01B /* JWT */ = { - isa = PBXGroup; - children = ( - F85736791F4F155300C9C00A /* LICENSE */, - F857367A1F4F155300C9C00A /* README.md */, - F88664121F4AD1EE0036D01B /* Core */, - ); - name = JWT; - path = CodePush/JWT; - sourceTree = ""; - }; - F88664121F4AD1EE0036D01B /* Core */ = { - isa = PBXGroup; - children = ( - F88664131F4AD1EE0036D01B /* Algorithms */, - F88664301F4AD1EE0036D01B /* ClaimSet */, - F88664391F4AD1EE0036D01B /* Coding */, - F88664441F4AD1EE0036D01B /* FrameworkSupplement */, - F88664471F4AD1EE0036D01B /* Supplement */, - ); - path = Core; - sourceTree = ""; - }; - F88664131F4AD1EE0036D01B /* Algorithms */ = { - isa = PBXGroup; - children = ( - F88664141F4AD1EE0036D01B /* Base */, - F886641A1F4AD1EE0036D01B /* ESFamily */, - F886641D1F4AD1EE0036D01B /* Holders */, - F88664221F4AD1EE0036D01B /* HSFamily */, - F88664251F4AD1EE0036D01B /* RSFamily */, - ); - path = Algorithms; - sourceTree = ""; - }; - F88664141F4AD1EE0036D01B /* Base */ = { - isa = PBXGroup; - children = ( - F88664151F4AD1EE0036D01B /* JWTAlgorithm.h */, - F88664161F4AD1EE0036D01B /* JWTAlgorithmFactory.h */, - F88664171F4AD1EE0036D01B /* JWTAlgorithmFactory.m */, - F88664181F4AD1EE0036D01B /* JWTAlgorithmNone.h */, - F88664191F4AD1EE0036D01B /* JWTAlgorithmNone.m */, - ); - path = Base; - sourceTree = ""; - }; - F886641A1F4AD1EE0036D01B /* ESFamily */ = { - isa = PBXGroup; - children = ( - F886641B1F4AD1EE0036D01B /* JWTAlgorithmESBase.h */, - F886641C1F4AD1EE0036D01B /* JWTAlgorithmESBase.m */, - ); - path = ESFamily; - sourceTree = ""; - }; - F886641D1F4AD1EE0036D01B /* Holders */ = { - isa = PBXGroup; - children = ( - F886641E1F4AD1EE0036D01B /* JWTAlgorithmDataHolder.h */, - F886641F1F4AD1EE0036D01B /* JWTAlgorithmDataHolder.m */, - F88664201F4AD1EE0036D01B /* JWTAlgorithmDataHolderChain.h */, - F88664211F4AD1EE0036D01B /* JWTAlgorithmDataHolderChain.m */, - ); - path = Holders; - sourceTree = ""; - }; - F88664221F4AD1EE0036D01B /* HSFamily */ = { - isa = PBXGroup; - children = ( - F88664231F4AD1EE0036D01B /* JWTAlgorithmHSBase.h */, - F88664241F4AD1EE0036D01B /* JWTAlgorithmHSBase.m */, - ); - path = HSFamily; - sourceTree = ""; - }; - F88664251F4AD1EE0036D01B /* RSFamily */ = { - isa = PBXGroup; - children = ( - F88664261F4AD1EE0036D01B /* JWTAlgorithmRSBase.h */, - F88664271F4AD1EE0036D01B /* JWTAlgorithmRSBase.m */, - F88664281F4AD1EE0036D01B /* JWTRSAlgorithm.h */, - F88664291F4AD1EE0036D01B /* RSKeys */, - ); - path = RSFamily; - sourceTree = ""; - }; - F88664291F4AD1EE0036D01B /* RSKeys */ = { - isa = PBXGroup; - children = ( - F886642A1F4AD1EE0036D01B /* JWTCryptoKey.h */, - F886642B1F4AD1EE0036D01B /* JWTCryptoKey.m */, - F886642C1F4AD1EE0036D01B /* JWTCryptoKeyExtractor.h */, - F886642D1F4AD1EE0036D01B /* JWTCryptoKeyExtractor.m */, - F886642E1F4AD1EE0036D01B /* JWTCryptoSecurity.h */, - F886642F1F4AD1EE0036D01B /* JWTCryptoSecurity.m */, - ); - path = RSKeys; - sourceTree = ""; - }; - F88664301F4AD1EE0036D01B /* ClaimSet */ = { - isa = PBXGroup; - children = ( - F88664311F4AD1EE0036D01B /* JWTClaim.h */, - F88664321F4AD1EE0036D01B /* JWTClaim.m */, - F88664331F4AD1EE0036D01B /* JWTClaimsSet.h */, - F88664341F4AD1EE0036D01B /* JWTClaimsSet.m */, - F88664351F4AD1EE0036D01B /* JWTClaimsSetSerializer.h */, - F88664361F4AD1EE0036D01B /* JWTClaimsSetSerializer.m */, - F88664371F4AD1EE0036D01B /* JWTClaimsSetVerifier.h */, - F88664381F4AD1EE0036D01B /* JWTClaimsSetVerifier.m */, - ); - path = ClaimSet; - sourceTree = ""; - }; - F88664391F4AD1EE0036D01B /* Coding */ = { - isa = PBXGroup; - children = ( - F886643A1F4AD1EE0036D01B /* JWTCoding+ResultTypes.h */, - F886643B1F4AD1EE0036D01B /* JWTCoding+ResultTypes.m */, - F886643C1F4AD1EE0036D01B /* JWTCoding+VersionOne.h */, - F886643D1F4AD1EE0036D01B /* JWTCoding+VersionOne.m */, - F886643E1F4AD1EE0036D01B /* JWTCoding+VersionThree.h */, - F886643F1F4AD1EE0036D01B /* JWTCoding+VersionThree.m */, - F88664401F4AD1EE0036D01B /* JWTCoding+VersionTwo.h */, - F88664411F4AD1EE0036D01B /* JWTCoding+VersionTwo.m */, - F88664421F4AD1EE0036D01B /* JWTCoding.h */, - F88664431F4AD1EE0036D01B /* JWTCoding.m */, - ); - path = Coding; - sourceTree = ""; - }; - F88664441F4AD1EE0036D01B /* FrameworkSupplement */ = { - isa = PBXGroup; - children = ( - F88664451F4AD1EE0036D01B /* JWT.h */, - F88664461F4AD1EE0036D01B /* Map.modulemap */, - ); - path = FrameworkSupplement; - sourceTree = ""; - }; - F88664471F4AD1EE0036D01B /* Supplement */ = { - isa = PBXGroup; - children = ( - F88664481F4AD1EE0036D01B /* JWTBase64Coder.h */, - F88664491F4AD1EE0036D01B /* JWTBase64Coder.m */, - F886644A1F4AD1EE0036D01B /* JWTDeprecations.h */, - F886644B1F4AD1EE0036D01B /* JWTErrorDescription.h */, - F886644C1F4AD1EE0036D01B /* JWTErrorDescription.m */, - ); - path = Supplement; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -608,46 +335,20 @@ files = ( 3221E4712C8ABE1300268379 /* mz_strm_zlib.h in Headers */, 3221E48B2C8ABE1400268379 /* mz_strm_os.h in Headers */, - F88664791F4AD1EE0036D01B /* JWTErrorDescription.h in Headers */, - F85736761F4F03BF00C9C00A /* MF_Base64Additions.h in Headers */, - F88664541F4AD1EE0036D01B /* JWTAlgorithmDataHolder.h in Headers */, - F88664501F4AD1EE0036D01B /* JWTAlgorithmNone.h in Headers */, - F88664671F4AD1EE0036D01B /* JWTClaimsSetSerializer.h in Headers */, - F88664521F4AD1EE0036D01B /* JWTAlgorithmESBase.h in Headers */, - F88664781F4AD1EE0036D01B /* JWTDeprecations.h in Headers */, 3221E4852C8ABE1400268379 /* mz_crypt.h in Headers */, 3221E4512C8ABE1300268379 /* ZipArchive.h in Headers */, - F88664631F4AD1EE0036D01B /* JWTClaim.h in Headers */, - F886645A1F4AD1EE0036D01B /* JWTAlgorithmRSBase.h in Headers */, - F886645F1F4AD1EE0036D01B /* JWTCryptoKeyExtractor.h in Headers */, - F88664651F4AD1EE0036D01B /* JWTClaimsSet.h in Headers */, - F886644E1F4AD1EE0036D01B /* JWTAlgorithmFactory.h in Headers */, - F886645C1F4AD1EE0036D01B /* JWTRSAlgorithm.h in Headers */, - F88664731F4AD1EE0036D01B /* JWTCoding.h in Headers */, 3221E45F2C8ABE1300268379 /* mz_os.h in Headers */, 3221E4872C8ABE1400268379 /* mz_strm_mem.h in Headers */, 3221E48D2C8ABE1400268379 /* SSZipArchive.h in Headers */, - F88664581F4AD1EE0036D01B /* JWTAlgorithmHSBase.h in Headers */, - F886646D1F4AD1EE0036D01B /* JWTCoding+VersionOne.h in Headers */, 3221E47F2C8ABE1400268379 /* mz.h in Headers */, - F88664761F4AD1EE0036D01B /* JWTBase64Coder.h in Headers */, - F88664561F4AD1EE0036D01B /* JWTAlgorithmDataHolderChain.h in Headers */, 3221E4592C8ABE1300268379 /* mz_compat.h in Headers */, - F886644D1F4AD1EE0036D01B /* JWTAlgorithm.h in Headers */, - F88664611F4AD1EE0036D01B /* JWTCryptoSecurity.h in Headers */, 3221E48F2C8ABE1400268379 /* SSZipCommon.h in Headers */, - F88664751F4AD1EE0036D01B /* JWT.h in Headers */, - F886645D1F4AD1EE0036D01B /* JWTCryptoKey.h in Headers */, 3221E4692C8ABE1300268379 /* mz_strm.h in Headers */, 3221E4772C8ABE1300268379 /* mz_zip_rw.h in Headers */, - F886646F1F4AD1EE0036D01B /* JWTCoding+VersionThree.h in Headers */, - F88664691F4AD1EE0036D01B /* JWTClaimsSetVerifier.h in Headers */, 3221E4572C8ABE1300268379 /* mz_strm_wzaes.h in Headers */, 3221E4632C8ABE1300268379 /* mz_strm_split.h in Headers */, 3221E4752C8ABE1300268379 /* mz_strm_pkcrypt.h in Headers */, 8482F84E1E24C66300F793DB /* CodePush.h in Headers */, - F88664711F4AD1EE0036D01B /* JWTCoding+VersionTwo.h in Headers */, - F886646B1F4AD1EE0036D01B /* JWTCoding+ResultTypes.h in Headers */, 3221E4652C8ABE1300268379 /* mz_strm_buf.h in Headers */, 3221E47B2C8ABE1400268379 /* mz_zip.h in Headers */, ); @@ -736,52 +437,30 @@ files = ( 3221E47D2C8ABE1400268379 /* mz_os_posix.c in Sources */, 3221E4792C8ABE1300268379 /* mz_os.c in Sources */, - F88664621F4AD1EE0036D01B /* JWTCryptoSecurity.m in Sources */, - F88664701F4AD1EE0036D01B /* JWTCoding+VersionThree.m in Sources */, 540D20121C7684FE00D6EF41 /* CodePushUpdateUtils.m in Sources */, 3221E4812C8ABE1400268379 /* mz_strm_buf.c in Sources */, 3221E46D2C8ABE1300268379 /* mz_crypt.c in Sources */, - F886646E1F4AD1EE0036D01B /* JWTCoding+VersionOne.m in Sources */, 1BCC09A71CC19EB700DDC0DD /* RCTConvert+CodePushUpdateState.m in Sources */, - F88664661F4AD1EE0036D01B /* JWTClaimsSet.m in Sources */, 3221E4892C8ABE1400268379 /* mz_strm.c in Sources */, 1B23B9141BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m in Sources */, - F886645E1F4AD1EE0036D01B /* JWTCryptoKey.m in Sources */, 81D51F3A1B6181C2000DA084 /* CodePushConfig.m in Sources */, 3221E4732C8ABE1300268379 /* mz_compat.c in Sources */, - F886646A1F4AD1EE0036D01B /* JWTClaimsSetVerifier.m in Sources */, 3221E45B2C8ABE1300268379 /* mz_strm_zlib.c in Sources */, 3221E46B2C8ABE1300268379 /* mz_strm_mem.c in Sources */, 54FFEDE01BF550630061DD23 /* CodePushDownloadHandler.m in Sources */, 3221E4672C8ABE1300268379 /* mz_crypt_apple.c in Sources */, 3221E4912C8ABE1400268379 /* SSZipArchive.m in Sources */, - F88664551F4AD1EE0036D01B /* JWTAlgorithmDataHolder.m in Sources */, - F88664681F4AD1EE0036D01B /* JWTClaimsSetSerializer.m in Sources */, 5421FE311C58AD5A00986A55 /* CodePushTelemetryManager.m in Sources */, - F886646C1F4AD1EE0036D01B /* JWTCoding+ResultTypes.m in Sources */, 3221E46F2C8ABE1300268379 /* mz_strm_wzaes.c in Sources */, - F88664601F4AD1EE0036D01B /* JWTCryptoKeyExtractor.m in Sources */, - F88664571F4AD1EE0036D01B /* JWTAlgorithmDataHolderChain.m in Sources */, 13BE3DEE1AC21097009241FE /* CodePush.m in Sources */, - F85736771F4F03BF00C9C00A /* MF_Base64Additions.m in Sources */, - F88664641F4AD1EE0036D01B /* JWTClaim.m in Sources */, - F88664741F4AD1EE0036D01B /* JWTCoding.m in Sources */, 3221E45D2C8ABE1300268379 /* mz_zip.c in Sources */, 1B762E901C9A5E9A006EF800 /* CodePushErrorUtils.m in Sources */, - F886645B1F4AD1EE0036D01B /* JWTAlgorithmRSBase.m in Sources */, 3221E4832C8ABE1400268379 /* mz_strm_split.c in Sources */, - F886647A1F4AD1EF0036D01B /* JWTErrorDescription.m in Sources */, - F886644F1F4AD1EE0036D01B /* JWTAlgorithmFactory.m in Sources */, - F88664591F4AD1EE0036D01B /* JWTAlgorithmHSBase.m in Sources */, - F88664771F4AD1EE0036D01B /* JWTBase64Coder.m in Sources */, - F88664511F4AD1EE0036D01B /* JWTAlgorithmNone.m in Sources */, 5498D8F61D21F14100B5EB43 /* CodePushUtils.m in Sources */, 3221E4612C8ABE1300268379 /* mz_zip_rw.c in Sources */, 810D4E6D1B96935000B397E9 /* CodePushPackage.m in Sources */, 3221E4552C8ABE1300268379 /* mz_strm_pkcrypt.c in Sources */, - F88664531F4AD1EE0036D01B /* JWTAlgorithmESBase.m in Sources */, 3221E4532C8ABE1300268379 /* mz_strm_os_posix.c in Sources */, - F88664721F4AD1EE0036D01B /* JWTCoding+VersionTwo.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -936,7 +615,6 @@ "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../../react-native/React/**", - "$(SRC_ROOT)/JWT/**", ); IPHONEOS_DEPLOYMENT_TARGET = 15.5; LIBRARY_SEARCH_PATHS = "$(inherited)"; @@ -965,7 +643,6 @@ "$(inherited)", /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, "$(SRCROOT)/../../react-native/React/**", - "$(SRC_ROOT)/JWT/**", ); IPHONEOS_DEPLOYMENT_TARGET = 15.5; LIBRARY_SEARCH_PATHS = "$(inherited)"; @@ -988,12 +665,30 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_TESTABILITY = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + HAVE_INTTYPES_H, + HAVE_PKCRYPT, + HAVE_STDINT_H, + HAVE_WZAES, + HAVE_ZLIB, + ZLIB_COMPAT, + ); GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../../react-native/React/**", + ); + LIBRARY_SEARCH_PATHS = "$(inherited)"; + OTHER_LDFLAGS = ( + "-ObjC", + "-lz", + ); PRODUCT_NAME = CodePush; SDKROOT = appletvos; SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 10.2; + TVOS_DEPLOYMENT_TARGET = 12.0; }; name = Debug; }; @@ -1007,12 +702,30 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + HAVE_INTTYPES_H, + HAVE_PKCRYPT, + HAVE_STDINT_H, + HAVE_WZAES, + HAVE_ZLIB, + ZLIB_COMPAT, + ); GCC_NO_COMMON_BLOCKS = YES; - OTHER_LDFLAGS = "-ObjC"; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../../react-native/React/**", + ); + LIBRARY_SEARCH_PATHS = "$(inherited)"; + OTHER_LDFLAGS = ( + "-ObjC", + "-lz", + ); PRODUCT_NAME = CodePush; SDKROOT = appletvos; SKIP_INSTALL = YES; - TVOS_DEPLOYMENT_TARGET = 10.2; + TVOS_DEPLOYMENT_TARGET = 12.0; }; name = Release; }; diff --git a/ios/CodePush/Base64/Base64/MF_Base64Additions.h b/ios/CodePush/Base64/Base64/MF_Base64Additions.h deleted file mode 100644 index ede8b510d..000000000 --- a/ios/CodePush/Base64/Base64/MF_Base64Additions.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// MF_Base64Additions.h -// Base64 -- RFC 4648 compatible implementation -// see http://www.ietf.org/rfc/rfc4648.txt for more details -// -// Designed to be compiled with Automatic Reference Counting -// -// Created by Dave Poirier on 2012-06-14. -// Public Domain -// Hosted at https://github.com/ekscrypto/Base64 -// - -#import - -@interface NSString (Base64Addition) -+(NSString *)stringFromBase64String:(NSString *)base64String; -+(NSString *)stringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString; --(NSString *)base64String; --(NSString *)base64UrlEncodedString; -@end - -@interface NSData (Base64Addition) -+(NSData *)dataWithBase64String:(NSString *)base64String; -+(NSData *)dataWithBase64UrlEncodedString:(NSString *)base64UrlEncodedString; --(NSString *)base64String; --(NSString *)base64UrlEncodedString; -@end - -@interface MF_Base64Codec : NSObject -+(NSData *)dataFromBase64String:(NSString *)base64String; -+(NSString *)base64StringFromData:(NSData *)data; -+(NSString *)base64UrlEncodedStringFromBase64String:(NSString *)base64String; -+(NSString *)base64StringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString; -@end diff --git a/ios/CodePush/Base64/Base64/MF_Base64Additions.m b/ios/CodePush/Base64/Base64/MF_Base64Additions.m deleted file mode 100644 index f4ee5ad50..000000000 --- a/ios/CodePush/Base64/Base64/MF_Base64Additions.m +++ /dev/null @@ -1,252 +0,0 @@ -// -// MF_Base64Additions.m -// Base64 -- RFC 4648 compatible implementation -// see http://www.ietf.org/rfc/rfc4648.txt for more details -// -// Designed to be compiled with Automatic Reference Counting -// -// Created by Dave Poirier on 2012-06-14. -// Public Domain -// Hosted at https://github.com/ekscrypto/Base64 -// - -#import "MF_Base64Additions.h" - -@implementation MF_Base64Codec - -+(NSString *)base64StringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString -{ - NSString *s = base64UrlEncodedString; - s = [s stringByReplacingOccurrencesOfString:@"-" withString:@"+"]; - s = [s stringByReplacingOccurrencesOfString:@"_" withString:@"/"]; - switch (s.length % 4) { - case 2: - s = [s stringByAppendingString:@"=="]; - break; - case 3: - s = [s stringByAppendingString:@"="]; - break; - default: - break; - } - return s; -} - -+(NSString *)base64UrlEncodedStringFromBase64String:(NSString *)base64String -{ - NSString *s = base64String; - s = [s stringByReplacingOccurrencesOfString:@"=" withString:@""]; - s = [s stringByReplacingOccurrencesOfString:@"+" withString:@"-"]; - s = [s stringByReplacingOccurrencesOfString:@"/" withString:@"_"]; - return s; -} - -+(NSData *)dataFromBase64String:(NSString *)encoding -{ - NSData *data = nil; - unsigned char *decodedBytes = NULL; - @try { -#define __ 255 - static char decodingTable[256] = { - __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x00 - 0x0F - __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x10 - 0x1F - __,__,__,__, __,__,__,__, __,__,__,62, __,__,__,63, // 0x20 - 0x2F - 52,53,54,55, 56,57,58,59, 60,61,__,__, __, 0,__,__, // 0x30 - 0x3F - __, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, // 0x40 - 0x4F - 15,16,17,18, 19,20,21,22, 23,24,25,__, __,__,__,__, // 0x50 - 0x5F - __,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, // 0x60 - 0x6F - 41,42,43,44, 45,46,47,48, 49,50,51,__, __,__,__,__, // 0x70 - 0x7F - __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x80 - 0x8F - __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0x90 - 0x9F - __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xA0 - 0xAF - __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xB0 - 0xBF - __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xC0 - 0xCF - __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xD0 - 0xDF - __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xE0 - 0xEF - __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__, // 0xF0 - 0xFF - }; - encoding = [encoding stringByReplacingOccurrencesOfString:@"=" withString:@""]; - NSData *encodedData = [encoding dataUsingEncoding:NSASCIIStringEncoding]; - unsigned char *encodedBytes = (unsigned char *)[encodedData bytes]; - - NSUInteger encodedLength = [encodedData length]; - if( encodedLength >= (NSUIntegerMax - 3) ) return nil; // NSUInteger overflow check - NSUInteger encodedBlocks = (encodedLength+3) >> 2; - NSUInteger expectedDataLength = encodedBlocks * 3; - - unsigned char decodingBlock[4]; - - decodedBytes = malloc(expectedDataLength); - if( decodedBytes != NULL ) { - - NSUInteger i = 0; - NSUInteger j = 0; - NSUInteger k = 0; - unsigned char c; - while( i < encodedLength ) { - c = decodingTable[encodedBytes[i]]; - i++; - if( c != __ ) { - decodingBlock[j] = c; - j++; - if( j == 4 ) { - decodedBytes[k] = (decodingBlock[0] << 2) | (decodingBlock[1] >> 4); - decodedBytes[k+1] = (decodingBlock[1] << 4) | (decodingBlock[2] >> 2); - decodedBytes[k+2] = (decodingBlock[2] << 6) | (decodingBlock[3]); - j = 0; - k += 3; - } - } - } - - // Process left over bytes, if any - if( j == 3 ) { - decodedBytes[k] = (decodingBlock[0] << 2) | (decodingBlock[1] >> 4); - decodedBytes[k+1] = (decodingBlock[1] << 4) | (decodingBlock[2] >> 2); - k += 2; - } else if( j == 2 ) { - decodedBytes[k] = (decodingBlock[0] << 2) | (decodingBlock[1] >> 4); - k += 1; - } - data = [[NSData alloc] initWithBytes:decodedBytes length:k]; - } - } - @catch (NSException *exception) { - data = nil; - NSLog(@"WARNING: error occured while decoding base 32 string: %@", exception); - } - @finally { - if( decodedBytes != NULL ) { - free( decodedBytes ); - } - } - return data; -} -+(NSString *)base64StringFromData:(NSData *)data -{ - NSString *encoding = nil; - unsigned char *encodingBytes = NULL; - @try { - static char encodingTable[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - static NSUInteger paddingTable[] = {0,2,1}; - // Table 1: The Base 64 Alphabet - // - // Value Encoding Value Encoding Value Encoding Value Encoding - // 0 A 17 R 34 i 51 z - // 1 B 18 S 35 j 52 0 - // 2 C 19 T 36 k 53 1 - // 3 D 20 U 37 l 54 2 - // 4 E 21 V 38 m 55 3 - // 5 F 22 W 39 n 56 4 - // 6 G 23 X 40 o 57 5 - // 7 H 24 Y 41 p 58 6 - // 8 I 25 Z 42 q 59 7 - // 9 J 26 a 43 r 60 8 - // 10 K 27 b 44 s 61 9 - // 11 L 28 c 45 t 62 + - // 12 M 29 d 46 u 63 / - // 13 N 30 e 47 v - // 14 O 31 f 48 w (pad) = - // 15 P 32 g 49 x - // 16 Q 33 h 50 y - - NSUInteger dataLength = [data length]; - NSUInteger encodedBlocks = dataLength / 3; - if( (encodedBlocks + 1) >= (NSUIntegerMax / 4) ) return nil; // NSUInteger overflow check - NSUInteger padding = paddingTable[dataLength % 3]; - if( padding > 0 ) encodedBlocks++; - NSUInteger encodedLength = encodedBlocks * 4; - - encodingBytes = malloc(encodedLength); - if( encodingBytes != NULL ) { - NSUInteger rawBytesToProcess = dataLength; - NSUInteger rawBaseIndex = 0; - NSUInteger encodingBaseIndex = 0; - unsigned char *rawBytes = (unsigned char *)[data bytes]; - unsigned char rawByte1, rawByte2, rawByte3; - while( rawBytesToProcess >= 3 ) { - rawByte1 = rawBytes[rawBaseIndex]; - rawByte2 = rawBytes[rawBaseIndex+1]; - rawByte3 = rawBytes[rawBaseIndex+2]; - encodingBytes[encodingBaseIndex] = encodingTable[((rawByte1 >> 2) & 0x3F)]; - encodingBytes[encodingBaseIndex+1] = encodingTable[((rawByte1 << 4) & 0x30) | ((rawByte2 >> 4) & 0x0F) ]; - encodingBytes[encodingBaseIndex+2] = encodingTable[((rawByte2 << 2) & 0x3C) | ((rawByte3 >> 6) & 0x03) ]; - encodingBytes[encodingBaseIndex+3] = encodingTable[(rawByte3 & 0x3F)]; - - rawBaseIndex += 3; - encodingBaseIndex += 4; - rawBytesToProcess -= 3; - } - rawByte2 = 0; - switch (dataLength-rawBaseIndex) { - case 2: - rawByte2 = rawBytes[rawBaseIndex+1]; - case 1: - rawByte1 = rawBytes[rawBaseIndex]; - encodingBytes[encodingBaseIndex] = encodingTable[((rawByte1 >> 2) & 0x3F)]; - encodingBytes[encodingBaseIndex+1] = encodingTable[((rawByte1 << 4) & 0x30) | ((rawByte2 >> 4) & 0x0F) ]; - encodingBytes[encodingBaseIndex+2] = encodingTable[((rawByte2 << 2) & 0x3C) ]; - // we can skip rawByte3 since we have a partial block it would always be 0 - break; - } - // compute location from where to begin inserting padding, it may overwrite some bytes from the partial block encoding - // if their value was 0 (cases 1-2). - encodingBaseIndex = encodedLength - padding; - while( padding-- > 0 ) { - encodingBytes[encodingBaseIndex++] = '='; - } - encoding = [[NSString alloc] initWithBytes:encodingBytes length:encodedLength encoding:NSASCIIStringEncoding]; - } - } - @catch (NSException *exception) { - encoding = nil; - NSLog(@"WARNING: error occured while tring to encode base 32 data: %@", exception); - } - @finally { - if( encodingBytes != NULL ) { - free( encodingBytes ); - } - } - return encoding; -} -@end - -@implementation NSString (Base64Addition) --(NSString *)base64String -{ - NSData *utf8encoding = [self dataUsingEncoding:NSUTF8StringEncoding]; - return [MF_Base64Codec base64StringFromData:utf8encoding]; -} --(NSString *)base64UrlEncodedString -{ - return [MF_Base64Codec base64UrlEncodedStringFromBase64String:[self base64String]]; -} -+(NSString *)stringFromBase64String:(NSString *)base64String -{ - NSData *utf8encoding = [MF_Base64Codec dataFromBase64String:base64String]; - return [[NSString alloc] initWithData:utf8encoding encoding:NSUTF8StringEncoding]; -} -+(NSString *)stringFromBase64UrlEncodedString:(NSString *)base64UrlEncodedString -{ - return [self stringFromBase64String:[MF_Base64Codec base64StringFromBase64UrlEncodedString:base64UrlEncodedString]]; -} -@end - -@implementation NSData (Base64Addition) -+(NSData *)dataWithBase64String:(NSString *)base64String -{ - return [MF_Base64Codec dataFromBase64String:base64String]; -} -+(NSData *)dataWithBase64UrlEncodedString:(NSString *)base64UrlEncodedString -{ - return [self dataWithBase64String:[MF_Base64Codec base64StringFromBase64UrlEncodedString:base64UrlEncodedString]]; -} --(NSString *)base64String -{ - return [MF_Base64Codec base64StringFromData:self]; -} --(NSString *)base64UrlEncodedString -{ - return [MF_Base64Codec base64UrlEncodedStringFromBase64String:[self base64String]]; -} -@end \ No newline at end of file diff --git a/ios/CodePush/Base64/README.md b/ios/CodePush/Base64/README.md deleted file mode 100644 index 4921449b0..000000000 --- a/ios/CodePush/Base64/README.md +++ /dev/null @@ -1,47 +0,0 @@ -[![CI Status](https://travis-ci.org/ekscrypto/Base64.svg?branch=master)](https://github.com/ekscrypto/Base64) - -Base64 Additions for Objective-C on Mac OS X and iOS -======= - - -Usage ----- -Open the Xcode project file, and drag MF_Base64Additions.m/.h into your project. - -In files where you want to use Base64 encoding/decoding, simply include the header file and use one of the provided NSData or NSString additions. - -Example use: - #import "MF_Base64Additions.h" - - NSString *helloWorld = @"Hello World"; - NSString *helloInBase64 = [helloWorld base64String]; - NSString *helloDecoded = [NSString stringFromBase64String:helloInBase64]; - - - - -Performance ----- -* Encoding: Approximately 4 to 5 times faster than using the equivalent SecTransform. -* Encoding: 30% faster than https://github.com/l4u/NSData-Base64 -* Decoding: 5% faster than using the equivalent SecTransform. -* Decoding: 5% faster than https://github.com/l4u/NSData-Base64 - - - -Requirements ------ -* Compile with Automatic Reference Counting -* Compatible with Mac OSX 10.6+ and iOS 4.0+ - - - -Implementation ----- -* Implemented as per RFC 4648, see http://www.ietf.org/rfc/rfc4648.txt for more details. - - - -Licensing ----- -* Public Domain diff --git a/ios/CodePush/CodePushUpdateUtils.m b/ios/CodePush/CodePushUpdateUtils.m index e0f170b71..a7a3a65f2 100644 --- a/ios/CodePush/CodePushUpdateUtils.m +++ b/ios/CodePush/CodePushUpdateUtils.m @@ -1,6 +1,13 @@ #import "CodePush.h" #include + +#if __has_include() +#import +#elif __has_include() +#import +#else #import "JWT.h" +#endif @implementation CodePushUpdateUtils diff --git a/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h b/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h deleted file mode 100644 index 0e603a878..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +++ /dev/null @@ -1,69 +0,0 @@ -// -// JWTAlgorithm.h -// JWT -// -// Created by Klaas Pieter Annema on 31-05-13. -// Copyright (c) 2013 Karma. All rights reserved. -// - -#import -#import "JWTDeprecations.h" - -@protocol JWTAlgorithm - -@required -/** - Signs data using provided secret data. - @param hash The data to sign. - @param key The secret to use for signing. - @param error The inout error. - */ -- (NSData *)signHash:(NSData *)hash key:(NSData *)key error:(NSError *__autoreleasing*)error; -/** - Verifies data using. - @param hash The data to sign. - @param signature The secret to use for signing. - @param error The inout error. - */ -- (BOOL)verifyHash:(NSData *)hash signature:(NSData *)signature key:(NSData *)key error:(NSError *__autoreleasing*)error; - -//@required - -@property (nonatomic, readonly, copy) NSString *name; - -/** - Encodes and encrypts the provided payload using the provided secret key - @param theString The string to encode - @param theSecret The secret to use for encryption - @return An NSData object containing the encrypted payload, or nil if something went wrong. - */ -- (NSData *)encodePayload:(NSString *)theString withSecret:(NSString *)theSecret __deprecated_and_will_be_removed_in_release_version(JWTVersion_3_0_0); - -/** - Verifies the provided signature using the signed input and verification key - @param input The header and payload encoded string - @param signature The JWT provided signature - @param verificationKey The key to use for verifying the signature - @return YES if the provided signature is valid, NO otherwise - */ -- (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature verificationKey:(NSString *)verificationKey __deprecated_and_will_be_removed_in_release_version(JWTVersion_3_0_0); - -@optional - -/** - Encodes and encrypts the provided payload using the provided secret key - @param theStringData The data to encode - @param theSecretData The secret data to use for encryption - @return An NSData object containing the encrypted payload, or nil if something went wrong. - */ -- (NSData *)encodePayloadData:(NSData *)theStringData withSecret:(NSData *)theSecretData; - -/** - Verifies the provided signature using the signed input and verification key (as data) - @param input The header and payload encoded string - @param signature The JWT provided signature - @param verificationKeyData The key data to use for verifying the signature - @return YES if the provided signature is valid, NO otherwise - */ -- (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature verificationKeyData:(NSData *)verificationKeyData; -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h b/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h deleted file mode 100644 index 2ce9b64ba..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// JWTAlgorithmFactory.h -// JWT -// -// Created by Lobanov Dmitry on 07.10.15. -// Copyright © 2015 Karma. All rights reserved. -// - -#import -#import "JWTAlgorithm.h" -@interface JWTAlgorithmFactory : NSObject - -+ (NSArray *)algorithms; -+ (id)algorithmByName:(NSString *)name; - -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m b/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m deleted file mode 100644 index 99da813c7..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +++ /dev/null @@ -1,51 +0,0 @@ -// -// JWTAlgorithmFactory.m -// JWT -// -// Created by Lobanov Dmitry on 07.10.15. -// Copyright © 2015 Karma. All rights reserved. -// - -#import "JWTAlgorithmFactory.h" -#import "JWTAlgorithmHSBase.h" -#import "JWTAlgorithmRSBase.h" -#import "JWTAlgorithmNone.h" - -// not implemented. -NSString *const JWTAlgorithmNameES256 = @"ES256"; -NSString *const JWTAlgorithmNameES384 = @"ES384"; -NSString *const JWTAlgorithmNameES512 = @"ES512"; - -@implementation JWTAlgorithmFactory - -+ (NSArray *)algorithms { - return @[ - [JWTAlgorithmNone new], - [JWTAlgorithmHSBase algorithm256], - [JWTAlgorithmHSBase algorithm384], - [JWTAlgorithmHSBase algorithm512], - [JWTAlgorithmRSBase algorithm256], - [JWTAlgorithmRSBase algorithm384], - [JWTAlgorithmRSBase algorithm512] - ]; - -} - -+ (id)algorithmByName:(NSString *)name { - id algorithm = nil; - - NSString *algName = [name copy]; - - NSUInteger index = [[self algorithms] indexOfObjectPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) { - // lowercase comparison - return [obj.name.lowercaseString isEqualToString:algName.lowercaseString]; - }]; - - if (index != NSNotFound) { - algorithm = [self algorithms][index]; - } - - return algorithm; -} - -@end \ No newline at end of file diff --git a/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h b/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h deleted file mode 100644 index f8828e170..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// JWTAlgorithmNone.h -// JWT -// -// Created by Lobanov Dmitry on 16.10.15. -// Copyright © 2015 Karma. All rights reserved. -// - -#import -#import "JWTAlgorithm.h" -extern NSString *const JWTAlgorithmNameNone; - -@interface JWTAlgorithmNone : NSObject - -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m b/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m deleted file mode 100644 index ffed9aa54..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +++ /dev/null @@ -1,55 +0,0 @@ -// -// JWTAlgorithmNone.m -// JWT -// -// Created by Lobanov Dmitry on 16.10.15. -// Copyright © 2015 Karma. All rights reserved. -// - -#import "JWTAlgorithmNone.h" -NSString *const JWTAlgorithmNameNone = @"none"; - -@implementation JWTAlgorithmNone - -- (NSString *)name { - return JWTAlgorithmNameNone; -} - -- (NSData *)signHash:(NSData *)hash key:(NSData *)key error:(NSError *__autoreleasing *)error { - return [NSData data]; -} - -- (BOOL)verifyHash:(NSData *)hash signature:(NSData *)signature key:(NSData *)key error:(NSError *__autoreleasing *)error { - //if a secret is provided, this isn't the None algorithm - if (key && key.length > 0) { - return NO; - } - - //If the signature isn't blank, this isn't the None algorithm - if (signature && signature.length > 0) { - return NO; - } - - return YES; -} - -- (NSData *)encodePayload:(NSString *)theString withSecret:(NSString *)theSecret { - return [self encodePayloadData:[theSecret dataUsingEncoding:NSUTF8StringEncoding] withSecret:[theSecret dataUsingEncoding:NSUTF8StringEncoding]]; -} - -- (NSData *)encodePayloadData:(NSData *)theStringData withSecret:(NSData *)theSecretData -{ - return [self signHash:theStringData key:theSecretData error:nil]; -} - -- (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature verificationKey:(NSString *)verificationKey -{ - return [self verifySignedInput:input withSignature:signature verificationKeyData:verificationKey]; -} - -- (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature verificationKeyData:(NSData *)verificationKeyData -{ - return [self verifyHash:[input dataUsingEncoding:NSUTF8StringEncoding] signature:[signature dataUsingEncoding:NSUTF8StringEncoding] key:verificationKeyData error:nil]; -} - -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h b/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h deleted file mode 100644 index fb9984a79..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// JWTAlgorithmESBase.h -// Pods -// -// Created by Lobanov Dmitry on 12.02.17. -// -// - -#import -#import "JWTRSAlgorithm.h" -extern NSString *const JWTAlgorithmNameES256; -extern NSString *const JWTAlgorithmNameES384; -extern NSString *const JWTAlgorithmNameES512; -@interface JWTAlgorithmESBase : NSObject @end - -@interface JWTAlgorithmESBase (JWTAsymmetricKeysAlgorithm) @end - -@interface JWTAlgorithmESBase (Create) - -+ (instancetype)algorithm256; -+ (instancetype)algorithm384; -+ (instancetype)algorithm512; - -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m b/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m deleted file mode 100644 index 908547394..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +++ /dev/null @@ -1,41 +0,0 @@ -// -// JWTAlgorithmESBase.m -// Pods -// -// Created by Lobanov Dmitry on 12.02.17. -// -// - -#import "JWTAlgorithmESBase.h" -#import -@interface JWTAlgorithmESBase () - -@end -@implementation JWTAlgorithmESBase -@synthesize keyExtractorType; -@synthesize signKey; -@synthesize verifyKey; -@end - -// thanks! https://github.com/soyersoyer/SwCrypt -@interface JWTAlgorithmESBase (ImportKeys) -- (void)importKey; -//importKey(publicKey, format: .importKeyBinary, keyType: .keyPublic) -@end -@implementation JWTAlgorithmESBase (ImportKeys) -- (void)importKey { - return; -} -@end - -@implementation JWTAlgorithmESBase (JWTAsymmetricKeysAlgorithm) -- (NSString *)name { - return @"ESBase"; -} -- (NSData *)signHash:(NSData *)hash key:(NSData *)key error:(NSError *__autoreleasing *)error { - return nil; -} -- (BOOL)verifyHash:(NSData *)hash signature:(NSData *)signature key:(NSData *)key error:(NSError *__autoreleasing *)error { - return NO; -} -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h b/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h deleted file mode 100644 index 84367cba9..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// JWTAlgorithmHSBase.h -// JWT -// -// Created by Lobanov Dmitry on 13.03.16. -// Copyright © 2016 Karma. All rights reserved. -// - -#import -#import "JWTAlgorithm.h" -extern NSString *const JWTAlgorithmNameHS256; -extern NSString *const JWTAlgorithmNameHS384; -extern NSString *const JWTAlgorithmNameHS512; - -@interface JWTAlgorithmHSBase : NSObject - -@property (assign, nonatomic, readonly) size_t ccSHANumberDigestLength; -@property (assign, nonatomic, readonly) uint32_t ccHmacAlgSHANumber; - -@end - -@interface JWTAlgorithmHSBase (Create) - -+ (instancetype)algorithm256; -+ (instancetype)algorithm384; -+ (instancetype)algorithm512; - -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m b/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m deleted file mode 100644 index e687aef7a..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +++ /dev/null @@ -1,205 +0,0 @@ -// -// JWTAlgorithmHSBase.m -// JWT -// -// Created by Lobanov Dmitry on 13.03.16. -// Copyright © 2016 Karma. All rights reserved. -// - -#import "JWTAlgorithmHSBase.h" -#import "JWTBase64Coder.h" -#import -#import - -NSString *const JWTAlgorithmNameHS256 = @"HS256"; -NSString *const JWTAlgorithmNameHS384 = @"HS384"; -NSString *const JWTAlgorithmNameHS512 = @"HS512"; - -@interface JWTAlgorithmHSBase () @end - -@implementation JWTAlgorithmHSBase - -- (size_t)ccSHANumberDigestLength { - @throw [[NSException alloc] initWithName:NSInternalInconsistencyException reason:@"ccSHANumberDigestLength property should be overriden" userInfo:nil]; -} - -- (uint32_t)ccHmacAlgSHANumber { - @throw [[NSException alloc] initWithName:NSInternalInconsistencyException reason:@"ccHmacAlgSHANumber property should be overriden" userInfo:nil]; -} - -- (NSData *)signHash:(NSData *)hash key:(NSData *)key error:(NSError *__autoreleasing *)error { - size_t amount = self.ccSHANumberDigestLength; - size_t fullSize = amount * sizeof(unsigned char); - unsigned char* cHMAC = malloc(fullSize); - CCHmacAlgorithm ccAlg = self.ccHmacAlgSHANumber; - - CCHmac(ccAlg, key.bytes, key.length, hash.bytes, hash.length, cHMAC); - - NSData *result = [[NSData alloc] initWithBytes:cHMAC length:fullSize]; - free(cHMAC); - return result; -} - -- (BOOL)verifyHash:(NSData *)hash signature:(NSData *)signature key:(NSData *)key error:(NSError *__autoreleasing *)error { - NSData *expectedSignatureData = [self signHash:hash key:key error:error]; - return [expectedSignatureData isEqualToData:signature]; -} - -- (NSString *)name; -{ - return @"HSBase"; -} - -- (NSData *)encodePayload:(NSString *)theString withSecret:(NSString *)theSecret; -{ - NSData *inputData = [theString dataUsingEncoding:NSUTF8StringEncoding]; - NSData *secretData = [theSecret dataUsingEncoding:NSUTF8StringEncoding]; - //[JWTBase64Coder dataWithBase64UrlEncodedString:theSecret]; - return [self encodePayloadData:inputData withSecret:secretData]; -// const char *cString = [theString cStringUsingEncoding:NSUTF8StringEncoding]; -// const char *cSecret = [theSecret cStringUsingEncoding:NSUTF8StringEncoding]; -// -// size_t amount = self.ccSHANumberDigestLength; -// size_t fullSize = amount * sizeof(unsigned char); -// unsigned char* cHMAC = malloc(fullSize); -// CCHmacAlgorithm ccAlg = self.ccHmacAlgSHANumber; -// -// CCHmac(ccAlg, cSecret, strlen(cSecret), cString, strlen(cString), cHMAC); -// -// NSData *returnData = [[NSData alloc] initWithBytes:cHMAC length:fullSize]; -// free(cHMAC); -// return returnData; -} - -- (NSData *)encodePayloadData:(NSData *)theStringData withSecret:(NSData *)theSecretData -{ - return [self signHash:theStringData key:theSecretData error:nil]; -// size_t amount = self.ccSHANumberDigestLength; -// size_t fullSize = amount * sizeof(unsigned char); -// unsigned char* cHMAC = malloc(fullSize); -// CCHmacAlgorithm ccAlg = self.ccHmacAlgSHANumber; -// -// CCHmac(ccAlg, theSecretData.bytes, [theSecretData length], theStringData.bytes, [theStringData length], cHMAC); -// -// NSData *returnData = [[NSData alloc] initWithBytes:cHMAC length:fullSize]; -// free(cHMAC); -// return returnData; -} - -- (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature verificationKey:(NSString *)verificationKey -{ - NSData *verificationKeyData = [verificationKey dataUsingEncoding:NSUTF8StringEncoding]; - return [self verifySignedInput:input withSignature:signature verificationKeyData:verificationKeyData]; -// NSData *expectedSignatureData = [self encodePayload:input withSecret:verificationKey]; -// NSString *expectedSignature = [JWTBase64Coder base64UrlEncodedStringWithData:expectedSignatureData]; -// -// return [expectedSignature isEqualToString:signature]; -} - -- (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature verificationKeyData:(NSData *)verificationKeyData { - NSData *signatureData = [JWTBase64Coder dataWithBase64UrlEncodedString:signature]; - NSData *inputData = [input dataUsingEncoding:NSUTF8StringEncoding];//[JWTBase64Coder dataWithBase64UrlEncodedString:input]; - return [self verifyHash:inputData signature:signatureData key:verificationKeyData error:nil ]; -// const char *cString = [input cStringUsingEncoding:NSUTF8StringEncoding]; -// NSData *inputData = [NSData dataWithBytes:cString length:strlen(cString)]; -// -// NSData *expectedSignatureData = [self encodePayloadData:inputData withSecret:verificationKeyData]; -// NSString *expectedSignature = [JWTBase64Coder base64UrlEncodedStringWithData:expectedSignatureData]; -// -// return [expectedSignature isEqualToString:signature]; -} - -@end - -@interface JWTAlgorithmHSFamilyMember : JWTAlgorithmHSBase @end -@implementation JWTAlgorithmHSFamilyMember @end - -@interface JWTAlgorithmHS256 : JWTAlgorithmHSBase @end -@interface JWTAlgorithmHS384 : JWTAlgorithmHSBase @end -@interface JWTAlgorithmHS512 : JWTAlgorithmHSBase @end - -@implementation JWTAlgorithmHS256 - -- (size_t)ccSHANumberDigestLength { - return CC_SHA256_DIGEST_LENGTH; -} - -- (uint32_t)ccHmacAlgSHANumber { - return kCCHmacAlgSHA256; -} - -- (NSString *)name { - return @"HS256"; -} - -@end - -@implementation JWTAlgorithmHS384 - -- (size_t)ccSHANumberDigestLength { - return CC_SHA384_DIGEST_LENGTH; -} - -- (uint32_t)ccHmacAlgSHANumber { - return kCCHmacAlgSHA384; -} - -- (NSString *)name { - return @"HS384"; -} - -@end - -@implementation JWTAlgorithmHS512 - -- (size_t)ccSHANumberDigestLength { - return CC_SHA512_DIGEST_LENGTH; -} - -- (uint32_t)ccHmacAlgSHANumber { - return kCCHmacAlgSHA512; -} - -- (NSString *)name { - return @"HS512"; -} - -@end - -@interface JWTAlgorithmHSFamilyMemberMutable : JWTAlgorithmHSFamilyMember -@property (assign, nonatomic, readwrite) size_t ccSHANumberDigestLength; -@property (assign, nonatomic, readwrite) uint32_t ccHmacAlgSHANumber; -@property (copy, nonatomic, readwrite) NSString *name; -@end - -@implementation JWTAlgorithmHSFamilyMemberMutable - -@synthesize ccSHANumberDigestLength = _ccSHANumberDigestLength; -@synthesize ccHmacAlgSHANumber = _ccHmacAlgSHANumber; -@synthesize name = _name; - -- (size_t)ccSHANumberDigestLength { - return _ccSHANumberDigestLength; -} - -- (uint32_t)ccHmacAlgSHANumber { - return _ccHmacAlgSHANumber; -} - -@end - -@implementation JWTAlgorithmHSBase (Create) - -+ (instancetype)algorithm256 { - return [JWTAlgorithmHS256 new]; -} - -+ (instancetype)algorithm384 { - return [JWTAlgorithmHS384 new]; -} - -+ (instancetype)algorithm512 { - return [JWTAlgorithmHS512 new]; -} - -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h b/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h deleted file mode 100644 index f105dad87..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +++ /dev/null @@ -1,103 +0,0 @@ -// -// JWTAlgorithmDataHolder.h -// JWT -// -// Created by Lobanov Dmitry on 31.08.16. -// Copyright © 2016 Karma. All rights reserved. -// - -#import -#import "JWTAlgorithm.h" -#import "JWTDeprecations.h" -#import "JWTBase64Coder.h" - -// TODO: available in 3.0 -// All methods with secret as NSString in algorithms will be deprecated or removed. - -@protocol JWTAlgorithmDataHolderProtocol -/** - The verification key to use when encoding/decoding a JWT in data form - */ -@property (copy, nonatomic, readwrite) NSData *internalSecretData; - -/** - The to use for encoding a JWT - */ -@property (strong, nonatomic, readwrite) id internalAlgorithm; - -/** - The string coder. It converts data to string and vice versa. - */ -@property (strong, nonatomic, readwrite) id internalStringCoder; -@end - -@interface JWTAlgorithmBaseDataHolder : NSObject - -#pragma mark - Getters -/** - The verification key to use when encoding/decoding a JWT - */ -@property (copy, nonatomic, readonly) NSString *internalSecret; - -/** - The algorithm name to use for decoding the JWT. Required unless force decode is true - */ -@property (copy, nonatomic, readonly) NSString *internalAlgorithmName; - -#pragma mark - Setters -/** - Sets jwtSecret and returns the JWTAlgorithmBaseDataHolder to allow for method chaining - */ -@property (copy, nonatomic, readonly) JWTAlgorithmBaseDataHolder *(^secret)(NSString *secret); - -/** - Sets jwtSecretData and returns the JWTAlgorithmBaseDataHolder to allow for method chaining - */ -@property (copy, nonatomic, readonly) JWTAlgorithmBaseDataHolder *(^secretData)(NSData *secretData); - -/** - Sets jwtAlgorithm and returns the JWTAlgorithmBaseDataHolder to allow for method chaining - */ -@property (copy, nonatomic, readonly) JWTAlgorithmBaseDataHolder *(^algorithm)(idalgorithm); - -/** - Sets jwtAlgorithmName and returns the JWTAlgorithmBaseDataHolder to allow for method chaining. See list of names in appropriate headers. - */ -@property (copy, nonatomic, readonly) JWTAlgorithmBaseDataHolder *(^algorithmName)(NSString *algorithmName); - -/** - Sets stringCoder and returns the JWTAlgorithmBaseDataHolder to allow for method chaining. See list of names in appropriate headers. - */ -@property (copy, nonatomic, readonly) JWTAlgorithmBaseDataHolder *(^stringCoder)(id stringCoder); -@end - -@protocol JWTAlgorithmDataHolderCreateProtocol - -+ (instancetype)createWithAlgorithm256; -+ (instancetype)createWithAlgorithm384; -+ (instancetype)createWithAlgorithm512; - -@end - -@interface JWTAlgorithmNoneDataHolder : JWTAlgorithmBaseDataHolder @end -@interface JWTAlgorithmHSFamilyDataHolder : JWTAlgorithmBaseDataHolder -@end -@protocol JWTCryptoKeyProtocol; -@interface JWTAlgorithmRSFamilyDataHolder : JWTAlgorithmBaseDataHolder -#pragma mark - Getters -/** - The passphrase for the PKCS12 blob, which represents the certificate containing the private key for the RS algorithms. - */ -@property (copy, nonatomic, readonly) NSString *internalPrivateKeyCertificatePassphrase; -@property (copy, nonatomic, readonly) NSString *internalKeyExtractorType; -@property (strong, nonatomic, readonly) id internalSignKey; -@property (strong, nonatomic, readonly) id internalVerifyKey; -#pragma mark - Setters -/** - Sets jwtPrivateKeyCertificatePassphrase and returns the JWTAlgorithmRSFamilyDataHolder to allow for method chaining - */ -@property (copy, nonatomic, readonly) JWTAlgorithmRSFamilyDataHolder *(^privateKeyCertificatePassphrase)(NSString *privateKeyCertificatePassphrase); -@property (copy, nonatomic, readonly) JWTAlgorithmRSFamilyDataHolder *(^keyExtractorType)(NSString *keyExtractorType); -@property (copy, nonatomic, readonly) JWTAlgorithmRSFamilyDataHolder *(^signKey)(id signKey); -@property (copy, nonatomic, readonly) JWTAlgorithmRSFamilyDataHolder *(^verifyKey)(id verifyKey); -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m b/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m deleted file mode 100644 index 6eb530145..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +++ /dev/null @@ -1,322 +0,0 @@ -// -// JWTAlgorithmDataHolder.m -// JWT -// -// Created by Lobanov Dmitry on 31.08.16. -// Copyright © 2016 Karma. All rights reserved. -// - -#import "JWTAlgorithmDataHolder.h" -#import "JWTAlgorithmFactory.h" -#import "JWTAlgorithmNone.h" -#import "JWTRSAlgorithm.h" -#import "JWTAlgorithmHSBase.h" -#import "JWTAlgorithmRSBase.h" -#import "JWTBase64Coder.h" - -@interface JWTAlgorithmBaseDataHolder() -// not needed by algorithm adoption. -// @property (copy, nonatomic, readwrite) NSData *internalSecretData; -// @property (strong, nonatomic, readwrite) id internalAlgorithm; - -#pragma mark - Setters -/** - Sets jwtSecret and returns the JWTAlgorithmBaseDataHolder to allow for method chaining - */ -@property (copy, nonatomic, readwrite) JWTAlgorithmBaseDataHolder *(^secret)(NSString *secret); - -/** - Sets jwtSecretData and returns the JWTAlgorithmBaseDataHolder to allow for method chaining - */ -@property (copy, nonatomic, readwrite) JWTAlgorithmBaseDataHolder *(^secretData)(NSData *secretData); - -/** - Sets jwtAlgorithm and returns the JWTAlgorithmBaseDataHolder to allow for method chaining - */ -@property (copy, nonatomic, readwrite) JWTAlgorithmBaseDataHolder *(^algorithm)(idalgorithm); - -/** - Sets jwtAlgorithmName and returns the JWTAlgorithmBaseDataHolder to allow for method chaining. See list of names in appropriate headers. - */ -@property (copy, nonatomic, readwrite) JWTAlgorithmBaseDataHolder *(^algorithmName)(NSString *algorithmName); - -/** - Sets stringCoder and returns the JWTAlgorithmBaseDataHolder to allow for method chaining. See list of names in appropriate headers. - */ -@property (copy, nonatomic, readwrite) JWTAlgorithmBaseDataHolder *(^stringCoder)(id stringCoder); -@end - -@interface JWTAlgorithmBaseDataHolder (Convertions) - -- (NSData *)dataFromString:(NSString *)string; -- (NSString *)stringFromData:(NSData *)data; - -@end - -@implementation JWTAlgorithmBaseDataHolder (Convertions) -#pragma mark - Convertions -- (NSData *)dataFromString:(NSString *)string { - NSData *result = [self.internalStringCoder dataWithString:string]; - - if (result == nil) { - // tell about it?! - NSLog(@"%@ %@ something went wrong. Data is not base64encoded", self.debugDescription, NSStringFromSelector(_cmd)); - } - - return result;// ?: [string dataUsingEncoding:NSUTF8StringEncoding]; -} - -- (NSString *)stringFromData:(NSData *)data { - NSString *result = [self.internalStringCoder stringWithData:data]; - - if (result == nil) { - NSLog(@"%@ %@ something went wrong. String is not base64encoded", self.debugDescription, NSStringFromSelector(_cmd)); - } - return result ?: [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; -} -@end - -@interface JWTAlgorithmBaseDataHolder (Fluent) -- (void)setupFluent; -@end - -@implementation JWTAlgorithmBaseDataHolder (Fluent) -#pragma mark - Fluent -- (instancetype)secretData:(NSData *)secretData { - self.internalSecretData = secretData; - return self; -} - -- (instancetype)secret:(NSString *)secret { - self.internalSecretData = [self dataFromString:secret]; - return self; -} - -- (instancetype)algorithm:(id)algorithm { - self.internalAlgorithm = algorithm; - return self; -} - -- (instancetype)algorithmName:(NSString *)algorithmName { - self.internalAlgorithm = [JWTAlgorithmFactory algorithmByName:algorithmName]; - return self; -} - -- (instancetype)stringCoder:(id)stringCoder { - self.internalStringCoder = stringCoder; - return self; -} - -- (void)setupFluent { - __weak typeof(self) weakSelf = self; - self.secret = ^(NSString *secret) { - return [weakSelf secret:secret]; - }; - - self.secretData = ^(NSData *secretData) { - return [weakSelf secretData:secretData]; - }; - - self.algorithm = ^(id algorithm) { - return [weakSelf algorithm:algorithm]; - }; - - self.algorithmName = ^(NSString *algorithmName) { - return [weakSelf algorithmName:algorithmName]; - }; - - self.stringCoder = ^(id stringCoder) { - return [weakSelf stringCoder:stringCoder]; - }; -} -@end - -@interface JWTAlgorithmBaseDataHolder (Debug) -- (NSDictionary *)debugInformation; -@end -@implementation JWTAlgorithmBaseDataHolder (Debug) -- (NSString *)debugDescription { - return [[self debugInformation] debugDescription]; -} -- (NSDictionary *)debugInformation { - return @{ - @"algorithmName" : self.internalAlgorithmName ?: @"unknown", - @"algorithm" : [self.internalAlgorithm debugDescription] ?: @"unknown", - @"secretData" : [self.internalSecretData debugDescription] ?: @"unknown", - @"stringCoder" : [self.internalStringCoder debugDescription] ?: @"unknown" - }; -} - -@end - -@implementation JWTAlgorithmBaseDataHolder -@synthesize internalAlgorithm; -@synthesize internalSecretData; -@synthesize internalStringCoder = _internalStringCoder; - -- (id)internalStringCoder { - return _internalStringCoder ?: [JWTBase64Coder new]; -} - -#pragma mark - Custom Getters -- (NSString *)internalAlgorithmName { - return [self.internalAlgorithm name]; -} - -- (NSString *)internalSecret { - return [self stringFromData:self.internalSecretData]; -} - -- (instancetype)init { - self = [super init]; - if (self) { - [self setupFluent]; - } - return self; -} - -#pragma mark - Copy -- (id)copyWithZone:(NSZone *)zone { - JWTAlgorithmBaseDataHolder *holder = [self.class new]; - holder.internalAlgorithm = self.internalAlgorithm; - holder.internalSecretData = self.internalSecretData; - holder.internalStringCoder = self.internalStringCoder; - return holder; -} -@end - -@interface JWTAlgorithmBaseDataHolder(Create) -- (instancetype)initWithAlgorithmName:(NSString *)name; -@end - -@implementation JWTAlgorithmBaseDataHolder(Create) -- (instancetype)initWithAlgorithmName:(NSString *)name { - return [self init].algorithmName(name); -} -@end - -@implementation JWTAlgorithmNoneDataHolder -- (instancetype)init { - if (self = [super init]) { - self.internalAlgorithm = [JWTAlgorithmFactory algorithmByName:JWTAlgorithmNameNone]; - self.internalSecretData = nil; - } - return self; -} -@end - -@implementation JWTAlgorithmHSFamilyDataHolder -+ (instancetype)createWithAlgorithm256 { - return [[self alloc] initWithAlgorithmName:JWTAlgorithmNameHS256]; -} -+ (instancetype)createWithAlgorithm384 { - return [[self alloc] initWithAlgorithmName:JWTAlgorithmNameHS384]; -} -+ (instancetype)createWithAlgorithm512 { - return [[self alloc] initWithAlgorithmName:JWTAlgorithmNameHS512]; -} -@end - -@interface JWTAlgorithmRSFamilyDataHolder() -#pragma mark - Getters -@property (copy, nonatomic, readwrite) NSString *internalPrivateKeyCertificatePassphrase; -@property (copy, nonatomic, readwrite) NSString *internalKeyExtractorType; -@property (strong, nonatomic, readwrite) id internalSignKey; -@property (strong, nonatomic, readwrite) id internalVerifyKey; -#pragma mark - Setters -@property (copy, nonatomic, readwrite) JWTAlgorithmRSFamilyDataHolder *(^privateKeyCertificatePassphrase)(NSString *privateKeyCertificatePassphrase); -@property (copy, nonatomic, readwrite) JWTAlgorithmRSFamilyDataHolder *(^keyExtractorType)(NSString *keyExtractorType); -@property (copy, nonatomic, readwrite) JWTAlgorithmRSFamilyDataHolder *(^signKey)(id signKey); -@property (copy, nonatomic, readwrite) JWTAlgorithmRSFamilyDataHolder *(^verifyKey)(id verifyKey); -@end - -@implementation JWTAlgorithmRSFamilyDataHolder (Debug) -- (NSDictionary *)debugInformation { - NSDictionary *add = @{@"privateKeyCertificatePassphrase" : self.internalPrivateKeyCertificatePassphrase ?: @"unknown", - @"keyExtractorType" : self.internalKeyExtractorType ?: @"unknown", - @"signKey" : [self.signKey debugDescription] ?: @"unknown", - @"verifyKey" : [self.verifyKey debugDescription] ?: @"unknown" - }; - NSMutableDictionary *result = [[super debugInformation] mutableCopy]; - [result addEntriesFromDictionary:add]; - return result; -} -@end - -@implementation JWTAlgorithmRSFamilyDataHolder - -#pragma mark - Initialization -+ (instancetype)createWithAlgorithm256 { - return [[self alloc] initWithAlgorithmName:JWTAlgorithmNameRS256]; -} - -+ (instancetype)createWithAlgorithm384 { - return [[self alloc] initWithAlgorithmName:JWTAlgorithmNameRS384]; -} - -+ (instancetype)createWithAlgorithm512 { - return [[self alloc] initWithAlgorithmName:JWTAlgorithmNameRS512]; -} - -#pragma mark - Getters -- (id)internalAlgorithm { - id algorithm = [super internalAlgorithm]; - if ([algorithm conformsToProtocol:@protocol(JWTRSAlgorithm)]) { - // copy? - idcurrentAlgorithm = [(id )algorithm copyWithZone:nil]; - currentAlgorithm.privateKeyCertificatePassphrase = self.internalPrivateKeyCertificatePassphrase; - currentAlgorithm.keyExtractorType = self.internalKeyExtractorType; - currentAlgorithm.signKey = self.internalSignKey; - currentAlgorithm.verifyKey = self.internalVerifyKey; - algorithm = currentAlgorithm; - } - return algorithm; -} - -#pragma mark - Setters -- (instancetype)privateKeyCertificatePassphrase:(NSString *)passphrase { - self.internalPrivateKeyCertificatePassphrase = passphrase; - return self; -} -- (instancetype)keyExtractorType:(NSString *)type { - self.internalKeyExtractorType = type; - return self; -} -- (instancetype)signKey:(id)key { - self.internalSignKey = key; - return self; -} -- (instancetype)verifyKey:(id)key { - self.internalVerifyKey = key; - return self; -} - -#pragma mark - Copy -- (id)copyWithZone:(NSZone *)zone { - JWTAlgorithmRSFamilyDataHolder *holder = [super copyWithZone:zone]; - holder.internalPrivateKeyCertificatePassphrase = self.internalPrivateKeyCertificatePassphrase; - holder.internalKeyExtractorType = self.internalKeyExtractorType; - holder.internalSignKey = self.internalSignKey; - holder.internalVerifyKey = self.internalVerifyKey; - return holder; -} -@end - -@implementation JWTAlgorithmRSFamilyDataHolder (Fluent) -- (void)setupFluent { - [super setupFluent]; - __weak typeof(self) weakSelf = self; - self.privateKeyCertificatePassphrase = ^(NSString *privateKeyCertificatePassphrase) { - return [weakSelf privateKeyCertificatePassphrase:privateKeyCertificatePassphrase]; - }; - self.keyExtractorType = ^(NSString *keyExtractorType) { - return [weakSelf keyExtractorType:keyExtractorType]; - }; - self.signKey = ^(id key){ - return [weakSelf signKey:key]; - }; - self.verifyKey = ^(id key){ - return [weakSelf verifyKey:key]; - }; -} -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h b/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h deleted file mode 100644 index 461ead406..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// JWTAlgorithmDataHolderChain.h -// JWT -// -// Created by Lobanov Dmitry on 02.10.16. -// Copyright © 2016 Karma. All rights reserved. -// - -#import -#import "JWTAlgorithmDataHolder.h" - -@interface JWTAlgorithmDataHolderChain : NSObject - -@property (strong, nonatomic, readonly) NSArray *holders; - -#pragma mark - Initialization -- (instancetype)initWithHolders:(NSArray *)holders; -- (instancetype)initWithHolder:(id)holder; - -#pragma mark - Appending -- (instancetype)chainByAppendingChain:(JWTAlgorithmDataHolderChain *)chain; -- (instancetype)chainByAppendingHolders:(NSArray *)holders; -- (instancetype)chainByAppendingHolder:(id)holder; - -#pragma mark - Create -+ (instancetype)chainWithHolders:(NSArray *)holders; -+ (instancetype)chainWithHolder:(id)holder; -@end - -@interface JWTAlgorithmDataHolderChain (HoldersPopulation) -- (NSArray *)singleAlgorithm:(id)algorithm withManySecretData:(NSArray *)secretsData; -- (NSArray *)singleSecretData:(NSData *)secretData withManyAlgorithms:(NSArray *)algorithms; - -- (instancetype)chainByPopulatingAlgorithm:(id)algorithm withManySecretData:(NSArray *)secretsData; -- (instancetype)chainByPopulatingSecretData:(NSData *)secretData withManyAlgorithms:(NSArray *)algorithms; - -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m b/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m deleted file mode 100644 index c079d6ffc..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +++ /dev/null @@ -1,145 +0,0 @@ -// -// JWTAlgorithmDataHolderChain.m -// JWT -// -// Created by Lobanov Dmitry on 02.10.16. -// Copyright © 2016 Karma. All rights reserved. -// - -#import "JWTAlgorithmDataHolderChain.h" - -@interface JWTAlgorithmDataHolderChain() - -@property (strong, nonatomic, readwrite) NSArray *holders; - -@end - -@implementation JWTAlgorithmDataHolderChain - -- (NSArray *)holders { - if (!_holders) { - _holders = @[]; - } - return _holders; -} - -#pragma mark - Initialization -- (instancetype)initWithHolders:(NSArray *)holders { - self = [super init]; - if (holders) { - // check that holders conform to protocol - NSArray *checkedHolders = [holders filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id _Nullable evaluatedObject, NSDictionary * _Nullable bindings) { - return [evaluatedObject conformsToProtocol:@protocol(JWTAlgorithmDataHolderProtocol)]; - }]]; - self.holders = checkedHolders; - } - return self; -} - -- (instancetype)initWithHolder:(id)holder { - if (holder) { - return [self initWithHolders:@[holder]]; - } - return nil; -} - -#pragma mark - Appending -- (instancetype)chainByAppendingChain:(JWTAlgorithmDataHolderChain *)chain { - NSArray *holders = self.holders; - if (chain) { - holders = [holders arrayByAddingObjectsFromArray:chain.holders]; - } - return [[self.class alloc] initWithHolders:holders]; -} - -- (instancetype)chainByAppendingHolders:(NSArray *)holders { - // create new chain with holders - JWTAlgorithmDataHolderChain *chain = nil; - if (holders) { - chain = [[self.class alloc] initWithHolders:holders]; - } - return [self chainByAppendingChain:chain]; -} - -- (instancetype)chainByAppendingHolder:(id)holder { - return [self chainByAppendingHolders:holder ? @[holder] : nil]; -} - -#pragma mark - Create -+ (instancetype)chainWithHolders:(NSArray *)holders { - return [[self new] chainByAppendingHolders:holders]; -} - -+ (instancetype)chainWithHolder:(id)holder { - return [[self new] chainByAppendingHolder:holder]; -} - -#pragma mark - Debug -- (NSString *)debugDescription { - return [NSString stringWithFormat:@"%@ holders: %@", self.class, [self.holders valueForKey:@"debugDescription"]]; -} -@end - -@implementation JWTAlgorithmDataHolderChain (Convenient) -- (id)firstHolderByAlgorithm:(id)algorithm { - NSInteger index = [self.holders indexOfObjectPassingTest:^BOOL(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - return [[[obj internalAlgorithm] name] isEqualToString:[algorithm name]]; - }]; - if (index != NSNotFound) { - return self.holders[index]; - } - - return nil; -} -- (id)firstHolderBySecretData:(NSData *)secretData { - NSInteger index = [self.holders indexOfObjectPassingTest:^BOOL(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - return [[obj internalSecretData] isEqualToData:secretData]; - }]; - if (index != NSNotFound) { - return self.holders[index]; - } - - return nil; -} -- (NSArray *)singleAlgorithm:(id)algorithm withManySecretData:(NSArray *)secretsData { - NSArray *holders = @[]; - - id holder = [self firstHolderByAlgorithm:algorithm]; - - if (!holder) { - return holders; - } - - for (NSData *secretData in secretsData) { - id newHolder = [holder copy]; - [newHolder setInternalSecretData:secretData]; - holders = [holders arrayByAddingObject:newHolder]; - } - return holders; -} - -- (NSArray *)singleSecretData:(NSData *)secretData withManyAlgorithms:(NSArray *)algorithms { - NSArray *holders = @[]; - - id holder = [self firstHolderBySecretData:secretData]; - - if (!holder) { - return holders; - } - - for (idalgorithm in algorithms) { - id newHolder = [holder copy]; - [newHolder setInternalAlgorithm:algorithm]; - [holders arrayByAddingObject:newHolder]; - } - return holders; -} - -- (instancetype)chainByPopulatingAlgorithm:(id)algorithm withManySecretData:(NSArray *)secretsData { - return [[self.class alloc] initWithHolders:[self singleAlgorithm:algorithm withManySecretData:secretsData]]; -} - -- (instancetype)chainByPopulatingSecretData:(NSData *)secretData withManyAlgorithms:(NSArray *)algorithms { - return [[self.class alloc] initWithHolders:[self singleSecretData:secretData withManyAlgorithms:algorithms]]; -} -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h b/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h deleted file mode 100644 index 67a7af017..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// JWTAlgorithmRSBase.h -// JWT -// -// Created by Lobanov Dmitry on 13.03.16. -// Copyright © 2016 Karma. All rights reserved. -// - -#import -#import "JWTRSAlgorithm.h" -extern NSString *const JWTAlgorithmNameRS256; -extern NSString *const JWTAlgorithmNameRS384; -extern NSString *const JWTAlgorithmNameRS512; - -@interface JWTAlgorithmRSBase : NSObject - -@property (assign, nonatomic, readonly) size_t ccSHANumberDigestLength; -@property (assign, nonatomic, readonly) uint32_t secPaddingPKCS1SHANumber; -- (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(uint32_t)len withHashBytes:(unsigned char *)hashBytes; - -@end - -@interface JWTAlgorithmRSBase (Create) - -+ (instancetype)algorithm256; -+ (instancetype)algorithm384; -+ (instancetype)algorithm512; -+ (instancetype)mutableAlgorithm __deprecated; - -@end - -/* - // when you can't live without mutability, uncomment. - @class JWTAlgorithmRSFamilyMemberMutable; -*/ \ No newline at end of file diff --git a/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m b/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m deleted file mode 100644 index 496e242c1..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +++ /dev/null @@ -1,551 +0,0 @@ -// -// JWTAlgorithmRSBase.m -// JWT -// -// Created by Lobanov Dmitry on 13.03.16. -// Copyright © 2016 Karma. All rights reserved. -// - -#import "JWTAlgorithmRSBase.h" -#import "JWTBase64Coder.h" -#import "JWTCryptoSecurity.h" -#import "JWTCryptoKeyExtractor.h" -#import "JWTCryptoKey.h" -#import "JWTAlgorithmFactory.h" -#import -/* -* * Possible inheritence * -* -* -* RSBase (Public + Create-category) -* / \ -* / \ -* RSBaseMac RSBaseIOS -* \ ifdef / -* \ / -* RSFamilyMember -* | -* RSFamilyMemberMutable -* -*/ - -NSString *const JWTAlgorithmNameRS256 = @"RS256"; -NSString *const JWTAlgorithmNameRS384 = @"RS384"; -NSString *const JWTAlgorithmNameRS512 = @"RS512"; - -@interface JWTAlgorithmRSBase() -@property (nonatomic, readonly) id keyExtractor; -@end - -@implementation JWTAlgorithmRSBase - -#pragma mark - NSCopying -- (id)copyWithZone:(NSZone *)zone { - // create new. - id algorithm = (id)[JWTAlgorithmFactory algorithmByName:[self name]]; - algorithm.privateKeyCertificatePassphrase = self.privateKeyCertificatePassphrase; - algorithm.keyExtractorType = self.keyExtractorType; - algorithm.signKey = self.signKey; - algorithm.verifyKey = self.verifyKey; - return algorithm; -} - -@synthesize privateKeyCertificatePassphrase; -@synthesize keyExtractorType; -@synthesize signKey; -@synthesize verifyKey; -- (id) keyExtractor { - return [JWTCryptoKeyExtractor createWithType:self.keyExtractorType]; -} -#pragma mark - Override -- (size_t)ccSHANumberDigestLength { - @throw [[NSException alloc] initWithName:NSInternalInconsistencyException reason:@"ccSHANumberDigestLength property should be overriden" userInfo:nil]; -} - -- (uint32_t)secPaddingPKCS1SHANumber { - @throw [[NSException alloc] initWithName:NSInternalInconsistencyException reason:@"secPaddingPKCS1SHANumber property should be overriden" userInfo:nil]; -} - -- (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(CC_LONG)len withHashBytes:(unsigned char *)hashBytes { - return nil; -} - -- (NSString *)name { - return @"RSBase"; -} - -#pragma mark - JWTAlgorithm -- (NSData *)signHash:(NSData *)hash key:(NSData *)key error:(NSError *__autoreleasing *)error { - NSData *result = nil; - if (self.signKey || self.keyExtractor) { - NSError *extractKeyError = nil; - id keyItem = self.signKey ?: [self.keyExtractor keyFromData:key parameters:@{ [JWTCryptoKeyExtractor parametersKeyCertificatePassphrase] : self.privateKeyCertificatePassphrase ?: [NSNull null] } error:&extractKeyError]; - - if (extractKeyError || keyItem == nil) { - // tell about error - if (extractKeyError && error) { - *error = extractKeyError; - } - NSError *removeError = nil; - [JWTCryptoSecurity removeKeyByTag:keyItem.tag error:&removeError]; - if (removeError && error) { - *error = removeError; - } - } - else { - result = [self signData:hash withKey:keyItem.key]; - } - } - else { - SecIdentityRef identity = nil; - SecTrustRef trust = nil; - -// [JWTCryptoSecurity extractIdentityAndTrustFromPKCS12:inPKCS12Data password:keyPassword identity:outIdentity trust:outTrust]; - [JWTCryptoSecurity extractIdentityAndTrustFromPKCS12:(__bridge CFDataRef)(key) password: (__bridge CFStringRef)(self.privateKeyCertificatePassphrase) identity:&identity trust:&trust]; - - if (identity && trust) { - SecKeyRef privateKey; - SecIdentityCopyPrivateKey(identity, &privateKey); - result = [self signData:hash withKey:privateKey]; - - if (privateKey) { - CFRelease(privateKey); - } - } - - if (identity) { - CFRelease(identity); - } - - if (trust) { - CFRelease(trust); - } - } - return result; -} -- (BOOL)verifyHash:(NSData *)hash signature:(NSData *)signature key:(NSData *)key error:(NSError *__autoreleasing *)error { - if (self.verifyKey || self.keyExtractor) { - NSError *extractKeyError = nil; - id keyItem = self.verifyKey?: [self.keyExtractor keyFromData:key parameters:nil error:&extractKeyError]; - BOOL verified = NO; - - if (extractKeyError || keyItem == nil) { - // error while getting key. - // cleanup. - // tell about error - if (extractKeyError && error) { - *error = extractKeyError; - } - NSError *removeError = nil; - [JWTCryptoSecurity removeKeyByTag:keyItem.tag error:&removeError]; - if (removeError && error) { - //??? - *error = removeError; - } - return verified; - } - else { - verified = [self verifyData:hash witSignature:signature withKey:keyItem.key]; - } - - NSError *removeError = nil; - [JWTCryptoSecurity removeKeyByTag:keyItem.tag error:&removeError]; - - if (error && removeError) { - *error = removeError; - } - - return verified; - } - else { - SecKeyRef publicKey = [JWTCryptoSecurity publicKeyFromCertificate:key]; - // TODO: special error handling here. - // add error handling later? - if (publicKey != NULL) { - BOOL verified = [self verifyData:hash witSignature:signature withKey:publicKey]; - CFRelease(publicKey); - return verified; - } - } - return NO; -} - -- (NSData *)encodePayload:(NSString *)theString withSecret:(NSString *)theSecret { - return [self encodePayloadData:[theString dataUsingEncoding:NSUTF8StringEncoding] withSecret:[JWTBase64Coder dataWithBase64UrlEncodedString:theSecret]]; -} -- (NSData *)encodePayloadData:(NSData *)theStringData withSecret:(NSData *)theSecretData { - return [self signHash:theStringData key:theSecretData error:nil]; -} -- (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature verificationKey:(NSString *)verificationKey { - NSData *certificateData = [JWTBase64Coder dataWithBase64UrlEncodedString:verificationKey]; - return [self verifySignedInput:input withSignature:signature verificationKeyData:certificateData]; -} -- (BOOL)verifySignedInput:(NSString *)input withSignature:(NSString *)signature verificationKeyData:(NSData *)verificationKeyData { - return [self verifyHash:[input dataUsingEncoding:NSUTF8StringEncoding] signature:[JWTBase64Coder dataWithBase64UrlEncodedString:signature] key:verificationKeyData error:nil]; -} - -#pragma mark - Private ( Override-part depends on platform ) -- (BOOL)verifyData:(NSData *)plainData witSignature:(NSData *)signature withKey:(SecKeyRef) publicKey { - return NO; -} - -- (NSData *)signData:(NSData *)plainData withKey:(SecKeyRef)privateKey { - return nil; -} -@end - -#if TARGET_OS_MAC && TARGET_OS_IPHONE -@interface JWTAlgorithmRSBaseIOS : JWTAlgorithmRSBase @end -@implementation JWTAlgorithmRSBaseIOS -- (BOOL)verifyData:(NSData *)plainData witSignature:(NSData *)signature withKey:(SecKeyRef) publicKey { - size_t signedHashBytesSize = SecKeyGetBlockSize(publicKey); - const void* signedHashBytes = [signature bytes]; - - size_t hashBytesSize = self.ccSHANumberDigestLength; - uint8_t* hashBytes = malloc(hashBytesSize); - if (![self CC_SHANumberWithData:[plainData bytes] withLength:(CC_LONG)[plainData length] withHashBytes:hashBytes]) { - return false; - } - - OSStatus status = SecKeyRawVerify(publicKey, - self.secPaddingPKCS1SHANumber, - hashBytes, - hashBytesSize, - signedHashBytes, - signedHashBytesSize); - - return status == errSecSuccess; -} - -- (NSData *)signData:(NSData *)plainData withKey:(SecKeyRef)privateKey { - size_t signedHashBytesSize = SecKeyGetBlockSize(privateKey); - uint8_t* signedHashBytes = malloc(signedHashBytesSize); - memset(signedHashBytes, 0x0, signedHashBytesSize); - - size_t hashBytesSize = self.ccSHANumberDigestLength; - uint8_t* hashBytes = malloc(hashBytesSize); - - // ([plainData bytes], (CC_LONG)[plainData length], hashBytes) - unsigned char *str = [self CC_SHANumberWithData:[plainData bytes] withLength:(CC_LONG)[plainData length] withHashBytes:hashBytes]; - - if (!str) { - return nil; - } - - SecKeyRawSign(privateKey, - self.secPaddingPKCS1SHANumber, - hashBytes, - hashBytesSize, - signedHashBytes, - &signedHashBytesSize); - - NSData* signedHash = [NSData dataWithBytes:signedHashBytes - length:(NSUInteger)signedHashBytesSize]; - - if (hashBytes) { - free(hashBytes); - } - - if (signedHashBytes) { - free(signedHashBytes); - } - - return signedHash; -} -@end -#endif - -#if TARGET_OS_MAC && !TARGET_OS_IPHONE -@interface JWTAlgorithmRSBaseMac : JWTAlgorithmRSBase -@end - -@implementation JWTAlgorithmRSBaseMac -- (NSData *)executeTransform:(SecTransformRef)transform withInput:(NSData *)input withDigestType:(CFStringRef)type withDigestLength:(NSNumber *)length withFalseResult:(CFTypeRef)falseResultRef { - CFErrorRef errorRef = NULL; - - CFTypeRef resultRef = NULL; - NSData *resultData = nil; - - - BOOL success = transform != NULL; - //TODO: after import algorithm by pem, this code seems not working well. - //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" - //TODO: add error inout parameter to this method. - if (success) { - // setup digest type - success = SecTransformSetAttribute(transform, kSecDigestTypeAttribute, type, &errorRef); - } - - if (success) { - // digest length - success = SecTransformSetAttribute(transform, kSecDigestLengthAttribute, (__bridge CFNumberRef)length, &errorRef); - } - - if (success) { - // set input - success = SecTransformSetAttribute(transform, kSecTransformInputAttributeName, (__bridge CFDataRef)input, &errorRef); - } - - if (success) { - // execute - resultRef = SecTransformExecute(transform, &errorRef); - success = (resultRef != falseResultRef); - } - - BOOL positiveResult = success; // resultRef != falseResultRef - - // error - if (errorRef != NULL) { - NSLog(@"%@ error: %@", self.debugDescription, (__bridge NSError *)errorRef); - } - else { - if (positiveResult) { - resultData = (__bridge NSData *)resultRef; - } - } - - // release - if (transform != NULL) { - CFRelease(transform); - } - - if (errorRef != NULL) { - CFRelease(errorRef); - } - - if (resultRef != NULL) { - CFRelease(resultRef); - } - - return resultData; -} -- (BOOL)verifyData:(NSData *)plainData witSignature:(NSData *)signature withKey:(SecKeyRef) publicKey { - - size_t signedHashBytesSize = SecKeyGetBlockSize(publicKey); - //const void* signedHashBytes = [signature bytes]; - - size_t hashBytesSize = self.ccSHANumberDigestLength; - uint8_t* hashBytes = malloc(hashBytesSize); - if (![self CC_SHANumberWithData:[plainData bytes] withLength:(CC_LONG)[plainData length] withHashBytes:hashBytes]) { - return false; - } - - // verify for iOS -// OSStatus status = SecKeyRawVerify(publicKey, -// self.secPaddingPKCS1SHANumber, -// hashBytes, -// hashBytesSize, -// signedHashBytes, -// signedHashBytesSize); -// return status == errSecSuccess; - - CFErrorRef errorRef = NULL; - SecTransformRef transform = SecVerifyTransformCreate(publicKey, (__bridge CFDataRef)signature, &errorRef); - - // verification. false result is kCFBooleanFalse - BOOL result = [self executeTransform:transform withInput:plainData withDigestType:kSecDigestSHA2 withDigestLength:@(signedHashBytesSize) withFalseResult:kCFBooleanFalse] != nil; - - if (errorRef != NULL) { - CFRelease(errorRef); - } - - return result; -} - -- (NSData *)signData:(NSData *)plainData withKey:(SecKeyRef)privateKey { - size_t signedHashBytesSize = SecKeyGetBlockSize(privateKey); - //uint8_t* signedHashBytes = malloc(signedHashBytesSize); - //memset(signedHashBytes, 0x0, signedHashBytesSize); - - size_t hashBytesSize = self.ccSHANumberDigestLength; - uint8_t* hashBytes = malloc(hashBytesSize); - - /** - for sha256 - CC_SHANumberWithData() is CC_SHA256() - self.secPaddingPKCS1SHANumber = kSecPaddingPKCS1SHA256 - self.ccSHANumberDigestLength = CC_SHA256_DIGEST_LENGTH - */ - unsigned char *str = [self CC_SHANumberWithData:[plainData bytes] withLength:(CC_LONG)[plainData length] withHashBytes:hashBytes]; - - if (!str) { - return nil; - } - - CFErrorRef errorRef = NULL; - - SecTransformRef transform = SecSignTransformCreate(privateKey, &errorRef); - - /** iOS - SecKeyRawSign(privateKey, - self.secPaddingPKCS1SHANumber, - hashBytes, - hashBytesSize, - signedHashBytes, - &signedHashBytesSize); - - NSData* signedHash = [NSData dataWithBytes:signedHashBytes - length:(NSUInteger)signedHashBytesSize]; - - */ - - NSData *resultData = nil; - // signing: false result is NULL. - // it will release error. - resultData = [self executeTransform:transform withInput:plainData withDigestType:kSecDigestSHA2 withDigestLength:@(signedHashBytesSize) withFalseResult:NULL]; - - if (errorRef != NULL) { - CFRelease(errorRef); - } - - return resultData; -} -@end -#endif - - -// MacOS OR iOS is Base -#if TARGET_OS_MAC && !TARGET_OS_IPHONE -@interface JWTAlgorithmRSFamilyMember : JWTAlgorithmRSBaseMac @end -#else -@interface JWTAlgorithmRSFamilyMember : JWTAlgorithmRSBaseIOS @end -#endif - -@interface JWTAlgorithmRS256 : JWTAlgorithmRSFamilyMember @end -@interface JWTAlgorithmRS384 : JWTAlgorithmRSFamilyMember @end -@interface JWTAlgorithmRS512 : JWTAlgorithmRSFamilyMember @end - -@implementation JWTAlgorithmRSFamilyMember -- (uint32_t)secPaddingPKCS1SHANumber { - return 0; -} -@end - -@implementation JWTAlgorithmRS256 - -- (size_t)ccSHANumberDigestLength { - return CC_SHA256_DIGEST_LENGTH; -} - -#if TARGET_OS_MAC && TARGET_OS_IPHONE -- (uint32_t)secPaddingPKCS1SHANumber { - return kSecPaddingPKCS1SHA256; -} -#endif - -- (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(CC_LONG)len withHashBytes:(unsigned char *)hashBytes { - return CC_SHA256(data, len, hashBytes); -} - -- (NSString *)name { - return JWTAlgorithmNameRS256; -} - -@end - -@implementation JWTAlgorithmRS384 - -- (size_t)ccSHANumberDigestLength { - return CC_SHA384_DIGEST_LENGTH; -} - -#if TARGET_OS_MAC && TARGET_OS_IPHONE -- (uint32_t)secPaddingPKCS1SHANumber { - return kSecPaddingPKCS1SHA384; -} -#endif - -- (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(CC_LONG)len withHashBytes:(unsigned char *)hashBytes { - return CC_SHA384(data, len, hashBytes); -} - -- (NSString *)name { - return JWTAlgorithmNameRS384; -} - -@end - -@implementation JWTAlgorithmRS512 - -- (size_t)ccSHANumberDigestLength { - return CC_SHA512_DIGEST_LENGTH; -} - -#if TARGET_OS_MAC && TARGET_OS_IPHONE -- (uint32_t)secPaddingPKCS1SHANumber { - return kSecPaddingPKCS1SHA512; -} -#endif - -- (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(CC_LONG)len withHashBytes:(unsigned char *)hashBytes { - return CC_SHA512(data, len, hashBytes); -} - -- (NSString *)name { - return JWTAlgorithmNameRS512; -} - -@end - - -@interface JWTAlgorithmRSFamilyMemberMutable : JWTAlgorithmRSFamilyMember - -@property (assign, nonatomic, readwrite) size_t ccSHANumberDigestLength; -@property (assign, nonatomic, readwrite) uint32_t secPaddingPKCS1SHANumber; -@property (copy, nonatomic, readwrite) unsigned char * (^ccShaNumberWithData)(const void *data, CC_LONG len, unsigned char *hashBytes); -@property (copy, nonatomic, readwrite) NSString *name; -@end - -@implementation JWTAlgorithmRSFamilyMemberMutable - -@synthesize ccSHANumberDigestLength = _ccSHANumberDigestLength; -@synthesize secPaddingPKCS1SHANumber = _secPaddingPKCS1SHANumber; -@synthesize name = _name; - -- (size_t)ccSHANumberDigestLength { - return _ccSHANumberDigestLength; -} - -- (uint32_t)secPaddingPKCS1SHANumber { - return _secPaddingPKCS1SHANumber; -} - -- (unsigned char *)CC_SHANumberWithData:(const void *)data withLength:(uint32_t)len withHashBytes:(unsigned char *)hashBytes { - unsigned char *result = [super CC_SHANumberWithData:data withLength:len withHashBytes:hashBytes]; - if (!result && self.ccShaNumberWithData) { - result = self.ccShaNumberWithData(data, len, hashBytes); - } - return result; -} - -@end - - -@implementation JWTAlgorithmRSBase (Create) - -+ (instancetype)algorithm256 { - return [JWTAlgorithmRS256 new]; -} - -+ (instancetype)algorithm384 { - return [JWTAlgorithmRS384 new]; -} - -+ (instancetype)algorithm512 { - return [JWTAlgorithmRS512 new]; -} - -+ (instancetype)mutableAlgorithm { - JWTAlgorithmRSFamilyMemberMutable *base = [JWTAlgorithmRSFamilyMemberMutable new]; - base.ccSHANumberDigestLength = CC_SHA256_DIGEST_LENGTH; - - //set to something ok - //base.secPaddingPKCS1SHANumber = kSecPaddingPKCS1SHA256; - base.ccShaNumberWithData = ^unsigned char *(const void *data, CC_LONG len, unsigned char *hashBytes){ - return CC_SHA256(data, len, hashBytes); - }; - base.name = @"RS256"; - return base; -} - -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h b/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h deleted file mode 100644 index 07c3b3f10..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// Created by Marcelo Schroeder on 12/03/2016. -// Copyright (c) 2016 Karma. All rights reserved. -// - -#import -#import "JWTAlgorithm.h" -@protocol JWTCryptoKeyProtocol; - -@protocol JWTAsymmetricKeysAlgorithm - -@optional -@property(nonatomic, readwrite, copy) NSString *keyExtractorType; -@property(nonatomic, readwrite, strong) id signKey; -@property(nonatomic, readwrite, strong) id verifyKey; - -@end - -@protocol JWTRSAlgorithm - -@required -@property(nonatomic, readwrite, copy) NSString *privateKeyCertificatePassphrase; -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h b/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h deleted file mode 100644 index 57f95ae76..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// JWTCryptoKey.h -// JWT -// -// Created by Lobanov Dmitry on 04.02.17. -// Copyright © 2017 JWTIO. All rights reserved. -// - -#import -#import - -@protocol JWTCryptoKeyProtocol -@property (copy, nonatomic, readonly) NSString *tag; -@property (assign, nonatomic, readonly) SecKeyRef key; -@property (copy, nonatomic, readonly) NSData *rawKey; -@end - -@interface JWTCryptoKeyBuilder : NSObject -@property (assign, nonatomic, readonly) NSString *keyType; -- (instancetype)keyTypeRSA; -- (instancetype)keyTypeEC; -@end - -@interface JWTCryptoKey : NSObject -- (instancetype)initWithData:(NSData *)data parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; //NS_DESIGNATED_INITIALIZER -- (instancetype)initWithBase64String:(NSString *)base64String parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; -- (instancetype)initWithPemEncoded:(NSString *)encoded parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; -- (instancetype)initWithPemAtURL:(NSURL *)url parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; -@end - -@interface JWTCryptoKey (Parameters) -+ (NSString *)parametersKeyBuilder; -@end - -@interface JWTCryptoKeyPublic : JWTCryptoKey -- (instancetype)initWithCertificateData:(NSData *)certificateData parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; //NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithCertificateBase64String:(NSString *)certificateString parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; -@end - -@interface JWTCryptoKeyPrivate : JWTCryptoKey -- (instancetype)initWithP12Data:(NSData *)p12Data withPassphrase:(NSString *)passphrase parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; //NS_DESIGNATED_INITIALIZER; -- (instancetype)initWithP12AtURL:(NSURL *)url withPassphrase:(NSString *)passphrase parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m b/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m deleted file mode 100644 index 15714c6c8..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +++ /dev/null @@ -1,230 +0,0 @@ -// -// JWTCryptoKey.m -// JWT -// -// Created by Lobanov Dmitry on 04.02.17. -// Copyright © 2017 JWTIO. All rights reserved. -// - -#import "JWTCryptoKey.h" -#import "JWTCryptoSecurity.h" -#import "JWTBase64Coder.h" -@interface JWTCryptoKeyBuilder() -+ (NSString *)keyTypeRSA; -+ (NSString *)keyTypeEC; -@property (assign, nonatomic, readwrite) BOOL public; -@property (assign, nonatomic, readwrite) NSString *keyType; -@property (nonatomic, readonly) BOOL withKeyTypeRSA; -@property (nonatomic, readonly) BOOL withKeyTypeEC; -@end -@implementation JWTCryptoKeyBuilder -+ (NSString *)keyTypeRSA { - return @"RSA"; -} -+ (NSString *)keyTypeEC { - return @"EC"; -} -- (instancetype)keyTypeRSA { - self.keyType = [self.class keyTypeRSA]; - return self; -} -- (instancetype)keyTypeEC { - self.keyType = [self.class keyTypeEC]; - return self; -} -- (BOOL)withKeyTypeRSA { - return [self.keyType isEqualToString:self.class.keyTypeRSA]; -} -- (BOOL)withKeyTypeEC { - return [self.keyType isEqualToString:self.class.keyTypeEC]; -} -@end -@interface JWTCryptoKey () -@property (copy, nonatomic, readwrite) NSString *tag; -@property (assign, nonatomic, readwrite) SecKeyRef key; -@property (copy, nonatomic, readwrite) NSData *rawKey; -@end -@interface JWTCryptoKey (Class) -+ (NSString *)uniqueTag; -@end -@implementation JWTCryptoKey (Class) -+ (NSString *)uniqueTag { - return [[NSUUID UUID].UUIDString stringByReplacingOccurrencesOfString:@"-" withString:@""].lowercaseString; -} -@end -@implementation JWTCryptoKey (Parameters) -+ (NSString *)parametersKeyBuilder { - return NSStringFromSelector(_cmd); -} -@end -@interface JWTCryptoKey (ParametersExtraction) -- (NSString *)extractedSecKeyTypeWithParameters:(NSDictionary *)parameters; -- (JWTCryptoKeyBuilder *)extractedBuilderWithParameters:(NSDictionary *)parameters; -@end -// Consider that both methods in this category should return non-nullable values -@implementation JWTCryptoKey (ParametersExtraction) -// Parameters are nil at that moment, could be used later for some purposes -- (JWTCryptoKeyBuilder *)extractedBuilderWithParameters:(NSDictionary *)parameters { - return (JWTCryptoKeyBuilder *)parameters[[self.class parametersKeyBuilder]] ?: [JWTCryptoKeyBuilder new].keyTypeRSA; -} -// Parameters are nil at that moment, could be used later for some purposes -- (NSString *)extractedSecKeyTypeWithParameters:(NSDictionary *)parameters { - JWTCryptoKeyBuilder *builder = [self extractedBuilderWithParameters:parameters]; - NSString *result = nil; - if (builder.withKeyTypeEC) { - result = [JWTCryptoSecurity keyTypeEC]; - } - return result ?: [JWTCryptoSecurity keyTypeRSA]; -} -@end -@implementation JWTCryptoKey -- (instancetype)initWithData:(NSData *)data parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error { - return [super init]; -} -- (instancetype)initWithBase64String:(NSString *)base64String parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error { - return [self initWithData:[JWTBase64Coder dataWithBase64UrlEncodedString:base64String] parameters:parameters error:error]; -} -- (instancetype)initWithPemEncoded:(NSString *)encoded parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error { - //TODO: check correctness. - //maybe use clean initWithBase64String and remove ?: encoded tail. - NSString *clean = [JWTCryptoSecurity keyFromPemFileContent:encoded] ?: encoded;//[JWTCryptoSecurity stringByRemovingPemHeadersFromString:encoded]; - return [self initWithBase64String:clean parameters:parameters error:error]; -} -- (instancetype)initWithPemAtURL:(NSURL *)url parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error { - // contents of url - NSError *contentsExtractingError = nil; - NSString *pemEncoded = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:&contentsExtractingError]; - if (error && contentsExtractingError) { - *error = contentsExtractingError; - return nil; - } - return [self initWithPemEncoded:pemEncoded parameters:parameters error:error]; -} -@end -@implementation JWTCryptoKeyPublic -- (instancetype)initWithData:(NSData *)data parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error { - self = [super initWithData:data parameters:parameters error:error]; - if (self) { - self.tag = [self.class uniqueTag]; - - if (!data) { - return nil; - } - - NSError *removingHeaderError = nil; - // asks builder - - JWTCryptoKeyBuilder *builder = [self extractedBuilderWithParameters:parameters]; - NSData *keyData = data; - if (builder.withKeyTypeRSA) { - keyData = [JWTCryptoSecurity dataByRemovingPublicKeyHeader:data error:&removingHeaderError]; - if (!keyData || removingHeaderError) { - if (error && removingHeaderError != nil) { - *error = removingHeaderError; - } - return nil; - } - } - - if (builder.withKeyTypeEC) { - // unknown here. - // process keyData before passing it to JWTCryptoSecurity+addKey... method. - } - - NSError *addKeyError = nil; - - self.key = [JWTCryptoSecurity addKeyWithData:keyData asPublic:YES tag:self.tag type:[self extractedSecKeyTypeWithParameters:parameters] error:&addKeyError]; - if (!self.key || addKeyError) { - if (error && addKeyError != nil) { - *error = removingHeaderError; - } - return nil; - } - } - return self; -} -- (instancetype)initWithCertificateData:(NSData *)certificateData parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error { - SecKeyRef key = [JWTCryptoSecurity publicKeyFromCertificate:certificateData]; - if (!key) { - // error: Public certificate incorrect. - return nil; - } - - if (self = [super init]) { - self.key = key; - } - - return self; -} -- (instancetype)initWithCertificateBase64String:(NSString *)certificate parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error { - // cleanup certificate if needed. - // call initWithCertificateData:(NSData *)certificateData - NSData *certificateData = nil; - return [self initWithCertificateData:certificateData parameters:parameters error:error]; -} -@end - -@implementation JWTCryptoKeyPrivate -- (instancetype)initWithData:(NSData *)data parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error { - self = [super initWithData:data parameters:parameters error:error]; - if (self) { - self.tag = [self.class uniqueTag]; - NSError *addKeyError = nil; - if (!data) { - // error: no data? - // or put it in superclass? - return nil; - } - self.key = [JWTCryptoSecurity addKeyWithData:data asPublic:NO tag:self.tag type:[self extractedSecKeyTypeWithParameters:parameters] error:&addKeyError]; - if (!self.key || addKeyError) { - if (error && addKeyError) { - *error = addKeyError; - } - return nil; - } - } - return self; -} -// Exists -- (instancetype)initWithP12AtURL:(NSURL *)url withPassphrase:(NSString *)passphrase parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error { - // take data. - // cleanup if needed. - NSData *data = [NSData dataWithContentsOfURL:url]; - return [self initWithP12Data:data withPassphrase:passphrase parameters:parameters error:error]; -} -- (instancetype)initWithP12Data:(NSData *)p12Data withPassphrase:(NSString *)passphrase parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error { - if (p12Data == nil) { - return nil; - } - - // cleanup if needed. - SecIdentityRef identity = nil; - SecTrustRef trust = nil; - [JWTCryptoSecurity extractIdentityAndTrustFromPKCS12:(__bridge CFDataRef)p12Data password:(__bridge CFStringRef)passphrase identity:&identity trust:&trust]; - BOOL identityAndTrust = identity && trust; - - if (identityAndTrust) { - self = [super init]; - SecKeyRef privateKey; - SecIdentityCopyPrivateKey(identity, &privateKey); - if (self) { - self.key = privateKey; - } - } - - if (identity) { - CFRelease(identity); - } - - if (trust) { - CFRelease(trust); - } - - if (!identityAndTrust) { - //error: no identity and trust. - return nil; - } - - return self; -} -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h b/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h deleted file mode 100644 index c3d59359a..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// JWTCryptoKeyExtractor.h -// JWT -// -// Created by Lobanov Dmitry on 04.02.17. -// Copyright © 2017 JWTIO. All rights reserved. -// - -#import -#import - -@protocol JWTCryptoKeyProtocol; -@protocol JWTCryptoKeyExtractorProtocol -@optional -- (id)keyFromString:(NSString *)string parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; -- (id)keyFromData:(NSData *)data parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing*)error; -@end - -@interface JWTCryptoKeyExtractor : NSObject -@property (copy, nonatomic, readonly) NSString *type; -+ (NSString *)type; -+ (NSString *)parametersKeyCertificatePassphrase; -@end - -@interface JWTCryptoKeyExtractor (ClassCluster) -+ (instancetype)publicKeyWithCertificate; -+ (instancetype)privateKeyInP12; -+ (instancetype)publicKeyWithPEMBase64; -+ (instancetype)privateKeyWithPEMBase64; -+ (instancetype)createWithType:(NSString *)type; -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m b/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m deleted file mode 100644 index 1b24bcf1d..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +++ /dev/null @@ -1,113 +0,0 @@ -// -// JWTCryptoKeyExtractor.m -// JWT -// -// Created by Lobanov Dmitry on 04.02.17. -// Copyright © 2017 JWTIO. All rights reserved. -// - -#import "JWTCryptoKeyExtractor.h" -#import "JWTCryptoKey.h" -#import "JWTBase64Coder.h" - -@implementation JWTCryptoKeyExtractor -- (NSString *)type { - return self.class.type; -} -+ (NSString *)type { - return NSStringFromClass(self); -} -+ (NSString *)parametersKeyCertificatePassphrase { - return NSStringFromSelector(_cmd); -} -- (id)keyFromData:(NSData *)data parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing *)error { -#pragma message "Not Implemented" - if (error) { - *error = [NSError errorWithDomain:@"io.jwt.crypto.rsa" code:-100 userInfo:@{ - NSLocalizedDescriptionKey : @"Method not implemented" - }]; - } - return nil; -} -- (id)keyFromString:(NSString *)string parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing *)error { - if (error) { - *error = [NSError errorWithDomain:@"io.jwt.crypto.rsa" code:-100 userInfo:@{ - NSLocalizedDescriptionKey : @"Method not implemented" - }]; - } - return nil; -} -@end - -@interface JWTCryptoKeyExtractor_Public_Pem_Certificate : JWTCryptoKeyExtractor @end - -@implementation JWTCryptoKeyExtractor_Public_Pem_Certificate -- (id)keyFromData:(NSData *)data parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing *)error { - return [[JWTCryptoKeyPublic alloc] initWithCertificateData:data parameters:parameters error:error]; -} -@end - -@interface JWTCryptoKeyExtractor_Private_P12 : JWTCryptoKeyExtractor @end - -@implementation JWTCryptoKeyExtractor_Private_P12 -- (id)keyFromData:(NSData *)data parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing *)error { - NSString *certificatePassphrase = parameters[self.class.parametersKeyCertificatePassphrase]; - if ([certificatePassphrase isEqual:[NSNull null]]) { - certificatePassphrase = nil; - } - return [[JWTCryptoKeyPrivate alloc] initWithP12Data:data withPassphrase:certificatePassphrase parameters:parameters error:error]; -} -@end - -@interface JWTCryptoKeyExtractor_Public_Pem_Key : JWTCryptoKeyExtractor @end - -@implementation JWTCryptoKeyExtractor_Public_Pem_Key -- (id)keyFromData:(NSData *)data parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing *)error { - return [self keyFromString:[JWTBase64Coder base64UrlEncodedStringWithData:data] parameters:parameters error:error]; -} -- (id)keyFromString:(NSString *)string parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing *)error { - return [[JWTCryptoKeyPublic alloc] initWithPemEncoded:string parameters:parameters error:error]; -} -@end - -@interface JWTCryptoKeyExtractor_Private_Pem_Key : JWTCryptoKeyExtractor @end - -@implementation JWTCryptoKeyExtractor_Private_Pem_Key -- (id)keyFromData:(NSData *)data parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing *)error { - return [self keyFromString:[JWTBase64Coder base64UrlEncodedStringWithData:data] parameters:parameters error:error]; -} -- (id)keyFromString:(NSString *)string parameters:(NSDictionary *)parameters error:(NSError *__autoreleasing *)error { - return [[JWTCryptoKeyPrivate alloc] initWithPemEncoded:string parameters:parameters error:error]; -} -@end - -@implementation JWTCryptoKeyExtractor (ClassCluster) -+ (instancetype)publicKeyWithCertificate { - return [JWTCryptoKeyExtractor_Public_Pem_Certificate new]; -} -+ (instancetype)privateKeyInP12 { - return [JWTCryptoKeyExtractor_Private_P12 new]; -} -+ (instancetype)publicKeyWithPEMBase64 { - return [JWTCryptoKeyExtractor_Public_Pem_Key new]; -} -+ (instancetype)privateKeyWithPEMBase64 { - return [JWTCryptoKeyExtractor_Private_Pem_Key new]; -} -+ (NSArray *)availableExtractors { - return @[ - [self publicKeyWithCertificate], - [self privateKeyInP12], - [self publicKeyWithPEMBase64], - [self privateKeyWithPEMBase64] - ]; -} -+ (NSDictionary *)typesAndExtractors { - static NSDictionary *dictionary = nil; - return dictionary ?: (dictionary = [[NSDictionary alloc] initWithObjects:[self availableExtractors] forKeys:[[self availableExtractors] valueForKey:@"type"]], - dictionary); -} -+ (instancetype)createWithType:(NSString *)type { - return [self typesAndExtractors][type]; -} -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h b/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h deleted file mode 100644 index 47d631f54..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// JWTCryptoSecurity.h -// JWT -// -// Created by Lobanov Dmitry on 04.02.17. -// Copyright © 2017 JWTIO. All rights reserved. -// - -#import -#import -// Thanks for https://github.com/TakeScoop/SwiftyRSA! -@interface JWTCryptoSecurity : NSObject -+ (NSString *)keyTypeRSA; -+ (NSString *)keyTypeEC; -+ (SecKeyRef)addKeyWithData:(NSData *)data asPublic:(BOOL)public tag:(NSString *)tag type:(NSString *)type error:(NSError *__autoreleasing*)error; -+ (SecKeyRef)addKeyWithData:(NSData *)data asPublic:(BOOL)public tag:(NSString *)tag error:(NSError *__autoreleasing*)error; -+ (SecKeyRef)keyByTag:(NSString *)tag error:(NSError *__autoreleasing*)error; -+ (void)removeKeyByTag:(NSString *)tag error:(NSError *__autoreleasing*)error; -@end - -@interface JWTCryptoSecurity (Certificates) -+ (OSStatus)extractIdentityAndTrustFromPKCS12:(CFDataRef)inPKCS12Data password:(CFStringRef)password identity:(SecIdentityRef *)outIdentity trust:(SecTrustRef *)outTrust; -+ (SecKeyRef)publicKeyFromCertificate:(NSData *)certificateData; -@end - -@interface JWTCryptoSecurity (Pem) -+ (NSString *)certificateFromPemFileContent:(NSString *)content; -+ (NSString *)keyFromPemFileContent:(NSString *)content; -+ (NSArray *)itemsFromPemFileContent:(NSString *)content byRegex:(NSRegularExpression *)expression; -+ (NSString *)certificateFromPemFileWithName:(NSString *)name; -+ (NSString *)keyFromPemFileWithName:(NSString *)name; -+ (NSArray *)itemsFromPemFileWithName:(NSString *)name byRegex:(NSRegularExpression *)expression; -+ (NSString *)stringByRemovingPemHeadersFromString:(NSString *)string; -@end - -@interface JWTCryptoSecurity (PublicKey) -+ (NSData *)dataByRemovingPublicKeyHeader:(NSData *)data error:(NSError *__autoreleasing*)error; -@end diff --git a/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m b/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m deleted file mode 100644 index fcc36f6b6..000000000 --- a/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +++ /dev/null @@ -1,500 +0,0 @@ -// -// JWTCryptoSecurity.m -// JWT -// -// Created by Lobanov Dmitry on 04.02.17. -// Copyright © 2017 JWTIO. All rights reserved. -// - -#import "JWTCryptoSecurity.h" -@interface JWTMemoryLayout : NSObject -+ (NSString *)typeUInt8; -+ (NSString *)typeCUnsignedChar; -- (instancetype)initWithType:(NSString *)type; -+ (instancetype)createWithType:(NSString *)type; -@property (copy, nonatomic, readwrite) NSString *type; -@property (assign, nonatomic, readonly) NSInteger size; -@end -@implementation JWTMemoryLayout -+ (NSString *)typeUInt8 { - return NSStringFromSelector(_cmd); -} -+ (NSString *)typeCUnsignedChar { - return [self typeUInt8]; -} -- (instancetype)initWithType:(NSString *)type { - self = [super init]; - if (self) { - self.type = type; - } - return self; -} -+ (instancetype)createWithType:(NSString *)type { - return [[self alloc] initWithType:type]; -} -+ (NSDictionary *)sizesAndTypes { - static NSDictionary *sizesAndTypes = nil; - return sizesAndTypes ?: (sizesAndTypes = @{ - [self typeUInt8] : @(1) // or 8? - }, sizesAndTypes); -} -- (NSInteger)size { - return [[self.class sizesAndTypes][self.type] integerValue]; -} -@end -@implementation JWTCryptoSecurity -+ (NSDictionary *)dictionaryByCombiningDictionaries:(NSArray *)dictionaries { - NSMutableDictionary *result = [@{} mutableCopy]; - for (NSDictionary *dictionary in dictionaries) { - [result addEntriesFromDictionary:dictionary]; - } - return [result copy]; -} -+ (NSString *)keyTypeRSA { - return (__bridge NSString *)kSecAttrKeyTypeRSA; -} -+ (NSString *)keyTypeEC { -// extern const CFStringRef kSecAttrKeyTypeEC -// __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_4_0); -// extern const CFStringRef kSecAttrKeyTypeECSECPrimeRandom -// __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0); - return (__bridge NSString *)kSecAttrKeyTypeEC; -} -+ (SecKeyRef)addKeyWithData:(NSData *)data asPublic:(BOOL)public tag:(NSString *)tag type:(NSString *)type error:(NSError *__autoreleasing*)error; { - NSString *keyClass = (__bridge NSString *)(public ? kSecAttrKeyClassPublic : kSecAttrKeyClassPrivate); - NSInteger sizeInBits = data.length * [JWTMemoryLayout createWithType:[JWTMemoryLayout typeUInt8]].size; - NSDictionary *attributes = @{ - (__bridge NSString*)kSecAttrKeyType : type, - (__bridge NSString*)kSecAttrKeyClass : keyClass, - (__bridge NSString*)kSecAttrKeySizeInBits : @(sizeInBits) - }; - - if (SecKeyCreateWithData != NULL) { - CFErrorRef createError = NULL; - SecKeyRef key = SecKeyCreateWithData((__bridge CFDataRef)data, (__bridge CFDictionaryRef)attributes, &createError); - if (error && createError != nil) { - *error = (__bridge NSError*)createError; - } - return key; - } - // oh... not avaialbe API :/ - else { - - CFTypeRef result = NULL; - NSData *tagData = [tag dataUsingEncoding:NSUTF8StringEncoding]; - NSDictionary *commonAttributes = @{ - (__bridge NSString*)kSecClass: (__bridge NSString*)kSecClassKey, - (__bridge NSString*)kSecAttrApplicationTag: tagData, - (__bridge NSString*)kSecAttrAccessible: (__bridge NSString*)kSecAttrAccessibleWhenUnlocked - }; - - - NSDictionary *addItemAttributes = @{ - (__bridge NSString*)kSecValueData: data, - (__bridge NSString*)kSecReturnPersistentRef: @(YES), - }; - - OSStatus addItemStatus = SecItemAdd((__bridge CFDictionaryRef)[self dictionaryByCombiningDictionaries:@[attributes, commonAttributes, addItemAttributes]], &result); - if (addItemStatus != errSecSuccess && addItemStatus != errSecDuplicateItem) { - // add item error - // not duplicate and not added to keychain. - return NULL; - } - - NSDictionary *copyAttributes = @{ - (__bridge NSString*)kSecReturnRef: @(YES), - }; - - CFTypeRef key = NULL; - // TODO: Add error handling later. - OSStatus copyItemStatus = errSecSuccess; - SecItemCopyMatching((__bridge CFDictionaryRef)[self dictionaryByCombiningDictionaries:@[attributes, commonAttributes, copyAttributes]], &key); - if (key == NULL) { - // copy item error - } - return (SecKeyRef)key; - } - - return NULL; -} -+ (SecKeyRef)addKeyWithData:(NSData *)data asPublic:(BOOL)public tag:(NSString *)tag error:(NSError *__autoreleasing*)error; { - return [self addKeyWithData:data asPublic:public tag:tag type:[self keyTypeRSA] error:error]; -} - -+ (SecKeyRef)keyByTag:(NSString *)tag error:(NSError *__autoreleasing*)error; { - return NULL; -} - -+ (void)removeKeyByTag:(NSString *)tag error:(NSError *__autoreleasing*)error; { - NSData *tagData = [tag dataUsingEncoding:NSUTF8StringEncoding]; - if (tagData == nil) { - // tell that nothing to remove. - return; - } - NSDictionary *removeAttributes = @{ - (__bridge NSString*)kSecClass: (__bridge NSString*)kSecClassKey, - (__bridge NSString*)kSecAttrKeyType: (__bridge NSString*)kSecAttrKeyTypeRSA, - (__bridge NSString*)kSecAttrApplicationTag: tagData, - }; - SecItemDelete((__bridge CFDictionaryRef)removeAttributes); -} -@end - -@implementation JWTCryptoSecurity (Certificates) -+ (OSStatus)extractIdentityAndTrustFromPKCS12:(CFDataRef)inPKCS12Data password:(CFStringRef)password identity:(SecIdentityRef *)outIdentity trust:(SecTrustRef *)outTrust { - - OSStatus securityError = errSecSuccess; - - - const void *keys[] = { kSecImportExportPassphrase }; - const void *values[] = { password }; - CFDictionaryRef optionsDictionary = NULL; - - /* Create a dictionary containing the passphrase if one - was specified. Otherwise, create an empty dictionary. */ - optionsDictionary = CFDictionaryCreate( - NULL, keys, - values, (password ? 1 : 0), - NULL, NULL); // 1 - - CFArrayRef items = NULL; - securityError = SecPKCS12Import(inPKCS12Data, - optionsDictionary, - &items); // 2 - - - // - if (securityError == 0) { // 3 - CFDictionaryRef myIdentityAndTrust = CFArrayGetValueAtIndex (items, 0); - const void *tempIdentity = NULL; - tempIdentity = CFDictionaryGetValue (myIdentityAndTrust, - kSecImportItemIdentity); - CFRetain(tempIdentity); - *outIdentity = (SecIdentityRef)tempIdentity; - const void *tempTrust = NULL; - tempTrust = CFDictionaryGetValue (myIdentityAndTrust, kSecImportItemTrust); - - CFRetain(tempTrust); - *outTrust = (SecTrustRef)tempTrust; - } - - if (optionsDictionary) // 4 - CFRelease(optionsDictionary); - - if (items) - CFRelease(items); - - return securityError; -} - -+ (SecKeyRef)publicKeyFromCertificate:(NSData *)certificateData { - SecCertificateRef certificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificateData); - if (certificate != NULL) { - SecPolicyRef secPolicy = SecPolicyCreateBasicX509(); - SecTrustRef trust; - SecTrustCreateWithCertificates(certificate, secPolicy, &trust); - SecTrustResultType resultType; - SecTrustEvaluate(trust, &resultType); - SecKeyRef publicKey = SecTrustCopyPublicKey(trust); - (CFRelease(trust)); - (CFRelease(secPolicy)); - (CFRelease(certificate)); - return publicKey; - } - return NULL; -} -@end - -@implementation JWTCryptoSecurity (Pem) -+ (NSString *)certificateFromPemFileContent:(NSString *)content { - NSRegularExpression *expression = [[NSRegularExpression alloc] initWithPattern:@"-----BEGIN CERTIFICATE-----(.+?)-----END CERTIFICATE-----" options:NSRegularExpressionDotMatchesLineSeparators error:nil]; - return [self itemsFromPemFileContent:content byRegex:expression].firstObject; -} -+ (NSString *)keyFromPemFileContent:(NSString *)content { - NSRegularExpression *expression = [[NSRegularExpression alloc] initWithPattern:@"-----BEGIN(?:[\\w\\s]|)+KEY-----(.+?)-----END(?:[\\w\\s])+KEY-----" options:NSRegularExpressionDotMatchesLineSeparators error:nil]; - return [self itemsFromPemFileContent:content byRegex:expression].firstObject; -} -+ (NSArray *)itemsFromPemFileContent:(NSString *)content byRegex:(NSRegularExpression *)expression { - NSArray *matches = [expression matchesInString:content options:0 range:NSMakeRange(0, content.length)]; - NSTextCheckingResult *result = matches.firstObject; - NSArray *resultArray = @[]; - - if (result) { - for (NSUInteger i = 1; i < result.numberOfRanges; ++i) { - NSString *extractedString = [content substringWithRange:[result rangeAtIndex:i]]; - resultArray = [resultArray arrayByAddingObject:extractedString]; - } - } - return resultArray; -} -+ (NSString *)certificateFromPemFileWithName:(NSString *)name { - NSRegularExpression *expression = [[NSRegularExpression alloc] initWithPattern:@"-----BEGIN CERTIFICATE-----(.+?)-----END CERTIFICATE-----" options:NSRegularExpressionDotMatchesLineSeparators error:nil]; - return [self itemsFromPemFileWithName:name byRegex:expression].firstObject; -} -+ (NSString *)keyFromPemFileWithName:(NSString *)name { - NSRegularExpression *expression = [[NSRegularExpression alloc] initWithPattern:@"-----BEGIN(?:[\\w\\s]|)+KEY-----(.+?)-----END(?:[\\w\\s])+KEY-----" options:NSRegularExpressionDotMatchesLineSeparators error:nil]; - return [self itemsFromPemFileWithName:name byRegex:expression].firstObject; -} -+ (NSArray *)itemsFromPemFileWithName:(NSString *)name byRegex:(NSRegularExpression *)expression { - NSURL *fileURL = [[NSBundle bundleForClass:self.class] URLForResource:name withExtension:@"pem"]; - NSError *error = nil; - NSString *fileContent = [NSString stringWithContentsOfURL:fileURL encoding:NSUTF8StringEncoding error:&error]; - - if (error) { - NSLog(@"%@ error: %@", self.debugDescription, error); - return nil; - } - - return [self itemsFromPemFileContent:fileContent byRegex:expression]; -} -+ (NSString *)stringByRemovingPemHeadersFromString:(NSString *)string { - NSArray *lines = [string componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; - NSArray *linesWithoutHeaders = [lines filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSString *_Nullable evaluatedObject, NSDictionary * _Nullable bindings) { - return !([evaluatedObject hasPrefix:@"-----BEGIN"] || [evaluatedObject hasPrefix:@"-----END"]); - }]]; - return [linesWithoutHeaders componentsJoinedByString:@""]; -} -@end - -@implementation JWTCryptoSecurity (PublicKey) -/** - This method strips the x509 from a provided ASN.1 DER public key. - If the key doesn't contain a header, the DER data is returned as is. - - Supported formats are: - - Headerless: - SEQUENCE - INTEGER (1024 or 2048 bit) -- modulo - INTEGER -- public exponent - - With x509 header: - SEQUENCE - SEQUENCE - OBJECT IDENTIFIER 1.2.840.113549.1.1.1 - NULL - BIT STRING - SEQUENCE - INTEGER (1024 or 2048 bit) -- modulo - INTEGER -- public exponent - - Example of headerless key: - https://lapo.it/asn1js/#3082010A0282010100C1A0DFA367FBC2A5FD6ED5A071E02A4B0617E19C6B5AD11BB61192E78D212F10A7620084A3CED660894134D4E475BAD7786FA1D40878683FD1B7A1AD9C0542B7A666457A270159DAC40CE25B2EAE7CCD807D31AE725CA394F90FBB5C5BA500545B99C545A9FE08EFF00A5F23457633E1DB84ED5E908EF748A90F8DFCCAFF319CB0334705EA012AF15AA090D17A9330159C9AFC9275C610BB9B7C61317876DC7386C723885C100F774C19830F475AD1E9A9925F9CA9A69CE0181A214DF2EB75FD13E6A546B8C8ED699E33A8521242B7E42711066AEC22D25DD45D56F94D3170D6F2C25164D2DACED31C73963BA885ADCB706F40866B8266433ED5161DC50E4B3B0203010001 - - Example of key with X509 header (notice the additional ASN.1 sequence): - https://lapo.it/asn1js/#30819F300D06092A864886F70D010101050003818D0030818902818100D0674615A252ED3D75D2A3073A0A8A445F3188FD3BEB8BA8584F7299E391BDEC3427F287327414174997D147DD8CA62647427D73C9DA5504E0A3EED5274A1D50A1237D688486FADB8B82061675ABFA5E55B624095DB8790C6DBCAE83D6A8588C9A6635D7CF257ED1EDE18F04217D37908FD0CBB86B2C58D5F762E6207FF7B92D0203010001 - */ -//static func stripPublicKeyHeader(keyData: Data) throws -> Data { -// let count = keyData.count / MemoryLayout.size -// -// guard count > 0 else { -// throw SwiftyRSAError(message: "Provided public key is empty") -// } -// -// var byteArray = [UInt8](repeating: 0, count: count) -// (keyData as NSData).getBytes(&byteArray, length: keyData.count) -// -// var index = 0 -// guard byteArray[index] == 0x30 else { -// throw SwiftyRSAError(message: "Provided key doesn't have a valid ASN.1 structure (first byte should be 0x30 == SEQUENCE)") -// } -// -// index += 1 -// if byteArray[index] > 0x80 { -// index += Int(byteArray[index]) - 0x80 + 1 -// } else { -// index += 1 -// } -// -// // If current byte marks an integer (0x02), it means the key doesn't have a X509 header and just -// // contains its modulo & public exponent. In this case, we can just return the provided DER data as is. -// if Int(byteArray[index]) == 0x02 { -// return keyData -// } -// -// // Now that we've excluded the possibility of headerless key, we're looking for a valid X509 header sequence. -// // It should look like this: -// // 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00 -// guard Int(byteArray[index]) == 0x30 else { -// throw SwiftyRSAError(message: "Provided key doesn't have a valid X509 header") -// } -// -// index += 15 -// if byteArray[index] != 0x03 { -// throw SwiftyRSAError(message: "Invalid byte at index \(index - 1) (\(byteArray[index - 1])) for public key header") -// } -// -// index += 1 -// if byteArray[index] > 0x80 { -// index += Int(byteArray[index]) - 0x80 + 1 -// } else { -// index += 1 -// } -// -// guard byteArray[index] == 0 else { -// throw SwiftyRSAError(message: "Invalid byte at index \(index - 1) (\(byteArray[index - 1])) for public key header") -// } -// -// index += 1 -// -// let strippedKeyBytes = [UInt8](byteArray[index...keyData.count - 1]) -// let data = Data(bytes: UnsafePointer(strippedKeyBytes), count: keyData.count - index) -// -// return data -//} -typedef NS_ENUM(NSInteger, JWTPublicHeaderStrippingError) { - JWTPublicHeaderStrippingError_KeyIsEmpty = -200, - JWTPublicHeaderStrippingError_Invalid_ASN1_Structure, - JWTPublicHeaderStrippingError_Invalid_X509_Header, - JWTPublicHeaderStrippingError_Invalid_Byte_At_Index, -}; -+ (NSDictionary *)publicHeaderStrippingMessagesAndCodes { - static NSDictionary *publicHeaderStrippingMessagesAndCodes = nil; - return publicHeaderStrippingMessagesAndCodes ?: - (publicHeaderStrippingMessagesAndCodes = @{ - @(JWTPublicHeaderStrippingError_KeyIsEmpty) : @"Provided public key is empty", - @(JWTPublicHeaderStrippingError_Invalid_ASN1_Structure) : @"Provided key doesn't have a valid ASN.1 structure (first byte should be 0x30 == SEQUENCE)", - @(JWTPublicHeaderStrippingError_Invalid_X509_Header) : @"Provided key doesn't have a valid X509 header", - @(JWTPublicHeaderStrippingError_Invalid_Byte_At_Index) : @"Invalid byte at index (index - 1) ((bytes[index - 1])) for public key header. Access as error.userInfo[Parameters][index] or error.userInfo[Parameters][byte]" - }, - publicHeaderStrippingMessagesAndCodes); -} -+ (NSString *)stringForPublicHeaderStrippingErrorCode:(NSInteger)code { - return [self publicHeaderStrippingMessagesAndCodes][@(code)] ?: @"Unknown Public Header Stripping Error"; -} -+ (NSError*)publicHeaderStrippingErrorForCode:(NSInteger)code parameters:(NSDictionary *)parameters { - return [NSError errorWithDomain:@"io.jwt.crypto.stripping_public_header" code:code userInfo:@{ - @"Parameters" : parameters ?: [NSNull null],NSLocalizedDescriptionKey: [self stringForPublicHeaderStrippingErrorCode:code] - }]; -} -+ (NSError*)publicHeaderStrippingErrorForCode:(NSInteger)code { - return [self publicHeaderStrippingErrorForCode:code parameters:nil]; -} -+ (NSData *)dataByRemovingPublicKeyHeader:(NSData *)data error:(NSError *__autoreleasing *)error { - NSError *currentError = nil; - NSData *currentData = [data copy]; - // let count = keyData.count / MemoryLayout.size - // - // guard count > 0 else { - // throw SwiftyRSAError(message: "Provided public key is empty") - // } - NSInteger countOfBytes = currentData.length / [JWTMemoryLayout createWithType:[JWTMemoryLayout typeUInt8]].size; - if (countOfBytes == 0) { - // throw SwiftyRSAError(message: "Provided public key is empty") - currentError = [self publicHeaderStrippingErrorForCode:JWTPublicHeaderStrippingError_KeyIsEmpty]; - if (error) { - *error = currentError; - } - return nil; - } - // var byteArray = [UInt8](repeating: 0, count: count) - // (keyData as NSData).getBytes(&byteArray, length: keyData.count) -// UInt8 *bytes = (UInt8*)malloc(countOfBytes); - UInt8 *bytes = (UInt8 *)[currentData bytes]; -// memcpy(bytes, [currentData bytes], countOfBytes); - - // var index = 0 - // guard byteArray[index] == 0x30 else { - // throw SwiftyRSAError(message: "Provided key doesn't have a valid ASN.1 structure (first byte should be 0x30 == SEQUENCE)") - // } - - UInt8 index = 0; - if (bytes[index] != 0x30) { - // throw SwiftyRSAError(message: "Provided key doesn't have a valid ASN.1 structure (first byte should be 0x30 == SEQUENCE)") - currentError = [self publicHeaderStrippingErrorForCode:JWTPublicHeaderStrippingError_Invalid_ASN1_Structure]; - if (error) { - *error = currentError; - } - return nil; - } - - // index += 1 - // if byteArray[index] > 0x80 { - // index += Int(byteArray[index]) - 0x80 + 1 - // } else { - // index += 1 - // } - index += 1; - if (bytes[index] > 0x80) { - index += (SInt8)bytes[index] - 0x80 + 1; - } - else { - index += 1; - } - - // Headerless! - // // If current byte marks an integer (0x02), it means the key doesn't have a X509 header and just - // // contains its modulo & public exponent. In this case, we can just return the provided DER data as is. - // if Int(byteArray[index]) == 0x02 { - // return keyData - // } - if ((SInt8)bytes[index] == 0x02) { - return currentData; - } - - // Has header. - - // // Now that we've excluded the possibility of headerless key, we're looking for a valid X509 header sequence. - // // It should look like this: - // // 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00 - // guard Int(byteArray[index]) == 0x30 else { - // throw SwiftyRSAError(message: "Provided key doesn't have a valid X509 header") - // } - if ((SInt8)bytes[index] != 0x30) { - // throw SwiftyRSAError(message: "Provided key doesn't have a valid X509 header") - currentError = [self publicHeaderStrippingErrorForCode:JWTPublicHeaderStrippingError_Invalid_X509_Header]; - if (error) { - *error = currentError; - } - return nil; - } - - // index += 15 - // if byteArray[index] != 0x03 { - // throw SwiftyRSAError(message: "Invalid byte at index \(index - 1) (\(byteArray[index - 1])) for public key header") - // } - index += 15; - if (bytes[index] != 0x03) { - // throw SwiftyRSAError(message: "Invalid byte at index \(index - 1) (\(byteArray[index - 1])) for public key header") - currentError = [self publicHeaderStrippingErrorForCode:JWTPublicHeaderStrippingError_Invalid_Byte_At_Index parameters:@{@"index" : @(index - 1), @"byte": @(bytes[index - 1] ?: 0)}]; - if (error) { - *error = currentError; - } - return nil; - } - // index += 1 - // if byteArray[index] > 0x80 { - // index += Int(byteArray[index]) - 0x80 + 1 - // } else { - // index += 1 - // } - index += 1; - if (bytes[index] > 0x80) { - index += (SInt8)bytes[index] - 0x80 + 1; - } - else { - index += 1; - } - // guard byteArray[index] == 0 else { - // throw SwiftyRSAError(message: "Invalid byte at index \(index - 1) (\(byteArray[index - 1])) for public key header") - // } - if (bytes[index] != 0) { - // throw SwiftyRSAError(message: "Invalid byte at index \(index - 1) (\(byteArray[index - 1])) for public key header") - currentError = [self publicHeaderStrippingErrorForCode:JWTPublicHeaderStrippingError_Invalid_Byte_At_Index parameters:@{@"index" : @(index - 1), @"byte": @(bytes[index - 1] ?: 0)}]; - if (error) { - *error = currentError; - } - return nil; - } - // index += 1 - // - // let strippedKeyBytes = [UInt8](byteArray[index...keyData.count - 1]) - // let data = Data(bytes: UnsafePointer(strippedKeyBytes), count: keyData.count - index) - index += 1; - NSInteger countOfStrippedBytes = currentData.length - index; - UInt8 *strippedBytes = (UInt8 *)(bytes + index); - NSData *resultData = [[NSData alloc] initWithBytes:strippedBytes length:countOfStrippedBytes]; - // return data - return resultData; -} -@end diff --git a/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h b/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h deleted file mode 100644 index adffc40ee..000000000 --- a/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// JWTClaim.h -// JWT -// -// Created by Lobanov Dmitry on 13.02.16. -// Copyright © 2016 Karma. All rights reserved. -// - -#import - -@interface JWTClaim : NSObject - -+ (NSString *)name; -+ (instancetype)claimByName:(NSString *)name; -+ (BOOL)verifyValue:(NSObject *)value withTrustedValue:(NSObject *)trustedValue; -- (BOOL)verifyValue:(NSObject *)value withTrustedValue:(NSObject *)trustedValue; - -@end diff --git a/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m b/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m deleted file mode 100644 index 502cca214..000000000 --- a/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +++ /dev/null @@ -1,214 +0,0 @@ -// -// JWTClaim.m -// JWT -// -// Created by Lobanov Dmitry on 13.02.16. -// Copyright © 2016 Karma. All rights reserved. -// - -#import "JWTClaim.h" - -// TODO(3.0): Claim aud should check include in collection? -// Add claims specification tests. -// "iss" (Issuer) Claim -// "sub" (Subject) Claim -// "aud" (Audience) Claim -// "exp" (Expiration Time) Claim -// "nbf" (Not Before) Claim -// "iat" (Issued At) Claim -// "jti" (JWT ID) Claim -// "typ" (Type) Claim -// "scope" (Scope) Claim - -@interface JWTClaimIssuer : JWTClaim - -@end - -@implementation JWTClaimIssuer - -+ (NSString *)name { - return @"iss"; -} - -+ (BOOL)verifyValue:(NSString *)value withTrustedValue:(NSString *)trustedValue { - return [trustedValue isEqualToString:value]; -} - -@end - -@interface JWTClaimSubject : JWTClaim - -@end - -@implementation JWTClaimSubject - -+ (NSString *)name { - return @"sub"; -} - -+ (BOOL)verifyValue:(NSString *)value withTrustedValue:(NSString *)trustedValue { - return [trustedValue isEqualToString:value]; -} - -@end - -@interface JWTClaimAudience : JWTClaim - -@end - -// TODO: add array support later -@implementation JWTClaimAudience - -+ (NSString *)name { - return @"aud"; -} - -+ (BOOL)verifyValue:(NSString *)value withTrustedValue:(NSString *)trustedValue { - return [trustedValue isEqualToString:value]; -} - -@end - -@interface JWTClaimExpirationTime : JWTClaim - -@end - -@implementation JWTClaimExpirationTime - -+ (NSString *)name { - return @"exp"; -} - -+ (BOOL)verifyValue:(NSDate *)value withTrustedValue:(NSDate *)trustedValue { - // trustedValue - current date - // value - expiration date - // trustedValue < value, so - return [trustedValue compare:value] == NSOrderedAscending; -} - -@end - -@interface JWTClaimNotBefore : JWTClaim - -@end - -@implementation JWTClaimNotBefore - -+ (NSString *)name { - return @"nbf"; -} - -+ (BOOL)verifyValue:(NSDate *)value withTrustedValue:(NSDate *)trustedValue { - // trustedValue - current date - // value - start date - // value <= trustedValue, so - // trustedValue >= value, which means: - // !(trustedValue < value) or NOT OrderedAscending - return [trustedValue compare:value] != NSOrderedAscending; -} - -@end - -@interface JWTClaimIssuedAt : JWTClaim - -@end - -@implementation JWTClaimIssuedAt - -+ (NSString *)name { - return @"iat"; -} - -+ (BOOL)verifyValue:(NSDate *)value withTrustedValue:(NSDate *)trustedValue { - // trustedValue - current date - // value - issued at date - // value < trustedValue, so - // trustedValue > value - return [trustedValue compare:value] == NSOrderedDescending; -} - -@end - -@interface JWTClaimJWTID : JWTClaim - -@end - -@implementation JWTClaimJWTID - -+ (NSString *)name { - return @"jti"; -} - -+ (BOOL)verifyValue:(NSString *)value withTrustedValue:(NSString *)trustedValue { - return [trustedValue isEqualToString:value]; -} - -@end - -@interface JWTClaimType : JWTClaim - -@end - -@implementation JWTClaimType - -+ (NSString *)name { - return @"typ"; -} - -+ (BOOL)verifyValue:(NSString *)value withTrustedValue:(NSString *)trustedValue { - return [trustedValue isEqualToString:value]; -} - -@end - -@interface JWTClaimScope : JWTClaim - -@end - -@implementation JWTClaimScope - -+ (NSString *)name { - return @"scope"; -} - -+ (BOOL)verifyValue:(NSString *)value withTrustedValue:(NSString *)trustedValue { - return [trustedValue isEqualToString:value]; -} - -@end - - -@implementation JWTClaim -+ (NSString *)name { - return @""; -} - -+ (NSDictionary *)claimsAndNames { - static NSDictionary *dictionary = nil; - return dictionary ? dictionary : (dictionary = @{ - [JWTClaimIssuer name] : [JWTClaimIssuer new], - [JWTClaimSubject name] : [JWTClaimSubject new], - [JWTClaimAudience name] : [JWTClaimAudience new], - [JWTClaimExpirationTime name] : [JWTClaimExpirationTime new], - [JWTClaimNotBefore name] : [JWTClaimNotBefore new], - [JWTClaimIssuedAt name] : [JWTClaimIssuedAt new], - [JWTClaimJWTID name] : [JWTClaimJWTID new], - [JWTClaimType name] : [JWTClaimType new], - [JWTClaimScope name] : [JWTClaimScope new] - }, dictionary); -} - -+ (instancetype)claimByName:(NSString *)name { - return [self claimsAndNames][name]; -} - -+ (BOOL)verifyValue:(NSObject *)value withTrustedValue:(NSObject *)trustedValue { - return NO; -} - -- (BOOL)verifyValue:(NSObject *)value withTrustedValue:(NSObject *)trustedValue { - return [self.class verifyValue:value withTrustedValue:trustedValue]; -} - -@end - diff --git a/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h b/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h deleted file mode 100644 index 80be7e1d5..000000000 --- a/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// JWTClaimsSet.h -// JWT -// -// Created by Klaas Pieter Annema on 31-05-13. -// Copyright (c) 2013 Karma. All rights reserved. -// - -#import - -@interface JWTClaimsSet : NSObject - -@property (nonatomic, readwrite, copy) NSString *issuer; -@property (nonatomic, readwrite, copy) NSString *subject; -@property (nonatomic, readwrite, copy) NSString *audience; -@property (nonatomic, readwrite, copy) NSDate *expirationDate; -@property (nonatomic, readwrite, copy) NSDate *notBeforeDate; -@property (nonatomic, readwrite, copy) NSDate *issuedAt; -@property (nonatomic, readwrite, copy) NSString *identifier; -@property (nonatomic, readwrite, copy) NSString *type; -@property (nonatomic, readwrite, copy) NSString *scope; - -@end diff --git a/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m b/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m deleted file mode 100644 index b64a8d07a..000000000 --- a/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// JWTClaimsSet.m -// JWT -// -// Created by Klaas Pieter Annema on 31-05-13. -// Copyright (c) 2013 Karma. All rights reserved. -// - -#import "JWTClaimsSet.h" - -@implementation JWTClaimsSet - -- (id)copyWithZone:(NSZone *)zone { - JWTClaimsSet *newClaimsSet = [[self.class alloc] init]; - - newClaimsSet.issuer = self.issuer; - newClaimsSet.subject = self.subject; - newClaimsSet.audience = self.audience; - newClaimsSet.expirationDate = self.expirationDate; - newClaimsSet.notBeforeDate = self.notBeforeDate; - newClaimsSet.issuedAt = self.issuedAt; - newClaimsSet.identifier = self.identifier; - newClaimsSet.type = self.type; - newClaimsSet.scope = self.scope; - - return newClaimsSet; -} - -@end diff --git a/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h b/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h deleted file mode 100644 index cdbaede47..000000000 --- a/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// JWTClaimsSetSerializer.h -// JWT -// -// Created by Klaas Pieter Annema on 31-05-13. -// Copyright (c) 2013 Karma. All rights reserved. -// - -#import - -#import "JWTClaimsSet.h" - -@interface JWTClaimsSetSerializer : NSObject - -+ (NSArray *)claimsSetKeys; -+ (NSDictionary *)dictionaryWithClaimsSet:(JWTClaimsSet *)theClaimsSet; -+ (JWTClaimsSet *)claimsSetWithDictionary:(NSDictionary *)theDictionary; - -@end diff --git a/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m b/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m deleted file mode 100644 index a91b238b0..000000000 --- a/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +++ /dev/null @@ -1,68 +0,0 @@ -// -// JWTClaimsSetSerializer.m -// JWT -// -// Created by Klaas Pieter Annema on 31-05-13. -// Copyright (c) 2013 Karma. All rights reserved. -// - -#import "JWTClaimsSetSerializer.h" - -@implementation JWTClaimsSetSerializer - -+ (NSArray *)claimsSetKeys -{ - return @[@"iss", @"sub", @"aud", @"exp", @"nbf", @"iat", @"jti", @"typ", @"scope"]; -} - -+ (NSDictionary *)dictionaryWithClaimsSet:(JWTClaimsSet *)theClaimsSet; -{ - NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; - [self dictionary:dictionary setObjectIfNotNil:theClaimsSet.issuer forKey:@"iss"]; - [self dictionary:dictionary setObjectIfNotNil:theClaimsSet.subject forKey:@"sub"]; - [self dictionary:dictionary setObjectIfNotNil:theClaimsSet.audience forKey:@"aud"]; - [self dictionary:dictionary setDateIfNotNil:theClaimsSet.expirationDate forKey:@"exp"]; - [self dictionary:dictionary setDateIfNotNil:theClaimsSet.notBeforeDate forKey:@"nbf"]; - [self dictionary:dictionary setDateIfNotNil:theClaimsSet.issuedAt forKey:@"iat"]; - [self dictionary:dictionary setObjectIfNotNil:theClaimsSet.identifier forKey:@"jti"]; - [self dictionary:dictionary setObjectIfNotNil:theClaimsSet.type forKey:@"typ"]; - [self dictionary:dictionary setObjectIfNotNil:theClaimsSet.scope forKey:@"scope"]; - - return [dictionary copy]; -} - -+ (JWTClaimsSet *)claimsSetWithDictionary:(NSDictionary *)theDictionary; -{ - JWTClaimsSet *claimsSet = [[JWTClaimsSet alloc] init]; - claimsSet.issuer = [theDictionary objectForKey:@"iss"]; - claimsSet.subject = [theDictionary objectForKey:@"sub"]; - claimsSet.audience = [theDictionary objectForKey:@"aud"]; - claimsSet.expirationDate = [NSDate dateWithTimeIntervalSince1970:[[theDictionary objectForKey:@"exp"] doubleValue]]; - claimsSet.notBeforeDate = [NSDate dateWithTimeIntervalSince1970:[[theDictionary objectForKey:@"nbf"] doubleValue]]; - claimsSet.issuedAt = [NSDate dateWithTimeIntervalSince1970:[[theDictionary objectForKey:@"iat"] doubleValue]]; - claimsSet.identifier = [theDictionary objectForKey:@"jti"]; - claimsSet.type = [theDictionary objectForKey:@"typ"]; - claimsSet.scope = [theDictionary objectForKey:@"scope"]; - - return claimsSet; -} - -+ (void)dictionary:(NSMutableDictionary *)theDictionary setObjectIfNotNil:(id)theObject forKey:(id)theKey; -{ - if (!theObject) - return; - - [theDictionary setObject:theObject forKey:theKey]; -} - -+ (void)dictionary:(NSMutableDictionary *)theDictionary setDateIfNotNil:(NSDate*)date forKey:(id)theKey; -{ - if (!date) - return; - NSNumber* value = @((unsigned long)[date timeIntervalSince1970]); - - [theDictionary setObject:value forKey:theKey]; -} - - -@end diff --git a/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h b/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h deleted file mode 100644 index de70250d1..000000000 --- a/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// JWTClaimsSetVerifier.h -// JWT -// -// Created by Lobanov Dmitry on 13.02.16. -// Copyright © 2016 Karma. All rights reserved. -// - -#import -#import "JWTClaimsSet.h" - -@interface JWTClaimsSetVerifier : NSObject - -+ (BOOL)verifyClaimsSet:(JWTClaimsSet *)theClaimsSet withTrustedClaimsSet:(JWTClaimsSet *)trustedClaimsSet; - -+ (BOOL)verifyClaimsSetDictionary:(NSDictionary *)theClaimsSetDictionary withTrustedClaimsSet:(JWTClaimsSet *)trustedClaimsSet; - -@end diff --git a/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m b/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m deleted file mode 100644 index 91f24740d..000000000 --- a/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +++ /dev/null @@ -1,72 +0,0 @@ -// -// JWTClaimsSetVerifier.m -// JWT -// -// Created by Lobanov Dmitry on 13.02.16. -// Copyright © 2016 Karma. All rights reserved. -// - -#import "JWTClaimsSetVerifier.h" -#import "JWTClaimsSetSerializer.h" -#import "JWTClaim.h" - -@implementation JWTClaimsSetVerifier - -+ (BOOL)verifyDictionary:(NSDictionary *)dictionary withTrustedDictionary:(NSDictionary *)trustedDictionary byKey:(NSString *)key { - NSObject *value = dictionary[key]; - NSObject *trustedValue = trustedDictionary[key]; - - BOOL result = YES; - - if (trustedValue) { - result = [[JWTClaim claimByName:key] verifyValue:value withTrustedValue:trustedValue]; - } - - return result; -} - -+ (BOOL)verifyClaimsSetDictionary:(NSDictionary *)theClaimsSetDictionary withTrustedClaimsSetDictionary:(NSDictionary *)trustedClaimsSetDictionary { - - NSArray *claimsSets = [JWTClaimsSetSerializer claimsSetKeys]; - - if (!trustedClaimsSetDictionary) { - return YES; - } - - if (!theClaimsSetDictionary) { - return NO; - } - - BOOL result = YES; - - for (NSString *key in claimsSets) { - result = result && [self verifyDictionary:theClaimsSetDictionary withTrustedDictionary:trustedClaimsSetDictionary byKey:key]; - } - - return result; -} - - -+ (BOOL)verifyClaimsSet:(JWTClaimsSet *)theClaimsSet withTrustedClaimsSet:(JWTClaimsSet *)trustedClaimsSet { - - NSDictionary *dictionary = [JWTClaimsSetSerializer dictionaryWithClaimsSet:theClaimsSet]; - - NSDictionary *trustedDictionary = [JWTClaimsSetSerializer dictionaryWithClaimsSet:trustedClaimsSet]; - - NSArray *claimsSets = [JWTClaimsSetSerializer claimsSetKeys]; - - BOOL result = YES; - for (NSString *key in claimsSets) { - result = result && [self verifyDictionary:dictionary withTrustedDictionary:trustedDictionary byKey:key]; - } - - return result; -} - -+ (BOOL)verifyClaimsSetDictionary:(NSDictionary *)theClaimsSetDictionary withTrustedClaimsSet:(JWTClaimsSet *)trustedClaimsSet { - NSDictionary *trustedDictionary = [JWTClaimsSetSerializer dictionaryWithClaimsSet:trustedClaimsSet]; - - return [self verifyClaimsSetDictionary:theClaimsSetDictionary withTrustedClaimsSetDictionary:trustedDictionary]; -} - -@end \ No newline at end of file diff --git a/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h b/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h deleted file mode 100644 index 08f5cdef0..000000000 --- a/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +++ /dev/null @@ -1,67 +0,0 @@ -// -// JWTCoding+ResultTypes.h -// JWT -// -// Created by Lobanov Dmitry on 30.11.16. -// Copyright © 2016 JWTIO. All rights reserved. -// - -#import -@class JWTClaimsSet; - -extern NSString *JWTCodingResultHeaders; -extern NSString *JWTCodingResultPayload; - -@interface JWT (ResultTypes) @end - -/* - ResultType - /\ - / \ - / \ - Success Error - - Protocols: Mutable and Immutable (?!?) - */ - -// Public -@protocol JWTCodingResultTypeSuccessEncodedProtocol -@property (copy, nonatomic, readonly) NSString *encoded; -- (instancetype)initWithEncoded:(NSString *)encoded; -@property (copy, nonatomic, readonly) NSString *token; -- (instancetype)initWithToken:(NSString *)token; -@end - -// Public -@protocol JWTCodingResultTypeSuccessDecodedProtocol -@property (copy, nonatomic, readonly) NSDictionary *headers; -@property (copy, nonatomic, readonly) NSDictionary *payload; - -// dictionary @{ -// JWTCodingResultHeaders : self.headers, -// JWTCodingResultPayload : self.payload -//} -@property (copy, nonatomic, readonly) NSDictionary *headerAndPayloadDictionary; - -@property (nonatomic, readonly) JWTClaimsSet *claimsSet; -- (instancetype)initWithHeaders:(NSDictionary *)headers withPayload:(NSDictionary *)payload; -- (instancetype)initWithClaimsSet:(JWTClaimsSet *)claimsSet; -@end - -// Public -@interface JWTCodingResultTypeSuccess : NSObject @end - -// Public -@protocol JWTCodingResultTypeErrorProtocol -@property (copy, nonatomic, readonly) NSError *error; -- (instancetype)initWithError:(NSError *)error; -@end - -@interface JWTCodingResultTypeError : NSObject @end - -@interface JWTCodingResultType : NSObject -- (instancetype)initWithSuccessResult:(JWTCodingResultTypeSuccess *)success; -- (instancetype)initWithErrorResult:(JWTCodingResultTypeError *)error; -@property (strong, nonatomic, readonly) JWTCodingResultTypeSuccess *successResult; -@property (strong, nonatomic, readonly) JWTCodingResultTypeError *errorResult; -@end diff --git a/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m b/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m deleted file mode 100644 index 74fe4ed71..000000000 --- a/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +++ /dev/null @@ -1,111 +0,0 @@ -// -// JWTCoding+ResultTypes.m -// JWT -// -// Created by Lobanov Dmitry on 30.11.16. -// Copyright © 2016 JWTIO. All rights reserved. -// - -#import "JWTCoding+ResultTypes.h" - -NSString *JWTCodingResultHeaders = @"header"; -NSString *JWTCodingResultPayload = @"payload"; - -@implementation JWT (ResultTypes) @end - -// Protected? -@protocol JWTMutableCodingResultTypeSuccessEncodedProtocol -@property (copy, nonatomic, readwrite) NSString *encoded; -@property (copy, nonatomic, readwrite) NSString *token; -@end - -// Protected? -@protocol JWTMutableCodingResultTypeSuccessDecodedProtocol -@property (copy, nonatomic, readwrite) NSDictionary *headers; -@property (copy, nonatomic, readwrite) NSDictionary *payload; -@property (nonatomic, readwrite) JWTClaimsSet *claimsSet; -@end - -// Protected? -@protocol JWTMutableCodingResultTypeErrorProtocol -@property (copy, nonatomic, readwrite) NSError *error; -@end - -@interface JWTCodingResultTypeSuccess () @end - -@implementation JWTCodingResultTypeSuccess -@synthesize encoded = _encoded; -@synthesize headers = _headers; -@synthesize payload = _payload; -@synthesize claimsSet = _claimsSet; -//Not used yet. Could be replacement for _encoded. -@synthesize token = _token; - -- (NSDictionary *)headerAndPayloadDictionary { - if (self.headers && self.payload) { - return @{ - JWTCodingResultHeaders: self.headers, - JWTCodingResultPayload: self.payload - }; - } - return nil; -} -- (instancetype)initWithEncoded:(NSString *)encoded { - if (self = [super init]) { - self.encoded = encoded; - } - return self; -} -- (instancetype)initWithToken:(NSString *)token { - if (self = [super init]) { - self.token = token; - } - return self; -} -- (instancetype)initWithHeaders:(NSDictionary *)headers withPayload:(NSDictionary *)payload { - if (self = [super init]) { - self.headers = headers; - self.payload = payload; - } - return self; -} -- (instancetype)initWithClaimsSet:(JWTClaimsSet *)claimsSet { - if (self = [super init]) { - self.claimsSet = claimsSet; - } - return self; -} -@end - -@interface JWTCodingResultTypeError () @end - -@implementation JWTCodingResultTypeError -@synthesize error = _error; -- (instancetype)initWithError:(NSError *)error { - if (self = [super init]) { - self.error = error; - } - return self; -} -@end - -@interface JWTCodingResultType () -@property (strong, nonatomic, readwrite) JWTCodingResultTypeSuccess *successResult; -@property (strong, nonatomic, readwrite) JWTCodingResultTypeError *errorResult; -@end - -@implementation JWTCodingResultType -- (instancetype)initWithSuccessResult:(JWTCodingResultTypeSuccess *)success { - if (self = [super init]) { - self.successResult = success; - } - return self; -} -- (instancetype)initWithErrorResult:(JWTCodingResultTypeError *)error { - if (self = [super init]) { - self.errorResult = error; - } - return self; -} - -@end diff --git a/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h b/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h deleted file mode 100644 index 2ecefbf61..000000000 --- a/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +++ /dev/null @@ -1,119 +0,0 @@ -// -// JWTCoding+VersionOne.h -// JWT -// -// Created by Lobanov Dmitry on 27.11.16. -// Copyright © 2016 JWTIO. All rights reserved. -// - -#import - -@protocol JWTAlgorithm; -@class JWTClaimsSet; - -@interface JWT (VersionOne) -#pragma mark - Encode -+ (NSString *)encodeClaimsSet:(JWTClaimsSet *)theClaimsSet withSecret:(NSString *)theSecret; -+ (NSString *)encodeClaimsSet:(JWTClaimsSet *)theClaimsSet withSecret:(NSString *)theSecret algorithm:(id)theAlgorithm; - -+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret; -+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret algorithm:(id)theAlgorithm; - -+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret withHeaders:(NSDictionary *)theHeaders algorithm:(id)theAlgorithm; - -+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret withHeaders:(NSDictionary *)theHeaders algorithm:(id)theAlgorithm withError:(NSError * __autoreleasing *)theError; - -//Will be deprecated in later releases -#pragma mark - Decode - -/** - Decodes a JWT and returns the decoded Header and Payload - @param theMessage The encoded JWT - @param theSecret The verification key to use for validating the JWT signature - @param theTrustedClaimsSet The JWTClaimsSet to use for verifying the JWT values - @param theError Error pointer, if there is an error decoding the message, upon return contains an NSError object that describes the problem. - @param theAlgorithmName The name of the algorithm to use for verifying the signature. Required, unless skipping verification - @param theForcedOption BOOL indicating if verifying the JWT signature should be skipped. Should only be used for debugging - @return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs. - */ -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withTrustedClaimsSet:(JWTClaimsSet *)theTrustedClaimsSet withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName withForcedOption:(BOOL)theForcedOption; - -/** - Decodes a JWT and returns the decoded Header and Payload - @param theMessage The encoded JWT - @param theSecret The verification key to use for validating the JWT signature - @param theTrustedClaimsSet The JWTClaimsSet to use for verifying the JWT values - @param theError Error pointer, if there is an error decoding the message, upon return contains an NSError object that describes the problem. - @param theAlgorithmName The name of the algorithm to use for verifying the signature. Required. - @return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs. - */ -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withTrustedClaimsSet:(JWTClaimsSet *)theTrustedClaimsSet withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName; - -/** - Decodes a JWT and returns the decoded Header and Payload. - - Uses the JWTAlgorithmHS512 for decoding - - @param theMessage The encoded JWT - @param theSecret The verification key to use for validating the JWT signature - @param theTrustedClaimsSet The JWTClaimsSet to use for verifying the JWT values - @param theError Error pointer, if there is an error decoding the message, upon return contains an NSError object that describes the problem. - @param theForcedOption BOOL indicating if verifying the JWT signature should be skipped. Should only be used for debugging - @return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs. - */ -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withTrustedClaimsSet:(JWTClaimsSet *)theTrustedClaimsSet withError:(NSError *__autoreleasing *)theError withForcedOption:(BOOL)theForcedOption; - -/** - Decodes a JWT and returns the decoded Header and Payload - @param theMessage The encoded JWT - @param theSecret The verification key to use for validating the JWT signature - @param theError Error pointer, if there is an error decoding the message, upon return contains an NSError object that describes the problem. - @param theAlgorithmName The name of the algorithm to use for verifying the signature. Required, unless skipping verification - @param skipVerification BOOL indicating if verifying the JWT signature should be skipped. Should only be used for debugging - @return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs. - */ -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName skipVerification:(BOOL)skipVerification; - -/** - Decodes a JWT and returns the decoded Header and Payload - @param theMessage The encoded JWT - @param theSecret The verification key to use for validating the JWT signature - @param theError Error pointer, if there is an error decoding the message, upon return contains an NSError object that describes the problem. - @param theAlgorithmName The name of the algorithm to use for verifying the signature. Required. - @return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs. - */ -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName; - -/** - Decodes a JWT and returns the decoded Header and Payload - - Uses the JWTAlgorithmHS512 for decoding - - @param theMessage The encoded JWT - @param theSecret The verification key to use for validating the JWT signature - @param theError Error pointer, if there is an error decoding the message, upon return contains an NSError object that describes the problem. - @param theForcedOption BOOL indicating if verifying the JWT signature should be skipped. - @return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs. - */ -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError *__autoreleasing *)theError withForcedOption:(BOOL)theForcedOption; - -/** - Decodes a JWT and returns the decoded Header and Payload. - Uses the JWTAlgorithmHS512 for decoding - @param theMessage The encoded JWT - @param theSecret The verification key to use for validating the JWT signature - @param theError Error pointer, if there is an error decoding the message, upon return contains an NSError object that describes the problem. - @return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs. - */ -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError * __autoreleasing *)theError; - -/** - Decodes a JWT and returns the decoded Header and Payload. - Uses the JWTAlgorithmHS512 for decoding - @param theMessage The encoded JWT - @param theSecret The verification key to use for validating the JWT signature - @return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs. - */ -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret; - -@end diff --git a/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m b/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m deleted file mode 100644 index 04c0c7cea..000000000 --- a/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +++ /dev/null @@ -1,307 +0,0 @@ -// -// JWTCoding+VersionOne.m -// JWT -// -// Created by Lobanov Dmitry on 27.11.16. -// Copyright © 2016 JWTIO. All rights reserved. -// - -#import "JWTCoding+VersionOne.h" -#import "JWTBase64Coder.h" - -#import "JWTRSAlgorithm.h" - -#import "JWTAlgorithmFactory.h" -#import "JWTAlgorithmHSBase.h" - -#import "JWTAlgorithmDataHolder.h" - -#import "JWTClaimsSetSerializer.h" -#import "JWTClaimsSetVerifier.h" - -#import "JWTErrorDescription.h" - -@implementation JWT (VersionOne) -#pragma mark - Private Methods -+ (NSString *)encodeSegment:(id)theSegment withError:(NSError **)error -{ - NSData *encodedSegmentData = nil; - - if (theSegment) { - encodedSegmentData = [NSJSONSerialization dataWithJSONObject:theSegment options:0 error:error]; - } - else { - // error! - NSError *generatedError = [JWTErrorDescription errorWithCode:JWTInvalidSegmentSerializationError]; - if (error) { - *error = generatedError; - } - NSLog(@"%@ Could not encode segment: %@", self.class, generatedError.localizedDescription); - return nil; - } - - NSString *encodedSegment = nil; - - if (encodedSegmentData) { - encodedSegment = [JWTBase64Coder base64UrlEncodedStringWithData:encodedSegmentData];//[encodedSegmentData base64UrlEncodedString]; - } - - return encodedSegment; -} - -+ (NSString *)encodeSegment:(id)theSegment; -{ - NSError *error; - return [self encodeSegment:theSegment withError:&error]; -} - -#pragma mark - Public Methods - -+ (NSString *)encodeClaimsSet:(JWTClaimsSet *)theClaimsSet withSecret:(NSString *)theSecret; -{ - return [self encodeClaimsSet:theClaimsSet withSecret:theSecret algorithm:[JWTAlgorithmFactory algorithmByName:JWTAlgorithmNameHS512]]; -} - -+ (NSString *)encodeClaimsSet:(JWTClaimsSet *)theClaimsSet withSecret:(NSString *)theSecret algorithm:(id)theAlgorithm; -{ - NSDictionary *payload = [JWTClaimsSetSerializer dictionaryWithClaimsSet:theClaimsSet]; - return [self encodePayload:payload withSecret:theSecret algorithm:theAlgorithm]; -} - -+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret; -{ - return [self encodePayload:thePayload withSecret:theSecret algorithm:[JWTAlgorithmFactory algorithmByName:JWTAlgorithmNameHS512]]; -} - -+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret algorithm:(id)theAlgorithm; -{ - return [self encodePayload:thePayload withSecret:theSecret withHeaders:nil algorithm:theAlgorithm]; -} - -+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret withHeaders:(NSDictionary *)theHeaders algorithm:(id)theAlgorithm; -{ - - NSError *error = nil; - NSString *encodedString = [self encodePayload:thePayload withSecret:theSecret withHeaders:theHeaders algorithm:theAlgorithm withError:&error]; - - if (error) { - // do something - } - - return encodedString; -} - -+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret withHeaders:(NSDictionary *)theHeaders algorithm:(id)theAlgorithm withError:(NSError * __autoreleasing *)theError; -{ - - NSDictionary *header = @{@"typ": @"JWT", @"alg": theAlgorithm.name}; - NSMutableDictionary *allHeaders = [header mutableCopy]; - - if (theHeaders.allKeys.count) { - [allHeaders addEntriesFromDictionary:theHeaders]; - } - - NSString *headerSegment = [self encodeSegment:[allHeaders copy] withError:theError]; - - if (!headerSegment) { - // encode header segment error - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTEncodingHeaderError]; - } - return nil; - } - - NSString *payloadSegment = [self encodeSegment:thePayload withError:theError]; - - if (!payloadSegment) { - // encode payment segment error - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTEncodingPayloadError]; - } - return nil; - } - - if (!theAlgorithm) { - // error - *theError = [JWTErrorDescription errorWithCode:JWTUnsupportedAlgorithmError]; - return nil; - } - - NSString *signingInput = [@[headerSegment, payloadSegment] componentsJoinedByString:@"."]; - NSData *signedOutputData = [theAlgorithm encodePayload:signingInput withSecret:theSecret]; - NSString *signedOutput = [JWTBase64Coder base64UrlEncodedStringWithData:signedOutputData]; - - return [@[headerSegment, payloadSegment, signedOutput] componentsJoinedByString:@"."]; -} - -#pragma mark - Decode - -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withTrustedClaimsSet:(JWTClaimsSet *)theTrustedClaimsSet withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName -{ - return [self decodeMessage:theMessage withSecret:theSecret withTrustedClaimsSet:theTrustedClaimsSet withError:theError withForcedAlgorithmByName:theAlgorithmName withForcedOption:NO]; -} - -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withTrustedClaimsSet:(JWTClaimsSet *)theTrustedClaimsSet withError:(NSError *__autoreleasing *)theError withForcedOption:(BOOL)theForcedOption -{ - return [self decodeMessage:theMessage withSecret:theSecret withTrustedClaimsSet:theTrustedClaimsSet withError:theError withForcedAlgorithmByName:JWTAlgorithmNameHS512 withForcedOption:theForcedOption]; -} - -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withTrustedClaimsSet:(JWTClaimsSet *)theTrustedClaimsSet withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName withForcedOption:(BOOL)theForcedOption -{ - return [self decodeMessage:theMessage withSecret:theSecret withTrustedClaimsSet:theTrustedClaimsSet withError:theError withForcedAlgorithmByName:theAlgorithmName withForcedOption:theForcedOption withAlgorithmWhiteList:nil]; -} - -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withTrustedClaimsSet:(JWTClaimsSet *)theTrustedClaimsSet withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName withForcedOption:(BOOL)theForcedOption withAlgorithmWhiteList:(NSSet *)theWhitelist -{ - NSDictionary *dictionary = [self decodeMessage:theMessage withSecret:theSecret withError:theError withForcedAlgorithmByName:theAlgorithmName skipVerification:theForcedOption whitelist:theWhitelist]; - - if (*theError) { - // do something - return dictionary; - } - - if (theTrustedClaimsSet) { - BOOL claimVerified = [JWTClaimsSetVerifier verifyClaimsSet:[JWTClaimsSetSerializer claimsSetWithDictionary:dictionary[@"payload"]] withTrustedClaimsSet:theTrustedClaimsSet]; - if (claimVerified) { - return dictionary; - } - else { - *theError = [JWTErrorDescription errorWithCode:JWTClaimsSetVerificationFailed]; - return nil; - } - } - - return dictionary; -} - -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError *__autoreleasing *)theError withForcedOption:(BOOL)theForcedOption; -{ - return [self decodeMessage:theMessage withSecret:theSecret withError:theError withForcedAlgorithmByName:JWTAlgorithmNameHS512 skipVerification:theForcedOption]; -} - -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName; -{ - return [self decodeMessage:theMessage withSecret:theSecret withError:theError withForcedAlgorithmByName:theAlgorithmName skipVerification:NO]; -} - -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName skipVerification:(BOOL)skipVerification -{ - return [self decodeMessage:theMessage withSecret:theSecret withError:theError withForcedAlgorithmByName:theAlgorithmName skipVerification:skipVerification whitelist:nil]; -} - -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName skipVerification:(BOOL)skipVerification whitelist:(NSSet *)theWhitelist -{ - NSArray *parts = [theMessage componentsSeparatedByString:@"."]; - - if (parts.count < 3) { - // generate error? - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTInvalidFormatError]; - } - return nil; - } - - NSString *headerPart = parts[0]; - NSString *payloadPart = parts[1]; - NSString *signedPart = parts[2]; - - // decode headerPart - NSError *jsonError = nil; - NSData *headerData = [JWTBase64Coder dataWithBase64UrlEncodedString:headerPart]; - id headerJSON = [NSJSONSerialization JSONObjectWithData:headerData - options:0 - error:&jsonError]; - if (jsonError) { - *theError = [JWTErrorDescription errorWithCode:JWTDecodingHeaderError]; - return nil; - } - NSDictionary *header = (NSDictionary *)headerJSON; - if (!header) { - *theError = [JWTErrorDescription errorWithCode:JWTNoHeaderError]; - return nil; - } - - if (!skipVerification) { - // find algorithm - - //It is insecure to trust the header's value for the algorithm, since - //the signature hasn't been verified yet, so an algorithm must be provided - if (!theAlgorithmName) { - *theError = [JWTErrorDescription errorWithCode:JWTUnspecifiedAlgorithmError]; - return nil; - } - - NSString *headerAlgorithmName = header[@"alg"]; - - //If the algorithm in the header doesn't match what's expected, verification fails - if (![theAlgorithmName isEqualToString:headerAlgorithmName]) { - *theError = [JWTErrorDescription errorWithCode:JWTUnsupportedAlgorithmError]; - return nil; - } - - //If a whitelist is passed in, ensure the chosen algorithm is allowed - if (theWhitelist) { - if (![theWhitelist containsObject:theAlgorithmName]) { - *theError = [JWTErrorDescription errorWithCode:JWTUnsupportedAlgorithmError]; - return nil; - } - } - - id algorithm = [JWTAlgorithmFactory algorithmByName:theAlgorithmName]; - - if (!algorithm) { - *theError = [JWTErrorDescription errorWithCode:JWTUnsupportedAlgorithmError]; - return nil; - } - - // Verify the signed part - NSString *signingInput = [@[headerPart, payloadPart] componentsJoinedByString:@"."]; - BOOL signatureValid = [algorithm verifySignedInput:signingInput withSignature:signedPart verificationKey:theSecret]; - - if (!signatureValid) { - *theError = [JWTErrorDescription errorWithCode:JWTInvalidSignatureError]; - return nil; - } - } - - // and decode payload - jsonError = nil; - NSData *payloadData = [JWTBase64Coder dataWithBase64UrlEncodedString:payloadPart]; - id payloadJSON = [NSJSONSerialization JSONObjectWithData:payloadData - options:0 - error:&jsonError]; - if (jsonError) { - *theError = [JWTErrorDescription errorWithCode:JWTDecodingPayloadError]; - return nil; - } - NSDictionary *payload = (NSDictionary *)payloadJSON; - - if (!payload) { - *theError = [JWTErrorDescription errorWithCode:JWTNoPayloadError]; - return nil; - } - - NSDictionary *result = @{ - @"header" : header, - @"payload" : payload - }; - - return result; -} - -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError * __autoreleasing *)theError; -{ - return [self decodeMessage:theMessage withSecret:theSecret withError:theError withForcedAlgorithmByName:JWTAlgorithmNameHS512]; -} - -+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret; -{ - NSError *error = nil; - NSDictionary *dictionary = [self decodeMessage:theMessage withSecret:theSecret withError:&error]; - if (error) { - // do something - } - return dictionary; -} - -@end diff --git a/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h b/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h deleted file mode 100644 index 1c96b6e25..000000000 --- a/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +++ /dev/null @@ -1,94 +0,0 @@ -// -// JWTCoding+VersionThree.h -// JWT -// -// Created by Lobanov Dmitry on 27.11.16. -// Copyright © 2016 JWTIO. All rights reserved. -// - -#import - -// encode and decode options -@protocol JWTAlgorithm; -@class JWTClaimsSet; -@class JWTCodingBuilder; -@class JWTEncodingBuilder; -@class JWTDecodingBuilder; -@class JWTAlgorithmDataHolderChain; -@protocol JWTAlgorithmDataHolderProtocol; -@class JWTCodingResultType; - -@interface JWT (VersionThree) -+ (JWTEncodingBuilder *)encodeWithHolders:(NSArray *)holders; -+ (JWTEncodingBuilder *)encodeWithChain:(JWTAlgorithmDataHolderChain *)chain; -+ (JWTDecodingBuilder *)decodeWithHolders:(NSArray *)holders; -+ (JWTDecodingBuilder *)decodeWithChain:(JWTAlgorithmDataHolderChain *)chain; -@end - -@interface JWTCodingBuilder : NSObject -#pragma mark - Create -// each element should conform to JWTAlgorithmDataHolderProtocol -+ (instancetype)createWithHolders:(NSArray *)holders; -+ (instancetype)createWithChain:(JWTAlgorithmDataHolderChain *)chain; -+ (instancetype)createWithEmptyChain; - -#pragma mark - Internal -@property (nonatomic, readonly) JWTAlgorithmDataHolderChain *internalChain; -@property (copy, nonatomic, readonly) NSNumber *internalOptions; - -#pragma mark - Fluent -@property (copy, nonatomic, readonly) JWTCodingBuilder *(^chain)(JWTAlgorithmDataHolderChain *chain); -@property (copy, nonatomic, readonly) JWTCodingBuilder *(^constructChain)(JWTAlgorithmDataHolderChain *(^block)()); -@property (copy, nonatomic, readonly) JWTCodingBuilder *(^modifyChain)(JWTAlgorithmDataHolderChain *(^block)(JWTAlgorithmDataHolderChain * chain)); -@property (copy, nonatomic, readonly) JWTCodingBuilder *(^options)(NSNumber *options); -@property (copy, nonatomic, readonly) JWTCodingBuilder *(^addHolder)(id holder); -//@property (copy, nonatomic, readonly) JWTCodingBuilder *(^constructHolder)(id(^block)(id holder)); -@end - -@interface JWTCodingBuilder (Sugar) -- (instancetype)and; -- (instancetype)with; -@end - -@interface JWTCodingBuilder (Coding) -@property (nonatomic, readonly) JWTCodingResultType *result; -@end - -@interface JWTEncodingBuilder : JWTCodingBuilder -#pragma mark - Create -+ (instancetype)encodePayload:(NSDictionary *)payload; -+ (instancetype)encodeClaimsSet:(JWTClaimsSet *)claimsSet; - -#pragma mark - Internal -@property (copy, nonatomic, readonly) NSDictionary *internalPayload; -@property (copy, nonatomic, readonly) NSDictionary *internalHeaders; -@property (nonatomic, readonly) JWTClaimsSet *internalClaimsSet; - -#pragma mark - Fluent -@property (copy, nonatomic, readonly) JWTEncodingBuilder *(^payload)(NSDictionary *payload); -@property (copy, nonatomic, readonly) JWTEncodingBuilder *(^headers)(NSDictionary *headers); -@property (copy, nonatomic, readonly) JWTEncodingBuilder *(^claimsSet)(JWTClaimsSet *claimsSet); - -@end - -@interface JWTEncodingBuilder (Coding) -@property (nonatomic, readonly) JWTCodingResultType *encode; -@end - -@interface JWTDecodingBuilder : JWTCodingBuilder -#pragma mark - Create -+ (instancetype)decodeMessage:(NSString *)message; - -#pragma mark - Internal -@property (copy, nonatomic, readonly) NSString *internalMessage; -@property (nonatomic, readonly) JWTClaimsSet *internalClaimsSet; - -#pragma mark - Fluent -@property (copy, nonatomic, readonly) JWTDecodingBuilder *(^message)(NSString *message); -@property (copy, nonatomic, readonly) JWTDecodingBuilder *(^claimsSet)(JWTClaimsSet *claimsSet); - -@end - -@interface JWTDecodingBuilder (Coding) -@property (nonatomic, readonly) JWTCodingResultType *decode; -@end diff --git a/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m b/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m deleted file mode 100644 index e681d2400..000000000 --- a/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +++ /dev/null @@ -1,619 +0,0 @@ -// -// JWTCoding+VersionThree.m -// JWT -// -// Created by Lobanov Dmitry on 27.11.16. -// Copyright © 2016 JWTIO. All rights reserved. -// - -#import "JWTCoding+VersionThree.h" -#import "JWTAlgorithmDataHolderChain.h" -#import "JWTRSAlgorithm.h" -#import "JWTCoding+ResultTypes.h" -#import "JWTAlgorithmFactory.h" -#import "JWTErrorDescription.h" -#import "JWTBase64Coder.h" -#import "JWTClaimsSetSerializer.h" -#import "JWTClaimsSetVerifier.h" - -@implementation JWT (VersionThree) -+ (JWTEncodingBuilder *)encodeWithHolders:(NSArray *)holders { - return [JWTEncodingBuilder createWithHolders:holders]; -} -+ (JWTEncodingBuilder *)encodeWithChain:(JWTAlgorithmDataHolderChain *)chain { - return [JWTEncodingBuilder createWithChain:chain]; -} -+ (JWTDecodingBuilder *)decodeWithHolders:(NSArray *)holders { - return [JWTDecodingBuilder createWithHolders:holders]; -} -+ (JWTDecodingBuilder *)decodeWithChain:(JWTAlgorithmDataHolderChain *)chain { - return [JWTDecodingBuilder createWithChain:chain]; -} -@end - -@interface JWTCodingBuilder () -#pragma mark - Internal -@property (strong, nonatomic, readwrite) JWTAlgorithmDataHolderChain *internalChain; -@property (copy, nonatomic, readwrite) NSNumber *internalOptions; - -#pragma mark - Fluent -@property (copy, nonatomic, readwrite) JWTCodingBuilder *(^chain)(JWTAlgorithmDataHolderChain *chain); -@property (copy, nonatomic, readwrite) JWTCodingBuilder *(^constructChain)(JWTAlgorithmDataHolderChain *(^block)()); -@property (copy, nonatomic, readwrite) JWTCodingBuilder *(^modifyChain)(JWTAlgorithmDataHolderChain *(^block)(JWTAlgorithmDataHolderChain * chain)); -@property (copy, nonatomic, readwrite) JWTCodingBuilder *(^options)(NSNumber *options); -@property (copy, nonatomic, readwrite) JWTCodingBuilder *(^addHolder)(id holder); -@property (copy, nonatomic, readwrite) JWTCodingBuilder *(^constructHolder)(id(^block)(id holder)); - -@end -@interface JWTCodingBuilder (Fluent_Setup) -- (instancetype)chain:(JWTAlgorithmDataHolderChain *)chain; -- (instancetype)options:(NSNumber *)options; -- (instancetype)addHolder:(id)holder; -- (void)setupFluent; -@end - -@implementation JWTCodingBuilder (Fluent_Setup) -- (instancetype)chain:(JWTAlgorithmDataHolderChain *)chain { - self.internalChain = chain; - return self; -} -- (instancetype)options:(NSNumber *)options { - self.internalOptions = options; - return self; -} -- (instancetype)addHolder:(id)holder { - self.internalChain = [self.internalChain chainByAppendingHolder:holder]; - return self; -} -- (void)setupFluent { - __weak typeof(self) weakSelf = self; - self.chain = ^(JWTAlgorithmDataHolderChain *chain) { - return [weakSelf chain:chain]; - }; - - self.constructChain = ^(JWTAlgorithmDataHolderChain *(^block)()) { - if (block) { - JWTAlgorithmDataHolderChain *chain = block(); - return [weakSelf chain:chain]; - } - return weakSelf; - }; - - self.modifyChain = ^(JWTAlgorithmDataHolderChain *(^block)(JWTAlgorithmDataHolderChain *chain)) { - if (block) { - JWTAlgorithmDataHolderChain *chain = block(weakSelf.internalChain); - return [weakSelf chain:chain]; - } - return weakSelf; - }; - - - self.options = ^(NSNumber *options) { - return [weakSelf options:options]; - }; - - self.addHolder = ^(id holder) { - return [weakSelf addHolder:holder]; - }; - - self.constructHolder = ^(id (^block)(id holder)) { - if (block) { - [weakSelf addHolder:block([JWTAlgorithmBaseDataHolder new])]; - } - return weakSelf; - }; -} -@end - -@implementation JWTCodingBuilder -#pragma mark - Getters -// Chain always exists -- (JWTAlgorithmDataHolderChain *)internalChain { - return _internalChain ?: (_internalChain = [JWTAlgorithmDataHolderChain new], _internalChain); -} -#pragma mark - Create -- (instancetype)initWithChain:(JWTAlgorithmDataHolderChain *)chain { - if (self = [super init]) { - self.internalChain = chain; - [self setupFluent]; - } - return self; -} -+ (instancetype)createWithHolders:(NSArray *)items { - return [self createWithChain:[[JWTAlgorithmDataHolderChain alloc] initWithHolders:items]]; -} -+ (instancetype)createWithChain:(JWTAlgorithmDataHolderChain *)chain { - return [[self alloc] initWithChain:chain]; -} -+ (instancetype)createWithEmptyChain { - return [self createWithChain:nil]; -} -@end - -@implementation JWTCodingBuilder (Sugar) -- (instancetype)and { - return self; -} -- (instancetype)with { - return self; -} -@end - -@interface JWTEncodingBuilder () -#pragma mark - Internal -@property (copy, nonatomic, readwrite) NSDictionary *internalPayload; -@property (copy, nonatomic, readwrite) NSDictionary *internalHeaders; -@property (strong, nonatomic, readwrite) JWTClaimsSet *internalClaimsSet; -@property (copy, nonatomic, readwrite) NSDictionary *internalMixingClaimsPayload; - -#pragma mark - Fluent -@property (copy, nonatomic, readwrite) JWTEncodingBuilder *(^payload)(NSDictionary *payload); -@property (copy, nonatomic, readwrite) JWTEncodingBuilder *(^headers)(NSDictionary *headers); -@property (copy, nonatomic, readwrite) JWTEncodingBuilder *(^claimsSet)(JWTClaimsSet *claimsSet); -@end - -@interface JWTEncodingBuilder (Fluent_Setup) -- (instancetype)payload:(NSDictionary *)payload; -- (instancetype)headers:(NSDictionary *)headers; -- (instancetype)claimsSet:(JWTClaimsSet *)claimsSet; -@end - -@implementation JWTEncodingBuilder (Fluent_Setup) - -- (instancetype)payload:(NSDictionary *)payload { - self.internalPayload = payload; - return self; -} -- (instancetype)headers:(NSDictionary *)headers { - self.internalHeaders = headers; - return self; -} - -- (instancetype)claimsSet:(JWTClaimsSet *)claimsSet { - self.internalClaimsSet = claimsSet; - return self; -} - -- (void)setupFluent { - [super setupFluent]; - __weak typeof(self) weakSelf = self; - self.payload = ^(NSDictionary *payload) { - return [weakSelf payload:payload]; - }; - self.headers = ^(NSDictionary *headers) { - return [weakSelf headers:headers]; - }; - self.claimsSet = ^(JWTClaimsSet *claimsSet) { - return [weakSelf claimsSet:claimsSet]; - }; -} - -@end - -@implementation JWTEncodingBuilder -#pragma mark - Getters -- (NSDictionary *)internalMixingClaimsPayload { - NSMutableDictionary *dictionary = [@{} mutableCopy]; - if (_internalPayload) { - [dictionary addEntriesFromDictionary:_internalPayload]; - } - - if (_internalClaimsSet) { - [dictionary addEntriesFromDictionary:[JWTClaimsSetSerializer dictionaryWithClaimsSet:_internalClaimsSet]]; - } - - return dictionary; -} - -#pragma mark - Create -+ (instancetype)encodePayload:(NSDictionary *)payload { - return ((JWTEncodingBuilder *)[self createWithEmptyChain]).payload(payload); -} - -+ (instancetype)encodeClaimsSet:(JWTClaimsSet *)claimsSet { - return ((JWTEncodingBuilder *)[self createWithEmptyChain]).claimsSet(claimsSet); -} - -@end - -@implementation JWTEncodingBuilder (Coding) -- (JWTCodingResultType *)encode { - - NSDictionary *headers = self.internalHeaders; - NSDictionary *payload = self.internalMixingClaimsPayload; - - NSString *encodedMessage = nil; - NSError *error = nil; - - NSArray *holders = self.internalChain.holders; - // ERROR: HOLDERS ARE EMPTY. - if (holders.count == 0) { - error = [JWTErrorDescription errorWithCode:JWTDecodingHoldersChainEmptyError]; - } - - for (id holder in holders) { - id algorithm = holder.internalAlgorithm; - NSData *secretData = holder.internalSecretData; - encodedMessage = [self encodeWithAlgorithm:algorithm withHeaders:headers withPayload:payload withSecretData:secretData withError:&error]; - if (encodedMessage && (error == nil)) { - break; - } - } - - JWTCodingResultType *result = nil; - - if (error) { - result = [[JWTCodingResultType alloc] initWithErrorResult:[[JWTCodingResultTypeError alloc] initWithError:error]]; - } - else if (encodedMessage) { - result = [[JWTCodingResultType alloc] initWithSuccessResult:[[JWTCodingResultTypeSuccess alloc] initWithEncoded:encodedMessage]]; - } - else { - NSLog(@"%@ something went wrong! result is nil!", self.debugDescription); - } - - return result; -} -- (NSString *)encodeWithAlgorithm:(id)theAlgorithm withHeaders:(NSDictionary *)theHeaders withPayload:(NSDictionary *)thePayload withSecretData:(NSData *)theSecretData withError:(NSError *__autoreleasing *)theError { - // do it! - - if (!theAlgorithm) { - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTUnspecifiedAlgorithmError]; - } - return nil; - } - - NSString *theAlgorithmName = [theAlgorithm name]; - - if (!theAlgorithmName) { - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTUnsupportedAlgorithmError]; - } - return nil; - } - - NSDictionary *header = @{ - @"alg": theAlgorithmName, - @"typ": @"JWT" - }; - NSMutableDictionary *allHeaders = [header mutableCopy]; - - if (theHeaders.allKeys.count > 0) { - [allHeaders addEntriesFromDictionary:theHeaders]; - } - - NSString *headerSegment = [self encodeSegment:[allHeaders copy] withError:nil]; - - if (!headerSegment) { - // encode header segment error - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTEncodingHeaderError]; - } - return nil; - } - - NSString *payloadSegment = [self encodeSegment:thePayload withError:nil]; - - if (!payloadSegment) { - // encode payment segment error - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTEncodingPayloadError]; - } - return nil; - } - - NSString *signingInput = [@[headerSegment, payloadSegment] componentsJoinedByString:@"."]; - - NSString *signedOutput = nil; - - // this happens somewhere outside. - - NSError *algorithmError = nil; - if (theSecretData && [theAlgorithm respondsToSelector:@selector(signHash:key:error:)]) { - NSData *signedOutputData = [theAlgorithm signHash:[signingInput dataUsingEncoding:NSUTF8StringEncoding] key:theSecretData error:&algorithmError]; - signedOutput = [JWTBase64Coder base64UrlEncodedStringWithData:signedOutputData]; - } -// if (theSecretData && [theAlgorithm respondsToSelector:@selector(encodePayloadData:withSecret:)]) { -// // not sure that it is correct. -// NSData *signedOutputData = [theAlgorithm encodePayloadData:[signingInput dataUsingEncoding:NSUTF8StringEncoding] withSecret:theSecretData]; -// signedOutput = [JWTBase64Coder base64UrlEncodedStringWithData:signedOutputData]; -// } - // not used now. -// else { -// NSData *signedOutputData = [theAlgorithm encodePayload:signingInput withSecret:self.jwtSecret]; -// signedOutput = [JWTBase64Coder base64UrlEncodedStringWithData:signedOutputData]; -// } - - if (algorithmError) { - // algorithmError - if (theError) { - *theError = algorithmError; - } - return nil; - } - if (!signedOutput) { - // Make sure signing worked (e.g. we may have issues extracting the key from the PKCS12 bundle if passphrase is incorrect) - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTEncodingSigningError]; - } - return nil; - } - - return [@[headerSegment, payloadSegment, signedOutput] componentsJoinedByString:@"."]; -} - -- (NSString *)encodeSegment:(id)theSegment withError:(NSError *__autoreleasing*)error { - NSData *encodedSegmentData = nil; - - if (theSegment) { - encodedSegmentData = [NSJSONSerialization dataWithJSONObject:theSegment options:0 error:error]; - } - else { - // error! - NSError *generatedError = [JWTErrorDescription errorWithCode:JWTInvalidSegmentSerializationError]; - if (error) { - *error = generatedError; - } - NSLog(@"%@ Could not encode segment: %@", self.class, generatedError.localizedDescription); - return nil; - } - - NSString *encodedSegment = nil; - - if (encodedSegmentData) { - encodedSegment = [JWTBase64Coder base64UrlEncodedStringWithData:encodedSegmentData]; - } - - return encodedSegment; -} - -- (JWTCodingResultType *)result { - return self.encode; -} -@end - -@interface JWTDecodingBuilder () -#pragma mark - Internal -@property (copy, nonatomic, readwrite) NSString *internalMessage; -@property (nonatomic, readwrite) JWTClaimsSet *internalClaimsSet; - -#pragma mark - Fluent -@property (copy, nonatomic, readwrite) JWTDecodingBuilder *(^message)(NSString *message); -@property (copy, nonatomic, readwrite) JWTDecodingBuilder *(^claimsSet)(JWTClaimsSet *claimsSet); - -@end - -@interface JWTDecodingBuilder (Fluent_Setup) -- (instancetype)message:(NSString *)message; -- (instancetype)claimsSet:(JWTClaimsSet *)claimsSet; -@end -@implementation JWTDecodingBuilder (Fluent_Setup) -- (instancetype)message:(NSString *)message { - self.internalMessage = message; - return self; -} -- (instancetype)claimsSet:(JWTClaimsSet *)claimsSet { - self.internalClaimsSet = claimsSet; - return self; -} -- (void)setupFluent { - [super setupFluent]; - __weak typeof(self) weakSelf = self; - self.message = ^(NSString *message) { - return [weakSelf message:message]; - }; - self.claimsSet = ^(JWTClaimsSet *claimsSet) { - return [weakSelf claimsSet:claimsSet]; - }; -} -@end - -@implementation JWTDecodingBuilder -#pragma mark - Create -+ (instancetype)decodeMessage:(NSString *)message { - return ((JWTDecodingBuilder *)[self createWithEmptyChain]).message(message); -} -@end - -@implementation JWTDecodingBuilder (Coding) -- (JWTCodingResultType *)decode { - // do! - // iterate over items in chain! - // and return if everything ok! - // or return error! - NSError *error = nil; - NSDictionary *decodedDictionary = nil; - NSString *message = self.internalMessage; - NSNumber *options = self.internalOptions; - NSArray *holders = self.internalChain.holders; - JWTClaimsSet *claimsSet = self.internalClaimsSet; - - // ERROR: HOLDERS ARE EMPTY. - if (holders.count == 0) { - error = [JWTErrorDescription errorWithCode:JWTDecodingHoldersChainEmptyError]; - } - - for (id holder in self.internalChain.holders) { - // try decode! - id algorithm = holder.internalAlgorithm; - NSData *secretData = holder.internalSecretData; - // try to retrieve passphrase. - decodedDictionary = [self decodeMessage:message secretData:secretData algorithm:algorithm options:options error:&error]; - if (decodedDictionary && (error == nil)) { - break; - } - } - - // claimsSet verification. - JWTCodingResultType *result = nil; - if (error) { - return [[JWTCodingResultType alloc] initWithErrorResult:[[JWTCodingResultTypeError alloc] initWithError:error]]; - } - - if (claimsSet) { - BOOL claimsVerified = [JWTClaimsSetVerifier verifyClaimsSet:[JWTClaimsSetSerializer claimsSetWithDictionary:decodedDictionary[JWTCodingResultPayload]] withTrustedClaimsSet:claimsSet]; - if (!claimsVerified){ - error = [JWTErrorDescription errorWithCode:JWTClaimsSetVerificationFailed]; - return [[JWTCodingResultType alloc] initWithErrorResult:[[JWTCodingResultTypeError alloc] initWithError:error]]; - } - } - - if (decodedDictionary) { - NSDictionary *headers = decodedDictionary[JWTCodingResultHeaders]; - NSDictionary *payload = decodedDictionary[JWTCodingResultPayload]; - result = [[JWTCodingResultType alloc] initWithSuccessResult:[[JWTCodingResultTypeSuccess alloc] initWithHeaders:headers withPayload:payload]]; - } - else { - NSLog(@"%@ something went wrong! result is nil!", self.debugDescription); - } - - return result; -} - -// Maybe later add algorithmName -- (NSDictionary *)decodeMessage:(NSString *)theMessage secretData:(NSData *)theSecretData algorithm:(id)theAlgorithm options:(NSNumber *)theOptions error:(NSError *__autoreleasing *)theError { - - BOOL skipVerification = [theOptions boolValue]; - NSString *theAlgorithmName = [theAlgorithm name]; - - NSArray *parts = [theMessage componentsSeparatedByString:@"."]; - - if (parts.count < 3) { - // generate error? - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTInvalidFormatError]; - } - return nil; - } - - NSString *headerPart = parts[0]; - NSString *payloadPart = parts[1]; - NSString *signedPart = parts[2]; - - // decode headerPart - NSError *jsonError = nil; - NSData *headerData = [JWTBase64Coder dataWithBase64UrlEncodedString:headerPart]; - id headerJSON = [NSJSONSerialization JSONObjectWithData:headerData - options:0 - error:&jsonError]; - if (jsonError) { - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTDecodingHeaderError]; - } - return nil; - } - NSDictionary *header = (NSDictionary *)headerJSON; - if (!header) { - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTNoHeaderError]; - } - return nil; - } - - if (!skipVerification) { - // find algorithm - - //It is insecure to trust the header's value for the algorithm, since - //the signature hasn't been verified yet, so an algorithm must be provided - if (!theAlgorithmName) { - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTUnspecifiedAlgorithmError]; - } - return nil; - } - - NSString *headerAlgorithmName = header[@"alg"]; - - //If the algorithm in the header doesn't match what's expected, verification fails - if (![theAlgorithmName isEqualToString:headerAlgorithmName]) { - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTAlgorithmNameMismatchError]; - } - return nil; - } - - // A shit logic, but... - // You should copy algorithm if this algorithm conforms to RSAlgorithm (NSCopying). - // Now RS Algorithm holds too much. ( All data about keys :/ ) - // Need further investigation. - id algorithm = nil; - if ([theAlgorithm conformsToProtocol:@protocol(JWTRSAlgorithm)]) { - algorithm = [(id)theAlgorithm copyWithZone:nil]; - } - else { - algorithm = [JWTAlgorithmFactory algorithmByName:theAlgorithmName]; - } - - if (!algorithm) { - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTUnsupportedAlgorithmError]; - } - return nil; - } - - // Verify the signed part - NSString *signingInput = [@[headerPart, payloadPart] componentsJoinedByString:@"."]; - BOOL signatureValid = NO; - - NSError *algorithmError = nil; - if (theSecretData && [algorithm respondsToSelector:@selector(verifyHash:signature:key:error:)]) { - signatureValid = - //[algorithm verifySignedInput:signingInput withSignature:signedPart verificationKeyData:theSecretData]; - [algorithm verifyHash:[signingInput dataUsingEncoding:NSUTF8StringEncoding] signature:[JWTBase64Coder dataWithBase64UrlEncodedString:signedPart] key:theSecretData error:&algorithmError]; - } -// if (theSecretData && [algorithm respondsToSelector:@selector(verifySignedInput:withSignature:verificationKeyData:)]) { -// signatureValid = [algorithm verifySignedInput:signingInput withSignature:signedPart verificationKeyData:theSecretData]; -// -// // Not used now. -//// } else { -//// signatureValid = [algorithm verifySignedInput:signingInput withSignature:signedPart verificationKey:theSecret]; -// } - - if (algorithmError) { - if (theError) { - *theError = algorithmError; - } - return nil; - } - if (!signatureValid) { - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTInvalidSignatureError]; - } - return nil; - } - } - - // and decode payload - jsonError = nil; - NSData *payloadData = [JWTBase64Coder dataWithBase64UrlEncodedString:payloadPart]; - id payloadJSON = [NSJSONSerialization JSONObjectWithData:payloadData - options:0 - error:&jsonError]; - if (jsonError) { - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTDecodingPayloadError]; - } - return nil; - } - NSDictionary *payload = (NSDictionary *)payloadJSON; - - if (!payload) { - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTNoPayloadError]; - } - return nil; - } - - NSDictionary *result = @{ - JWTCodingResultHeaders : header, - JWTCodingResultPayload : payload - }; - - return result; -} - -- (JWTCodingResultType *)result { - return self.decode; -} -@end diff --git a/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h b/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h deleted file mode 100644 index 18e41a0b1..000000000 --- a/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +++ /dev/null @@ -1,164 +0,0 @@ -// -// JWTCoding+VersionTwo.h -// JWT -// -// Created by Lobanov Dmitry on 27.11.16. -// Copyright © 2016 JWTIO. All rights reserved. -// - -#import - -@protocol JWTAlgorithm; -@class JWTClaimsSet; -@class JWTBuilder; - -@interface JWT (VersionTwo) -#pragma mark - Builder -+ (JWTBuilder *)encodePayload:(NSDictionary *)payload; -+ (JWTBuilder *)encodeClaimsSet:(JWTClaimsSet *)claimsSet; -+ (JWTBuilder *)decodeMessage:(NSString *)message; -@end - -@interface JWTBuilder : NSObject - -+ (JWTBuilder *)encodePayload:(NSDictionary *)payload; -+ (JWTBuilder *)encodeClaimsSet:(JWTClaimsSet *)claimsSet; -+ (JWTBuilder *)decodeMessage:(NSString *)message; - -/** - The JWT in it's encoded form. Will be decoded and verified - */ -@property (copy, nonatomic, readonly) NSString *jwtMessage; - -/** - The payload dictionary to encode - */ -@property (copy, nonatomic, readonly) NSDictionary *jwtPayload; - -/** - The header dictionary to encode - */ -@property (copy, nonatomic, readonly) NSDictionary *jwtHeaders; - -/** - The expected JWTClaimsSet to compare against a decoded JWT - */ -@property (copy, nonatomic, readonly) JWTClaimsSet *jwtClaimsSet; - -/** - The algorithm data holders. They contain necessary information about algorithms. - */ -@property (copy, nonatomic, readonly) NSArray *jwtDataHolders; - -/** - The verification key to use when encoding/decoding a JWT - */ -@property (copy, nonatomic, readonly) NSString *jwtSecret; - -/** - The verification key to use when encoding/decoding a JWT in data form - */ -@property (copy, nonatomic, readonly) NSData *jwtSecretData; - -/** - The passphrase for the PKCS12 blob, which represents the certificate containing the private key for the RS algorithms. - */ -@property (copy, nonatomic, readonly) NSString *jwtPrivateKeyCertificatePassphrase; - -/** - Contains the error that occured during an operation, or nil if no error occured - */ -@property (copy, nonatomic, readonly) NSError *jwtError; - -/** - The to use for encoding a JWT - */ -@property (strong, nonatomic, readonly) id jwtAlgorithm; - -/** - The algorithm name to use for decoding the JWT. Required unless force decode is true - */ -@property (copy, nonatomic, readonly) NSString *jwtAlgorithmName; - -/** - The force decode option. If set to true, a JWT won't be validated before decoding. - Should only be used for debugging - */ -@property (copy, nonatomic, readonly) NSNumber *jwtOptions; - -/* - Optional algorithm name whitelist. If non-null, a JWT can only be decoded using an algorithm - specified on this list. - */ -@property (copy, nonatomic, readonly) NSSet *algorithmWhitelist; - -/** - Sets jwtMessage and returns the JWTBuilder to allow for method chaining - */ -@property (copy, nonatomic, readonly) JWTBuilder *(^message)(NSString *message); - -/** - Sets jwtPayload and returns the JWTBuilder to allow for method chaining - */ -@property (copy, nonatomic, readonly) JWTBuilder *(^payload)(NSDictionary *payload); - -/** - Sets jwtHeaders and returns the JWTBuilder to allow for method chaining - */ -@property (copy, nonatomic, readonly) JWTBuilder *(^headers)(NSDictionary *headers); - -/** - Sets jwtClaimsSet and returns the JWTBuilder to allow for method chaining - */ -@property (copy, nonatomic, readonly) JWTBuilder *(^claimsSet)(JWTClaimsSet *claimsSet); - -/** - Sets jwtSecret and returns the JWTBuilder to allow for method chaining - */ -@property (copy, nonatomic, readonly) JWTBuilder *(^secret)(NSString *secret); - -/** - Sets jwtSecretData and returns the JWTBuilder to allow for method chaining - */ -@property (copy, nonatomic, readonly) JWTBuilder *(^secretData)(NSData *secretData); - -/** - Sets jwtPrivateKeyCertificatePassphrase and returns the JWTBuilder to allow for method chaining - */ -@property (copy, nonatomic, readonly) JWTBuilder *(^privateKeyCertificatePassphrase)(NSString *privateKeyCertificatePassphrase); - -/** - Sets jwtAlgorithm and returns the JWTBuilder to allow for method chaining - */ -@property (copy, nonatomic, readonly) JWTBuilder *(^algorithm)(idalgorithm); - -/** - Sets jwtAlgorithmName and returns the JWTBuilder to allow for method chaining. See list of names in appropriate headers. - */ -@property (copy, nonatomic, readonly) JWTBuilder *(^algorithmName)(NSString *algorithmName); - -/** - Sets jwtOptions and returns the JWTBuilder to allow for method chaining - */ -@property (copy, nonatomic, readonly) JWTBuilder *(^options)(NSNumber *options); - -/** - Sets algorithmWhitelist and returns the JWTBuilder to allow for method chaining - */ -@property (copy, nonatomic, readonly) JWTBuilder *(^whitelist)(NSArray *whitelist); - -/** - Creates the encoded JWT string based on the currently set properties, or nil if an - error occured - */ -@property (copy, nonatomic, readonly) NSString *encode; - -/** - Decodes and returns the JWT as a dictionary, based on the JWTBuilder's currently set - properties, or nil, if an error occured. - */ -@property (copy, nonatomic, readonly) NSDictionary *decode; - -//@property (copy, nonatomic, readonly) JWTBuilder * (^addDataHolder)(JWTAlgorithmBaseDataHolder *dataHolder) __available_in_release_version(JWTVersion_3_0_0); -//@property (copy, nonatomic, readonly) JWTBuilder * (^constructDataHolder)(id (^block)()) __available_in_release_version(JWTVersion_3_0_0); -@end diff --git a/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m b/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m deleted file mode 100644 index 6f66476d4..000000000 --- a/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +++ /dev/null @@ -1,514 +0,0 @@ -// -// JWTCoding+VersionTwo.m -// JWT -// -// Created by Lobanov Dmitry on 27.11.16. -// Copyright © 2016 JWTIO. All rights reserved. -// - -#import "JWTCoding+VersionTwo.h" -#import "JWTBase64Coder.h" - -#import "JWTRSAlgorithm.h" - -#import "JWTAlgorithmFactory.h" - -#import "JWTAlgorithmDataHolder.h" - -#import "JWTClaimsSetSerializer.h" -#import "JWTClaimsSetVerifier.h" - -#import "JWTErrorDescription.h" - -@implementation JWT (VersionTwo) -#pragma mark - Builder - -+ (JWTBuilder *)encodePayload:(NSDictionary *)payload { - return [JWTBuilder encodePayload:payload]; -} - -+ (JWTBuilder *)encodeClaimsSet:(JWTClaimsSet *)claimsSet { - return [JWTBuilder encodeClaimsSet:claimsSet]; -} - -+ (JWTBuilder *)decodeMessage:(NSString *)message { - return [JWTBuilder decodeMessage:message]; -} -@end - -@interface JWTBuilder() - -@property (copy, nonatomic, readwrite) NSString *jwtMessage; -@property (copy, nonatomic, readwrite) NSDictionary *jwtPayload; -@property (copy, nonatomic, readwrite) NSDictionary *jwtHeaders; -@property (copy, nonatomic, readwrite) JWTClaimsSet *jwtClaimsSet; -@property (copy, nonatomic, readwrite) NSArray *jwtDataHolders; - -@property (copy, nonatomic, readwrite) NSString *jwtSecret; -@property (copy, nonatomic, readwrite) NSData *jwtSecretData; -@property (copy, nonatomic, readwrite) NSString *jwtPrivateKeyCertificatePassphrase; -@property (copy, nonatomic, readwrite) NSError *jwtError; -@property (strong, nonatomic, readwrite) id jwtAlgorithm; -@property (copy, nonatomic, readwrite) NSString *jwtAlgorithmName; -@property (copy, nonatomic, readwrite) NSNumber *jwtOptions; -@property (copy, nonatomic, readwrite) NSSet *algorithmWhitelist; - -@property (copy, nonatomic, readwrite) JWTBuilder *(^message)(NSString *message); -@property (copy, nonatomic, readwrite) JWTBuilder *(^payload)(NSDictionary *payload); -@property (copy, nonatomic, readwrite) JWTBuilder *(^headers)(NSDictionary *headers); -@property (copy, nonatomic, readwrite) JWTBuilder *(^claimsSet)(JWTClaimsSet *claimsSet); -@property (copy, nonatomic, readwrite) JWTBuilder *(^secret)(NSString *secret); -@property (copy, nonatomic, readwrite) JWTBuilder *(^secretData)(NSData *secretData); -@property (copy, nonatomic, readwrite) JWTBuilder *(^privateKeyCertificatePassphrase)(NSString *privateKeyCertificatePassphrase); -@property (copy, nonatomic, readwrite) JWTBuilder *(^algorithm)(idalgorithm); -@property (copy, nonatomic, readwrite) JWTBuilder *(^algorithmName)(NSString *algorithmName); -@property (copy, nonatomic, readwrite) JWTBuilder *(^options)(NSNumber *options); -@property (copy, nonatomic, readwrite) JWTBuilder *(^whitelist)(NSArray *whitelist); -@property (copy, nonatomic, readwrite) JWTBuilder * (^addDataHolder)(JWTAlgorithmBaseDataHolder *dataHolder); -@property (copy, nonatomic, readwrite) JWTBuilder * (^constructDataHolder)(id (^block)()); -@end - -@implementation JWTBuilder - -#pragma mark - Getters -- (id)jwtAlgorithm { - if (!_jwtAlgorithm) { - _jwtAlgorithm = [JWTAlgorithmFactory algorithmByName:_jwtAlgorithmName]; - } - return _jwtAlgorithm; -} - -- (NSDictionary *)jwtPayload { - return _jwtClaimsSet ? [JWTClaimsSetSerializer dictionaryWithClaimsSet:_jwtClaimsSet] : _jwtPayload; -} - -#pragma mark - Fluent -- (instancetype)message:(NSString *)message { - self.jwtMessage = message; - return self; -} - -- (instancetype)payload:(NSDictionary *)payload { - self.jwtPayload = payload; - return self; -} - -- (instancetype)headers:(NSDictionary *)headers { - self.jwtHeaders = headers; - return self; -} - -- (instancetype)claimSet:(JWTClaimsSet *)claimSet { - self.jwtClaimsSet = claimSet; - return self; -} - -- (instancetype)secret:(NSString *)secret { - self.jwtSecret = secret; - return self; -} - -- (instancetype)secretData:(NSData *)secretData { - self.jwtSecretData = secretData; - return self; -} - -- (instancetype)privateKeyCertificatePassphrase:(NSString *)privateKeyCertificatePassphrase { - self.jwtPrivateKeyCertificatePassphrase = privateKeyCertificatePassphrase; - return self; -} - -- (instancetype)algorithm:(id)algorithm { - self.jwtAlgorithm = algorithm; - return self; -} - -- (instancetype)algorithmName:(NSString *)algorithmName { - self.jwtAlgorithmName = algorithmName; - return self; -} - -- (instancetype)options:(NSNumber *)options { - self.jwtOptions = options; - return self; -} - -- (instancetype)whitelist:(NSArray *)whitelist { - if (whitelist) { - self.algorithmWhitelist = [NSSet setWithArray:whitelist]; - } else { - self.algorithmWhitelist = nil; - } - return self; -} - -- (instancetype)addDataHolder:(JWTAlgorithmBaseDataHolder *)dataHolder { - if (dataHolder) { - - } - return self; -} - -#pragma mark - Initialization -+ (JWTBuilder *)encodePayload:(NSDictionary *)payload { - return [[JWTBuilder alloc] init].payload(payload); -} - -+ (JWTBuilder *)encodeClaimsSet:(JWTClaimsSet *)claimsSet { - return [[JWTBuilder alloc] init].claimsSet(claimsSet); -} - -+ (JWTBuilder *)decodeMessage:(NSString *)message { - return [[JWTBuilder alloc] init].message(message); -} - -- (instancetype)init { - self = [super init]; - if (self) { - __weak typeof(self) weakSelf = self; - self.message = ^(NSString *message) { - return [weakSelf message:message]; - }; - - self.payload = ^(NSDictionary *payload) { - return [weakSelf payload:payload]; - }; - - self.headers = ^(NSDictionary *headers) { - return [weakSelf headers:headers]; - }; - - self.claimsSet = ^(JWTClaimsSet *claimSet) { - return [weakSelf claimSet:claimSet]; - }; - - self.secret = ^(NSString *secret) { - return [weakSelf secret:secret]; - }; - - self.secretData = ^(NSData *secretData) { - return [weakSelf secretData:secretData]; - }; - - self.privateKeyCertificatePassphrase = ^(NSString *privateKeyCertificatePassphrase) { - return [weakSelf privateKeyCertificatePassphrase:privateKeyCertificatePassphrase]; - }; - - self.algorithm = ^(id algorithm) { - return [weakSelf algorithm:algorithm]; - }; - - self.algorithmName = ^(NSString *algorithmName) { - return [weakSelf algorithmName:algorithmName]; - }; - - self.options = ^(NSNumber *options) { - return [weakSelf options:options]; - }; - - self.whitelist = ^(NSArray *whitelist) { - return [weakSelf whitelist:whitelist]; - }; - - self.addDataHolder = ^(JWTAlgorithmBaseDataHolder *holder) { - return [weakSelf addDataHolder:holder]; - }; - - self.constructDataHolder = ^(id (^block)()) { - if (block) { - return [weakSelf addDataHolder:block()]; - } - return weakSelf; - }; - } - - return self; -} - -#pragma mark - Encoding/Decoding - -- (NSString *)encode { - NSString *result = nil; - self.jwtError = nil; - result = [self encodeHelper]; - return result; -} - -- (NSDictionary *)decode { - NSDictionary *result = nil; - self.jwtError = nil; - result = [self decodeHelper]; - - return result; -} - -#pragma mark - Private - -#pragma mark - Encode Helpers - -- (NSString *)encodeHelper -{ - if (!self.jwtAlgorithm) { - self.jwtError = [JWTErrorDescription errorWithCode:JWTUnspecifiedAlgorithmError]; - return nil; - } - - NSDictionary *header = @{@"typ": @"JWT", @"alg": self.jwtAlgorithm.name}; - NSMutableDictionary *allHeaders = [header mutableCopy]; - - if (self.jwtHeaders.allKeys.count > 0) { - [allHeaders addEntriesFromDictionary:self.jwtHeaders]; - } - - NSString *headerSegment = [self encodeSegment:[allHeaders copy] withError:nil]; - - if (!headerSegment) { - // encode header segment error - self.jwtError = [JWTErrorDescription errorWithCode:JWTEncodingHeaderError]; - return nil; - } - - NSString *payloadSegment = [self encodeSegment:self.jwtPayload withError:nil]; - - if (!payloadSegment) { - // encode payment segment error - self.jwtError = [JWTErrorDescription errorWithCode:JWTEncodingPayloadError]; - return nil; - } - - NSString *signingInput = [@[headerSegment, payloadSegment] componentsJoinedByString:@"."]; - - NSString *signedOutput; - - if ([self.jwtAlgorithm conformsToProtocol:@protocol(JWTRSAlgorithm)]) { - id jwtRsAlgorithm = (id ) self.jwtAlgorithm; - jwtRsAlgorithm.privateKeyCertificatePassphrase = self.jwtPrivateKeyCertificatePassphrase; - } - if (self.jwtSecretData && [self.jwtAlgorithm respondsToSelector:@selector(encodePayloadData:withSecret:)]) { - NSData *signedOutputData = [self.jwtAlgorithm encodePayloadData:[signingInput dataUsingEncoding:NSUTF8StringEncoding] withSecret:self.jwtSecretData]; - - signedOutput = [JWTBase64Coder base64UrlEncodedStringWithData:signedOutputData]; - } else { - NSData *signedOutputData = [self.jwtAlgorithm encodePayload:signingInput withSecret:self.jwtSecret]; - signedOutput = [JWTBase64Coder base64UrlEncodedStringWithData:signedOutputData]; - } - - if (signedOutput) { // Make sure signing worked (e.g. we may have issues extracting the key from the PKCS12 bundle if passphrase is incorrect) - return [@[headerSegment, payloadSegment, signedOutput] componentsJoinedByString:@"."]; - } else { - self.jwtError = [JWTErrorDescription errorWithCode:JWTEncodingSigningError]; - return nil; - } -} - -- (NSString *)encodeSegment:(id)theSegment withError:(NSError **)error -{ - NSData *encodedSegmentData = nil; - - if (theSegment) { - encodedSegmentData = [NSJSONSerialization dataWithJSONObject:theSegment options:0 error:error]; - } - else { - // error! - NSError *generatedError = [JWTErrorDescription errorWithCode:JWTInvalidSegmentSerializationError]; - if (error) { - *error = generatedError; - } - NSLog(@"%@ Could not encode segment: %@", self.class, generatedError.localizedDescription); - return nil; - } - - NSString *encodedSegment = nil; - - if (encodedSegmentData) { - encodedSegment = [JWTBase64Coder base64UrlEncodedStringWithData:encodedSegmentData]; - } - - return encodedSegment; -} - -#pragma mark - Decode Helpers - -- (NSDictionary *)decodeHelper -{ - NSError *error = nil; - NSDictionary *dictionary = [self decodeMessage:self.jwtMessage withSecret:self.jwtSecret withSecretData:self.jwtSecretData withError:&error withForcedAlgorithmByName:self.jwtAlgorithmName skipVerification:[self.jwtOptions boolValue] whitelist:self.algorithmWhitelist]; - - if (error) { - self.jwtError = error; - return nil; - } - - if (self.jwtClaimsSet) { - BOOL claimVerified = [JWTClaimsSetVerifier verifyClaimsSet:[JWTClaimsSetSerializer claimsSetWithDictionary:dictionary[@"payload"]] withTrustedClaimsSet:self.jwtClaimsSet]; - if (claimVerified) { - return dictionary; - } - else { - self.jwtError = [JWTErrorDescription errorWithCode:JWTClaimsSetVerificationFailed]; - return nil; - } - } - - return dictionary; -} - -- (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withSecretData:(NSData *)secretData withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName skipVerification:(BOOL)skipVerification { - NSArray *parts = [theMessage componentsSeparatedByString:@"."]; - - if (parts.count < 3) { - // generate error? - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTInvalidFormatError]; - } - return nil; - } - - NSString *headerPart = parts[0]; - NSString *payloadPart = parts[1]; - NSString *signedPart = parts[2]; - - // decode headerPart - NSError *jsonError = nil; - NSData *headerData = [JWTBase64Coder dataWithBase64UrlEncodedString:headerPart]; - id headerJSON = [NSJSONSerialization JSONObjectWithData:headerData - options:0 - error:&jsonError]; - if (jsonError) { - *theError = [JWTErrorDescription errorWithCode:JWTDecodingHeaderError]; - return nil; - } - NSDictionary *header = (NSDictionary *)headerJSON; - if (!header) { - *theError = [JWTErrorDescription errorWithCode:JWTNoHeaderError]; - return nil; - } - - if (!skipVerification) { - // find algorithm - - //It is insecure to trust the header's value for the algorithm, since - //the signature hasn't been verified yet, so an algorithm must be provided - if (!theAlgorithmName) { - *theError = [JWTErrorDescription errorWithCode:JWTUnspecifiedAlgorithmError]; - return nil; - } - - NSString *headerAlgorithmName = header[@"alg"]; - - //If the algorithm in the header doesn't match what's expected, verification fails - if (![theAlgorithmName isEqualToString:headerAlgorithmName]) { - *theError = [JWTErrorDescription errorWithCode:JWTAlgorithmNameMismatchError]; - return nil; - } - - id algorithm = [JWTAlgorithmFactory algorithmByName:theAlgorithmName]; - - if (!algorithm) { - *theError = [JWTErrorDescription errorWithCode:JWTUnsupportedAlgorithmError]; - return nil; - // NSAssert(!algorithm, @"Can't decode segment!, %@", header); - } - - // Verify the signed part - NSString *signingInput = [@[headerPart, payloadPart] componentsJoinedByString:@"."]; - BOOL signatureValid = NO; - - - if (secretData && [algorithm respondsToSelector:@selector(verifySignedInput:withSignature:verificationKeyData:)]) { - signatureValid = [algorithm verifySignedInput:signingInput withSignature:signedPart verificationKeyData:secretData]; - } else { - signatureValid = [algorithm verifySignedInput:signingInput withSignature:signedPart verificationKey:theSecret]; - } - - if (!signatureValid) { - *theError = [JWTErrorDescription errorWithCode:JWTInvalidSignatureError]; - return nil; - } - } - - // and decode payload - jsonError = nil; - NSData *payloadData = [JWTBase64Coder dataWithBase64UrlEncodedString:payloadPart]; - id payloadJSON = [NSJSONSerialization JSONObjectWithData:payloadData - options:0 - error:&jsonError]; - if (jsonError) { - *theError = [JWTErrorDescription errorWithCode:JWTDecodingPayloadError]; - return nil; - } - NSDictionary *payload = (NSDictionary *)payloadJSON; - - if (!payload) { - *theError = [JWTErrorDescription errorWithCode:JWTNoPayloadError]; - return nil; - } - - NSDictionary *result = @{ - @"header" : header, - @"payload" : payload - }; - - return result; -} - -- (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withSecretData:(NSData *)secretData withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName skipVerification:(BOOL)skipVerification whitelist:(NSSet *)theWhitelist -{ - /* - many cases: - 1. whitelist 1, algorithm 1, match 1 - everything fine, match exists. just decode by algorithm name. - 2. whitelist 1, algorithm 0 // match not needed. - use every algorithm and try to decode. - 3. whitelist 1, algorithm 1, match 0 - throw black list error. - 4. whitelist 0 - normal decode by algorithm. - */ - if (theWhitelist) { - if (!theAlgorithmName) { - // name -> decoding - NSMutableArray *tries = [@[] mutableCopy]; - NSMutableDictionary *result = nil; - for (NSString *name in theWhitelist) { - // special case for none algorithm. - // none algorithm uses - // maybe remove later? - NSDictionary *try = nil; - if ([name isEqualToString:@"none"]) { - try = [self decodeMessage:theMessage withSecret:nil withSecretData:nil withError:theError withForcedAlgorithmByName:name skipVerification:skipVerification]; - } - else { - try = [self decodeMessage:theMessage withSecret:theSecret withSecretData:secretData withError:theError withForcedAlgorithmByName:name skipVerification:skipVerification]; - } - if (try) { - result = [try mutableCopy]; - result[@"tries"] = [tries copy]; - if (theError) { - *theError = nil; - } - break; - } - else { - if (theError && *theError) { - [tries addObject:*theError]; - } - } - } - return [result copy]; - } - else { - //If a whitelist is passed in, ensure the chosen algorithm is allowed - if (![theWhitelist containsObject:theAlgorithmName]) { - if (theError) { - *theError = [JWTErrorDescription errorWithCode:JWTBlacklistedAlgorithmError]; - } - return nil; - } - } - } - - return [self decodeMessage:theMessage withSecret:theSecret withSecretData:secretData withError:theError withForcedAlgorithmByName:theAlgorithmName skipVerification:skipVerification]; -} - -@end diff --git a/ios/CodePush/JWT/Core/Coding/JWTCoding.h b/ios/CodePush/JWT/Core/Coding/JWTCoding.h deleted file mode 100644 index a436b02e9..000000000 --- a/ios/CodePush/JWT/Core/Coding/JWTCoding.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// JWT.h -// JWT -// -// Created by Klaas Pieter Annema on 31-05-13. -// Copyright (c) 2013 Karma. All rights reserved. -// - -#import -/** - @discussion JWT is a general interface for decoding and encoding. - Now it is to complex and fat to support. - Possible solution: split interface into several pieces. - - JWT_1_0 -> JWT with plain old functions. - JWT_2_0 -> JWT with builder usage. - JWT_3_0 -> JWT with splitted apart algorithm data and payload data. - */ -@interface JWT : NSObject @end - -typedef NS_OPTIONS(NSInteger, JWTCodingDecodingOptions) { - JWTCodingDecodingOptionsNone = 0, - JWTCodingDecodingOptionsSkipVerification = 1 -}; diff --git a/ios/CodePush/JWT/Core/Coding/JWTCoding.m b/ios/CodePush/JWT/Core/Coding/JWTCoding.m deleted file mode 100644 index 6994564e0..000000000 --- a/ios/CodePush/JWT/Core/Coding/JWTCoding.m +++ /dev/null @@ -1,11 +0,0 @@ -// -// JWT.m -// JWT -// -// Created by Klaas Pieter Annema on 31-05-13. -// Copyright (c) 2013 Karma. All rights reserved. -// - -#import "JWTCoding.h" - -@implementation JWT @end diff --git a/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h b/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h deleted file mode 100644 index 27950211d..000000000 --- a/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +++ /dev/null @@ -1,52 +0,0 @@ -// -// JWT.h -// JWT -// -// Created by Lobanov Dmitry on 23.10.16. -// Copyright © 2016 Karma. All rights reserved. -// - -#import - -//! Project version number for JWT. -FOUNDATION_EXPORT double JWTVersionNumber; - -//! Project version string for JWT. -FOUNDATION_EXPORT const unsigned char JWTVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - -// Coding -#import -#import -#import -#import -#import - -// Algorithms -#import -#import -#import -#import -#import -#import - -// Holders -#import -#import - -// Claims -#import -#import -#import -#import - -// Supplement -#import -#import -#import - -// Crypto -#import -#import -#import diff --git a/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap b/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap deleted file mode 100644 index cd802eac6..000000000 --- a/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +++ /dev/null @@ -1,5 +0,0 @@ -framework module JWT { - umbrella header "JWT.h" - export * - module * { export * } -} \ No newline at end of file diff --git a/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h b/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h deleted file mode 100644 index 40b8554fb..000000000 --- a/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// JWTBase64Coder.h -// Pods -// -// Created by Lobanov Dmitry on 05.10.16. -// -// - -#import - -@protocol JWTStringCoder__Protocol -- (NSString *)stringWithData:(NSData *)data; -- (NSData *)dataWithString:(NSString *)string; -@end - -@interface JWTBase64Coder : NSObject -+ (NSString *)base64UrlEncodedStringWithData:(NSData *)data; -+ (NSData *)dataWithBase64UrlEncodedString:(NSString *)urlEncodedString; -@end - -@interface JWTBase64Coder (JWTStringCoder__Protocol) @end - - -@interface JWTStringCoder__For__Encoding : NSObject -@property (assign, nonatomic, readwrite) NSStringEncoding stringEncoding; -+ (instancetype)utf8Encoding; -@end -@interface JWTStringCoder__For__Encoding (JWTStringCoder__Protocol) @end diff --git a/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m b/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m deleted file mode 100644 index 11cfbd3cf..000000000 --- a/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +++ /dev/null @@ -1,70 +0,0 @@ -// -// JWTBase64Coder.m -// Pods -// -// Created by Lobanov Dmitry on 05.10.16. -// -// - -#import "JWTBase64Coder.h" - -@interface JWTBase64Coder (ConditionLinking) -+ (BOOL)isBase64AddtionsAvailable; -@end - -@implementation JWTBase64Coder (ConditionLinking) -+ (BOOL)isBase64AddtionsAvailable { - return [[NSData class] respondsToSelector:@selector(dataWithBase64UrlEncodedString:)]; -} -@end - -#if __has_include("MF_Base64Additions.h") -#import -#endif - -@implementation JWTBase64Coder - -+ (NSString *)base64UrlEncodedStringWithData:(NSData *)data { - if ([self isBase64AddtionsAvailable] && [data respondsToSelector:@selector(base64UrlEncodedString)]) { - return [data performSelector:@selector(base64UrlEncodedString)]; - } - else { - return [data base64EncodedStringWithOptions:0]; - } -} - -+ (NSData *)dataWithBase64UrlEncodedString:(NSString *)urlEncodedString { - if ([self isBase64AddtionsAvailable] && [[NSData class] respondsToSelector:@selector(dataWithBase64UrlEncodedString:)]) { - return [[NSData class] performSelector:@selector(dataWithBase64UrlEncodedString:) withObject:urlEncodedString]; - } - else { - return [[NSData alloc] initWithBase64EncodedString:urlEncodedString options:0]; - } -} - -@end - -@implementation JWTBase64Coder (JWTStringCoder__Protocol) -- (NSString *)stringWithData:(NSData *)data { - return [self.class base64UrlEncodedStringWithData:data]; -} -- (NSData *)dataWithString:(NSString *)string { - return [self.class dataWithBase64UrlEncodedString:string]; -} -@end - -@implementation JWTStringCoder__For__Encoding -+ (instancetype)utf8Encoding { - JWTStringCoder__For__Encoding *coding = [self new]; - coding.stringEncoding = NSUTF8StringEncoding; - return coding; -} -@end -@implementation JWTStringCoder__For__Encoding (JWTStringCoder__Protocol) -- (NSString *)stringWithData:(NSData *)data { - return [[NSString alloc] initWithData:data encoding:self.stringEncoding]; -} -- (NSData *)dataWithString:(NSString *)string { - return [string dataUsingEncoding:self.stringEncoding]; -} -@end diff --git a/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h b/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h deleted file mode 100644 index 9c3a498bf..000000000 --- a/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// JWTDeprecations.h -// JWT -// -// Created by Lobanov Dmitry on 31.08.16. -// Copyright © 2016 Karma. All rights reserved. -// - -#ifndef JWTDeprecations_h -#define JWTDeprecations_h - -#define STR(str) #str -#define JWTVersion_2_1_0 2.1 -#define JWTVersion_2_2_0 2.2 -#define JWTVersion_3_0_0 3.0 -#define __first_deprecated_in_release_version(version) __deprecated_msg("first deprecated in release version: " STR(version)) -#define __deprecated_and_will_be_removed_in_release_version(version) __deprecated_msg("deprecated. will be removed in release version: "STR(version)) -#define __available_in_release_version(version) __deprecated_msg("will be introduced in release version: " STR(version)) - -#define __jwt_technical_debt(debt) __deprecated_msg("Don't forget to inspect it later." STR(debt)) - -#endif /* JWTDeprecations_h */ diff --git a/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h b/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h deleted file mode 100644 index f46c00685..000000000 --- a/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// JWTErrorDescription.h -// JWT -// -// Created by Lobanov Dmitry on 27.11.16. -// Copyright © 2016 JWTIO. All rights reserved. -// - -#import - -extern NSString *JWTErrorDomain; - -typedef NS_ENUM(NSInteger, JWTError) { - JWTInvalidFormatError = -100, - JWTUnsupportedAlgorithmError, - JWTAlgorithmNameMismatchError, - JWTInvalidSignatureError, - JWTNoPayloadError, - JWTNoHeaderError, - JWTEncodingHeaderError, - JWTEncodingPayloadError, - JWTEncodingSigningError, - JWTClaimsSetVerificationFailed, - JWTInvalidSegmentSerializationError, - JWTUnspecifiedAlgorithmError, - JWTBlacklistedAlgorithmError, - JWTDecodingHeaderError, - JWTDecodingPayloadError, - JWTDecodingHoldersChainEmptyError -}; - -@interface JWTErrorDescription : NSObject -+ (NSError *)errorWithCode:(JWTError)code; -@end diff --git a/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m b/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m deleted file mode 100644 index 382d9facf..000000000 --- a/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +++ /dev/null @@ -1,73 +0,0 @@ -// -// JWTErrorDescription.m -// JWT -// -// Created by Lobanov Dmitry on 27.11.16. -// Copyright © 2016 JWTIO. All rights reserved. -// - -#import "JWTErrorDescription.h" -NSString *JWTErrorDomain = @"io.jwt"; -@implementation JWTErrorDescription -+ (NSDictionary *)userDescriptionsAndCodes { - static NSDictionary *userDescriptionsAndCodes = nil; - return userDescriptionsAndCodes ?: (userDescriptionsAndCodes = @{ - @(JWTInvalidFormatError): @"Invalid format! Try to check your encoding algorithm. Maybe you put too many dots as delimiters?", - @(JWTUnsupportedAlgorithmError): @"Unsupported algorithm! You could implement it by yourself", - @(JWTAlgorithmNameMismatchError) : @"Algorithm doesn't match name in header.", - @(JWTInvalidSignatureError): @"Invalid signature! It seems that signed part of jwt mismatch generated part by algorithm provided in header.", - @(JWTNoPayloadError): @"No payload! Hey, forget payload?", - @(JWTNoHeaderError): @"No header! Hmm", - @(JWTEncodingHeaderError): @"It seems that header encoding failed", - @(JWTEncodingPayloadError): @"It seems that payload encoding failed", - @(JWTEncodingSigningError): @"It seems that signing output corrupted. Make sure signing worked (e.g. we may have issues extracting the key from the PKCS12 bundle if passphrase is incorrect).", - @(JWTClaimsSetVerificationFailed): @"It seems that claims verification failed", - @(JWTInvalidSegmentSerializationError): @"It seems that json serialization failed for segment", - @(JWTUnspecifiedAlgorithmError): @"Unspecified algorithm! You must explicitly choose an algorithm to decode with.", - @(JWTBlacklistedAlgorithmError): @"Algorithm in blacklist? Try to check whitelist parameter", - @(JWTDecodingHeaderError): @"Error decoding the JWT Header segment.", - @(JWTDecodingPayloadError): @"Error decoding the JWT Payload segment.", - @(JWTDecodingHoldersChainEmptyError) : @"Error decoding the JWT algorithm and data holders chain is empty!" - }, userDescriptionsAndCodes); -} - -+ (NSDictionary *)errorDescriptionsAndCodes { - static NSDictionary *errorDescriptionsAndCodes = nil; - return errorDescriptionsAndCodes ?: (errorDescriptionsAndCodes = @{ - @(JWTInvalidFormatError): @"JWTInvalidFormatError", - @(JWTUnsupportedAlgorithmError): @"JWTUnsupportedAlgorithmError", - @(JWTAlgorithmNameMismatchError) :@"JWTAlgorithmNameMismatchError", - @(JWTInvalidSignatureError): @"JWTInvalidSignatureError", - @(JWTNoPayloadError): @"JWTNoPayloadError", - @(JWTNoHeaderError): @"JWTNoHeaderError", - @(JWTEncodingHeaderError): @"JWTEncodingHeaderError", - @(JWTEncodingPayloadError): @"JWTEncodingPayloadError", - @(JWTEncodingSigningError): @"JWTEncodingSigningError", - @(JWTClaimsSetVerificationFailed): @"JWTClaimsSetVerificationFailed", - @(JWTInvalidSegmentSerializationError): @"JWTInvalidSegmentSerializationError", - @(JWTUnspecifiedAlgorithmError): @"JWTUnspecifiedAlgorithmError", - @(JWTBlacklistedAlgorithmError): @"JWTBlacklistedAlgorithmError", - @(JWTDecodingHeaderError): @"JWTDecodingHeaderError", - @(JWTDecodingPayloadError): @"JWTDecodingPayloadError", - @(JWTDecodingHoldersChainEmptyError) :@"JWTDecodingHoldersChainEmptyError" - }, errorDescriptionsAndCodes); -} - -+ (NSString *)userDescriptionForCode:(JWTError)code { - NSString *resultString = [self userDescriptionsAndCodes][@(code)]; - return resultString ?: @"Unexpected error"; -} - -+ (NSString *)errorDescriptionForCode:(JWTError)code { - NSString *resultString = [self errorDescriptionsAndCodes][@(code)]; - return resultString ?: @"JWTUnexpectedError"; -} - -+ (NSError *)errorWithCode:(JWTError)code { - return [self errorWithCode:code withUserDescription:[self userDescriptionForCode:code] withErrorDescription:[self errorDescriptionForCode:code]]; -} - -+ (NSError *)errorWithCode:(NSInteger)code withUserDescription:(NSString *)userDescription withErrorDescription:(NSString *)errorDescription { - return [NSError errorWithDomain:JWTErrorDomain code:code userInfo:@{NSLocalizedDescriptionKey: userDescription, @"errorDescription": errorDescription}]; -} -@end diff --git a/ios/CodePush/JWT/LICENSE b/ios/CodePush/JWT/LICENSE deleted file mode 100644 index b282079b0..000000000 --- a/ios/CodePush/JWT/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2013 Karma Mobility, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/ios/CodePush/JWT/README.md b/ios/CodePush/JWT/README.md deleted file mode 100644 index bd21a0c7d..000000000 --- a/ios/CodePush/JWT/README.md +++ /dev/null @@ -1,489 +0,0 @@ -[![JWT](http://jwt.io/assets/logo.svg)](https://jwt.io/) - -[![Build Status](https://travis-ci.org/yourkarma/JWT.svg?branch=master)](https://travis-ci.org/yourkarma/JWT) -[![Pod Version](http://img.shields.io/cocoapods/v/JWT.svg?style=flat)](http://cocoadocs.org/docsets/JWT) -[![Pod Platform](http://img.shields.io/cocoapods/p/JWT.svg?style=flat)](http://cocoadocs.org/docsets/JWT) -[![Reference Status](https://www.versioneye.com/objective-c/jwt/reference_badge.svg?style=flat)](https://www.versioneye.com/objective-c/jwt/references) - -# JWT - -A [JSON Web Token][] implementation in Objective-C. - -[JSON Web Token]: http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html - -# What's new in master and bleeding edge. -Nothing here. - -# What's new in Version 3.0 - -* Fluent style expanded. -* Coding result types added. -* Algorithms and data holders. -* Algorithms and data holders chain. -* Keys loaded from Pem files. - -## Introduction to Algorithms data holders and chain. -You have algorithm, secret data and unknown jwt token. -Let's try to decode it. - -```objective-c -// create token -NSString *token = @"..."; - -// possible that algorithm could return error. -// you could try use algorithm and data chain. - -NSString *firstSecret = @"first"; -NSString *firstAlgorithmName = JWTAlgorithmNameHS384; - -id firstHolder = [JWTAlgorithmHSFamilyDataHolder new].algorithmName(firstAlgorithmName).secret(firstSecret); - -id errorHolder = [JWTAlgorithmNoneDataHolder new]; - -// chain together. -JWTAlgorithmDataHolderChain *chain = [[JWTAlgorithmDataHolderChain alloc] initWithHolders:@[firstHolder, errorHolder]]; - -// or add them in builder -[JWTDecodingBuilder decodeMessage:token].addHolder(firstHolder).addHolder(errorHolder); - -// or add them as chain -[JWTDecodingBuilder decodeMessage:token].chain(chain); -``` - -Maybe you would like to try different secrets. - -```objective-c -// possible that your algorithm has several secrets. -// you don't know which secret to use. -// but you want to decode it. -NSString *firstSecret = @"first"; -NSArray *manySecrets = @[@"second", @"third", @"forty two"]; -// translate to data -NSArray *manySecretsData = @[]; -for (NSString *secret in manySecrets) { - NSData *secretData = [JWTBase64Coder dataWithBase64UrlEncodedString:secret]; - if (secret) { - manySecretsData = [manySecretsData arrayByAddingObject:secretData]; - } -} - -NSString *algorithmName = JWTAlgorithmNameHS384; - -id firstHolder = [JWTAlgorithmHSFamilyDataHolder new].algorithmName(algorithmName).secret(firstSecret); - -// lets create chain -JWTAlgorithmDataHolderChain *chain = [JWTAlgorithmDataHolderChain chainWithHolder:firstHolder]; - -// and lets populate chain with secrets. -NSLog(@"chain has: %@", chain.debugDescription); - -JWTAlgorithmDataHolderChain *expandedChain = [chain chainByPopulatingAlgorithm:firstHolder.currentAlgorithm withManySecretData:manySecretsData]; - -// now we have expanded chain with many secrets and one algorithm. -NSLog(@"expanded chain has: %@", expandedChain.debugDescription); -``` - -## Decode and encode with chain. - -```objective-c -JWTClaimsSet *claimsSet = [[JWTClaimsSet alloc] init]; -// fill it -claimsSet.issuer = @"Facebook"; -claimsSet.subject = @"Token"; -claimsSet.audience = @"https://jwt.io"; - -// encode it -NSString *secret = @"secret"; -NSString *algorithmName = @"HS384"; -NSDictionary *headers = @{@"custom":@"value"}; - -idholder = [JWTAlgorithmHSFamilyDataHolder new].algorithmName(algorithmName).secret(secret); - -JWTCodingResultType *result = [JWTEncodingBuilder encodeClaimsSet:claimsSet].headers(headers).addHolder(holder).result; - -NSString *encodedToken = result.successResult.encoded; -if (result.successResult) { - // handle encoded result - NSLog(@"encoded result: %@", result.successResult.encoded); -} -else { - // handle error - NSLog(@"encode failed, error: %@", result.errorResult.error); -} - -// decode it -// you can set any property that you want, all properties are optional -JWTClaimsSet *trustedClaimsSet = [claimsSet copy]; - -NSNumber *options = @(JWTCodingDecodingOptionsNone); -NSString *yourJwt = encodedToken; // from previous example -JWTCodingResultType *decodedResult = [JWTDecodingBuilder decodeMessage:yourJwt].claimsSet(claimsSet).addHolder(holder).options(options).and.result; - -if (decodedResult.successResult) { - // handle decoded result - NSLog(@"decoded result: %@", decodedResult.successResult.headerAndPayloadDictionary); - NSLog(@"headers: %@", decodedResult.successResult.headers); - NSLog(@"payload: %@", decodedResult.successResult.payload); -} -else { - // handle error - NSLog(@"decode failed, error: %@", decodedResult.errorResult.error); -} -``` - -## Keys loaded from Pem files. - -You have a key in pem file. And you want to use it directly for sign/verify. -Suppose, that "public_rsa.pem" and "private_rsa.pem" are public and private keys in pem format. -```objective-c -// Load keys -- (NSString *)pemKeyStringFromFileWithName:(NSString *)string inBundle:(NSBundle *)bundle { - NSURL *fileURL = [bundle URLForResource:name withExtension:@"pem"]; - NSError *error = nil; - NSString *fileContent = [NSString stringWithContentsOfURL:fileURL encoding:NSUTF8StringEncoding error:&error]; - if (error) { - NSLog(@"%@ error: %@", self.debugDescription, error); - return nil; - } -} - -// Sign and verify -- (void)signAndVerifyWithPrivateKeyPemString:(NSString *)privateKey publicKeyPemString:(NSString *)publicKey privateKeyPassphrase:(NSString *)passphrase { - NSString *algorithmName = @"RS256"; - - id signDataHolder = [JWTAlgorithmRSFamilyDataHolder new].keyExtractorType([JWTCryptoKeyExtractor privateKeyWithPEMBase64].type).privateKeyCertificatePassphrase(passphrase).algorithmName(algorithmName).secret(privateKey); - - id verifyDataHolder = [JWTAlgorithmRSFamilyDataHolder new].keyExtractorType([JWTCryptoKeyExtractor publicKeyWithPEMBase64].type).algorithmName(algorithmName).secret(publicKey); - - // sign - NSDictionary *payloadDictionary = @{@"hello": @"world"}; - - JWTCodingBuilder *signBuilder = [JWTEncodingBuilder encodePayload:payloadDictionary].addHolder(signDataHolder); - JWTCodingResultType *signResult = signBuilder.result; - NSString *token = nil; - if (signResult.successResult) { - // success - NSLog(@"%@ success: %@", self.debugDescription, signResult.successResult.encoded); - token = signResult.successResult.encoded; - } - else { - // error - NSLog(@"%@ error: %@", self.debugDescription, signResult.errorResult.error); - } - - // verify - if (token == nil) { - NSLog(@"something wrong"); - } - - JWTCodingBuilder *verifyBuilder = [JWTDecodingBuilder decodeMessage:token].addHolder(verifyDataHolder); - JWTCodingResultType *verifyResult = verifyBuilder.result; - if (verifyResult.successResult) { - // success - NSLog(@"%@ success: %@", self.debugDescription, verifyResult.successResult.payload); - token = verifyResult.successResult.encoded; - } - else { - // error - NSLog(@"%@ error: %@", self.debugDescription, verifyResult.errorResult.error); - } -} -``` - -# Experiments in Version 2.0 -## Whitelists possible algorithms. -When you need to decode jwt by several algorithms you could specify their names in whitelist. -Later this feature possible will migrate to options. -For example, someone returns result or error. -### Limitations -Restricted to pair (algorithm or none) due to limitations of unique `secret`. - -```objective-c -NSString *jwtResultOrError = /*...*/; -NSString *secret = @"secret"; -JWTBuilder *builder = [JWT decodeMessage:jwtResultOrError].secret(@"secret").whitelist(@[@"HS256", @"none"]); -NSDictionary *decoded = builder.decode; -if (builder.jwtError) { - // oh! -} -else { - NSDictionary *payload = decoded[@"payload"]; - NSDictionary *header = decoded[@"header"]; - NSArray *tries = decoded[@"tries"]; // will be evolded into something appropriate later. -} -``` - -# What's new in Version 2.0 - -* Old plain style deprecated. -* Use modern fluent style instead. - -```objective-c -NSDictionary *payload = @{@"foo" : @"bar"}; -NSString *secret = @"secret"; -id algorithm = [JWTAlgorithmFactory algorithmByName:@"HS256"]; -// Deprecated -[JWT encodePayload:payload withSecret:secret algorithm:algorithm]; - -// Modern -[JWTBuilder encodePayload:payload].secret(secret).algorithm(algorithm).encode; -``` - -# Installation - -Add the following to your [CocoaPods][] Podfile: - - pod "JWT" - -[CocoaPods]: http://cocoapods.org - -Install via Cartfile: - - github "yourkarma/JWT" "master" - -and `import JWT` - -# Documentation -# Usage - -## JWTBuilder - -To encode & decode JWTs, use fluent style with the `JWTBuilder` interface - -```objective-c -+ (JWTBuilder *)encodePayload:(NSDictionary *)payload; -+ (JWTBuilder *)encodeClaimsSet:(JWTClaimsSet *)claimsSet; -+ (JWTBuilder *)decodeMessage:(NSString *)message; -``` - -As you can see, JWTBuilder has interface from both decoding and encoding. - -Note: some attributes are encode-only or decode-only. - - #pragma mark - Encode only - *payload; - *headers; - *algorithm; - - #pragma mark - Decode only - *message - *options // as forcedOption from jwt decode functions interface. - *whitelist //optional array of algorithm names to whitelist for decoding - -You can inspect JWTBuilder by `jwt`-prefixed attributes. - -You can set JWTBuilder attributes by fluent style (block interface). - -You can encode arbitrary payloads like so: - -```objective-c -NSDictionary *payload = @{@"foo" : @"bar"}; -NSString *secret = @"secret"; -id algorithm = [JWTAlgorithmFactory algorithmByName:@"HS256"]; - -[JWTBuilder encodePayload:payload].secret(@"secret").algorithm(algorithm).encode; -``` - -If you're using reserved claim names you can encode your claim set like so (all properties are optional): - -```objective-c -JWTClaimsSet *claimsSet = [[JWTClaimsSet alloc] init]; -claimsSet.issuer = @"Facebook"; -claimsSet.subject = @"Token"; -claimsSet.audience = @"http://yourkarma.com"; -claimsSet.expirationDate = [NSDate distantFuture]; -claimsSet.notBeforeDate = [NSDate distantPast]; -claimsSet.issuedAt = [NSDate date]; -claimsSet.identifier = @"thisisunique"; -claimsSet.type = @"test"; - -NSString *secret = @"secret"; -id algorithm = [JWTAlgorithmFactory algorithmByName:@"HS256"]; - -[JWTBuilder encodeClaimsSet:claimsSet].secret(secret).algorithm(algorithm).encode; -``` - -You can decode a JWT like so: - -```objective-c -NSString *jwtToken = @"header.payload.signature"; -NSString *secret = @"secret"; -NSString *algorithmName = @"HS256"; //Must specify an algorithm to use - -NSDictionary *payload = [JWTBuilder decodeMessage:jwtToken].secret(secret).algorithmName(algorithmName).decode; -``` - -If you want to check claims while decoding, you could use next sample of code (all properties are optional): - -```objective-c -// Trusted Claims Set -JWTClaimsSet *trustedClaimsSet = [[JWTClaimsSet alloc] init]; -trustedClaimsSet.issuer = @"Facebook"; -trustedClaimsSet.subject = @"Token"; -trustedClaimsSet.audience = @"http://yourkarma.com"; -trustedClaimsSet.expirationDate = [NSDate date]; -trustedClaimsSet.notBeforeDate = [NSDate date]; -trustedClaimsSet.issuedAt = [NSDate date]; -trustedClaimsSet.identifier = @"thisisunique"; -trustedClaimsSet.type = @"test"; - -NSString *message = @"encodedJwt"; -NSString *secret = @"secret"; -NSString *algorithmName = @"chosenAlgorithm" - -JWTBuilder *builder = [JWTBuilder decodeMessage:jwt].secret(secret).algorithmName(algorithmName).claimsSet(trustedClaimsSet); -NSDictionary *payload = builder.decode; - -if (builder.jwtError == nil) { - // do your work here -} -else { - // handle error -} -``` - -If you want to enforce a whitelist of valid algorithms: - -```objective-c -NSArray *whitelist = @[@"HS256", @"HS512"]; -NSString *jwtToken = @"header.payload.signature"; -NSString *secret = @"secret"; -NSString *algorithmName = @"HS256"; - -//Returns nil -NSDictionary *payload = [JWTBuilder decodeMessage:jwtToken].secret(secret).algorithmName(algorithmName).whitelist(@[]).decode; - -//Returns the decoded payload -NSDictionary *payload = [JWTBuilder decodeMessage:jwtToken].secret(secret).algorithmName(algorithmName).whitelist(whitelist).decode; -``` - -### Encode / Decode Example - -```objective-c -// suppose, that you create ClaimsSet -JWTClaimsSet *claimsSet = [[JWTClaimsSet alloc] init]; -// fill it -claimsSet.issuer = @"Facebook"; -claimsSet.subject = @"Token"; -claimsSet.audience = @"http://yourkarma.com"; - -// encode it -NSString *secret = @"secret"; -NSString *algorithmName = @"HS384"; -NSDictionary *headers = @{@"custom":@"value"}; -id algorithm = [JWTAlgorithmFactory algorithmByName:algorithmName]; - -JWTBuilder *encodeBuilder = [JWT encodeClaimsSet:claimsSet]; -NSString *encodedResult = encodeBuilder.secret(secret).algorithm(algorithm).headers(headers).encode; - -if (encodeBuilder.jwtError == nil) { - // handle encoded result - NSLog(@"encoded result: %@", encodedResult); -} -else { - // handle error - NSLog(@"encode failed, error: %@", encodeBuilder.jwtError); -} - -// decode it -// you can set any property that you want, all properties are optional -JWTClaimsSet *trustedClaimsSet = [claimsSet copy]; - -// decode forced ? try YES -BOOL decodeForced = NO; -NSNumber *options = @(decodeForced); -NSString *yourJwt = encodedResult; // from previous example -NSString *yourSecret = secret; // from previous example -NSString *yourAlgorithm = algorithmName; // from previous example -JWTBuilder *decodeBuilder = [JWT decodeMessage:yourJwt]; -NSDictionary *decodedResult = decodeBuilder.message(yourJwt).secret(yourSecret).algorithmName(yourAlgorithm).claimsSet(trustedClaimsSet).options(options).decode; -if (decodeBuilder.jwtError == nil) { - // handle decoded result - NSLog(@"decoded result: %@", decodedResult); -} -else { - // handle error - NSLog(@"decode failed, error: %@", decodeBuilder.jwtError); -} -``` - -#### NSData -You can also encode/decode using a secret that is represented as an NSData object - -```objective-c -//Encode -NSData *secretData = ""; -NSString *algorithmName = @"HS384"; -NSDictionary *headers = @{@"custom":@"value"}; -id algorithm = [JWTAlgorithmFactory algorithmByName:algorithmName]; - -JWTBuilder *encodeBuilder = [JWT encodeClaimsSet:claimsSet]; -NSString *encodedResult = encodeBuilder.secretData(secretData).algorithm(algorithm).headers(headers).encode; - -//Decode -NSString *jwtToken = @"header.payload.signature"; -NSData *secretData = "" -NSString *algorithmName = @"HS256"; //Must specify an algorithm to use - -NSDictionary *payload = [JWTBuilder decodeMessage:jwtToken].secretData(secretData).algorithmName(algorithmName).decode; -``` - -# Algorithms - -The following algorithms are supported: - -* RS256 -* HS512 - HMAC using SHA-512. -* HS256 / HS384 / HS512 -* None - -## RS256 usage. -For example, you have your file with privateKey: `file.p12`. -And you have a secret passphrase for that file: `secret`. - -```objective-c -// Encode -NSDictionary *payload = @{@"payload" : @"hidden_information"}; -NSString *algorithmName = @"RS256"; - -NSString *filePath = [[NSBundle mainBundle] pathForResource:@"secret_key" ofType:@"p12"]; -NSData *privateKeySecretData = [NSData dataWithContentsOfFile:filePath]; - -NSString *passphraseForPrivateKey = @"secret"; - -JWTBuilder *builder = [JWTBuilder encodePayload:payload].secretData(privateKeySecretData).privateKeyCertificatePassphrase(passphraseForPrivateKey).algorithmName(algorithmName); -NSString *token = builder.encode; - -// check error -if (builder.jwtError == nil) { - // handle result -} -else { - // error occurred. -} - -// Decode -// Suppose, that you get token from previous example. You need a valid public key for a private key in previous example. -// Private key stored in @"secret_key.p12". So, you need public key for that private key. -NSString *publicKey = @"..."; // load public key. Or use it as raw string. - -algorithmName = @"RS256"; - -JWTBuilder *decodeBuilder = [JWTBuilder decodeMessage:token].secret(publicKey).algorithmName(algorithmName); -NSDictionary *envelopedPayload = decodeBuilder.decode; - -// check error -if (decodeBuilder.jwtError == nil) { - // handle result -} -else { - // error occurred. -} -``` - - -Additional algorithms can be added by implementing the `JWTAlgorithm` protocol. - -## Before pull request - -Please, read [Contribution notes](https://github.com/yourkarma/JWT/blob/master/.github/CONTRIBUTING.md) before make pull request. \ No newline at end of file diff --git a/package.json b/package.json index 667e75dc1..e5a2c1508 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "author": "Source Push", "license": "MIT", "scripts": { + "pod-install": "pod install --project-directory=ios", "clean": "shx rm -rf bin", "setup": "npm install --quiet --no-progress", "prebuild:tests": "npm run clean && npm run tslint", @@ -89,4 +90,4 @@ "postunlink": "node node_modules/@srcpush/react-native-code-push/scripts/postunlink/run" } } -} +} \ No newline at end of file From 0a8bd754fa1d89ea2305f172b29463a3afa1cda4 Mon Sep 17 00:00:00 2001 From: Hebert Date: Mon, 27 Apr 2026 10:43:42 -0300 Subject: [PATCH 2/7] Refactor code structure for improved readability and maintainability --- package-lock.json | 12 +- yarn.lock | 2498 --------------------------------------------- 2 files changed, 10 insertions(+), 2500 deletions(-) delete mode 100644 yarn.lock diff --git a/package-lock.json b/package-lock.json index 2fd7fc28a..69442ef39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@srcpush/react-native-code-push", - "version": "1.0.3", + "version": "1.1.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@srcpush/react-native-code-push", - "version": "1.0.3", + "version": "1.1.5", "license": "MIT", "dependencies": { "code-push": "4.2.3", @@ -4200,6 +4200,7 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true, + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -4208,6 +4209,13 @@ "node": ">=4.2.0" } }, + "node_modules/undici-types": { + "version": "7.19.2", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.19.2.tgz", + "integrity": "sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==", + "license": "MIT", + "optional": true + }, "node_modules/universalify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", diff --git a/yarn.lock b/yarn.lock deleted file mode 100644 index 11bc76b9f..000000000 --- a/yarn.lock +++ /dev/null @@ -1,2498 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@babel/code-frame@^7.0.0": - version "7.29.0" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.29.0.tgz#7cd7a59f15b3cc0dcd803038f7792712a7d0b15c" - integrity sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw== - dependencies: - "@babel/helper-validator-identifier" "^7.28.5" - js-tokens "^4.0.0" - picocolors "^1.1.1" - -"@babel/helper-validator-identifier@^7.28.5": - version "7.28.5" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz#010b6938fab7cb7df74aa2bbc06aa503b8fe5fb4" - integrity sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q== - -"@inquirer/external-editor@^1.0.0": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@inquirer/external-editor/-/external-editor-1.0.3.tgz#c23988291ee676290fdab3fd306e64010a6d13b8" - integrity sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA== - dependencies: - chardet "^2.1.1" - iconv-lite "^0.7.0" - -"@isaacs/cliui@^8.0.2": - version "8.0.2" - resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" - integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== - dependencies: - string-width "^5.1.2" - string-width-cjs "npm:string-width@^4.2.0" - strip-ansi "^7.0.1" - strip-ansi-cjs "npm:strip-ansi@^6.0.1" - wrap-ansi "^8.1.0" - wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" - -"@noble/hashes@^1.1.5": - version "1.8.0" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.8.0.tgz#cee43d801fcef9644b11b8194857695acd5f815a" - integrity sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A== - -"@paralleldrive/cuid2@^2.2.2": - version "2.3.1" - resolved "https://registry.yarnpkg.com/@paralleldrive/cuid2/-/cuid2-2.3.1.tgz#3d62ea9e7be867d3fa94b9897fab5b0ae187d784" - integrity sha512-XO7cAxhnTZl0Yggq6jOgjiOHhbgcO4NqFqwSmQpjK3b6TEE6Uj/jfSk6wzYyemh3+I0sHirKSetjQwn5cZktFw== - dependencies: - "@noble/hashes" "^1.1.5" - -"@pkgjs/parseargs@^0.11.0": - version "0.11.0" - resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" - integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== - -"@srcpush/plugin-testing-framework@0.1.0": - version "0.1.0" - resolved "https://registry.yarnpkg.com/@srcpush/plugin-testing-framework/-/plugin-testing-framework-0.1.0.tgz#459b0dd196ccf4fa8582f955ecca593a0489bd00" - integrity sha512-yb4qkTxfc9+WxhJYkcRV8ss3E5eEKUSxLnvqkQfMQU61T/ROQN+g+oLz17Tc0jzTjqj7xDkhrihIAAGeAXGT1w== - dependencies: - archiver "^7.0.1" - express "^5.1.0" - -"@tootallnate/quickjs-emscripten@^0.23.0": - version "0.23.0" - resolved "https://registry.yarnpkg.com/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz#db4ecfd499a9765ab24002c3b696d02e6d32a12c" - integrity sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA== - -"@types/assert@^1.5.2": - version "1.5.11" - resolved "https://registry.yarnpkg.com/@types/assert/-/assert-1.5.11.tgz#0b022efe761e14cca3d0f8ad1fd77a403de0071e" - integrity sha512-FjS1mxq2dlGr9N4z72/DO+XmyRS3ZZIoVn998MEopAN/OmyN28F4yumRL5pOw2z+hbFLuWGYuF2rrw5p11xM5A== - -"@types/mkdirp@^1.0.1": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-1.0.2.tgz#8d0bad7aa793abe551860be1f7ae7f3198c16666" - integrity sha512-o0K1tSO0Dx5X6xlU5F1D6625FawhC3dU3iqr25lluNv/+/QIVH8RLNEiVokgIZo+mz+87w/3Mkg/VvQS+J51fQ== - dependencies: - "@types/node" "*" - -"@types/mocha@^9.0.0": - version "9.1.1" - resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.1.1.tgz#e7c4f1001eefa4b8afbd1eee27a237fee3bf29c4" - integrity sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw== - -"@types/node@*": - version "25.6.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-25.6.0.tgz#4e09bad9b469871f2d0f68140198cbd714f4edca" - integrity sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ== - dependencies: - undici-types "~7.19.0" - -"@types/node@^14.0.27": - version "14.18.63" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.63.tgz#1788fa8da838dbb5f9ea994b834278205db6ca2b" - integrity sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ== - -"@types/q@^1.5.4": - version "1.5.8" - resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.8.tgz#95f6c6a08f2ad868ba230ead1d2d7f7be3db3837" - integrity sha512-hroOstUScF6zhIi+5+x0dzqrHA1EJi+Irri6b1fxolMTqqHIV/Cg77EtnQcZqZCu8hR3mX2BzIxN4/GzI68Kfw== - -"@xmldom/xmldom@^0.8.8": - version "0.8.12" - resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.8.12.tgz#cf488a5435fa06c7374ad1449c69cea0f823624b" - integrity sha512-9k/gHF6n/pAi/9tqr3m3aqkuiNosYTurLLUtc7xQ9sxB/wm7WPygCv8GYa6mS0fLJEHhqMC1ATYhz++U/lRHqg== - -abort-controller@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" - integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== - dependencies: - event-target-shim "^5.0.0" - -accepts@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/accepts/-/accepts-2.0.0.tgz#bbcf4ba5075467f3f2131eab3cffc73c2f5d7895" - integrity sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng== - dependencies: - mime-types "^3.0.0" - negotiator "^1.0.0" - -agent-base@^7.1.0, agent-base@^7.1.2: - version "7.1.4" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.4.tgz#e3cd76d4c548ee895d3c3fd8dc1f6c5b9032e7a8" - integrity sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ== - -ansi-cyan@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ansi-cyan/-/ansi-cyan-0.1.1.tgz#538ae528af8982f28ae30d86f2f17456d2609873" - integrity sha512-eCjan3AVo/SxZ0/MyIYRtkpxIu/H3xZN7URr1vXVrISxeyz8fUFz0FJziamK4sS8I+t35y4rHg1b2PklyBe/7A== - dependencies: - ansi-wrap "0.1.0" - -ansi-escapes@^4.2.1: - version "4.3.2" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" - integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== - dependencies: - type-fest "^0.21.3" - -ansi-gray@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ansi-gray/-/ansi-gray-0.1.1.tgz#2962cf54ec9792c48510a3deb524436861ef7251" - integrity sha512-HrgGIZUl8h2EHuZaU9hTR/cU5nhKxpVE1V6kdGsQ8e4zirElJ5fvtfc8N7Q1oq1aatO275i8pUFUCpNWCAnVWw== - dependencies: - ansi-wrap "0.1.0" - -ansi-red@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ansi-red/-/ansi-red-0.1.1.tgz#8c638f9d1080800a353c9c28c8a81ca4705d946c" - integrity sha512-ewaIr5y+9CUTGFwZfpECUbFlGcC0GCw1oqR9RI6h1gQCd9Aj2GxSckCnPsVJnmfMZbwFYE+leZGASgkWl06Jow== - dependencies: - ansi-wrap "0.1.0" - -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - integrity sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA== - -ansi-regex@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" - integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== - -ansi-regex@^6.2.2: - version "6.2.2" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.2.2.tgz#60216eea464d864597ce2832000738a0589650c1" - integrity sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg== - -ansi-styles@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - integrity sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA== - -ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== - dependencies: - color-convert "^1.9.0" - -ansi-styles@^4.0.0, ansi-styles@^4.1.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -ansi-styles@^6.1.0: - version "6.2.3" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.3.tgz#c044d5dcc521a076413472597a1acb1f103c4041" - integrity sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg== - -ansi-wrap@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf" - integrity sha512-ZyznvL8k/FZeQHr2T6LzcJ/+vBApDnMNZvfVFy3At0knswWd6rJ3/0Hhmpu8oqa6C92npmozs890sX9Dl6q+Qw== - -appcenter-file-upload-client@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/appcenter-file-upload-client/-/appcenter-file-upload-client-0.1.0.tgz#e4372462b83159f63526d5eb880700cfc2002fa7" - integrity sha512-W8lueBBvLuItND2vmvfdIDTbIYHOHXr5ohObhqvBNL3XCOGTqQq1rhWUxBX5Mb5geLBuLDC0HQOtq9pcBgi71w== - dependencies: - detect-node "^2.0.4" - superagent "5.1.0" - url-parse "^1.4.7" - -archiver-utils@^5.0.0, archiver-utils@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/archiver-utils/-/archiver-utils-5.0.2.tgz#63bc719d951803efc72cf961a56ef810760dd14d" - integrity sha512-wuLJMmIBQYCsGZgYLTy5FIB2pF6Lfb6cXMSF8Qywwk3t20zWnAi7zLcQFdKQmIB8wyZpY5ER38x08GbwtR2cLA== - dependencies: - glob "^10.0.0" - graceful-fs "^4.2.0" - is-stream "^2.0.1" - lazystream "^1.0.0" - lodash "^4.17.15" - normalize-path "^3.0.0" - readable-stream "^4.0.0" - -archiver@^7.0.1, archiver@latest: - version "7.0.1" - resolved "https://registry.yarnpkg.com/archiver/-/archiver-7.0.1.tgz#c9d91c350362040b8927379c7aa69c0655122f61" - integrity sha512-ZcbTaIqJOfCc03QwD468Unz/5Ir8ATtvAHsK+FdXbDIbGfihqh9mrvdcYunQzqn4HrvWWaFyaxJhGZagaJJpPQ== - dependencies: - archiver-utils "^5.0.2" - async "^3.2.4" - buffer-crc32 "^1.0.0" - readable-stream "^4.0.0" - readdir-glob "^1.1.2" - tar-stream "^3.0.0" - zip-stream "^6.0.1" - -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== - dependencies: - sprintf-js "~1.0.2" - -argparse@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" - integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== - -arr-diff@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-1.1.0.tgz#687c32758163588fef7de7b36fabe495eb1a399a" - integrity sha512-OQwDZUqYaQwyyhDJHThmzId8daf4/RFNLaeh3AevmSeZ5Y7ug4Ga/yKc6l6kTZOBW781rCj103ZuTh8GAsB3+Q== - dependencies: - arr-flatten "^1.0.1" - array-slice "^0.2.3" - -arr-flatten@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" - integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== - -arr-union@^2.0.1: - version "2.1.0" - resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-2.1.0.tgz#20f9eab5ec70f5c7d215b1077b1c39161d292c7d" - integrity sha512-t5db90jq+qdgk8aFnxEkjqta0B/GHrM1pxzuuZz2zWsOXc5nKu3t+76s/PQBA8FTcM/ipspIH9jWG4OxCBc2eA== - -array-slice@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-0.2.3.tgz#dd3cfb80ed7973a75117cdac69b0b99ec86186f5" - integrity sha512-rlVfZW/1Ph2SNySXwR9QYkChp8EkOEiTMO5Vwx60usw04i4nWemkm9RXmQqgkQFaLHsqLuADvjp6IfgL9l2M8Q== - -asap@^2.0.0: - version "2.0.6" - resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" - integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== - -ast-types@^0.13.4: - version "0.13.4" - resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.13.4.tgz#ee0d77b343263965ecc3fb62da16e7222b2b6782" - integrity sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w== - dependencies: - tslib "^2.0.1" - -async@^3.2.4: - version "3.2.6" - resolved "https://registry.yarnpkg.com/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce" - integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA== - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== - -b4a@^1.6.4: - version "1.8.0" - resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.8.0.tgz#1ca3ba0edc9469aaabef5647e769a83d50180b1a" - integrity sha512-qRuSmNSkGQaHwNbM7J78Wwy+ghLEYF1zNrSeMxj4Kgw6y33O3mXcQ6Ie9fRvfU/YnxWkOchPXbaLb73TkIsfdg== - -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== - -balanced-match@^4.0.2: - version "4.0.4" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-4.0.4.tgz#bfb10662feed8196a2c62e7c68e17720c274179a" - integrity sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA== - -bare-events@^2.5.4, bare-events@^2.7.0: - version "2.8.2" - resolved "https://registry.yarnpkg.com/bare-events/-/bare-events-2.8.2.tgz#7b3e10bd8e1fc80daf38bb516921678f566ab89f" - integrity sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ== - -bare-fs@^4.5.5: - version "4.7.1" - resolved "https://registry.yarnpkg.com/bare-fs/-/bare-fs-4.7.1.tgz#6e81f784761102867c13f0823aa48c942d160f00" - integrity sha512-WDRsyVN52eAx/lBamKD6uyw8H4228h/x0sGGGegOamM2cd7Pag88GfMQalobXI+HaEUxpCkbKQUDOQqt9wawRw== - dependencies: - bare-events "^2.5.4" - bare-path "^3.0.0" - bare-stream "^2.6.4" - bare-url "^2.2.2" - fast-fifo "^1.3.2" - -bare-os@^3.0.1: - version "3.8.7" - resolved "https://registry.yarnpkg.com/bare-os/-/bare-os-3.8.7.tgz#09c7c4e8c817de750b0b69b65c929513f69ede65" - integrity sha512-G4Gr1UsGeEy2qtDTZwL7JFLo2wapUarz7iTMcYcMFdS89AIQuBoyjgXZz0Utv7uHs3xA9LckhVbeBi8lEQrC+w== - -bare-path@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/bare-path/-/bare-path-3.0.0.tgz#b59d18130ba52a6af9276db3e96a2e3d3ea52178" - integrity sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw== - dependencies: - bare-os "^3.0.1" - -bare-stream@^2.6.4: - version "2.13.0" - resolved "https://registry.yarnpkg.com/bare-stream/-/bare-stream-2.13.0.tgz#dea59458dcf2689e9387134efccec015dfdbe3cf" - integrity sha512-3zAJRZMDFGjdn+RVnNpF9kuELw+0Fl3lpndM4NcEOhb9zwtSo/deETfuIwMSE5BXanA0FrN1qVjffGwAg2Y7EA== - dependencies: - streamx "^2.25.0" - teex "^1.0.1" - -bare-url@^2.2.2: - version "2.4.0" - resolved "https://registry.yarnpkg.com/bare-url/-/bare-url-2.4.0.tgz#1546d63057917189cab9b24629e946e1e8f7af31" - integrity sha512-NSTU5WN+fy/L0DDenfE8SXQna4voXuW0FHM7wH8i3/q9khUSchfPbPezO4zSFMnDGIf9YE+mt/RWhZgNRKRIXA== - dependencies: - bare-path "^3.0.0" - -base64-js@^1.3.1, base64-js@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" - integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - -basic-ftp@^5.0.2: - version "5.3.0" - resolved "https://registry.yarnpkg.com/basic-ftp/-/basic-ftp-5.3.0.tgz#88f057d1ba8442643c505c4c83bbaa4442b15cfd" - integrity sha512-5K9eNNn7ywHPsYnFwjKgYH8Hf8B5emh7JKcPaVjjrMJFQQwGpwowEnZNEtHs7DfR7hCZsmaK3VA4HUK0YarT+w== - -big-integer@1.6.x: - version "1.6.52" - resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.52.tgz#60a887f3047614a8e1bffe5d7173490a97dc8c85" - integrity sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg== - -bl@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" - integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== - dependencies: - buffer "^5.5.0" - inherits "^2.0.4" - readable-stream "^3.4.0" - -body-parser@^2.2.1, body-parser@latest: - version "2.2.2" - resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-2.2.2.tgz#1a32cdb966beaf68de50a9dfbe5b58f83cb8890c" - integrity sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA== - dependencies: - bytes "^3.1.2" - content-type "^1.0.5" - debug "^4.4.3" - http-errors "^2.0.0" - iconv-lite "^0.7.0" - on-finished "^2.4.1" - qs "^6.14.1" - raw-body "^3.0.1" - type-is "^2.0.1" - -bplist-creator@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/bplist-creator/-/bplist-creator-0.1.0.tgz#018a2d1b587f769e379ef5519103730f8963ba1e" - integrity sha512-sXaHZicyEEmY86WyueLTQesbeoH/mquvarJaQNbjuOQO+7gbFcDEWqKmcWA4cOTLzFlfgvkiVxolk1k5bBIpmg== - dependencies: - stream-buffers "2.2.x" - -bplist-parser@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.3.1.tgz#e1c90b2ca2a9f9474cc72f6862bbf3fee8341fd1" - integrity sha512-PyJxiNtA5T2PlLIeBot4lbp7rj4OadzjnMZD/G5zuBNt8ei/yCU7+wW0h2bag9vr8c+/WuRWmSxbqAl9hL1rBA== - dependencies: - big-integer "1.6.x" - -brace-expansion@^1.1.7: - version "1.1.14" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.14.tgz#d9de602370d91347cd9ddad1224d4fd701eb348b" - integrity sha512-MWPGfDxnyzKU7rNOW9SP/c50vi3xrmrua/+6hfPbCS2ABNWfx24vPidzvC7krjU/RTo235sV776ymlsMtGKj8g== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -brace-expansion@^2.0.1, brace-expansion@^2.0.2: - version "2.1.0" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.1.0.tgz#4f41a41190216ee36067ec381526fe9539c4f0ae" - integrity sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w== - dependencies: - balanced-match "^1.0.0" - -brace-expansion@^5.0.5: - version "5.0.5" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-5.0.5.tgz#dcc3a37116b79f3e1b46db994ced5d570e930fdb" - integrity sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ== - dependencies: - balanced-match "^4.0.2" - -browser-stdout@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" - integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== - -buffer-crc32@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-1.0.0.tgz#a10993b9055081d55304bd9feb4a072de179f405" - integrity sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w== - -buffer-crc32@~0.2.3: - version "0.2.13" - resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" - integrity sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ== - -buffer@^5.5.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" - integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.1.13" - -buffer@^6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" - integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.2.1" - -builtin-modules@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" - integrity sha512-wxXCdllwGhI2kCC0MnvTGYTMvnVZTvqgypkiTI8Pa5tcz2i6VqsqwYGgqwXji+4RgCzms6EajE4IxiUH6HH8nQ== - -bytes@^3.1.2, bytes@~3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" - integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== - -call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" - integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== - dependencies: - es-errors "^1.3.0" - function-bind "^1.1.2" - -call-bound@^1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/call-bound/-/call-bound-1.0.4.tgz#238de935d2a2a692928c538c7ccfa91067fd062a" - integrity sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg== - dependencies: - call-bind-apply-helpers "^1.0.2" - get-intrinsic "^1.3.0" - -camelcase@^6.0.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" - integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== - -chalk@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - integrity sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A== - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - -chalk@^2.3.0: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -chalk@^4.1.0, chalk@^4.1.1: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -chardet@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-2.1.1.tgz#5c75593704a642f71ee53717df234031e65373c8" - integrity sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ== - -chokidar@^4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-4.0.3.tgz#7be37a4c03c9aee1ecfe862a4a23b2c70c205d30" - integrity sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA== - dependencies: - readdirp "^4.0.1" - -cli-cursor@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" - integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== - dependencies: - restore-cursor "^3.1.0" - -cli-spinners@^2.5.0: - version "2.9.2" - resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.9.2.tgz#1773a8f4b9c4d6ac31563df53b3fc1d79462fe41" - integrity sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg== - -cli-width@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" - integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== - -cliui@^8.0.1: - version "8.0.1" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" - integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.1" - wrap-ansi "^7.0.0" - -clone@^1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" - integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== - -code-push@4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/code-push/-/code-push-4.2.3.tgz#2296fbc01ce6a1f473dbc2acf25b1896f1945c73" - integrity sha512-FPwcU9/5lgMJH7MfBgkr4nCta513DGx2v4mg2yW860+8sCQTbhHHnduoAjSlZgyZJj3FIxzW2ccD41pVtTJDow== - dependencies: - appcenter-file-upload-client "0.1.0" - proxy-agent "^6.3.0" - recursive-fs "^2.1.0" - slash "^3.0.0" - superagent "^8.0.0" - yazl "^2.5.1" - -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -color-support@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" - integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== - -combined-stream@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - -commander@^2.12.1: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - -component-emitter@^1.3.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.1.tgz#ef1d5796f7d93f135ee6fb684340b26403c97d17" - integrity sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ== - -compress-commons@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/compress-commons/-/compress-commons-6.0.2.tgz#26d31251a66b9d6ba23a84064ecd3a6a71d2609e" - integrity sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg== - dependencies: - crc-32 "^1.2.0" - crc32-stream "^6.0.0" - is-stream "^2.0.1" - normalize-path "^3.0.0" - readable-stream "^4.0.0" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== - -content-disposition@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-1.1.0.tgz#f3db789c752d45564cc7e9e1e0b31790d4a38e17" - integrity sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g== - -content-type@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.5.tgz#8b773162656d1d1086784c8f23a54ce6d73d7918" - integrity sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA== - -cookie-signature@^1.2.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.2.2.tgz#57c7fc3cc293acab9fec54d73e15690ebe4a1793" - integrity sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg== - -cookie@^0.7.1: - version "0.7.2" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.2.tgz#556369c472a2ba910f2979891b526b3436237ed7" - integrity sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w== - -cookiejar@^2.1.2, cookiejar@^2.1.4: - version "2.1.4" - resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.4.tgz#ee669c1fea2cf42dc31585469d193fef0d65771b" - integrity sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw== - -core-util-is@~1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" - integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== - -crc-32@^1.2.0: - version "1.2.2" - resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.2.tgz#3cad35a934b8bf71f25ca524b6da51fb7eace2ff" - integrity sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ== - -crc32-stream@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/crc32-stream/-/crc32-stream-6.0.0.tgz#8529a3868f8b27abb915f6c3617c0fadedbf9430" - integrity sha512-piICUB6ei4IlTv1+653yq5+KoqfBYmj9bw6LqXoOneTMDXk5nM1qt12mFW1caG3LlJXEKW1Bp0WggEmIfQB34g== - dependencies: - crc-32 "^1.2.0" - readable-stream "^4.0.0" - -cross-spawn@^7.0.6: - version "7.0.6" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" - integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -data-uri-to-buffer@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz#8a58bb67384b261a38ef18bea1810cb01badd28b" - integrity sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw== - -debug@4, debug@^4.1.1, debug@^4.3.4, debug@^4.3.5, debug@^4.4.0, debug@^4.4.3: - version "4.4.3" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" - integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== - dependencies: - ms "^2.1.3" - -decamelize@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" - integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== - -defaults@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.4.tgz#b0b02062c1e2aa62ff5d9528f0f98baa90978d7a" - integrity sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A== - dependencies: - clone "^1.0.2" - -degenerator@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/degenerator/-/degenerator-5.0.1.tgz#9403bf297c6dad9a1ece409b37db27954f91f2f5" - integrity sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ== - dependencies: - ast-types "^0.13.4" - escodegen "^2.1.0" - esprima "^4.0.1" - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== - -depd@^2.0.0, depd@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" - integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== - -detect-node@^2.0.4: - version "2.1.0" - resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.1.0.tgz#c9c70775a49c3d03bc2c06d9a73be550f978f8b1" - integrity sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g== - -dezalgo@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.4.tgz#751235260469084c132157dfa857f386d4c33d81" - integrity sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig== - dependencies: - asap "^2.0.0" - wrappy "1" - -diff@^4.0.1: - version "4.0.4" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.4.tgz#7a6dbfda325f25f07517e9b518f897c08332e07d" - integrity sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ== - -diff@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-7.0.0.tgz#3fb34d387cd76d803f6eebea67b921dab0182a9a" - integrity sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw== - -dunder-proto@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" - integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A== - dependencies: - call-bind-apply-helpers "^1.0.1" - es-errors "^1.3.0" - gopd "^1.2.0" - -eastasianwidth@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" - integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== - -ee-first@1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" - integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -emoji-regex@^9.2.2: - version "9.2.2" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" - integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== - -encodeurl@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-2.0.0.tgz#7b8ea898077d7e409d3ac45474ea38eaf0857a58" - integrity sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg== - -es-define-property@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" - integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g== - -es-errors@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" - integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== - -es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" - integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== - dependencies: - es-errors "^1.3.0" - -es-set-tostringtag@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz#f31dbbe0c183b00a6d26eb6325c810c0fd18bd4d" - integrity sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA== - dependencies: - es-errors "^1.3.0" - get-intrinsic "^1.2.6" - has-tostringtag "^1.0.2" - hasown "^2.0.2" - -escalade@^3.1.1: - version "3.2.0" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" - integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== - -escape-html@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" - integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== - -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== - -escape-string-regexp@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" - integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== - -escodegen@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" - integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== - dependencies: - esprima "^4.0.1" - estraverse "^5.2.0" - esutils "^2.0.2" - optionalDependencies: - source-map "~0.6.1" - -esprima@^4.0.0, esprima@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - -estraverse@^5.2.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" - integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== - -esutils@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" - integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== - -etag@^1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" - integrity sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg== - -event-target-shim@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" - integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== - -events-universal@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/events-universal/-/events-universal-1.0.1.tgz#b56a84fd611b6610e0a2d0f09f80fdf931e2dfe6" - integrity sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw== - dependencies: - bare-events "^2.7.0" - -events@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" - integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== - -express@^5.1.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/express/-/express-5.2.1.tgz#8f21d15b6d327f92b4794ecf8cb08a72f956ac04" - integrity sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw== - dependencies: - accepts "^2.0.0" - body-parser "^2.2.1" - content-disposition "^1.0.0" - content-type "^1.0.5" - cookie "^0.7.1" - cookie-signature "^1.2.1" - debug "^4.4.0" - depd "^2.0.0" - encodeurl "^2.0.0" - escape-html "^1.0.3" - etag "^1.8.1" - finalhandler "^2.1.0" - fresh "^2.0.0" - http-errors "^2.0.0" - merge-descriptors "^2.0.0" - mime-types "^3.0.0" - on-finished "^2.4.1" - once "^1.4.0" - parseurl "^1.3.3" - proxy-addr "^2.0.7" - qs "^6.14.0" - range-parser "^1.2.1" - router "^2.2.0" - send "^1.1.0" - serve-static "^2.2.0" - statuses "^2.0.1" - type-is "^2.0.1" - vary "^1.1.2" - -extend-shallow@^1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-1.1.4.tgz#19d6bf94dfc09d76ba711f39b872d21ff4dd9071" - integrity sha512-L7AGmkO6jhDkEBBGWlLtftA80Xq8DipnrRPr0pyi7GQLXkaq9JYA4xF4z6qnadIC6euiTDKco0cGSU9muw+WTw== - dependencies: - kind-of "^1.1.0" - -fancy-log@^1.3.2: - version "1.3.3" - resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.3.tgz#dbc19154f558690150a23953a0adbd035be45fc7" - integrity sha512-k9oEhlyc0FrVh25qYuSELjr8oxsCoc4/LEZfg2iJJrfEk/tZL9bCoJE47gqAvI2m/AUjluCS4+3I0eTx8n3AEw== - dependencies: - ansi-gray "^0.1.1" - color-support "^1.1.3" - parse-node-version "^1.0.0" - time-stamp "^1.0.0" - -fast-fifo@^1.2.0, fast-fifo@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.2.tgz#286e31de96eb96d38a97899815740ba2a4f3640c" - integrity sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ== - -fast-safe-stringify@^2.0.6, fast-safe-stringify@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" - integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== - -figures@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" - integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== - dependencies: - escape-string-regexp "^1.0.5" - -finalhandler@^2.1.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-2.1.1.tgz#a2c517a6559852bcdb06d1f8bd7f51b68fad8099" - integrity sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA== - dependencies: - debug "^4.4.0" - encodeurl "^2.0.0" - escape-html "^1.0.3" - on-finished "^2.4.1" - parseurl "^1.3.3" - statuses "^2.0.1" - -find-up@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" - integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== - dependencies: - locate-path "^6.0.0" - path-exists "^4.0.0" - -flat@^5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" - integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== - -foreground-child@^3.1.0: - version "3.3.1" - resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.1.tgz#32e8e9ed1b68a3497befb9ac2b6adf92a638576f" - integrity sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw== - dependencies: - cross-spawn "^7.0.6" - signal-exit "^4.0.1" - -form-data@^2.3.3: - version "2.5.5" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.5.tgz#a5f6364ad7e4e67e95b4a07e2d8c6f711c74f624" - integrity sha512-jqdObeR2rxZZbPSGL+3VckHMYtu+f9//KXBsVny6JSX/pa38Fy+bGjuG8eW/H6USNQWhLi8Num++cU2yOCNz4A== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - es-set-tostringtag "^2.1.0" - hasown "^2.0.2" - mime-types "^2.1.35" - safe-buffer "^5.2.1" - -form-data@^4.0.0: - version "4.0.5" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.5.tgz#b49e48858045ff4cbf6b03e1805cebcad3679053" - integrity sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - es-set-tostringtag "^2.1.0" - hasown "^2.0.2" - mime-types "^2.1.12" - -formidable@^1.2.1: - version "1.2.6" - resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.2.6.tgz#d2a51d60162bbc9b4a055d8457a7c75315d1a168" - integrity sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ== - -formidable@^2.1.2: - version "2.1.5" - resolved "https://registry.yarnpkg.com/formidable/-/formidable-2.1.5.tgz#dd7ef4d55c164afaf9b6eb472bfd04b02d66d2dd" - integrity sha512-Oz5Hwvwak/DCaXVVUtPn4oLMLLy1CdclLKO1LFgU7XzDpVMUU5UjlSLpGMocyQNNk8F6IJW9M/YdooSn2MRI+Q== - dependencies: - "@paralleldrive/cuid2" "^2.2.2" - dezalgo "^1.0.4" - once "^1.4.0" - qs "^6.11.0" - -forwarded@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" - integrity sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow== - -fresh@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/fresh/-/fresh-2.0.0.tgz#8dd7df6a1b3a1b3a5cf186c05a5dd267622635a4" - integrity sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A== - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== - -function-bind@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" - integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== - -get-caller-file@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" - integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== - -get-intrinsic@^1.2.5, get-intrinsic@^1.2.6, get-intrinsic@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" - integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== - dependencies: - call-bind-apply-helpers "^1.0.2" - es-define-property "^1.0.1" - es-errors "^1.3.0" - es-object-atoms "^1.1.1" - function-bind "^1.1.2" - get-proto "^1.0.1" - gopd "^1.2.0" - has-symbols "^1.1.0" - hasown "^2.0.2" - math-intrinsics "^1.1.0" - -get-proto@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" - integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== - dependencies: - dunder-proto "^1.0.1" - es-object-atoms "^1.0.0" - -get-uri@^6.0.1: - version "6.0.5" - resolved "https://registry.yarnpkg.com/get-uri/-/get-uri-6.0.5.tgz#714892aa4a871db671abc5395e5e9447bc306a16" - integrity sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg== - dependencies: - basic-ftp "^5.0.2" - data-uri-to-buffer "^6.0.2" - debug "^4.3.4" - -glob@^10.0.0, glob@^10.4.5: - version "10.5.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-10.5.0.tgz#8ec0355919cd3338c28428a23d4f24ecc5fe738c" - integrity sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg== - dependencies: - foreground-child "^3.1.0" - jackspeak "^3.1.2" - minimatch "^9.0.4" - minipass "^7.1.2" - package-json-from-dist "^1.0.0" - path-scurry "^1.11.1" - -glob@^13.0.1: - version "13.0.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-13.0.6.tgz#078666566a425147ccacfbd2e332deb66a2be71d" - integrity sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw== - dependencies: - minimatch "^10.2.2" - minipass "^7.1.3" - path-scurry "^2.0.2" - -glob@^7.0.0, glob@^7.1.1: - version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" - integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.1.1" - once "^1.3.0" - path-is-absolute "^1.0.0" - -gopd@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" - integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== - -graceful-fs@^4.2.0: - version "4.2.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" - integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== - -has-ansi@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - integrity sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg== - dependencies: - ansi-regex "^2.0.0" - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== - -has-flag@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" - integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== - -has-symbols@^1.0.3, has-symbols@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" - integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== - -has-tostringtag@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" - integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== - dependencies: - has-symbols "^1.0.3" - -hasown@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" - integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== - dependencies: - function-bind "^1.1.2" - -he@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" - integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== - -hoist-non-react-statics@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" - integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== - dependencies: - react-is "^16.7.0" - -http-errors@^2.0.0, http-errors@^2.0.1, http-errors@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.1.tgz#36d2f65bc909c8790018dd36fb4d93da6caae06b" - integrity sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ== - dependencies: - depd "~2.0.0" - inherits "~2.0.4" - setprototypeof "~1.2.0" - statuses "~2.0.2" - toidentifier "~1.0.1" - -http-proxy-agent@^7.0.0, http-proxy-agent@^7.0.1: - version "7.0.2" - resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz#9a8b1f246866c028509486585f62b8f2c18c270e" - integrity sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig== - dependencies: - agent-base "^7.1.0" - debug "^4.3.4" - -https-proxy-agent@^7.0.6: - version "7.0.6" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz#da8dfeac7da130b05c2ba4b59c9b6cd66611a6b9" - integrity sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw== - dependencies: - agent-base "^7.1.2" - debug "4" - -iconv-lite@^0.7.0, iconv-lite@~0.7.0: - version "0.7.2" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.7.2.tgz#d0bdeac3f12b4835b7359c2ad89c422a4d1cc72e" - integrity sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw== - dependencies: - safer-buffer ">= 2.1.2 < 3.0.0" - -ieee754@^1.1.13, ieee754@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" - integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3, inherits@~2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -inquirer@^8.1.5: - version "8.2.7" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-8.2.7.tgz#62f6b931a9b7f8735dc42db927316d8fb6f71de8" - integrity sha512-UjOaSel/iddGZJ5xP/Eixh6dY1XghiBw4XK13rCCIJcJfyhhoul/7KhLLUGtebEj6GDYM6Vnx/mVsjx2L/mFIA== - dependencies: - "@inquirer/external-editor" "^1.0.0" - ansi-escapes "^4.2.1" - chalk "^4.1.1" - cli-cursor "^3.1.0" - cli-width "^3.0.0" - figures "^3.0.0" - lodash "^4.17.21" - mute-stream "0.0.8" - ora "^5.4.1" - run-async "^2.4.0" - rxjs "^7.5.5" - string-width "^4.1.0" - strip-ansi "^6.0.0" - through "^2.3.6" - wrap-ansi "^6.0.1" - -interpret@^1.0.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" - integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== - -ip-address@^10.0.1: - version "10.1.0" - resolved "https://registry.yarnpkg.com/ip-address/-/ip-address-10.1.0.tgz#d8dcffb34d0e02eb241427444a6e23f5b0595aa4" - integrity sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q== - -ipaddr.js@1.9.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" - integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== - -is-core-module@^2.16.1: - version "2.16.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.16.1.tgz#2a98801a849f43e2add644fbb6bc6229b19a4ef4" - integrity sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w== - dependencies: - hasown "^2.0.2" - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -is-interactive@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e" - integrity sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w== - -is-path-inside@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" - integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== - -is-plain-obj@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" - integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== - -is-promise@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-4.0.0.tgz#42ff9f84206c1991d26debf520dd5c01042dd2f3" - integrity sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ== - -is-stream@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" - integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== - -is-unicode-supported@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" - integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== - -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== - -jackspeak@^3.1.2: - version "3.4.3" - resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a" - integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw== - dependencies: - "@isaacs/cliui" "^8.0.2" - optionalDependencies: - "@pkgjs/parseargs" "^0.11.0" - -js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== - -js-yaml@^3.13.1: - version "3.14.2" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.2.tgz#77485ce1dd7f33c061fd1b16ecea23b55fcb04b0" - integrity sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -js-yaml@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.1.tgz#854c292467705b699476e1a2decc0c8a3458806b" - integrity sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA== - dependencies: - argparse "^2.0.1" - -kind-of@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-1.1.0.tgz#140a3d2d41a36d2efcfa9377b62c24f8495a5c44" - integrity sha512-aUH6ElPnMGon2/YkxRIigV32MOpTVcoXQ1Oo8aYn40s+sJ3j+0gFZsT8HKDcxNy7Fi9zuquWtGaGAahOdv5p/g== - -lazystream@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/lazystream/-/lazystream-1.0.1.tgz#494c831062f1f9408251ec44db1cba29242a2638" - integrity sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw== - dependencies: - readable-stream "^2.0.5" - -locate-path@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" - integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== - dependencies: - p-locate "^5.0.0" - -lodash@^4.17.15, lodash@^4.17.21: - version "4.18.1" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.18.1.tgz#ff2b66c1f6326d59513de2407bf881439812771c" - integrity sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q== - -log-symbols@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" - integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== - dependencies: - chalk "^4.1.0" - is-unicode-supported "^0.1.0" - -lru-cache@^10.2.0: - version "10.4.3" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" - integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== - -lru-cache@^11.0.0: - version "11.3.5" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.3.5.tgz#29047d348c0b2793e3112a01c739bb7c6d855637" - integrity sha512-NxVFwLAnrd9i7KUBxC4DrUhmgjzOs+1Qm50D3oF1/oL+r1NpZ4gA7xvG0/zJ8evR7zIKn4vLf7qTNduWFtCrRw== - -lru-cache@^7.14.1: - version "7.18.3" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.18.3.tgz#f793896e0fd0e954a59dfdd82f0773808df6aa89" - integrity sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA== - -math-intrinsics@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" - integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== - -media-typer@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-1.1.0.tgz#6ab74b8f2d3320f2064b2a87a38e7931ff3a5561" - integrity sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw== - -merge-descriptors@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-2.0.0.tgz#ea922f660635a2249ee565e0449f951e6b603808" - integrity sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g== - -methods@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" - integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== - -mime-db@1.52.0: - version "1.52.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" - integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== - -mime-db@^1.54.0: - version "1.54.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.54.0.tgz#cddb3ee4f9c64530dff640236661d42cb6a314f5" - integrity sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ== - -mime-types@^2.1.12, mime-types@^2.1.35: - version "2.1.35" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== - dependencies: - mime-db "1.52.0" - -mime-types@^3.0.0, mime-types@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-3.0.2.tgz#39002d4182575d5af036ffa118100f2524b2e2ab" - integrity sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A== - dependencies: - mime-db "^1.54.0" - -mime@2.6.0, mime@^2.4.4: - version "2.6.0" - resolved "https://registry.yarnpkg.com/mime/-/mime-2.6.0.tgz#a2a682a95cd4d0cb1d6257e28f83da7e35800367" - integrity sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg== - -mimic-fn@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - -minimatch@^10.2.2: - version "10.2.5" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-10.2.5.tgz#bd48687a0be38ed2961399105600f832095861d1" - integrity sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg== - dependencies: - brace-expansion "^5.0.5" - -minimatch@^3.0.4, minimatch@^3.1.1: - version "3.1.5" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.5.tgz#580c88f8d5445f2bd6aa8f3cadefa0de79fbd69e" - integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== - dependencies: - brace-expansion "^1.1.7" - -minimatch@^5.1.0: - version "5.1.9" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.9.tgz#1293ef15db0098b394540e8f9f744f9fda8dee4b" - integrity sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw== - dependencies: - brace-expansion "^2.0.1" - -minimatch@^9.0.4, minimatch@^9.0.5: - version "9.0.9" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.9.tgz#9b0cb9fcb78087f6fd7eababe2511c4d3d60574e" - integrity sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg== - dependencies: - brace-expansion "^2.0.2" - -minimist@^1.2.3, minimist@^1.2.6: - version "1.2.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" - integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== - -"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2, minipass@^7.1.3: - version "7.1.3" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.3.tgz#79389b4eb1bb2d003a9bba87d492f2bd37bdc65b" - integrity sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A== - -mkdirp@^0.5.3: - version "0.5.6" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" - integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== - dependencies: - minimist "^1.2.6" - -mkdirp@latest: - version "3.0.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-3.0.1.tgz#e44e4c5607fb279c168241713cc6e0fea9adcb50" - integrity sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg== - -mocha@^11.7.2: - version "11.7.5" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-11.7.5.tgz#58f5bbfa5e0211ce7e5ee6128107cefc2515a627" - integrity sha512-mTT6RgopEYABzXWFx+GcJ+ZQ32kp4fMf0xvpZIIfSq9Z8lC/++MtcCnQ9t5FP2veYEP95FIYSvW+U9fV4xrlig== - dependencies: - browser-stdout "^1.3.1" - chokidar "^4.0.1" - debug "^4.3.5" - diff "^7.0.0" - escape-string-regexp "^4.0.0" - find-up "^5.0.0" - glob "^10.4.5" - he "^1.2.0" - is-path-inside "^3.0.3" - js-yaml "^4.1.0" - log-symbols "^4.1.0" - minimatch "^9.0.5" - ms "^2.1.3" - picocolors "^1.1.1" - serialize-javascript "^6.0.2" - strip-json-comments "^3.1.1" - supports-color "^8.1.1" - workerpool "^9.2.0" - yargs "^17.7.2" - yargs-parser "^21.1.1" - yargs-unparser "^2.0.0" - -ms@^2.1.3: - version "2.1.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - -mute-stream@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" - integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== - -negotiator@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-1.0.0.tgz#b6c91bb47172d69f93cfd7c357bbb529019b5f6a" - integrity sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg== - -netmask@^2.0.2: - version "2.1.1" - resolved "https://registry.yarnpkg.com/netmask/-/netmask-2.1.1.tgz#80043d265b53aa521b3bd01e8fcdf353f9e1e81e" - integrity sha512-eonl3sLUha+S1GzTPxychyhnUzKyeQkZ7jLjKrBagJgPla13F+uQ71HgpFefyHgqrjEbCPkDArxYsjY8/+gLKA== - -normalize-path@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== - -object-inspect@^1.13.3, object-inspect@^1.13.4: - version "1.13.4" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.4.tgz#8375265e21bc20d0fa582c22e1b13485d6e00213" - integrity sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew== - -on-finished@^2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" - integrity sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg== - dependencies: - ee-first "1.1.1" - -once@^1.3.0, once@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== - dependencies: - wrappy "1" - -onetime@^5.1.0: - version "5.1.2" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" - integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== - dependencies: - mimic-fn "^2.1.0" - -ora@^5.4.1: - version "5.4.1" - resolved "https://registry.yarnpkg.com/ora/-/ora-5.4.1.tgz#1b2678426af4ac4a509008e5e4ac9e9959db9e18" - integrity sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ== - dependencies: - bl "^4.1.0" - chalk "^4.1.0" - cli-cursor "^3.1.0" - cli-spinners "^2.5.0" - is-interactive "^1.0.0" - is-unicode-supported "^0.1.0" - log-symbols "^4.1.0" - strip-ansi "^6.0.0" - wcwidth "^1.0.1" - -p-limit@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" - integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== - dependencies: - yocto-queue "^0.1.0" - -p-locate@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" - integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== - dependencies: - p-limit "^3.0.2" - -pac-proxy-agent@^7.1.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz#9cfaf33ff25da36f6147a20844230ec92c06e5df" - integrity sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA== - dependencies: - "@tootallnate/quickjs-emscripten" "^0.23.0" - agent-base "^7.1.2" - debug "^4.3.4" - get-uri "^6.0.1" - http-proxy-agent "^7.0.0" - https-proxy-agent "^7.0.6" - pac-resolver "^7.0.1" - socks-proxy-agent "^8.0.5" - -pac-resolver@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/pac-resolver/-/pac-resolver-7.0.1.tgz#54675558ea368b64d210fd9c92a640b5f3b8abb6" - integrity sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg== - dependencies: - degenerator "^5.0.0" - netmask "^2.0.2" - -package-json-from-dist@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" - integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== - -parse-node-version@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/parse-node-version/-/parse-node-version-1.0.1.tgz#e2b5dbede00e7fa9bc363607f53327e8b073189b" - integrity sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA== - -parseurl@^1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" - integrity sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ== - -path-exists@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" - integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== - -path-key@^3.1.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" - integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== - -path-parse@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" - integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== - -path-scurry@^1.11.1: - version "1.11.1" - resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2" - integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA== - dependencies: - lru-cache "^10.2.0" - minipass "^5.0.0 || ^6.0.2 || ^7.0.0" - -path-scurry@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-2.0.2.tgz#6be0d0ee02a10d9e0de7a98bae65e182c9061f85" - integrity sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg== - dependencies: - lru-cache "^11.0.0" - minipass "^7.1.2" - -path-to-regexp@^8.0.0: - version "8.4.2" - resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-8.4.2.tgz#795c420c4f7ca45c5b887366f622ee0c9852cccd" - integrity sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA== - -picocolors@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" - integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== - -plist@^3.0.4, plist@^3.0.5: - version "3.1.0" - resolved "https://registry.yarnpkg.com/plist/-/plist-3.1.0.tgz#797a516a93e62f5bde55e0b9cc9c967f860893c9" - integrity sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ== - dependencies: - "@xmldom/xmldom" "^0.8.8" - base64-js "^1.5.1" - xmlbuilder "^15.1.1" - -plugin-error@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-0.1.2.tgz#3b9bb3335ccf00f425e07437e19276967da47ace" - integrity sha512-WzZHcm4+GO34sjFMxQMqZbsz3xiNEgonCskQ9v+IroMmYgk/tas8dG+Hr2D6IbRPybZ12oWpzE/w3cGJ6FJzOw== - dependencies: - ansi-cyan "^0.1.1" - ansi-red "^0.1.1" - arr-diff "^1.0.1" - arr-union "^2.0.1" - extend-shallow "^1.1.2" - -process-nextick-args@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" - integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== - -process@^0.11.10: - version "0.11.10" - resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" - integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== - -proxy-addr@^2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025" - integrity sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg== - dependencies: - forwarded "0.2.0" - ipaddr.js "1.9.1" - -proxy-agent@^6.3.0: - version "6.5.0" - resolved "https://registry.yarnpkg.com/proxy-agent/-/proxy-agent-6.5.0.tgz#9e49acba8e4ee234aacb539f89ed9c23d02f232d" - integrity sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A== - dependencies: - agent-base "^7.1.2" - debug "^4.3.4" - http-proxy-agent "^7.0.1" - https-proxy-agent "^7.0.6" - lru-cache "^7.14.1" - pac-proxy-agent "^7.1.0" - proxy-from-env "^1.1.0" - socks-proxy-agent "^8.0.5" - -proxy-from-env@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" - integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== - -q@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" - integrity sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw== - -qs@^6.11.0, qs@^6.14.0, qs@^6.14.1, qs@^6.7.0: - version "6.15.1" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.15.1.tgz#bdb55aed06bfac257a90c44a446a73fba5575c8f" - integrity sha512-6YHEFRL9mfgcAvql/XhwTvf5jKcOiiupt2FiJxHkiX1z4j7WL8J/jRHYLluORvc1XxB5rV20KoeK00gVJamspg== - dependencies: - side-channel "^1.1.0" - -querystringify@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" - integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== - -randombytes@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" - integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== - dependencies: - safe-buffer "^5.1.0" - -range-parser@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031" - integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg== - -raw-body@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-3.0.2.tgz#3e3ada5ae5568f9095d84376fd3a49b8fb000a51" - integrity sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA== - dependencies: - bytes "~3.1.2" - http-errors "~2.0.1" - iconv-lite "~0.7.0" - unpipe "~1.0.0" - -react-is@^16.7.0: - version "16.13.1" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" - integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== - -readable-stream@^2.0.5: - version "2.3.8" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" - integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -readable-stream@^3.4.0: - version "3.6.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" - integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - -readable-stream@^4.0.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-4.7.0.tgz#cedbd8a1146c13dfff8dab14068028d58c15ac91" - integrity sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg== - dependencies: - abort-controller "^3.0.0" - buffer "^6.0.3" - events "^3.3.0" - process "^0.11.10" - string_decoder "^1.3.0" - -readdir-glob@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/readdir-glob/-/readdir-glob-1.1.3.tgz#c3d831f51f5e7bfa62fa2ffbe4b508c640f09584" - integrity sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA== - dependencies: - minimatch "^5.1.0" - -readdirp@^4.0.1: - version "4.1.2" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-4.1.2.tgz#eb85801435fbf2a7ee58f19e0921b068fc69948d" - integrity sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg== - -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - integrity sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw== - dependencies: - resolve "^1.1.6" - -recursive-fs@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/recursive-fs/-/recursive-fs-2.1.0.tgz#1e20cf7836b292ed81208c4817550a58ad0e15ff" - integrity sha512-oed3YruYsD52Mi16s/07eYblQOLi5dTtxpIJNdfCEJ7S5v8dDgVcycar0pRWf4IBuPMIkoctC8RTqGJzIKMNAQ== - -require-directory@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== - -requires-port@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== - -resolve@^1.1.6, resolve@^1.3.2: - version "1.22.12" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.12.tgz#f5b2a680897c69c238a13cd16b15671f8b73549f" - integrity sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA== - dependencies: - es-errors "^1.3.0" - is-core-module "^2.16.1" - path-parse "^1.0.7" - supports-preserve-symlinks-flag "^1.0.0" - -restore-cursor@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" - integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== - dependencies: - onetime "^5.1.0" - signal-exit "^3.0.2" - -router@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/router/-/router-2.2.0.tgz#019be620b711c87641167cc79b99090f00b146ef" - integrity sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ== - dependencies: - debug "^4.4.0" - depd "^2.0.0" - is-promise "^4.0.0" - parseurl "^1.3.3" - path-to-regexp "^8.0.0" - -run-async@^2.4.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" - integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== - -run-sequence@latest: - version "2.2.1" - resolved "https://registry.yarnpkg.com/run-sequence/-/run-sequence-2.2.1.tgz#1ce643da36fd8c7ea7e1a9329da33fc2b8898495" - integrity sha512-qkzZnQWMZjcKbh3CNly2srtrkaO/2H/SI5f2eliMCapdRD3UhMrwjfOAZJAnZ2H8Ju4aBzFZkBGXUqFs9V0yxw== - dependencies: - chalk "^1.1.3" - fancy-log "^1.3.2" - plugin-error "^0.1.2" - -rxjs@^7.5.5: - version "7.8.2" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.2.tgz#955bc473ed8af11a002a2be52071bf475638607b" - integrity sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA== - dependencies: - tslib "^2.1.0" - -safe-buffer@^5.1.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0: - version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" - integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== - -safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - -"safer-buffer@>= 2.1.2 < 3.0.0": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -semver@^5.3.0: - version "5.7.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" - integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== - -semver@^6.1.1: - version "6.3.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" - integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== - -semver@^7.3.5, semver@^7.3.8: - version "7.7.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.4.tgz#28464e36060e991fa7a11d0279d2d3f3b57a7e8a" - integrity sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA== - -send@^1.1.0, send@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/send/-/send-1.2.1.tgz#9eab743b874f3550f40a26867bf286ad60d3f3ed" - integrity sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ== - dependencies: - debug "^4.4.3" - encodeurl "^2.0.0" - escape-html "^1.0.3" - etag "^1.8.1" - fresh "^2.0.0" - http-errors "^2.0.1" - mime-types "^3.0.2" - ms "^2.1.3" - on-finished "^2.4.1" - range-parser "^1.2.1" - statuses "^2.0.2" - -serialize-javascript@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" - integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== - dependencies: - randombytes "^2.1.0" - -serve-static@^2.2.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-2.2.1.tgz#7f186a4a4e5f5b663ad7a4294ff1bf37cf0e98a9" - integrity sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw== - dependencies: - encodeurl "^2.0.0" - escape-html "^1.0.3" - parseurl "^1.3.3" - send "^1.2.0" - -setprototypeof@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" - integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== - -shebang-command@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" - integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== - dependencies: - shebang-regex "^3.0.0" - -shebang-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" - integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== - -shelljs@^0.8.5: - version "0.8.5" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c" - integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow== - dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" - -shx@^0.3.4: - version "0.3.4" - resolved "https://registry.yarnpkg.com/shx/-/shx-0.3.4.tgz#74289230b4b663979167f94e1935901406e40f02" - integrity sha512-N6A9MLVqjxZYcVn8hLmtneQWIJtp8IKzMP4eMnx+nqkvXoqinUPCbUFLp2UcWTEIUONhlk0ewxr/jaVGlc+J+g== - dependencies: - minimist "^1.2.3" - shelljs "^0.8.5" - -side-channel-list@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/side-channel-list/-/side-channel-list-1.0.1.tgz#c2e0b5a14a540aebee3bbc6c3f8666cc9b509127" - integrity sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w== - dependencies: - es-errors "^1.3.0" - object-inspect "^1.13.4" - -side-channel-map@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/side-channel-map/-/side-channel-map-1.0.1.tgz#d6bb6b37902c6fef5174e5f533fab4c732a26f42" - integrity sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA== - dependencies: - call-bound "^1.0.2" - es-errors "^1.3.0" - get-intrinsic "^1.2.5" - object-inspect "^1.13.3" - -side-channel-weakmap@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz#11dda19d5368e40ce9ec2bdc1fb0ecbc0790ecea" - integrity sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A== - dependencies: - call-bound "^1.0.2" - es-errors "^1.3.0" - get-intrinsic "^1.2.5" - object-inspect "^1.13.3" - side-channel-map "^1.0.1" - -side-channel@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.0.tgz#c3fcff9c4da932784873335ec9765fa94ff66bc9" - integrity sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw== - dependencies: - es-errors "^1.3.0" - object-inspect "^1.13.3" - side-channel-list "^1.0.0" - side-channel-map "^1.0.1" - side-channel-weakmap "^1.0.2" - -signal-exit@^3.0.2: - version "3.0.7" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" - integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== - -signal-exit@^4.0.1: - version "4.1.0" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" - integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== - -simple-plist@^1.1.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/simple-plist/-/simple-plist-1.3.1.tgz#16e1d8f62c6c9b691b8383127663d834112fb017" - integrity sha512-iMSw5i0XseMnrhtIzRb7XpQEXepa9xhWxGUojHBL43SIpQuDQkh3Wpy67ZbDzZVr6EKxvwVChnVpdl8hEVLDiw== - dependencies: - bplist-creator "0.1.0" - bplist-parser "0.3.1" - plist "^3.0.5" - -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - -smart-buffer@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" - integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== - -socks-proxy-agent@^8.0.5: - version "8.0.5" - resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz#b9cdb4e7e998509d7659d689ce7697ac21645bee" - integrity sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw== - dependencies: - agent-base "^7.1.2" - debug "^4.3.4" - socks "^2.8.3" - -socks@^2.8.3: - version "2.8.7" - resolved "https://registry.yarnpkg.com/socks/-/socks-2.8.7.tgz#e2fb1d9a603add75050a2067db8c381a0b5669ea" - integrity sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A== - dependencies: - ip-address "^10.0.1" - smart-buffer "^4.2.0" - -source-map@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== - -statuses@^2.0.1, statuses@^2.0.2, statuses@~2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.2.tgz#8f75eecef765b5e1cfcdc080da59409ed424e382" - integrity sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw== - -stream-buffers@2.2.x: - version "2.2.0" - resolved "https://registry.yarnpkg.com/stream-buffers/-/stream-buffers-2.2.0.tgz#91d5f5130d1cef96dcfa7f726945188741d09ee4" - integrity sha512-uyQK/mx5QjHun80FLJTfaWE7JtwfRMKBLkMne6udYOmvH0CawotVa7TfgYHzAnpphn4+TweIx1QKMnRIbipmUg== - -streamx@^2.12.5, streamx@^2.15.0, streamx@^2.25.0: - version "2.25.0" - resolved "https://registry.yarnpkg.com/streamx/-/streamx-2.25.0.tgz#cc967e99390fda8b918b1eeaf3bc437637c8c7af" - integrity sha512-0nQuG6jf1w+wddNEEXCF4nTg3LtufWINB5eFEN+5TNZW7KWJp6x87+JFL43vaAUPyCfH1wID+mNVyW6OHtFamg== - dependencies: - events-universal "^1.0.0" - fast-fifo "^1.3.2" - text-decoder "^1.1.0" - -"string-width-cjs@npm:string-width@^4.2.0": - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - -string-width@^5.0.1, string-width@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" - integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== - dependencies: - eastasianwidth "^0.2.0" - emoji-regex "^9.2.2" - strip-ansi "^7.0.1" - -string_decoder@^1.1.1, string_decoder@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - integrity sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg== - dependencies: - ansi-regex "^2.0.0" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^7.0.1: - version "7.2.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.2.0.tgz#d22a269522836a627af8d04b5c3fd2c7fa3e32e3" - integrity sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w== - dependencies: - ansi-regex "^6.2.2" - -strip-json-comments@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" - integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== - -superagent@5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/superagent/-/superagent-5.1.0.tgz#9ce4f38bee64d65a56166423b573222fa1b8f041" - integrity sha512-7V6JVx5N+eTL1MMqRBX0v0bG04UjrjAvvZJTF/VDH/SH2GjSLqlrcYepFlpTrXpm37aSY6h3GGVWGxXl/98TKA== - dependencies: - component-emitter "^1.3.0" - cookiejar "^2.1.2" - debug "^4.1.1" - fast-safe-stringify "^2.0.6" - form-data "^2.3.3" - formidable "^1.2.1" - methods "^1.1.2" - mime "^2.4.4" - qs "^6.7.0" - readable-stream "^3.4.0" - semver "^6.1.1" - -superagent@^8.0.0: - version "8.1.2" - resolved "https://registry.yarnpkg.com/superagent/-/superagent-8.1.2.tgz#03cb7da3ec8b32472c9d20f6c2a57c7f3765f30b" - integrity sha512-6WTxW1EB6yCxV5VFOIPQruWGHqc3yI7hEmZK6h+pyk69Lk/Ut7rLUY6W/ONF2MjBuGjvmMiIpsrVJ2vjrHlslA== - dependencies: - component-emitter "^1.3.0" - cookiejar "^2.1.4" - debug "^4.3.4" - fast-safe-stringify "^2.1.1" - form-data "^4.0.0" - formidable "^2.1.2" - methods "^1.1.2" - mime "2.6.0" - qs "^6.11.0" - semver "^7.3.8" - -supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - integrity sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g== - -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - -supports-color@^7.1.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - -supports-color@^8.1.1: - version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== - dependencies: - has-flag "^4.0.0" - -supports-preserve-symlinks-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" - integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== - -tar-stream@^3.0.0: - version "3.1.8" - resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-3.1.8.tgz#a26f5b26c34dfd4936a4f8a9e694a8f5102af13d" - integrity sha512-U6QpVRyCGHva435KoNWy9PRoi2IFYCgtEhq9nmrPPpbRacPs9IH4aJ3gbrFC8dPcXvdSZ4XXfXT5Fshbp2MtlQ== - dependencies: - b4a "^1.6.4" - bare-fs "^4.5.5" - fast-fifo "^1.2.0" - streamx "^2.15.0" - -teex@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/teex/-/teex-1.0.1.tgz#b8fa7245ef8e8effa8078281946c85ab780a0b12" - integrity sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg== - dependencies: - streamx "^2.12.5" - -text-decoder@^1.1.0: - version "1.2.7" - resolved "https://registry.yarnpkg.com/text-decoder/-/text-decoder-1.2.7.tgz#5d073a9a74b9c0a9d28dfadcab96b604af57d8ba" - integrity sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ== - dependencies: - b4a "^1.6.4" - -through@^2.3.6: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== - -time-stamp@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.1.0.tgz#764a5a11af50561921b133f3b44e618687e0f5c3" - integrity sha512-gLCeArryy2yNTRzTGKbZbloctj64jkZ57hj5zdraXue6aFgd6PmvVtEyiUU+hvU0v7q08oVv8r8ev0tRo6bvgw== - -toidentifier@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" - integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== - -tslib@^1.13.0, tslib@^1.8.1: - version "1.14.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" - integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== - -tslib@^2.0.1, tslib@^2.1.0: - version "2.8.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" - integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== - -tslint@^6.1.3: - version "6.1.3" - resolved "https://registry.yarnpkg.com/tslint/-/tslint-6.1.3.tgz#5c23b2eccc32487d5523bd3a470e9aa31789d904" - integrity sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg== - dependencies: - "@babel/code-frame" "^7.0.0" - builtin-modules "^1.1.1" - chalk "^2.3.0" - commander "^2.12.1" - diff "^4.0.1" - glob "^7.1.1" - js-yaml "^3.13.1" - minimatch "^3.0.4" - mkdirp "^0.5.3" - resolve "^1.3.2" - semver "^5.3.0" - tslib "^1.13.0" - tsutils "^2.29.0" - -tsutils@^2.29.0: - version "2.29.0" - resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" - integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA== - dependencies: - tslib "^1.8.1" - -type-fest@^0.21.3: - version "0.21.3" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" - integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== - -type-is@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/type-is/-/type-is-2.0.1.tgz#64f6cf03f92fce4015c2b224793f6bdd4b068c97" - integrity sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw== - dependencies: - content-type "^1.0.5" - media-typer "^1.1.0" - mime-types "^3.0.0" - -typescript@^4.4.3: - version "4.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" - integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== - -undici-types@~7.19.0: - version "7.19.2" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.19.2.tgz#1b67fc26d0f157a0cba3a58a5b5c1e2276b8ba2a" - integrity sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg== - -unpipe@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" - integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== - -url-parse@^1.4.7: - version "1.5.10" - resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" - integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== - dependencies: - querystringify "^2.1.1" - requires-port "^1.0.0" - -util-deprecate@^1.0.1, util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== - -uuid@^7.0.3: - version "7.0.3" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.3.tgz#c5c9f2c8cf25dc0a372c4df1441c41f5bd0c680b" - integrity sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg== - -vary@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" - integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== - -wcwidth@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" - integrity sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg== - dependencies: - defaults "^1.0.3" - -which@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== - dependencies: - isexe "^2.0.0" - -workerpool@^9.2.0: - version "9.3.4" - resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-9.3.4.tgz#f6c92395b2141afd78e2a889e80cb338fe9fca41" - integrity sha512-TmPRQYYSAnnDiEB0P/Ytip7bFGvqnSU6I2BcuSw7Hx+JSg/DsUi5ebYfc8GYaSdpuvOcEs6dXxPurOYpe9QFwg== - -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^6.0.1: - version "6.2.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" - integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - -wrap-ansi@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" - integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== - dependencies: - ansi-styles "^6.1.0" - string-width "^5.0.1" - strip-ansi "^7.0.1" - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== - -xcode@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/xcode/-/xcode-3.0.1.tgz#3efb62aac641ab2c702458f9a0302696146aa53c" - integrity sha512-kCz5k7J7XbJtjABOvkc5lJmkiDh8VhjVCGNiqdKCscmVpdVUpEAyXv1xmCLkQJ5dsHqx3IPO4XW+NTDhU/fatA== - dependencies: - simple-plist "^1.1.0" - uuid "^7.0.3" - -xmlbuilder@^15.1.1: - version "15.1.1" - resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-15.1.1.tgz#9dcdce49eea66d8d10b42cae94a79c3c8d0c2ec5" - integrity sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg== - -y18n@^5.0.5: - version "5.0.8" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" - integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== - -yargs-parser@^21.1.1: - version "21.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" - integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== - -yargs-unparser@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" - integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== - dependencies: - camelcase "^6.0.0" - decamelize "^4.0.0" - flat "^5.0.2" - is-plain-obj "^2.1.0" - -yargs@^17.7.2: - version "17.7.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" - integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== - dependencies: - cliui "^8.0.1" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.3" - y18n "^5.0.5" - yargs-parser "^21.1.1" - -yazl@^2.5.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/yazl/-/yazl-2.5.1.tgz#a3d65d3dd659a5b0937850e8609f22fffa2b5c35" - integrity sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw== - dependencies: - buffer-crc32 "~0.2.3" - -yocto-queue@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" - integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== - -zip-stream@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/zip-stream/-/zip-stream-6.0.1.tgz#e141b930ed60ccaf5d7fa9c8260e0d1748a2bbfb" - integrity sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA== - dependencies: - archiver-utils "^5.0.0" - compress-commons "^6.0.2" - readable-stream "^4.0.0" From 95e1beda22a3e00269b37d902f21a8f6cbb3f793 Mon Sep 17 00:00:00 2001 From: Hebert Date: Mon, 27 Apr 2026 10:44:06 -0300 Subject: [PATCH 3/7] Remove mz_zip_rw.h header file from the minizip-ng project as it is no longer needed in the codebase. --- .github/CODEOWNERS | 1 - ios/CodePush.xcodeproj/project.pbxproj | 239 -- ios/CodePush/SSZipArchive/Info.plist | 26 - ios/CodePush/SSZipArchive/README.md | 1 - ios/CodePush/SSZipArchive/SSZipArchive.h | 178 -- ios/CodePush/SSZipArchive/SSZipArchive.m | 1496 --------- ios/CodePush/SSZipArchive/SSZipCommon.h | 71 - .../Supporting Files/PrivacyInfo.xcprivacy | 23 - .../SSZipArchive/include/ZipArchive.h | 25 - ios/CodePush/SSZipArchive/minizip/LICENSE | 17 - ios/CodePush/SSZipArchive/minizip/mz.h | 273 -- ios/CodePush/SSZipArchive/minizip/mz_compat.c | 1306 -------- ios/CodePush/SSZipArchive/minizip/mz_compat.h | 346 -- ios/CodePush/SSZipArchive/minizip/mz_crypt.c | 187 -- ios/CodePush/SSZipArchive/minizip/mz_crypt.h | 65 - .../SSZipArchive/minizip/mz_crypt_apple.c | 526 ---- ios/CodePush/SSZipArchive/minizip/mz_os.c | 348 --- ios/CodePush/SSZipArchive/minizip/mz_os.h | 176 -- .../SSZipArchive/minizip/mz_os_posix.c | 350 --- ios/CodePush/SSZipArchive/minizip/mz_strm.c | 556 ---- ios/CodePush/SSZipArchive/minizip/mz_strm.h | 132 - .../SSZipArchive/minizip/mz_strm_buf.c | 383 --- .../SSZipArchive/minizip/mz_strm_buf.h | 42 - .../SSZipArchive/minizip/mz_strm_mem.c | 269 -- .../SSZipArchive/minizip/mz_strm_mem.h | 48 - .../SSZipArchive/minizip/mz_strm_os.h | 40 - .../SSZipArchive/minizip/mz_strm_os_posix.c | 203 -- .../SSZipArchive/minizip/mz_strm_pkcrypt.c | 334 -- .../SSZipArchive/minizip/mz_strm_pkcrypt.h | 46 - .../SSZipArchive/minizip/mz_strm_split.c | 429 --- .../SSZipArchive/minizip/mz_strm_split.h | 43 - .../SSZipArchive/minizip/mz_strm_wzaes.c | 360 --- .../SSZipArchive/minizip/mz_strm_wzaes.h | 46 - .../SSZipArchive/minizip/mz_strm_zlib.c | 389 --- .../SSZipArchive/minizip/mz_strm_zlib.h | 43 - ios/CodePush/SSZipArchive/minizip/mz_zip.c | 2782 ----------------- ios/CodePush/SSZipArchive/minizip/mz_zip.h | 262 -- ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c | 1942 ------------ ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h | 285 -- 39 files changed, 14288 deletions(-) delete mode 100644 .github/CODEOWNERS delete mode 100644 ios/CodePush/SSZipArchive/Info.plist delete mode 100644 ios/CodePush/SSZipArchive/README.md delete mode 100644 ios/CodePush/SSZipArchive/SSZipArchive.h delete mode 100644 ios/CodePush/SSZipArchive/SSZipArchive.m delete mode 100644 ios/CodePush/SSZipArchive/SSZipCommon.h delete mode 100644 ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy delete mode 100644 ios/CodePush/SSZipArchive/include/ZipArchive.h delete mode 100644 ios/CodePush/SSZipArchive/minizip/LICENSE delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz.h delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_compat.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_compat.h delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_crypt.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_crypt.h delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_os.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_os.h delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_os_posix.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm.h delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm_os.h delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm_split.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm_split.h delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_zip.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_zip.h delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c delete mode 100644 ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index ba4118098..000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @microsoft/appcenter-fte diff --git a/ios/CodePush.xcodeproj/project.pbxproj b/ios/CodePush.xcodeproj/project.pbxproj index ac799b7c1..68844e5d6 100644 --- a/ios/CodePush.xcodeproj/project.pbxproj +++ b/ios/CodePush.xcodeproj/project.pbxproj @@ -11,72 +11,6 @@ 1B23B9141BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B23B9131BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m */; }; 1B762E901C9A5E9A006EF800 /* CodePushErrorUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B762E8F1C9A5E9A006EF800 /* CodePushErrorUtils.m */; }; 1BCC09A71CC19EB700DDC0DD /* RCTConvert+CodePushUpdateState.m in Sources */ = {isa = PBXBuildFile; fileRef = 1BCC09A61CC19EB700DDC0DD /* RCTConvert+CodePushUpdateState.m */; }; - 3221E4512C8ABE1300268379 /* ZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E42A2C8ABE1300268379 /* ZipArchive.h */; }; - 3221E4522C8ABE1300268379 /* ZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E42A2C8ABE1300268379 /* ZipArchive.h */; }; - 3221E4532C8ABE1300268379 /* mz_strm_os_posix.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E42C2C8ABE1300268379 /* mz_strm_os_posix.c */; }; - 3221E4542C8ABE1300268379 /* mz_strm_os_posix.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E42C2C8ABE1300268379 /* mz_strm_os_posix.c */; }; - 3221E4552C8ABE1300268379 /* mz_strm_pkcrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E42D2C8ABE1300268379 /* mz_strm_pkcrypt.c */; }; - 3221E4562C8ABE1300268379 /* mz_strm_pkcrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E42D2C8ABE1300268379 /* mz_strm_pkcrypt.c */; }; - 3221E4572C8ABE1300268379 /* mz_strm_wzaes.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E42E2C8ABE1300268379 /* mz_strm_wzaes.h */; }; - 3221E4582C8ABE1300268379 /* mz_strm_wzaes.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E42E2C8ABE1300268379 /* mz_strm_wzaes.h */; }; - 3221E4592C8ABE1300268379 /* mz_compat.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E42F2C8ABE1300268379 /* mz_compat.h */; }; - 3221E45A2C8ABE1300268379 /* mz_compat.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E42F2C8ABE1300268379 /* mz_compat.h */; }; - 3221E45B2C8ABE1300268379 /* mz_strm_zlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4302C8ABE1300268379 /* mz_strm_zlib.c */; }; - 3221E45C2C8ABE1300268379 /* mz_strm_zlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4302C8ABE1300268379 /* mz_strm_zlib.c */; }; - 3221E45D2C8ABE1300268379 /* mz_zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4312C8ABE1300268379 /* mz_zip.c */; }; - 3221E45E2C8ABE1300268379 /* mz_zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4312C8ABE1300268379 /* mz_zip.c */; }; - 3221E45F2C8ABE1300268379 /* mz_os.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4322C8ABE1300268379 /* mz_os.h */; }; - 3221E4602C8ABE1300268379 /* mz_os.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4322C8ABE1300268379 /* mz_os.h */; }; - 3221E4612C8ABE1300268379 /* mz_zip_rw.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4342C8ABE1300268379 /* mz_zip_rw.c */; }; - 3221E4622C8ABE1300268379 /* mz_zip_rw.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4342C8ABE1300268379 /* mz_zip_rw.c */; }; - 3221E4632C8ABE1300268379 /* mz_strm_split.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4352C8ABE1300268379 /* mz_strm_split.h */; }; - 3221E4642C8ABE1300268379 /* mz_strm_split.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4352C8ABE1300268379 /* mz_strm_split.h */; }; - 3221E4652C8ABE1300268379 /* mz_strm_buf.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4362C8ABE1300268379 /* mz_strm_buf.h */; }; - 3221E4662C8ABE1300268379 /* mz_strm_buf.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4362C8ABE1300268379 /* mz_strm_buf.h */; }; - 3221E4672C8ABE1300268379 /* mz_crypt_apple.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4372C8ABE1300268379 /* mz_crypt_apple.c */; }; - 3221E4682C8ABE1300268379 /* mz_crypt_apple.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4372C8ABE1300268379 /* mz_crypt_apple.c */; }; - 3221E4692C8ABE1300268379 /* mz_strm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4382C8ABE1300268379 /* mz_strm.h */; }; - 3221E46A2C8ABE1300268379 /* mz_strm.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4382C8ABE1300268379 /* mz_strm.h */; }; - 3221E46B2C8ABE1300268379 /* mz_strm_mem.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4392C8ABE1300268379 /* mz_strm_mem.c */; }; - 3221E46C2C8ABE1300268379 /* mz_strm_mem.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4392C8ABE1300268379 /* mz_strm_mem.c */; }; - 3221E46D2C8ABE1300268379 /* mz_crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E43A2C8ABE1300268379 /* mz_crypt.c */; }; - 3221E46E2C8ABE1300268379 /* mz_crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E43A2C8ABE1300268379 /* mz_crypt.c */; }; - 3221E46F2C8ABE1300268379 /* mz_strm_wzaes.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E43B2C8ABE1300268379 /* mz_strm_wzaes.c */; }; - 3221E4702C8ABE1300268379 /* mz_strm_wzaes.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E43B2C8ABE1300268379 /* mz_strm_wzaes.c */; }; - 3221E4712C8ABE1300268379 /* mz_strm_zlib.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E43C2C8ABE1300268379 /* mz_strm_zlib.h */; }; - 3221E4722C8ABE1300268379 /* mz_strm_zlib.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E43C2C8ABE1300268379 /* mz_strm_zlib.h */; }; - 3221E4732C8ABE1300268379 /* mz_compat.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E43D2C8ABE1300268379 /* mz_compat.c */; }; - 3221E4742C8ABE1300268379 /* mz_compat.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E43D2C8ABE1300268379 /* mz_compat.c */; }; - 3221E4752C8ABE1300268379 /* mz_strm_pkcrypt.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E43E2C8ABE1300268379 /* mz_strm_pkcrypt.h */; }; - 3221E4762C8ABE1300268379 /* mz_strm_pkcrypt.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E43E2C8ABE1300268379 /* mz_strm_pkcrypt.h */; }; - 3221E4772C8ABE1300268379 /* mz_zip_rw.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E43F2C8ABE1300268379 /* mz_zip_rw.h */; }; - 3221E4782C8ABE1300268379 /* mz_zip_rw.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E43F2C8ABE1300268379 /* mz_zip_rw.h */; }; - 3221E4792C8ABE1300268379 /* mz_os.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4402C8ABE1300268379 /* mz_os.c */; }; - 3221E47A2C8ABE1300268379 /* mz_os.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4402C8ABE1300268379 /* mz_os.c */; }; - 3221E47B2C8ABE1400268379 /* mz_zip.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4412C8ABE1300268379 /* mz_zip.h */; }; - 3221E47C2C8ABE1400268379 /* mz_zip.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4412C8ABE1300268379 /* mz_zip.h */; }; - 3221E47D2C8ABE1400268379 /* mz_os_posix.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4422C8ABE1300268379 /* mz_os_posix.c */; }; - 3221E47E2C8ABE1400268379 /* mz_os_posix.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4422C8ABE1300268379 /* mz_os_posix.c */; }; - 3221E47F2C8ABE1400268379 /* mz.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4432C8ABE1300268379 /* mz.h */; }; - 3221E4802C8ABE1400268379 /* mz.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4432C8ABE1300268379 /* mz.h */; }; - 3221E4812C8ABE1400268379 /* mz_strm_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4442C8ABE1300268379 /* mz_strm_buf.c */; }; - 3221E4822C8ABE1400268379 /* mz_strm_buf.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4442C8ABE1300268379 /* mz_strm_buf.c */; }; - 3221E4832C8ABE1400268379 /* mz_strm_split.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4452C8ABE1300268379 /* mz_strm_split.c */; }; - 3221E4842C8ABE1400268379 /* mz_strm_split.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4452C8ABE1300268379 /* mz_strm_split.c */; }; - 3221E4852C8ABE1400268379 /* mz_crypt.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4462C8ABE1300268379 /* mz_crypt.h */; }; - 3221E4862C8ABE1400268379 /* mz_crypt.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4462C8ABE1300268379 /* mz_crypt.h */; }; - 3221E4872C8ABE1400268379 /* mz_strm_mem.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4472C8ABE1300268379 /* mz_strm_mem.h */; }; - 3221E4882C8ABE1400268379 /* mz_strm_mem.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4472C8ABE1300268379 /* mz_strm_mem.h */; }; - 3221E4892C8ABE1400268379 /* mz_strm.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4482C8ABE1300268379 /* mz_strm.c */; }; - 3221E48A2C8ABE1400268379 /* mz_strm.c in Sources */ = {isa = PBXBuildFile; fileRef = 3221E4482C8ABE1300268379 /* mz_strm.c */; }; - 3221E48B2C8ABE1400268379 /* mz_strm_os.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4492C8ABE1300268379 /* mz_strm_os.h */; }; - 3221E48C2C8ABE1400268379 /* mz_strm_os.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E4492C8ABE1300268379 /* mz_strm_os.h */; }; - 3221E48D2C8ABE1400268379 /* SSZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E44A2C8ABE1300268379 /* SSZipArchive.h */; }; - 3221E48E2C8ABE1400268379 /* SSZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E44A2C8ABE1300268379 /* SSZipArchive.h */; }; - 3221E48F2C8ABE1400268379 /* SSZipCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E44E2C8ABE1300268379 /* SSZipCommon.h */; }; - 3221E4902C8ABE1400268379 /* SSZipCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 3221E44E2C8ABE1300268379 /* SSZipCommon.h */; }; - 3221E4912C8ABE1400268379 /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 3221E44F2C8ABE1300268379 /* SSZipArchive.m */; }; - 3221E4922C8ABE1400268379 /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 3221E44F2C8ABE1300268379 /* SSZipArchive.m */; }; 540D20121C7684FE00D6EF41 /* CodePushUpdateUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 540D20111C7684FE00D6EF41 /* CodePushUpdateUtils.m */; }; 5421FE311C58AD5A00986A55 /* CodePushTelemetryManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5421FE301C58AD5A00986A55 /* CodePushTelemetryManager.m */; }; 5498D8F61D21F14100B5EB43 /* CodePushUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 5498D8F51D21F14100B5EB43 /* CodePushUtils.m */; }; @@ -129,43 +63,6 @@ 1B23B9131BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "RCTConvert+CodePushInstallMode.m"; path = "CodePush/RCTConvert+CodePushInstallMode.m"; sourceTree = ""; }; 1B762E8F1C9A5E9A006EF800 /* CodePushErrorUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushErrorUtils.m; path = CodePush/CodePushErrorUtils.m; sourceTree = ""; }; 1BCC09A61CC19EB700DDC0DD /* RCTConvert+CodePushUpdateState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "RCTConvert+CodePushUpdateState.m"; path = "CodePush/RCTConvert+CodePushUpdateState.m"; sourceTree = ""; }; - 3221E42A2C8ABE1300268379 /* ZipArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZipArchive.h; sourceTree = ""; }; - 3221E42C2C8ABE1300268379 /* mz_strm_os_posix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_strm_os_posix.c; sourceTree = ""; }; - 3221E42D2C8ABE1300268379 /* mz_strm_pkcrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_strm_pkcrypt.c; sourceTree = ""; }; - 3221E42E2C8ABE1300268379 /* mz_strm_wzaes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mz_strm_wzaes.h; sourceTree = ""; }; - 3221E42F2C8ABE1300268379 /* mz_compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mz_compat.h; sourceTree = ""; }; - 3221E4302C8ABE1300268379 /* mz_strm_zlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_strm_zlib.c; sourceTree = ""; }; - 3221E4312C8ABE1300268379 /* mz_zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_zip.c; sourceTree = ""; }; - 3221E4322C8ABE1300268379 /* mz_os.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mz_os.h; sourceTree = ""; }; - 3221E4332C8ABE1300268379 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; - 3221E4342C8ABE1300268379 /* mz_zip_rw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_zip_rw.c; sourceTree = ""; }; - 3221E4352C8ABE1300268379 /* mz_strm_split.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mz_strm_split.h; sourceTree = ""; }; - 3221E4362C8ABE1300268379 /* mz_strm_buf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mz_strm_buf.h; sourceTree = ""; }; - 3221E4372C8ABE1300268379 /* mz_crypt_apple.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_crypt_apple.c; sourceTree = ""; }; - 3221E4382C8ABE1300268379 /* mz_strm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mz_strm.h; sourceTree = ""; }; - 3221E4392C8ABE1300268379 /* mz_strm_mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_strm_mem.c; sourceTree = ""; }; - 3221E43A2C8ABE1300268379 /* mz_crypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_crypt.c; sourceTree = ""; }; - 3221E43B2C8ABE1300268379 /* mz_strm_wzaes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_strm_wzaes.c; sourceTree = ""; }; - 3221E43C2C8ABE1300268379 /* mz_strm_zlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mz_strm_zlib.h; sourceTree = ""; }; - 3221E43D2C8ABE1300268379 /* mz_compat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_compat.c; sourceTree = ""; }; - 3221E43E2C8ABE1300268379 /* mz_strm_pkcrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mz_strm_pkcrypt.h; sourceTree = ""; }; - 3221E43F2C8ABE1300268379 /* mz_zip_rw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mz_zip_rw.h; sourceTree = ""; }; - 3221E4402C8ABE1300268379 /* mz_os.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_os.c; sourceTree = ""; }; - 3221E4412C8ABE1300268379 /* mz_zip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mz_zip.h; sourceTree = ""; }; - 3221E4422C8ABE1300268379 /* mz_os_posix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_os_posix.c; sourceTree = ""; }; - 3221E4432C8ABE1300268379 /* mz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mz.h; sourceTree = ""; }; - 3221E4442C8ABE1300268379 /* mz_strm_buf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_strm_buf.c; sourceTree = ""; }; - 3221E4452C8ABE1300268379 /* mz_strm_split.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_strm_split.c; sourceTree = ""; }; - 3221E4462C8ABE1300268379 /* mz_crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mz_crypt.h; sourceTree = ""; }; - 3221E4472C8ABE1300268379 /* mz_strm_mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mz_strm_mem.h; sourceTree = ""; }; - 3221E4482C8ABE1300268379 /* mz_strm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mz_strm.c; sourceTree = ""; }; - 3221E4492C8ABE1300268379 /* mz_strm_os.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mz_strm_os.h; sourceTree = ""; }; - 3221E44A2C8ABE1300268379 /* SSZipArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSZipArchive.h; sourceTree = ""; }; - 3221E44B2C8ABE1300268379 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; - 3221E44D2C8ABE1300268379 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; - 3221E44E2C8ABE1300268379 /* SSZipCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSZipCommon.h; sourceTree = ""; }; - 3221E44F2C8ABE1300268379 /* SSZipArchive.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSZipArchive.m; sourceTree = ""; }; - 3221E4502C8ABE1300268379 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 540D20111C7684FE00D6EF41 /* CodePushUpdateUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushUpdateUtils.m; path = CodePush/CodePushUpdateUtils.m; sourceTree = ""; }; 5421FE301C58AD5A00986A55 /* CodePushTelemetryManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushTelemetryManager.m; path = CodePush/CodePushTelemetryManager.m; sourceTree = ""; }; 5498D8F51D21F14100B5EB43 /* CodePushUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushUtils.m; path = CodePush/CodePushUtils.m; sourceTree = ""; }; @@ -203,75 +100,6 @@ name = Products; sourceTree = ""; }; - 3221E4282C8ABE1300268379 /* SSZipArchive */ = { - isa = PBXGroup; - children = ( - 3221E4292C8ABE1300268379 /* include */, - 3221E42B2C8ABE1300268379 /* minizip */, - 3221E44A2C8ABE1300268379 /* SSZipArchive.h */, - 3221E44B2C8ABE1300268379 /* README.md */, - 3221E44C2C8ABE1300268379 /* Supporting Files */, - 3221E44E2C8ABE1300268379 /* SSZipCommon.h */, - 3221E44F2C8ABE1300268379 /* SSZipArchive.m */, - 3221E4502C8ABE1300268379 /* Info.plist */, - ); - name = SSZipArchive; - path = CodePush/SSZipArchive; - sourceTree = ""; - }; - 3221E4292C8ABE1300268379 /* include */ = { - isa = PBXGroup; - children = ( - 3221E42A2C8ABE1300268379 /* ZipArchive.h */, - ); - path = include; - sourceTree = ""; - }; - 3221E42B2C8ABE1300268379 /* minizip */ = { - isa = PBXGroup; - children = ( - 3221E42C2C8ABE1300268379 /* mz_strm_os_posix.c */, - 3221E42D2C8ABE1300268379 /* mz_strm_pkcrypt.c */, - 3221E42E2C8ABE1300268379 /* mz_strm_wzaes.h */, - 3221E42F2C8ABE1300268379 /* mz_compat.h */, - 3221E4302C8ABE1300268379 /* mz_strm_zlib.c */, - 3221E4312C8ABE1300268379 /* mz_zip.c */, - 3221E4322C8ABE1300268379 /* mz_os.h */, - 3221E4332C8ABE1300268379 /* LICENSE */, - 3221E4342C8ABE1300268379 /* mz_zip_rw.c */, - 3221E4352C8ABE1300268379 /* mz_strm_split.h */, - 3221E4362C8ABE1300268379 /* mz_strm_buf.h */, - 3221E4372C8ABE1300268379 /* mz_crypt_apple.c */, - 3221E4382C8ABE1300268379 /* mz_strm.h */, - 3221E4392C8ABE1300268379 /* mz_strm_mem.c */, - 3221E43A2C8ABE1300268379 /* mz_crypt.c */, - 3221E43B2C8ABE1300268379 /* mz_strm_wzaes.c */, - 3221E43C2C8ABE1300268379 /* mz_strm_zlib.h */, - 3221E43D2C8ABE1300268379 /* mz_compat.c */, - 3221E43E2C8ABE1300268379 /* mz_strm_pkcrypt.h */, - 3221E43F2C8ABE1300268379 /* mz_zip_rw.h */, - 3221E4402C8ABE1300268379 /* mz_os.c */, - 3221E4412C8ABE1300268379 /* mz_zip.h */, - 3221E4422C8ABE1300268379 /* mz_os_posix.c */, - 3221E4432C8ABE1300268379 /* mz.h */, - 3221E4442C8ABE1300268379 /* mz_strm_buf.c */, - 3221E4452C8ABE1300268379 /* mz_strm_split.c */, - 3221E4462C8ABE1300268379 /* mz_crypt.h */, - 3221E4472C8ABE1300268379 /* mz_strm_mem.h */, - 3221E4482C8ABE1300268379 /* mz_strm.c */, - 3221E4492C8ABE1300268379 /* mz_strm_os.h */, - ); - path = minizip; - sourceTree = ""; - }; - 3221E44C2C8ABE1300268379 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 3221E44D2C8ABE1300268379 /* PrivacyInfo.xcprivacy */, - ); - path = "Supporting Files"; - sourceTree = ""; - }; 58B511D21A9E6C8500147676 = { isa = PBXGroup; children = ( @@ -287,7 +115,6 @@ 540D20111C7684FE00D6EF41 /* CodePushUpdateUtils.m */, 1B23B9131BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m */, 1BCC09A61CC19EB700DDC0DD /* RCTConvert+CodePushUpdateState.m */, - 3221E4282C8ABE1300268379 /* SSZipArchive */, 134814211AA4EA7D00B7C361 /* Products */, C31BB4D5018A48D5288C5137 /* Frameworks */, F886647B1F4ADB500036D01B /* libCodePush.a */, @@ -308,24 +135,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 3221E4662C8ABE1300268379 /* mz_strm_buf.h in Headers */, - 3221E48E2C8ABE1400268379 /* SSZipArchive.h in Headers */, - 3221E4762C8ABE1300268379 /* mz_strm_pkcrypt.h in Headers */, - 3221E4642C8ABE1300268379 /* mz_strm_split.h in Headers */, 6463C8471EBA0D290095B8CD /* CodePush.h in Headers */, - 3221E46A2C8ABE1300268379 /* mz_strm.h in Headers */, - 3221E4782C8ABE1300268379 /* mz_zip_rw.h in Headers */, - 3221E4802C8ABE1400268379 /* mz.h in Headers */, - 3221E4602C8ABE1300268379 /* mz_os.h in Headers */, - 3221E4882C8ABE1400268379 /* mz_strm_mem.h in Headers */, - 3221E4862C8ABE1400268379 /* mz_crypt.h in Headers */, - 3221E4902C8ABE1400268379 /* SSZipCommon.h in Headers */, - 3221E4582C8ABE1300268379 /* mz_strm_wzaes.h in Headers */, - 3221E4522C8ABE1300268379 /* ZipArchive.h in Headers */, - 3221E4722C8ABE1300268379 /* mz_strm_zlib.h in Headers */, - 3221E45A2C8ABE1300268379 /* mz_compat.h in Headers */, - 3221E47C2C8ABE1400268379 /* mz_zip.h in Headers */, - 3221E48C2C8ABE1400268379 /* mz_strm_os.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -333,24 +143,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 3221E4712C8ABE1300268379 /* mz_strm_zlib.h in Headers */, - 3221E48B2C8ABE1400268379 /* mz_strm_os.h in Headers */, - 3221E4852C8ABE1400268379 /* mz_crypt.h in Headers */, - 3221E4512C8ABE1300268379 /* ZipArchive.h in Headers */, - 3221E45F2C8ABE1300268379 /* mz_os.h in Headers */, - 3221E4872C8ABE1400268379 /* mz_strm_mem.h in Headers */, - 3221E48D2C8ABE1400268379 /* SSZipArchive.h in Headers */, - 3221E47F2C8ABE1400268379 /* mz.h in Headers */, - 3221E4592C8ABE1300268379 /* mz_compat.h in Headers */, - 3221E48F2C8ABE1400268379 /* SSZipCommon.h in Headers */, - 3221E4692C8ABE1300268379 /* mz_strm.h in Headers */, - 3221E4772C8ABE1300268379 /* mz_zip_rw.h in Headers */, - 3221E4572C8ABE1300268379 /* mz_strm_wzaes.h in Headers */, - 3221E4632C8ABE1300268379 /* mz_strm_split.h in Headers */, - 3221E4752C8ABE1300268379 /* mz_strm_pkcrypt.h in Headers */, 8482F84E1E24C66300F793DB /* CodePush.h in Headers */, - 3221E4652C8ABE1300268379 /* mz_strm_buf.h in Headers */, - 3221E47B2C8ABE1400268379 /* mz_zip.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -435,32 +228,16 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 3221E47D2C8ABE1400268379 /* mz_os_posix.c in Sources */, - 3221E4792C8ABE1300268379 /* mz_os.c in Sources */, 540D20121C7684FE00D6EF41 /* CodePushUpdateUtils.m in Sources */, - 3221E4812C8ABE1400268379 /* mz_strm_buf.c in Sources */, - 3221E46D2C8ABE1300268379 /* mz_crypt.c in Sources */, 1BCC09A71CC19EB700DDC0DD /* RCTConvert+CodePushUpdateState.m in Sources */, - 3221E4892C8ABE1400268379 /* mz_strm.c in Sources */, 1B23B9141BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m in Sources */, 81D51F3A1B6181C2000DA084 /* CodePushConfig.m in Sources */, - 3221E4732C8ABE1300268379 /* mz_compat.c in Sources */, - 3221E45B2C8ABE1300268379 /* mz_strm_zlib.c in Sources */, - 3221E46B2C8ABE1300268379 /* mz_strm_mem.c in Sources */, 54FFEDE01BF550630061DD23 /* CodePushDownloadHandler.m in Sources */, - 3221E4672C8ABE1300268379 /* mz_crypt_apple.c in Sources */, - 3221E4912C8ABE1400268379 /* SSZipArchive.m in Sources */, 5421FE311C58AD5A00986A55 /* CodePushTelemetryManager.m in Sources */, - 3221E46F2C8ABE1300268379 /* mz_strm_wzaes.c in Sources */, 13BE3DEE1AC21097009241FE /* CodePush.m in Sources */, - 3221E45D2C8ABE1300268379 /* mz_zip.c in Sources */, 1B762E901C9A5E9A006EF800 /* CodePushErrorUtils.m in Sources */, - 3221E4832C8ABE1400268379 /* mz_strm_split.c in Sources */, 5498D8F61D21F14100B5EB43 /* CodePushUtils.m in Sources */, - 3221E4612C8ABE1300268379 /* mz_zip_rw.c in Sources */, 810D4E6D1B96935000B397E9 /* CodePushPackage.m in Sources */, - 3221E4552C8ABE1300268379 /* mz_strm_pkcrypt.c in Sources */, - 3221E4532C8ABE1300268379 /* mz_strm_os_posix.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -468,31 +245,15 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 3221E47E2C8ABE1400268379 /* mz_os_posix.c in Sources */, - 3221E46C2C8ABE1300268379 /* mz_strm_mem.c in Sources */, - 3221E4922C8ABE1400268379 /* SSZipArchive.m in Sources */, - 3221E4822C8ABE1400268379 /* mz_strm_buf.c in Sources */, - 3221E45E2C8ABE1300268379 /* mz_zip.c in Sources */, 6463C82D1EBA0CFB0095B8CD /* CodePushUtils.m in Sources */, 6463C82E1EBA0CFB0095B8CD /* CodePush.m in Sources */, 6463C82F1EBA0CFB0095B8CD /* CodePushConfig.m in Sources */, 6463C8301EBA0CFB0095B8CD /* CodePushDownloadHandler.m in Sources */, 6463C8311EBA0CFB0095B8CD /* CodePushErrorUtils.m in Sources */, - 3221E46E2C8ABE1300268379 /* mz_crypt.c in Sources */, 6463C8321EBA0CFB0095B8CD /* CodePushPackage.m in Sources */, 6463C8331EBA0CFB0095B8CD /* CodePushTelemetryManager.m in Sources */, 6463C8341EBA0CFB0095B8CD /* CodePushUpdateUtils.m in Sources */, - 3221E45C2C8ABE1300268379 /* mz_strm_zlib.c in Sources */, - 3221E4682C8ABE1300268379 /* mz_crypt_apple.c in Sources */, - 3221E4842C8ABE1400268379 /* mz_strm_split.c in Sources */, - 3221E48A2C8ABE1400268379 /* mz_strm.c in Sources */, 6463C8351EBA0CFB0095B8CD /* RCTConvert+CodePushInstallMode.m in Sources */, - 3221E4742C8ABE1300268379 /* mz_compat.c in Sources */, - 3221E4542C8ABE1300268379 /* mz_strm_os_posix.c in Sources */, - 3221E4702C8ABE1300268379 /* mz_strm_wzaes.c in Sources */, - 3221E4562C8ABE1300268379 /* mz_strm_pkcrypt.c in Sources */, - 3221E47A2C8ABE1300268379 /* mz_os.c in Sources */, - 3221E4622C8ABE1300268379 /* mz_zip_rw.c in Sources */, 6463C8361EBA0CFB0095B8CD /* RCTConvert+CodePushUpdateState.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/ios/CodePush/SSZipArchive/Info.plist b/ios/CodePush/SSZipArchive/Info.plist deleted file mode 100644 index d3de8eefb..000000000 --- a/ios/CodePush/SSZipArchive/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/ios/CodePush/SSZipArchive/README.md b/ios/CodePush/SSZipArchive/README.md deleted file mode 100644 index cdab69e58..000000000 --- a/ios/CodePush/SSZipArchive/README.md +++ /dev/null @@ -1 +0,0 @@ -The source code in this folder is taken from [https://github.com/ZipArchive/ZipArchive/tree/2.5.5/SSZipArchive](https://github.com/ZipArchive/ZipArchive/tree/2.5.5/SSZipArchive) which is [MIT licensed](https://github.com/ZipArchive/ZipArchive/blob/2.5.5/LICENSE.txt). \ No newline at end of file diff --git a/ios/CodePush/SSZipArchive/SSZipArchive.h b/ios/CodePush/SSZipArchive/SSZipArchive.h deleted file mode 100644 index 778746445..000000000 --- a/ios/CodePush/SSZipArchive/SSZipArchive.h +++ /dev/null @@ -1,178 +0,0 @@ -// -// SSZipArchive.h -// SSZipArchive -// -// Created by Sam Soffes on 7/21/10. -// - -#ifndef _SSZIPARCHIVE_H -#define _SSZIPARCHIVE_H - -#import - -#import "SSZipCommon.h" - -NS_ASSUME_NONNULL_BEGIN - -extern NSString *const SSZipArchiveErrorDomain; -typedef NS_ENUM(NSInteger, SSZipArchiveErrorCode) { - SSZipArchiveErrorCodeFailedOpenZipFile = -1, - SSZipArchiveErrorCodeFailedOpenFileInZip = -2, - SSZipArchiveErrorCodeFileInfoNotLoadable = -3, - SSZipArchiveErrorCodeFileContentNotReadable = -4, - SSZipArchiveErrorCodeFailedToWriteFile = -5, - SSZipArchiveErrorCodeInvalidArguments = -6, - SSZipArchiveErrorCodeSymlinkEscapesTargetDirectory = -7, -}; - -@protocol SSZipArchiveDelegate; - -@interface SSZipArchive : NSObject - -// Password check -+ (BOOL)isFilePasswordProtectedAtPath:(NSString *)path; -+ (BOOL)isPasswordValidForArchiveAtPath:(NSString *)path password:(NSString *)pw error:(NSError * _Nullable * _Nullable)error NS_SWIFT_NOTHROW; - -// Total payload size -+ (NSNumber *)payloadSizeForArchiveAtPath:(NSString *)path error:(NSError **)error; - -// Unzip -+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination; -+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(nullable id)delegate; - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - overwrite:(BOOL)overwrite - password:(nullable NSString *)password - error:(NSError * *)error; - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - overwrite:(BOOL)overwrite - password:(nullable NSString *)password - error:(NSError * *)error - delegate:(nullable id)delegate NS_REFINED_FOR_SWIFT; - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - preserveAttributes:(BOOL)preserveAttributes - overwrite:(BOOL)overwrite - password:(nullable NSString *)password - error:(NSError * *)error - delegate:(nullable id)delegate; - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler - completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler; - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - overwrite:(BOOL)overwrite - password:(nullable NSString *)password - progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler - completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler; - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - preserveAttributes:(BOOL)preserveAttributes - overwrite:(BOOL)overwrite - nestedZipLevel:(NSInteger)nestedZipLevel - password:(nullable NSString *)password - error:(NSError **)error - delegate:(nullable id)delegate - progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler - completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler; - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - preserveAttributes:(BOOL)preserveAttributes - overwrite:(BOOL)overwrite - symlinksValidWithin:(nullable NSString *)symlinksValidWithin - nestedZipLevel:(NSInteger)nestedZipLevel - password:(nullable NSString *)password - error:(NSError **)error - delegate:(nullable id)delegate - progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler - completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler; - -// Zip -// default compression level is Z_DEFAULT_COMPRESSION (from "zlib.h") -// keepParentDirectory: if YES, then unzipping will give `directoryName/fileName`. If NO, then unzipping will just give `fileName`. Default is NO. - -// without password -+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths; -+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath; - -+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory; - -// with optional password, default encryption is AES -// don't use AES if you need compatibility with native macOS unzip and Archive Utility -+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths withPassword:(nullable NSString *)password; -+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths withPassword:(nullable NSString *)password progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler; -+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath withPassword:(nullable NSString *)password; -+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(nullable NSString *)password; -+ (BOOL)createZipFileAtPath:(NSString *)path - withContentsOfDirectory:(NSString *)directoryPath - keepParentDirectory:(BOOL)keepParentDirectory - withPassword:(nullable NSString *)password - andProgressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler; -+ (BOOL)createZipFileAtPath:(NSString *)path - withContentsOfDirectory:(NSString *)directoryPath - keepParentDirectory:(BOOL)keepParentDirectory - compressionLevel:(int)compressionLevel - password:(nullable NSString *)password - AES:(BOOL)aes - progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler; -//suport symlink compress --file -+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths withPassword:(nullable NSString *)password keepSymlinks:(BOOL)keeplinks; -//suport symlink compress --directory -+ (BOOL)createZipFileAtPath:(NSString *)path - withContentsOfDirectory:(NSString *)directoryPath - keepParentDirectory:(BOOL)keepParentDirectory - compressionLevel:(int)compressionLevel - password:(nullable NSString *)password - AES:(BOOL)aes - progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler - keepSymlinks:(BOOL)keeplinks; - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithPath:(NSString *)path NS_DESIGNATED_INITIALIZER; -- (BOOL)open; -- (BOOL)openForAppending; - -/// write empty folder -- (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName withPassword:(nullable NSString *)password; -/// write file -- (BOOL)writeFile:(NSString *)path withPassword:(nullable NSString *)password; -- (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName withPassword:(nullable NSString *)password; -- (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes; -///write symlink files -- (BOOL)writeSymlinkFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes; -/// write data -- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename withPassword:(nullable NSString *)password; -- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes; - -- (BOOL)close; - -@end - -@protocol SSZipArchiveDelegate - -@optional - -- (void)zipArchiveWillUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo; -- (void)zipArchiveDidUnzipArchiveAtPath:(NSString *)path zipInfo:(unz_global_info)zipInfo unzippedPath:(NSString *)unzippedPath; - -- (BOOL)zipArchiveShouldUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo; -- (void)zipArchiveWillUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo; -- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath fileInfo:(unz_file_info)fileInfo; -- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath unzippedFilePath:(NSString *)unzippedFilePath; - -- (void)zipArchiveProgressEvent:(unsigned long long)loaded total:(unsigned long long)total; - -@end - -NS_ASSUME_NONNULL_END - -#endif /* _SSZIPARCHIVE_H */ diff --git a/ios/CodePush/SSZipArchive/SSZipArchive.m b/ios/CodePush/SSZipArchive/SSZipArchive.m deleted file mode 100644 index 584fc221f..000000000 --- a/ios/CodePush/SSZipArchive/SSZipArchive.m +++ /dev/null @@ -1,1496 +0,0 @@ -// -// SSZipArchive.m -// SSZipArchive -// -// Created by Sam Soffes on 7/21/10. -// - -#import "SSZipArchive.h" -#include "minizip/mz_compat.h" -#include "minizip/mz_zip.h" -#include "minizip/mz_os.h" -#include -#include - -NSString *const SSZipArchiveErrorDomain = @"SSZipArchiveErrorDomain"; - -#define CHUNK 16384 - -int _zipOpenEntry(zipFile entry, NSString *name, const zip_fileinfo *zipfi, int level, NSString *password, BOOL aes); -BOOL _fileIsSymbolicLink(const unz_file_info *fileInfo); - -#ifndef API_AVAILABLE -// Xcode 7- compatibility -#define API_AVAILABLE(...) -#endif - -@interface NSData(SSZipArchive) -- (NSString *)_base64RFC4648 API_AVAILABLE(macos(10.9), ios(7.0), watchos(2.0), tvos(9.0)); -- (NSString *)_hexString; -@end - -@interface NSString (SSZipArchive) -- (NSString *)_sanitizedPath; -- (BOOL)_escapesTargetDirectory:(NSString *)targetDirectory; -@end - -@interface SSZipArchive () -- (instancetype)init NS_DESIGNATED_INITIALIZER; -@end - -@implementation SSZipArchive -{ - /// path for zip file - NSString *_path; - zipFile _zip; -} - -#pragma mark - Password check - -+ (BOOL)isFilePasswordProtectedAtPath:(NSString *)path { - // Begin opening - zipFile zip = unzOpen(path.fileSystemRepresentation); - if (zip == NULL) { - return NO; - } - - BOOL passwordProtected = NO; - int ret = unzGoToFirstFile(zip); - if (ret == UNZ_OK) { - do { - ret = unzOpenCurrentFile(zip); - if (ret != UNZ_OK) { - // attempting with an arbitrary password to workaround `unzOpenCurrentFile` limitation on AES encrypted files - ret = unzOpenCurrentFilePassword(zip, ""); - unzCloseCurrentFile(zip); - if (ret == UNZ_OK || ret == MZ_PASSWORD_ERROR) { - passwordProtected = YES; - } - break; - } - unz_file_info fileInfo = {}; - ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0); - unzCloseCurrentFile(zip); - if (ret != UNZ_OK) { - break; - } else if ((fileInfo.flag & MZ_ZIP_FLAG_ENCRYPTED) == 1) { - passwordProtected = YES; - break; - } - - ret = unzGoToNextFile(zip); - } while (ret == UNZ_OK); - } - - unzClose(zip); - return passwordProtected; -} - -+ (BOOL)isPasswordValidForArchiveAtPath:(NSString *)path password:(NSString *)pw error:(NSError **)error { - if (error) { - *error = nil; - } - - zipFile zip = unzOpen(path.fileSystemRepresentation); - if (zip == NULL) { - if (error) { - *error = [NSError errorWithDomain:SSZipArchiveErrorDomain - code:SSZipArchiveErrorCodeFailedOpenZipFile - userInfo:@{NSLocalizedDescriptionKey: @"failed to open zip file"}]; - } - return NO; - } - - // Initialize passwordValid to YES (No password required) - BOOL passwordValid = YES; - int ret = unzGoToFirstFile(zip); - if (ret == UNZ_OK) { - do { - if (pw.length == 0) { - ret = unzOpenCurrentFile(zip); - } else { - ret = unzOpenCurrentFilePassword(zip, [pw cStringUsingEncoding:NSUTF8StringEncoding]); - } - if (ret != UNZ_OK) { - if (ret != MZ_PASSWORD_ERROR) { - if (error) { - *error = [NSError errorWithDomain:SSZipArchiveErrorDomain - code:SSZipArchiveErrorCodeFailedOpenFileInZip - userInfo:@{NSLocalizedDescriptionKey: @"failed to open file in zip archive"}]; - } - } - passwordValid = NO; - break; - } - unz_file_info fileInfo = {}; - ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0); - if (ret != UNZ_OK) { - if (error) { - *error = [NSError errorWithDomain:SSZipArchiveErrorDomain - code:SSZipArchiveErrorCodeFileInfoNotLoadable - userInfo:@{NSLocalizedDescriptionKey: @"failed to retrieve info for file"}]; - } - passwordValid = NO; - break; - } else if ((fileInfo.flag & 1) == 1) { - unsigned char buffer[10] = {0}; - int readBytes = unzReadCurrentFile(zip, buffer, (unsigned)MIN(10UL,fileInfo.uncompressed_size)); - if (readBytes < 0) { - // Let's assume error Z_DATA_ERROR is caused by an invalid password - // Let's assume other errors are caused by Content Not Readable - if (readBytes != Z_DATA_ERROR) { - if (error) { - *error = [NSError errorWithDomain:SSZipArchiveErrorDomain - code:SSZipArchiveErrorCodeFileContentNotReadable - userInfo:@{NSLocalizedDescriptionKey: @"failed to read contents of file entry"}]; - } - } - passwordValid = NO; - break; - } - passwordValid = YES; - break; - } - - unzCloseCurrentFile(zip); - ret = unzGoToNextFile(zip); - } while (ret == UNZ_OK); - } - - unzClose(zip); - return passwordValid; -} - -+ (NSNumber *)payloadSizeForArchiveAtPath:(NSString *)path error:(NSError **)error { - if (error) { - *error = nil; - } - - zipFile zip = unzOpen(path.fileSystemRepresentation); - if (zip == NULL) { - if (error) { - *error = [NSError errorWithDomain:SSZipArchiveErrorDomain - code:SSZipArchiveErrorCodeFailedOpenZipFile - userInfo:@{NSLocalizedDescriptionKey: @"failed to open zip file"}]; - } - return @0; - } - - unsigned long long totalSize = 0; - int ret = unzGoToFirstFile(zip); - if (ret == UNZ_OK) { - do { - ret = unzOpenCurrentFile(zip); - if (ret != UNZ_OK) { - if (error) { - *error = [NSError errorWithDomain:SSZipArchiveErrorDomain - code:SSZipArchiveErrorCodeFailedOpenFileInZip - userInfo:@{NSLocalizedDescriptionKey: @"failed to open file in zip archive"}]; - } - break; - } - unz_file_info fileInfo = {}; - ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0); - if (ret != UNZ_OK) { - if (error) { - *error = [NSError errorWithDomain:SSZipArchiveErrorDomain - code:SSZipArchiveErrorCodeFileInfoNotLoadable - userInfo:@{NSLocalizedDescriptionKey: @"failed to retrieve info for file"}]; - } - break; - } - - totalSize += fileInfo.uncompressed_size; - - unzCloseCurrentFile(zip); - ret = unzGoToNextFile(zip); - } while (ret == UNZ_OK); - } - - unzClose(zip); - - return [NSNumber numberWithUnsignedLongLong:totalSize]; -} - -#pragma mark - Unzipping - -+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination -{ - return [self unzipFileAtPath:path toDestination:destination delegate:nil]; -} - -+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(nullable NSString *)password error:(NSError **)error -{ - return [self unzipFileAtPath:path toDestination:destination preserveAttributes:YES overwrite:overwrite password:password error:error delegate:nil progressHandler:nil completionHandler:nil]; -} - -+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(nullable id)delegate -{ - return [self unzipFileAtPath:path toDestination:destination preserveAttributes:YES overwrite:YES password:nil error:nil delegate:delegate progressHandler:nil completionHandler:nil]; -} - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - overwrite:(BOOL)overwrite - password:(nullable NSString *)password - error:(NSError **)error - delegate:(nullable id)delegate -{ - return [self unzipFileAtPath:path toDestination:destination preserveAttributes:YES overwrite:overwrite password:password error:error delegate:delegate progressHandler:nil completionHandler:nil]; -} - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - overwrite:(BOOL)overwrite - password:(NSString *)password - progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler - completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler -{ - return [self unzipFileAtPath:path toDestination:destination preserveAttributes:YES overwrite:overwrite password:password error:nil delegate:nil progressHandler:progressHandler completionHandler:completionHandler]; -} - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler - completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler -{ - return [self unzipFileAtPath:path toDestination:destination preserveAttributes:YES overwrite:YES password:nil error:nil delegate:nil progressHandler:progressHandler completionHandler:completionHandler]; -} - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - preserveAttributes:(BOOL)preserveAttributes - overwrite:(BOOL)overwrite - password:(nullable NSString *)password - error:(NSError * *)error - delegate:(nullable id)delegate -{ - return [self unzipFileAtPath:path toDestination:destination preserveAttributes:preserveAttributes overwrite:overwrite password:password error:error delegate:delegate progressHandler:nil completionHandler:nil]; -} - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - preserveAttributes:(BOOL)preserveAttributes - overwrite:(BOOL)overwrite - password:(nullable NSString *)password - error:(NSError **)error - delegate:(nullable id)delegate - progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler - completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler -{ - return [self unzipFileAtPath:path toDestination:destination preserveAttributes:preserveAttributes overwrite:overwrite nestedZipLevel:0 password:password error:error delegate:delegate progressHandler:progressHandler completionHandler:completionHandler]; -} - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - preserveAttributes:(BOOL)preserveAttributes - overwrite:(BOOL)overwrite - nestedZipLevel:(NSInteger)nestedZipLevel - password:(nullable NSString *)password - error:(NSError **)error - delegate:(nullable id)delegate - progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler - completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler -{ - return [self unzipFileAtPath:path - toDestination:destination - preserveAttributes:preserveAttributes - overwrite:overwrite - symlinksValidWithin:destination - nestedZipLevel:nestedZipLevel - password:password - error:error - delegate:delegate - progressHandler:progressHandler - completionHandler:completionHandler]; -} - - -+ (BOOL)unzipFileAtPath:(NSString *)path - toDestination:(NSString *)destination - preserveAttributes:(BOOL)preserveAttributes - overwrite:(BOOL)overwrite - symlinksValidWithin:(nullable NSString *)symlinksValidWithin - nestedZipLevel:(NSInteger)nestedZipLevel - password:(nullable NSString *)password - error:(NSError **)error - delegate:(nullable id)delegate - progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler - completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler -{ - // Guard against empty strings - if (path.length == 0 || destination.length == 0) - { - NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"received invalid argument(s)"}; - NSError *err = [NSError errorWithDomain:SSZipArchiveErrorDomain code:SSZipArchiveErrorCodeInvalidArguments userInfo:userInfo]; - if (error) - { - *error = err; - } - if (completionHandler) - { - completionHandler(nil, NO, err); - } - return NO; - } - - // Begin opening - zipFile zip = unzOpen(path.fileSystemRepresentation); - if (zip == NULL) - { - NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"failed to open zip file"}; - NSError *err = [NSError errorWithDomain:SSZipArchiveErrorDomain code:SSZipArchiveErrorCodeFailedOpenZipFile userInfo:userInfo]; - if (error) - { - *error = err; - } - if (completionHandler) - { - completionHandler(nil, NO, err); - } - return NO; - } - - NSDictionary * fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil]; - unsigned long long fileSize = [[fileAttributes objectForKey:NSFileSize] unsignedLongLongValue]; - unsigned long long currentPosition = 0; - - unz_global_info globalInfo = {}; - unzGetGlobalInfo(zip, &globalInfo); - - // Begin unzipping - int ret = 0; - ret = unzGoToFirstFile(zip); - if (ret != UNZ_OK && ret != MZ_END_OF_LIST) - { - NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"failed to open first file in zip file"}; - NSError *err = [NSError errorWithDomain:SSZipArchiveErrorDomain code:SSZipArchiveErrorCodeFailedOpenFileInZip userInfo:userInfo]; - if (error) - { - *error = err; - } - if (completionHandler) - { - completionHandler(nil, NO, err); - } - unzClose(zip); - return NO; - } - - BOOL success = YES; - BOOL canceled = NO; - int crc_ret = 0; - unsigned char buffer[4096] = {0}; - NSFileManager *fileManager = [NSFileManager defaultManager]; - NSMutableArray *directoriesModificationDates = [[NSMutableArray alloc] init]; - - // Message delegate - if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipArchiveAtPath:zipInfo:)]) { - [delegate zipArchiveWillUnzipArchiveAtPath:path zipInfo:globalInfo]; - } - if ([delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) { - [delegate zipArchiveProgressEvent:currentPosition total:fileSize]; - } - - NSInteger currentFileNumber = -1; - NSError *unzippingError; - do { - currentFileNumber++; - if (ret == MZ_END_OF_LIST) { - break; - } - @autoreleasepool { - if (password.length == 0) { - ret = unzOpenCurrentFile(zip); - } else { - ret = unzOpenCurrentFilePassword(zip, [password cStringUsingEncoding:NSUTF8StringEncoding]); - } - - if (ret != UNZ_OK) { - unzippingError = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:SSZipArchiveErrorCodeFailedOpenFileInZip userInfo:@{NSLocalizedDescriptionKey: @"failed to open file in zip file"}]; - success = NO; - break; - } - - // Reading data and write to file - unz_file_info fileInfo; - memset(&fileInfo, 0, sizeof(unz_file_info)); - - ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0); - if (ret != UNZ_OK) { - unzippingError = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:SSZipArchiveErrorCodeFileInfoNotLoadable userInfo:@{NSLocalizedDescriptionKey: @"failed to retrieve info for file"}]; - success = NO; - unzCloseCurrentFile(zip); - break; - } - - currentPosition += fileInfo.compressed_size; - - // Message delegate - if ([delegate respondsToSelector:@selector(zipArchiveShouldUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) { - if (![delegate zipArchiveShouldUnzipFileAtIndex:currentFileNumber - totalFiles:(NSInteger)globalInfo.number_entry - archivePath:path - fileInfo:fileInfo]) { - success = NO; - canceled = YES; - break; - } - } - if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) { - [delegate zipArchiveWillUnzipFileAtIndex:currentFileNumber totalFiles:(NSInteger)globalInfo.number_entry - archivePath:path fileInfo:fileInfo]; - } - if ([delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) { - [delegate zipArchiveProgressEvent:(NSInteger)currentPosition total:(NSInteger)fileSize]; - } - - char *filename = (char *)malloc(fileInfo.size_filename + 1); - if (filename == NULL) - { - success = NO; - break; - } - - unzGetCurrentFileInfo(zip, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0); - filename[fileInfo.size_filename] = '\0'; - - BOOL fileIsSymbolicLink = _fileIsSymbolicLink(&fileInfo); - - NSString * strPath = [SSZipArchive _filenameStringWithCString:filename - version_made_by:fileInfo.version - general_purpose_flag:fileInfo.flag - size:fileInfo.size_filename]; - if ([strPath hasPrefix:@"__MACOSX/"]) { - // ignoring resource forks: https://superuser.com/questions/104500/what-is-macosx-folder - unzCloseCurrentFile(zip); - ret = unzGoToNextFile(zip); - free(filename); - continue; - } - - // Check if it contains directory - BOOL isDirectory = NO; - if (filename[fileInfo.size_filename-1] == '/' || filename[fileInfo.size_filename-1] == '\\') { - isDirectory = YES; - } - free(filename); - - // Sanitize paths in the file name. - strPath = [strPath _sanitizedPath]; - if (!strPath.length) { - // if filename data is unsalvageable, we default to currentFileNumber - strPath = @(currentFileNumber).stringValue; - } - - NSString *fullPath = [destination stringByAppendingPathComponent:strPath]; - NSError *err = nil; - NSDictionary *directoryAttr; - if (preserveAttributes) { - NSDate *modDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.mz_dos_date]; - directoryAttr = @{NSFileCreationDate: modDate, NSFileModificationDate: modDate}; - [directoriesModificationDates addObject: @{@"path": fullPath, @"modDate": modDate}]; - } - if (isDirectory) { - [fileManager createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:directoryAttr error:&err]; - } else { - [fileManager createDirectoryAtPath:fullPath.stringByDeletingLastPathComponent withIntermediateDirectories:YES attributes:directoryAttr error:&err]; - } - if (err != nil) { - if ([err.domain isEqualToString:NSCocoaErrorDomain] && - err.code == 640) { - unzippingError = err; - unzCloseCurrentFile(zip); - success = NO; - break; - } - NSLog(@"[SSZipArchive] Error: %@", err.localizedDescription); - } - - if ([fileManager fileExistsAtPath:fullPath] && !isDirectory && !overwrite) { - //FIXME: couldBe CRC Check? - unzCloseCurrentFile(zip); - ret = unzGoToNextFile(zip); - continue; - } - - if (isDirectory && !fileIsSymbolicLink) { - // nothing to read/write for a directory - } else if (!fileIsSymbolicLink) { - // ensure we are not creating stale file entries - int readBytes = unzReadCurrentFile(zip, buffer, 4096); - if (readBytes >= 0) { - FILE *fp = fopen(fullPath.fileSystemRepresentation, "wb"); - while (fp) { - if (readBytes > 0) { - if (0 == fwrite(buffer, readBytes, 1, fp)) { - if (ferror(fp)) { - NSString *message = [NSString stringWithFormat:@"Failed to write file (check your free space)"]; - NSLog(@"[SSZipArchive] %@", message); - success = NO; - unzippingError = [NSError errorWithDomain:@"SSZipArchiveErrorDomain" code:SSZipArchiveErrorCodeFailedToWriteFile userInfo:@{NSLocalizedDescriptionKey: message}]; - break; - } - } - } else { - break; - } - readBytes = unzReadCurrentFile(zip, buffer, 4096); - if (readBytes < 0) { - // Let's assume error Z_DATA_ERROR is caused by an invalid password - // Let's assume other errors are caused by Content Not Readable - success = NO; - } - } - - if (fp) { - fclose(fp); - - if (nestedZipLevel - && [fullPath.pathExtension.lowercaseString isEqualToString:@"zip"] - && [self unzipFileAtPath:fullPath - toDestination:fullPath.stringByDeletingLastPathComponent - preserveAttributes:preserveAttributes - overwrite:overwrite - symlinksValidWithin:symlinksValidWithin - nestedZipLevel:nestedZipLevel - 1 - password:password - error:nil - delegate:nil - progressHandler:nil - completionHandler:nil]) { - [directoriesModificationDates removeLastObject]; - [[NSFileManager defaultManager] removeItemAtPath:fullPath error:nil]; - } else if (preserveAttributes) { - - // Set the original datetime property - if (fileInfo.mz_dos_date != 0) { - NSDate *orgDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.mz_dos_date]; - NSDictionary *attr = @{NSFileModificationDate: orgDate}; - - if (attr) { - if (![fileManager setAttributes:attr ofItemAtPath:fullPath error:nil]) { - // Can't set attributes - NSLog(@"[SSZipArchive] Failed to set attributes - whilst setting modification date"); - } - } - } - - // Set the original permissions on the file (+read/write to solve #293) - uLong permissions = fileInfo.external_fa >> 16 | 0b110000000; - if (permissions != 0) { - // Store it into a NSNumber - NSNumber *permissionsValue = @(permissions); - - // Retrieve any existing attributes - NSMutableDictionary *attrs = [[NSMutableDictionary alloc] initWithDictionary:[fileManager attributesOfItemAtPath:fullPath error:nil]]; - - // Set the value in the attributes dict - [attrs setObject:permissionsValue forKey:NSFilePosixPermissions]; - - // Update attributes - if (![fileManager setAttributes:attrs ofItemAtPath:fullPath error:nil]) { - // Unable to set the permissions attribute - NSLog(@"[SSZipArchive] Failed to set attributes - whilst setting permissions"); - } - } - } - } - else - { - // if we couldn't open file descriptor we can validate global errno to see the reason - int errnoSave = errno; - BOOL isSeriousError = NO; - switch (errnoSave) { - case EISDIR: - // Is a directory - // assumed case - break; - - case ENOSPC: - case EMFILE: - // No space left on device - // or - // Too many open files - isSeriousError = YES; - break; - - default: - // ignore case - // Just log the error - { - NSError *errorObject = [NSError errorWithDomain:NSPOSIXErrorDomain - code:errnoSave - userInfo:nil]; - NSLog(@"[SSZipArchive] Failed to open file on unzipping.(%@)", errorObject); - } - break; - } - - if (isSeriousError) { - // serious case - unzippingError = [NSError errorWithDomain:NSPOSIXErrorDomain - code:errnoSave - userInfo:nil]; - unzCloseCurrentFile(zip); - // Log the error - NSLog(@"[SSZipArchive] Failed to open file on unzipping.(%@)", unzippingError); - - // Break unzipping - success = NO; - break; - } - } - } else { - // Let's assume error Z_DATA_ERROR is caused by an invalid password - // Let's assume other errors are caused by Content Not Readable - success = NO; - break; - } - } - else - { - // Assemble the path for the symbolic link - NSMutableString *destinationPath = [NSMutableString string]; - int bytesRead = 0; - while ((bytesRead = unzReadCurrentFile(zip, buffer, 4096)) > 0) - { - buffer[bytesRead] = 0; - [destinationPath appendString:@((const char *)buffer)]; - } - if (bytesRead < 0) { - // Let's assume error Z_DATA_ERROR is caused by an invalid password - // Let's assume other errors are caused by Content Not Readable - success = NO; - break; - } - - // compose symlink full path - NSString *symlinkFullDestinationPath = destinationPath; - if (![symlinkFullDestinationPath isAbsolutePath]) { - symlinkFullDestinationPath = [[fullPath stringByDeletingLastPathComponent] stringByAppendingPathComponent:destinationPath]; - } - - if (symlinksValidWithin != nil && [symlinkFullDestinationPath _escapesTargetDirectory: symlinksValidWithin]) { - NSString *message = [NSString stringWithFormat:@"Symlink escapes target directory \"~%@ -> %@\"", strPath, destinationPath]; - NSLog(@"[SSZipArchive] %@", message); - success = NO; - unzippingError = [NSError errorWithDomain:SSZipArchiveErrorDomain code:SSZipArchiveErrorCodeSymlinkEscapesTargetDirectory userInfo:@{NSLocalizedDescriptionKey: message}]; - } else { - // Check if the symlink exists and delete it if we're overwriting - if (overwrite) - { - if ([fileManager fileExistsAtPath:fullPath]) - { - NSError *localError = nil; - BOOL removeSuccess = [fileManager removeItemAtPath:fullPath error:&localError]; - if (!removeSuccess) - { - NSString *message = [NSString stringWithFormat:@"Failed to delete existing symbolic link at \"%@\"", localError.localizedDescription]; - NSLog(@"[SSZipArchive] %@", message); - success = NO; - unzippingError = [NSError errorWithDomain:SSZipArchiveErrorDomain code:localError.code userInfo:@{NSLocalizedDescriptionKey: message}]; - } - } - } - - // Create the symbolic link (making sure it stays relative if it was relative before) - int symlinkError = symlink([destinationPath cStringUsingEncoding:NSUTF8StringEncoding], - [fullPath cStringUsingEncoding:NSUTF8StringEncoding]); - - if (symlinkError != 0) - { - // Bubble the error up to the completion handler - NSString *message = [NSString stringWithFormat:@"Failed to create symbolic link at \"%@\" to \"%@\" - symlink() error code: %d", fullPath, destinationPath, errno]; - NSLog(@"[SSZipArchive] %@", message); - success = NO; - unzippingError = [NSError errorWithDomain:NSPOSIXErrorDomain code:symlinkError userInfo:@{NSLocalizedDescriptionKey: message}]; - } - } - } - - crc_ret = unzCloseCurrentFile(zip); - if (crc_ret == MZ_CRC_ERROR) { - // CRC ERROR - success = NO; - break; - } - ret = unzGoToNextFile(zip); - - // Message delegate - if ([delegate respondsToSelector:@selector(zipArchiveDidUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) { - [delegate zipArchiveDidUnzipFileAtIndex:currentFileNumber totalFiles:(NSInteger)globalInfo.number_entry - archivePath:path fileInfo:fileInfo]; - } else if ([delegate respondsToSelector: @selector(zipArchiveDidUnzipFileAtIndex:totalFiles:archivePath:unzippedFilePath:)]) { - [delegate zipArchiveDidUnzipFileAtIndex: currentFileNumber totalFiles: (NSInteger)globalInfo.number_entry - archivePath:path unzippedFilePath: fullPath]; - } - - if (progressHandler) - { - progressHandler(strPath, fileInfo, currentFileNumber, globalInfo.number_entry); - } - } - } while (ret == UNZ_OK && success); - - // Close - unzClose(zip); - - // The process of decompressing the .zip archive causes the modification times on the folders - // to be set to the present time. So, when we are done, they need to be explicitly set. - // set the modification date on all of the directories. - if (success && preserveAttributes) { - NSError * err = nil; - for (NSDictionary * d in directoriesModificationDates) { - if (![[NSFileManager defaultManager] setAttributes:@{NSFileModificationDate: [d objectForKey:@"modDate"]} ofItemAtPath:[d objectForKey:@"path"] error:&err]) { - NSLog(@"[SSZipArchive] Set attributes failed for directory: %@.", [d objectForKey:@"path"]); - } - if (err) { - NSLog(@"[SSZipArchive] Error setting directory file modification date attribute: %@", err.localizedDescription); - } - } - } - - // Message delegate - if (success && [delegate respondsToSelector:@selector(zipArchiveDidUnzipArchiveAtPath:zipInfo:unzippedPath:)]) { - [delegate zipArchiveDidUnzipArchiveAtPath:path zipInfo:globalInfo unzippedPath:destination]; - } - // final progress event = 100% - if (!canceled && [delegate respondsToSelector:@selector(zipArchiveProgressEvent:total:)]) { - [delegate zipArchiveProgressEvent:fileSize total:fileSize]; - } - - NSError *retErr = nil; - if (crc_ret == MZ_CRC_ERROR) - { - NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"crc check failed for file"}; - retErr = [NSError errorWithDomain:SSZipArchiveErrorDomain code:SSZipArchiveErrorCodeFileInfoNotLoadable userInfo:userInfo]; - } - - if (error) { - if (unzippingError) { - *error = unzippingError; - } - else { - *error = retErr; - } - } - if (completionHandler) - { - if (unzippingError) { - completionHandler(path, success, unzippingError); - } - else - { - completionHandler(path, success, retErr); - } - } - return success; -} - -#pragma mark - Zipping -+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths -{ - return [SSZipArchive createZipFileAtPath:path withFilesAtPaths:paths withPassword:nil]; -} -+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath { - return [SSZipArchive createZipFileAtPath:path withContentsOfDirectory:directoryPath withPassword:nil]; -} - -+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory { - return [SSZipArchive createZipFileAtPath:path withContentsOfDirectory:directoryPath keepParentDirectory:keepParentDirectory withPassword:nil]; -} - -+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths withPassword:(NSString *)password { - return [self createZipFileAtPath:path withFilesAtPaths:paths withPassword:password progressHandler:nil]; -} - -+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths withPassword:(NSString *)password progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler -{ - SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path]; - BOOL success = [zipArchive open]; - if (success) { - NSUInteger total = paths.count, complete = 0; - for (NSString *filePath in paths) { - success &= [zipArchive writeFile:filePath withPassword:password]; - if (progressHandler) { - complete++; - progressHandler(complete, total); - } - } - success &= [zipArchive close]; - } - return success; -} - -+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath withPassword:(nullable NSString *)password { - return [SSZipArchive createZipFileAtPath:path withContentsOfDirectory:directoryPath keepParentDirectory:NO withPassword:password]; -} - - -+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(nullable NSString *)password { - return [SSZipArchive createZipFileAtPath:path - withContentsOfDirectory:directoryPath - keepParentDirectory:keepParentDirectory - withPassword:password - andProgressHandler:nil - ]; -} - -+ (BOOL)createZipFileAtPath:(NSString *)path - withContentsOfDirectory:(NSString *)directoryPath - keepParentDirectory:(BOOL)keepParentDirectory - withPassword:(nullable NSString *)password - andProgressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler { - return [self createZipFileAtPath:path withContentsOfDirectory:directoryPath keepParentDirectory:keepParentDirectory compressionLevel:Z_DEFAULT_COMPRESSION password:password AES:YES progressHandler:progressHandler]; -} - -+ (BOOL)createZipFileAtPath:(NSString *)path - withContentsOfDirectory:(NSString *)directoryPath - keepParentDirectory:(BOOL)keepParentDirectory - compressionLevel:(int)compressionLevel - password:(nullable NSString *)password - AES:(BOOL)aes - progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler { - - SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path]; - BOOL success = [zipArchive open]; - if (success) { - // use a local fileManager (queue/thread compatibility) - NSFileManager *fileManager = [[NSFileManager alloc] init]; - NSDirectoryEnumerator *dirEnumerator = [fileManager enumeratorAtPath:directoryPath]; - NSArray *allObjects = dirEnumerator.allObjects; - NSUInteger total = allObjects.count, complete = 0; - if (keepParentDirectory && !total) { - allObjects = @[@""]; - total = 1; - } - for (__strong NSString *fileName in allObjects) { - NSString *fullFilePath = [directoryPath stringByAppendingPathComponent:fileName]; - if ([fullFilePath isEqualToString:path]) { - NSLog(@"[SSZipArchive] the archive path and the file path: %@ are the same, which is forbidden.", fullFilePath); - continue; - } - - if (keepParentDirectory) { - fileName = [directoryPath.lastPathComponent stringByAppendingPathComponent:fileName]; - } - - BOOL isDir; - [fileManager fileExistsAtPath:fullFilePath isDirectory:&isDir]; - if (!isDir) { - // file - success &= [zipArchive writeFileAtPath:fullFilePath withFileName:fileName compressionLevel:compressionLevel password:password AES:aes]; - } else { - // directory - if (![fileManager enumeratorAtPath:fullFilePath].nextObject) { - // empty directory - success &= [zipArchive writeFolderAtPath:fullFilePath withFolderName:fileName withPassword:password]; - } - } - if (progressHandler) { - complete++; - progressHandler(complete, total); - } - } - success &= [zipArchive close]; - } - return success; -} - -+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths withPassword:(nullable NSString *)password keepSymlinks:(BOOL)keeplinks { - if (!keeplinks) { - return [SSZipArchive createZipFileAtPath:path withFilesAtPaths:paths withPassword:password]; - } else { - SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path]; - BOOL success = [zipArchive open]; - if (success) { - for (NSString *filePath in paths) { - //is symlink - if (mz_os_is_symlink(filePath.fileSystemRepresentation) == MZ_OK) { - success &= [zipArchive writeSymlinkFileAtPath:filePath withFileName:nil compressionLevel:Z_DEFAULT_COMPRESSION password:password AES:YES]; - } else { - success &= [zipArchive writeFile:filePath withPassword:password]; - } - } - success &= [zipArchive close]; - } - return success; - } -} - -+ (BOOL)createZipFileAtPath:(NSString *)path - withContentsOfDirectory:(NSString *)directoryPath - keepParentDirectory:(BOOL)keepParentDirectory - compressionLevel:(int)compressionLevel - password:(nullable NSString *)password - AES:(BOOL)aes - progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler - keepSymlinks:(BOOL)keeplinks { - if (!keeplinks) { - return [SSZipArchive createZipFileAtPath:path - withContentsOfDirectory:directoryPath - keepParentDirectory:keepParentDirectory - compressionLevel:compressionLevel - password:password - AES:aes - progressHandler:progressHandler]; - } else { - SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path]; - BOOL success = [zipArchive open]; - if (success) { - // use a local fileManager (queue/thread compatibility) - NSFileManager *fileManager = [[NSFileManager alloc] init]; - NSDirectoryEnumerator *dirEnumerator = [fileManager enumeratorAtPath:directoryPath]; - NSArray *allObjects = dirEnumerator.allObjects; - NSUInteger total = allObjects.count, complete = 0; - if (keepParentDirectory && !total) { - allObjects = @[@""]; - total = 1; - } - for (__strong NSString *fileName in allObjects) { - NSString *fullFilePath = [directoryPath stringByAppendingPathComponent:fileName]; - - if (keepParentDirectory) { - fileName = [directoryPath.lastPathComponent stringByAppendingPathComponent:fileName]; - } - //is symlink - BOOL isSymlink = NO; - if (mz_os_is_symlink(fullFilePath.fileSystemRepresentation) == MZ_OK) - isSymlink = YES; - BOOL isDir; - [fileManager fileExistsAtPath:fullFilePath isDirectory:&isDir]; - if (!isDir || isSymlink) { - // file or symlink - if (!isSymlink) { - success &= [zipArchive writeFileAtPath:fullFilePath withFileName:fileName compressionLevel:compressionLevel password:password AES:aes]; - } else { - success &= [zipArchive writeSymlinkFileAtPath:fullFilePath withFileName:fileName compressionLevel:compressionLevel password:password AES:aes]; - } - } else { - // directory - if (![fileManager enumeratorAtPath:fullFilePath].nextObject) { - // empty directory - success &= [zipArchive writeFolderAtPath:fullFilePath withFolderName:fileName withPassword:password]; - } - } - if (progressHandler) { - complete++; - progressHandler(complete, total); - } - } - success &= [zipArchive close]; - } - return success; - } -} - -- (BOOL)writeSymlinkFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes -{ - NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened"); - //read symlink - char link_path[1024]; - int32_t err = MZ_OK; - err = mz_os_read_symlink(path.fileSystemRepresentation, link_path, sizeof(link_path)); - if (err != MZ_OK) { - NSLog(@"[SSZipArchive] Failed to read sylink"); - return NO; - } - - if (!fileName) { - fileName = path.lastPathComponent; - } - - zip_fileinfo zipInfo = {}; - [SSZipArchive zipInfo:&zipInfo setAttributesOfItemAtPath:path]; - - //unpdate zipInfo.external_fa - uint32_t target_attrib = 0; - uint32_t src_attrib = 0; - uint32_t src_sys = 0; - mz_os_get_file_attribs(path.fileSystemRepresentation, &src_attrib); - src_sys = MZ_HOST_SYSTEM(MZ_VERSION_MADEBY); - - if ((src_sys != MZ_HOST_SYSTEM_MSDOS) && (src_sys != MZ_HOST_SYSTEM_WINDOWS_NTFS)) { - /* High bytes are OS specific attributes, low byte is always DOS attributes */ - if (mz_zip_attrib_convert(src_sys, src_attrib, MZ_HOST_SYSTEM_MSDOS, &target_attrib) == MZ_OK) - zipInfo.external_fa = target_attrib; - zipInfo.external_fa |= (src_attrib << 16); - } else { - zipInfo.external_fa = src_attrib; - } - - uint16_t version_madeby = 3 << 8;//UNIX - int error = zipOpenNewFileInZip5(_zip, fileName.fileSystemRepresentation, &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, compressionLevel, 0, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, password.UTF8String, 0, aes, version_madeby, 0, 0); - zipWriteInFileInZip(_zip, link_path, (uint32_t)strlen(link_path)); - zipCloseFileInZip(_zip); - return error == ZIP_OK; -} - -// disabling `init` because designated initializer is `initWithPath:` -- (instancetype)init { @throw nil; } - -// designated initializer -- (instancetype)initWithPath:(NSString *)path -{ - if ((self = [super init])) { - _path = [path copy]; - } - return self; -} - - -- (BOOL)open -{ - NSAssert((_zip == NULL), @"Attempting to open an archive which is already open"); - _zip = zipOpen(_path.fileSystemRepresentation, APPEND_STATUS_CREATE); - return (NULL != _zip); -} - -- (BOOL)openForAppending -{ - NSAssert((_zip == NULL), @"Attempting to open an archive which is already open"); - _zip = zipOpen(_path.fileSystemRepresentation, APPEND_STATUS_ADDINZIP); - return (NULL != _zip); -} - -- (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName withPassword:(nullable NSString *)password -{ - NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened"); - - zip_fileinfo zipInfo = {}; - - [SSZipArchive zipInfo:&zipInfo setAttributesOfItemAtPath:path]; - - int error = _zipOpenEntry(_zip, [folderName stringByAppendingString:@"/"], &zipInfo, Z_NO_COMPRESSION, password, NO); - const void *buffer = NULL; - zipWriteInFileInZip(_zip, buffer, 0); - zipCloseFileInZip(_zip); - return error == ZIP_OK; -} - -- (BOOL)writeFile:(NSString *)path withPassword:(nullable NSString *)password -{ - return [self writeFileAtPath:path withFileName:nil withPassword:password]; -} - -- (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName withPassword:(nullable NSString *)password -{ - return [self writeFileAtPath:path withFileName:fileName compressionLevel:Z_DEFAULT_COMPRESSION password:password AES:YES]; -} - -// supports writing files with logical folder/directory structure -// *path* is the absolute path of the file that will be compressed -// *fileName* is the relative name of the file how it is stored within the zip e.g. /folder/subfolder/text1.txt -- (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes -{ - NSAssert((_zip != NULL), @"Attempting to write to an archive which was never opened"); - - FILE *input = fopen(path.fileSystemRepresentation, "r"); - if (NULL == input) { - return NO; - } - - if (!fileName) { - fileName = path.lastPathComponent; - } - - zip_fileinfo zipInfo = {}; - - [SSZipArchive zipInfo:&zipInfo setAttributesOfItemAtPath:path]; - - void *buffer = malloc(CHUNK); - if (buffer == NULL) - { - fclose(input); - return NO; - } - - int error = _zipOpenEntry(_zip, fileName, &zipInfo, compressionLevel, password, aes); - - while (!feof(input) && !ferror(input)) - { - unsigned int len = (unsigned int) fread(buffer, 1, CHUNK, input); - zipWriteInFileInZip(_zip, buffer, len); - } - - zipCloseFileInZip(_zip); - free(buffer); - fclose(input); - return error == ZIP_OK; -} - -- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename withPassword:(nullable NSString *)password -{ - return [self writeData:data filename:filename compressionLevel:Z_DEFAULT_COMPRESSION password:password AES:YES]; -} - -- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes -{ - if (!_zip) { - return NO; - } - if (!data) { - return NO; - } - zip_fileinfo zipInfo = {}; - [SSZipArchive zipInfo:&zipInfo setDate:[NSDate date]]; - - int error = _zipOpenEntry(_zip, filename, &zipInfo, compressionLevel, password, aes); - - zipWriteInFileInZip(_zip, data.bytes, (unsigned int)data.length); - - zipCloseFileInZip(_zip); - return error == ZIP_OK; -} - -- (BOOL)close -{ - NSAssert((_zip != NULL), @"[SSZipArchive] Attempting to close an archive which was never opened"); - int error = zipClose(_zip, NULL); - _zip = nil; - return error == ZIP_OK; -} - -#pragma mark - Private - -+ (NSString *)_filenameStringWithCString:(const char *)filename - version_made_by:(uint16_t)version_made_by - general_purpose_flag:(uint16_t)flag - size:(uint16_t)size_filename { - - // Respect Language encoding flag only reading filename as UTF-8 when this is set - // when file entry created on dos system. - // - // https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT - // Bit 11: Language encoding flag (EFS). If this bit is set, - // the filename and comment fields for this file - // MUST be encoded using UTF-8. (see APPENDIX D) - uint16_t made_by = version_made_by >> 8; - BOOL made_on_dos = made_by == 0; - BOOL languageEncoding = (flag & (1 << 11)) != 0; - if (!languageEncoding && made_on_dos) { - // APPNOTE.TXT D.1: - // D.2 If general purpose bit 11 is unset, the file name and comment should conform - // to the original ZIP character encoding. If general purpose bit 11 is set, the - // filename and comment must support The Unicode Standard, Version 4.1.0 or - // greater using the character encoding form defined by the UTF-8 storage - // specification. The Unicode Standard is published by the The Unicode - // Consortium (www.unicode.org). UTF-8 encoded data stored within ZIP files - // is expected to not include a byte order mark (BOM). - - // Code Page 437 corresponds to kCFStringEncodingDOSLatinUS - NSStringEncoding encoding = CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingDOSLatinUS); - NSString* strPath = [NSString stringWithCString:filename encoding:encoding]; - if (strPath) { - return strPath; - } - } - - // attempting unicode encoding - NSString * strPath = @(filename); - if (strPath) { - return strPath; - } - - // if filename is non-unicode, detect and transform Encoding - NSData *data = [NSData dataWithBytes:(const void *)filename length:sizeof(unsigned char) * size_filename]; -// Testing availability of @available (https://stackoverflow.com/a/46927445/1033581) -#if __clang_major__ < 9 - // Xcode 8- - if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber10_9_2) { -#else - // Xcode 9+ - if (@available(macOS 10.10, iOS 8.0, watchOS 2.0, tvOS 9.0, *)) { -#endif - // supported encodings are in [NSString availableStringEncodings] - [NSString stringEncodingForData:data encodingOptions:nil convertedString:&strPath usedLossyConversion:nil]; - } else { - // fallback to a simple manual detect for macOS 10.9 or older - NSArray *encodings = @[@(kCFStringEncodingGB_18030_2000), @(kCFStringEncodingShiftJIS)]; - for (NSNumber *encoding in encodings) { - strPath = [NSString stringWithCString:filename encoding:(NSStringEncoding)CFStringConvertEncodingToNSStringEncoding(encoding.unsignedIntValue)]; - if (strPath) { - break; - } - } - } - if (strPath) { - return strPath; - } - - // if filename encoding is non-detected, we default to something based on data - // _hexString is more readable than _base64RFC4648 for debugging unknown encodings - strPath = [data _hexString]; - return strPath; -} - -+ (void)zipInfo:(zip_fileinfo *)zipInfo setAttributesOfItemAtPath:(NSString *)path -{ - NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:path error: nil]; - if (attr) - { - NSDate *fileDate = (NSDate *)[attr objectForKey:NSFileModificationDate]; - if (fileDate) - { - [self zipInfo:zipInfo setDate:fileDate]; - } - - // Write permissions into the external attributes, for details on this see here: https://unix.stackexchange.com/a/14727 - // Get the permissions value from the files attributes - NSNumber *permissionsValue = (NSNumber *)[attr objectForKey:NSFilePosixPermissions]; - if (permissionsValue != nil) { - // Get the short value for the permissions - short permissionsShort = permissionsValue.shortValue; - - // Convert this into an octal by adding 010000, 010000 being the flag for a regular file - NSInteger permissionsOctal = 0100000 + permissionsShort; - - // Convert this into a long value - uLong permissionsLong = @(permissionsOctal).unsignedLongValue; - - // Store this into the external file attributes once it has been shifted 16 places left to form part of the second from last byte - - // Casted back to an unsigned int to match type of external_fa in minizip - zipInfo->external_fa = (unsigned int)(permissionsLong << 16L); - } - } -} - -+ (void)zipInfo:(zip_fileinfo *)zipInfo setDate:(NSDate *)date -{ - NSCalendar *currentCalendar = SSZipArchive._gregorian; - NSCalendarUnit flags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond; - NSDateComponents *components = [currentCalendar components:flags fromDate:date]; - struct tm tmz_date; - tmz_date.tm_sec = (unsigned int)components.second; - tmz_date.tm_min = (unsigned int)components.minute; - tmz_date.tm_hour = (unsigned int)components.hour; - tmz_date.tm_mday = (unsigned int)components.day; - // ISO/IEC 9899 struct tm is 0-indexed for January but NSDateComponents for gregorianCalendar is 1-indexed for January - tmz_date.tm_mon = (unsigned int)components.month - 1; - // ISO/IEC 9899 struct tm is 0-indexed for AD 1900 but NSDateComponents for gregorianCalendar is 1-indexed for AD 1 - tmz_date.tm_year = (unsigned int)components.year - 1900; - zipInfo->mz_dos_date = mz_zip_tm_to_dosdate(&tmz_date); -} - -+ (NSCalendar *)_gregorian -{ - static NSCalendar *gregorian; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; - }); - - return gregorian; -} - -// Format from http://newsgroups.derkeiler.com/Archive/Comp/comp.os.msdos.programmer/2009-04/msg00060.html -// Two consecutive words, or a longword, YYYYYYYMMMMDDDDD hhhhhmmmmmmsssss -// YYYYYYY is years from 1980 = 0 -// sssss is (seconds/2). -// -// 3658 = 0011 0110 0101 1000 = 0011011 0010 11000 = 27 2 24 = 2007-02-24 -// 7423 = 0111 0100 0010 0011 - 01110 100001 00011 = 14 33 3 = 14:33:06 -+ (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime -{ - // the whole `_dateWithMSDOSFormat:` method is equivalent but faster than this one line, - // essentially because `mktime` is slow: - //NSDate *date = [NSDate dateWithTimeIntervalSince1970:dosdate_to_time_t(msdosDateTime)]; - static const UInt32 kYearMask = 0xFE000000; - static const UInt32 kMonthMask = 0x1E00000; - static const UInt32 kDayMask = 0x1F0000; - static const UInt32 kHourMask = 0xF800; - static const UInt32 kMinuteMask = 0x7E0; - static const UInt32 kSecondMask = 0x1F; - - NSAssert(0xFFFFFFFF == (kYearMask | kMonthMask | kDayMask | kHourMask | kMinuteMask | kSecondMask), @"[SSZipArchive] MSDOS date masks don't add up"); - - NSDateComponents *components = [[NSDateComponents alloc] init]; - components.year = 1980 + ((msdosDateTime & kYearMask) >> 25); - components.month = (msdosDateTime & kMonthMask) >> 21; - components.day = (msdosDateTime & kDayMask) >> 16; - components.hour = (msdosDateTime & kHourMask) >> 11; - components.minute = (msdosDateTime & kMinuteMask) >> 5; - components.second = (msdosDateTime & kSecondMask) * 2; - - NSDate *date = [self._gregorian dateFromComponents:components]; - return date; -} - -@end - -int _zipOpenEntry(zipFile entry, NSString *name, const zip_fileinfo *zipfi, int level, NSString *password, BOOL aes) -{ - // https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT - uint16_t made_on_darwin = 19 << 8; - //MZ_ZIP_FLAG_UTF8 - uint16_t flag_base = 1 << 11; - return zipOpenNewFileInZip5(entry, name.fileSystemRepresentation, zipfi, NULL, 0, NULL, 0, NULL, Z_DEFLATED, level, 0, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, password.UTF8String, 0, aes, made_on_darwin, flag_base, 1); -} - -#pragma mark - Private tools for file info - -BOOL _fileIsSymbolicLink(const unz_file_info *fileInfo) -{ - // - // Determine whether this is a symbolic link: - // - File is stored with 'version made by' value of UNIX (3), - // as per https://www.pkware.com/documents/casestudies/APPNOTE.TXT - // in the upper byte of the version field. - // - BSD4.4 st_mode constants are stored in the high 16 bits of the - // external file attributes (defacto standard, verified against libarchive) - // - // The original constants can be found here: - // https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/include/sys/stat.h - // - const uLong ZipUNIXVersion = 3; - const uLong BSD_SFMT = 0170000; - const uLong BSD_IFLNK = 0120000; - - BOOL fileIsSymbolicLink = ((fileInfo->version >> 8) == ZipUNIXVersion) && BSD_IFLNK == (BSD_SFMT & (fileInfo->external_fa >> 16)); - return fileIsSymbolicLink; -} - -#pragma mark - Private tools for unreadable encodings - -@implementation NSData (SSZipArchive) - -// `base64EncodedStringWithOptions` uses a base64 alphabet with '+' and '/'. -// we got those alternatives to make it compatible with filenames: https://en.wikipedia.org/wiki/Base64 -// * modified Base64 encoding for IMAP mailbox names (RFC 3501): uses '+' and ',' -// * modified Base64 for URL and filenames (RFC 4648): uses '-' and '_' -- (NSString *)_base64RFC4648 -{ - NSString *strName = [self base64EncodedStringWithOptions:0]; - strName = [strName stringByReplacingOccurrencesOfString:@"+" withString:@"-"]; - strName = [strName stringByReplacingOccurrencesOfString:@"/" withString:@"_"]; - return strName; -} - -// initWithBytesNoCopy from NSProgrammer, Jan 25 '12: https://stackoverflow.com/a/9009321/1033581 -// hexChars from Peter, Aug 19 '14: https://stackoverflow.com/a/25378464/1033581 -// not implemented as too lengthy: a potential mapping improvement from Moose, Nov 3 '15: https://stackoverflow.com/a/33501154/1033581 -- (NSString *)_hexString -{ - const char *hexChars = "0123456789ABCDEF"; - NSUInteger length = self.length; - const unsigned char *bytes = self.bytes; - char *chars = malloc(length * 2); - if (chars == NULL) { - // we directly raise an exception instead of using NSAssert to make sure assertion is not disabled as this is irrecoverable - [NSException raise:@"NSInternalInconsistencyException" format:@"failed malloc" arguments:nil]; - return nil; - } - char *s = chars; - NSUInteger i = length; - while (i--) { - *s++ = hexChars[*bytes >> 4]; - *s++ = hexChars[*bytes & 0xF]; - bytes++; - } - NSString *str = [[NSString alloc] initWithBytesNoCopy:chars - length:length * 2 - encoding:NSASCIIStringEncoding - freeWhenDone:YES]; - return str; -} - -@end - -#pragma mark Private tools for security - -@implementation NSString (SSZipArchive) - -// One implementation alternative would be to use the algorithm found at mz_path_resolve from https://github.com/nmoinvaz/minizip/blob/dev/mz_os.c, -// but making sure to work with unichar values and not ascii values to avoid breaking Unicode characters containing 2E ('.') or 2F ('/') in their decomposition -/// Sanitize path traversal characters to prevent directory backtracking. Ignoring these characters mimicks the default behavior of the Unarchiving tool on macOS. -- (NSString *)_sanitizedPath -{ - // Change Windows paths to Unix paths: https://en.wikipedia.org/wiki/Path_(computing) - // Possible improvement: only do this if the archive was created on a non-Unix system - NSString *strPath = [self stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; - - // Percent-encode file path (where path is defined by https://tools.ietf.org/html/rfc8089) - // The key part is to allow characters "." and "/" and disallow "%". - // CharacterSet.urlPathAllowed seems to do the job -#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 || __WATCH_OS_VERSION_MIN_REQUIRED >= 20000 || __TV_OS_VERSION_MIN_REQUIRED >= 90000) - strPath = [strPath stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLPathAllowedCharacterSet]; -#else - // Testing availability of @available (https://stackoverflow.com/a/46927445/1033581) -#if __clang_major__ < 9 - // Xcode 8- - if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber10_8_4) { -#else - // Xcode 9+ - if (@available(macOS 10.9, iOS 7.0, watchOS 2.0, tvOS 9.0, *)) { -#endif - strPath = [strPath stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLPathAllowedCharacterSet]; - } else { - strPath = [strPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - } -#endif - - // `NSString.stringByAddingPercentEncodingWithAllowedCharacters:` may theorically fail: https://stackoverflow.com/questions/33558933/ - // But because we auto-detect encoding using `NSString.stringEncodingForData:encodingOptions:convertedString:usedLossyConversion:`, - // we likely already prevent UTF-16, UTF-32 and invalid Unicode in the form of unpaired surrogate chars: https://stackoverflow.com/questions/53043876/ - // To be on the safe side, we will still perform a guard check. - if (strPath == nil) { - return nil; - } - - // Add scheme "file:///" to support sanitation on names with a colon like "file:a/../../../usr/bin" - strPath = [@"file:///" stringByAppendingString:strPath]; - - // Sanitize path traversal characters to prevent directory backtracking. Ignoring these characters mimicks the default behavior of the Unarchiving tool on macOS. - // "../../../../../../../../../../../tmp/test.txt" -> "tmp/test.txt" - // "a/b/../c.txt" -> "a/c.txt" - strPath = [NSURL URLWithString:strPath].standardizedURL.absoluteString; - - // Remove the "file:///" scheme - strPath = strPath.length < 8 ? @"" : [strPath substringFromIndex:8]; - - // Remove the percent-encoding -#if (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 || __WATCH_OS_VERSION_MIN_REQUIRED >= 20000 || __TV_OS_VERSION_MIN_REQUIRED >= 90000) - strPath = strPath.stringByRemovingPercentEncoding; -#else - // Testing availability of @available (https://stackoverflow.com/a/46927445/1033581) -#if __clang_major__ < 9 - // Xcode 8- - if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber10_8_4) { -#else - // Xcode 9+ - if (@available(macOS 10.9, iOS 7.0, watchOS 2.0, tvOS 9.0, *)) { -#endif - strPath = strPath.stringByRemovingPercentEncoding; - } else { - strPath = [strPath stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - } -#endif - - return strPath; -} - -/// Detects if the path represented in this string is pointing outside of the targetDirectory passed as argument. -/// -/// Helps detecting and avoiding a security vulnerability described here: -/// https://nvd.nist.gov/vuln/detail/CVE-2022-36943 -- (BOOL)_escapesTargetDirectory:(NSString *)targetDirectory { - NSString *standardizedPath = [[self stringByStandardizingPath] stringByResolvingSymlinksInPath]; - NSString *standardizedTargetPath = [[targetDirectory stringByStandardizingPath] stringByResolvingSymlinksInPath]; - - NSArray *targetPathComponents = [standardizedTargetPath pathComponents]; - NSArray *pathComponents = [standardizedPath pathComponents]; - - if (pathComponents.count < targetPathComponents.count) return YES; - - for (int idx = 0; idx < targetPathComponents.count; idx++) { - if (![pathComponents[idx] isEqual: targetPathComponents[idx]]) { - return YES; - } - } - - return NO; -} - -@end diff --git a/ios/CodePush/SSZipArchive/SSZipCommon.h b/ios/CodePush/SSZipArchive/SSZipCommon.h deleted file mode 100644 index 6c775734b..000000000 --- a/ios/CodePush/SSZipArchive/SSZipCommon.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef SSZipCommon -#define SSZipCommon - -// typedefs moved from mz_compat.h to here for public access - -/* unz_global_info structure contain global data about the ZIPfile - These data comes from the end of central dir */ -typedef struct unz_global_info64_s -{ - uint64_t number_entry; /* total number of entries in the central dir on this disk */ - uint32_t number_disk_with_CD; /* number the the disk with central dir, used for spanning ZIP */ - uint16_t size_comment; /* size of the global comment of the zipfile */ -} unz_global_info64; - - -typedef struct unz_global_info_s -{ - uint32_t number_entry; /* total number of entries in the central dir on this disk */ - uint32_t number_disk_with_CD; /* number the the disk with central dir, used for spanning ZIP */ - uint16_t size_comment; /* size of the global comment of the zipfile */ -} unz_global_info; - -/* unz_file_info contain information about a file in the zipfile */ -/* https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT */ -typedef struct unz_file_info64_s -{ - uint16_t version; /* version made by 2 bytes */ - uint16_t version_needed; /* version needed to extract 2 bytes */ - uint16_t flag; /* general purpose bit flag 2 bytes */ - uint16_t compression_method; /* compression method 2 bytes */ - uint32_t dos_date; /* last mod file date in Dos fmt 4 bytes */ - struct tm tmu_date; - uint32_t crc; /* crc-32 4 bytes */ - uint64_t compressed_size; /* compressed size 8 bytes */ - uint64_t uncompressed_size; /* uncompressed size 8 bytes */ - uint16_t size_filename; /* filename length 2 bytes */ - uint16_t size_file_extra; /* extra field length 2 bytes */ - uint16_t size_file_comment; /* file comment length 2 bytes */ - - uint32_t disk_num_start; /* disk number start 4 bytes */ - uint16_t internal_fa; /* internal file attributes 2 bytes */ - uint32_t external_fa; /* external file attributes 4 bytes */ - - uint64_t disk_offset; - - uint16_t size_file_extra_internal; -} unz_file_info64; - -typedef struct unz_file_info_s -{ - uint16_t version; /* version made by 2 bytes */ - uint16_t version_needed; /* version needed to extract 2 bytes */ - uint16_t flag; /* general purpose bit flag 2 bytes */ - uint16_t compression_method; /* compression method 2 bytes */ - uint32_t dos_date; /* last mod file date in Dos fmt 4 bytes */ - struct tm tmu_date; - uint32_t crc; /* crc-32 4 bytes */ - uint32_t compressed_size; /* compressed size 4 bytes */ - uint32_t uncompressed_size; /* uncompressed size 4 bytes */ - uint16_t size_filename; /* filename length 2 bytes */ - uint16_t size_file_extra; /* extra field length 2 bytes */ - uint16_t size_file_comment; /* file comment length 2 bytes */ - - uint16_t disk_num_start; /* disk number start 2 bytes */ - uint16_t internal_fa; /* internal file attributes 2 bytes */ - uint32_t external_fa; /* external file attributes 4 bytes */ - - uint64_t disk_offset; -} unz_file_info; - -#endif diff --git a/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy b/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy deleted file mode 100644 index 276f7610d..000000000 --- a/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +++ /dev/null @@ -1,23 +0,0 @@ - - - - - NSPrivacyTracking - - NSPrivacyCollectedDataTypes - - NSPrivacyTrackingDomains - - NSPrivacyAccessedAPITypes - - - NSPrivacyAccessedAPIType - NSPrivacyAccessedAPICategoryFileTimestamp - NSPrivacyAccessedAPITypeReasons - - C617.1 - - - - - diff --git a/ios/CodePush/SSZipArchive/include/ZipArchive.h b/ios/CodePush/SSZipArchive/include/ZipArchive.h deleted file mode 100644 index e81fc9b6e..000000000 --- a/ios/CodePush/SSZipArchive/include/ZipArchive.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// ZipArchive.h -// ZipArchive -// -// Created by Serhii Mumriak on 12/1/15. -// - -#import - -//! Project version number for ZipArchive. -FOUNDATION_EXPORT double ZipArchiveVersionNumber; - -//! Project version string for ZipArchive. -FOUNDATION_EXPORT const unsigned char ZipArchiveVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - -// This is to account for the many different ways this library gets imported. -#if __has_include() -#import -#elif __has_include("../SSZipArchive.h") -#import "../SSZipArchive.h" -#else -#import "SSZipArchive.h" -#endif diff --git a/ios/CodePush/SSZipArchive/minizip/LICENSE b/ios/CodePush/SSZipArchive/minizip/LICENSE deleted file mode 100644 index 3b6c4e142..000000000 --- a/ios/CodePush/SSZipArchive/minizip/LICENSE +++ /dev/null @@ -1,17 +0,0 @@ -Condition of use and distribution are the same as zlib: - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgement in the product documentation would be - appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. diff --git a/ios/CodePush/SSZipArchive/minizip/mz.h b/ios/CodePush/SSZipArchive/minizip/mz.h deleted file mode 100644 index a085f24e7..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz.h +++ /dev/null @@ -1,273 +0,0 @@ -/* mz.h -- Errors codes, zip flags and magic - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#ifndef MZ_H -#define MZ_H - -/***************************************************************************/ - -/* MZ_VERSION */ -#define MZ_VERSION ("3.0.9") -#define MZ_VERSION_BUILD (030009) - -/* MZ_ERROR */ -#define MZ_OK (0) /* zlib */ -#define MZ_STREAM_ERROR (-1) /* zlib */ -#define MZ_DATA_ERROR (-3) /* zlib */ -#define MZ_MEM_ERROR (-4) /* zlib */ -#define MZ_BUF_ERROR (-5) /* zlib */ -#define MZ_VERSION_ERROR (-6) /* zlib */ - -#define MZ_END_OF_LIST (-100) -#define MZ_END_OF_STREAM (-101) - -#define MZ_PARAM_ERROR (-102) -#define MZ_FORMAT_ERROR (-103) -#define MZ_INTERNAL_ERROR (-104) -#define MZ_CRC_ERROR (-105) -#define MZ_CRYPT_ERROR (-106) -#define MZ_EXIST_ERROR (-107) -#define MZ_PASSWORD_ERROR (-108) -#define MZ_SUPPORT_ERROR (-109) -#define MZ_HASH_ERROR (-110) -#define MZ_OPEN_ERROR (-111) -#define MZ_CLOSE_ERROR (-112) -#define MZ_SEEK_ERROR (-113) -#define MZ_TELL_ERROR (-114) -#define MZ_READ_ERROR (-115) -#define MZ_WRITE_ERROR (-116) -#define MZ_SIGN_ERROR (-117) -#define MZ_SYMLINK_ERROR (-118) - -/* MZ_OPEN */ -#define MZ_OPEN_MODE_READ (0x01) -#define MZ_OPEN_MODE_WRITE (0x02) -#define MZ_OPEN_MODE_READWRITE (MZ_OPEN_MODE_READ | MZ_OPEN_MODE_WRITE) -#define MZ_OPEN_MODE_APPEND (0x04) -#define MZ_OPEN_MODE_CREATE (0x08) -#define MZ_OPEN_MODE_EXISTING (0x10) - -/* MZ_SEEK */ -#define MZ_SEEK_SET (0) -#define MZ_SEEK_CUR (1) -#define MZ_SEEK_END (2) - -/* MZ_COMPRESS */ -#define MZ_COMPRESS_METHOD_STORE (0) -#define MZ_COMPRESS_METHOD_DEFLATE (8) -#define MZ_COMPRESS_METHOD_BZIP2 (12) -#define MZ_COMPRESS_METHOD_LZMA (14) -#define MZ_COMPRESS_METHOD_ZSTD (93) -#define MZ_COMPRESS_METHOD_XZ (95) -#define MZ_COMPRESS_METHOD_AES (99) - -#define MZ_COMPRESS_LEVEL_DEFAULT (-1) -#define MZ_COMPRESS_LEVEL_FAST (2) -#define MZ_COMPRESS_LEVEL_NORMAL (6) -#define MZ_COMPRESS_LEVEL_BEST (9) - -/* MZ_ZIP_FLAG */ -#define MZ_ZIP_FLAG_ENCRYPTED (1 << 0) -#define MZ_ZIP_FLAG_LZMA_EOS_MARKER (1 << 1) -#define MZ_ZIP_FLAG_DEFLATE_MAX (1 << 1) -#define MZ_ZIP_FLAG_DEFLATE_NORMAL (0) -#define MZ_ZIP_FLAG_DEFLATE_FAST (1 << 2) -#define MZ_ZIP_FLAG_DEFLATE_SUPER_FAST (MZ_ZIP_FLAG_DEFLATE_FAST | \ - MZ_ZIP_FLAG_DEFLATE_MAX) -#define MZ_ZIP_FLAG_DATA_DESCRIPTOR (1 << 3) -#define MZ_ZIP_FLAG_UTF8 (1 << 11) -#define MZ_ZIP_FLAG_MASK_LOCAL_INFO (1 << 13) - -/* MZ_ZIP_EXTENSION */ -#define MZ_ZIP_EXTENSION_ZIP64 (0x0001) -#define MZ_ZIP_EXTENSION_NTFS (0x000a) -#define MZ_ZIP_EXTENSION_AES (0x9901) -#define MZ_ZIP_EXTENSION_UNIX1 (0x000d) -#define MZ_ZIP_EXTENSION_SIGN (0x10c5) -#define MZ_ZIP_EXTENSION_HASH (0x1a51) -#define MZ_ZIP_EXTENSION_CDCD (0xcdcd) - -/* MZ_ZIP64 */ -#define MZ_ZIP64_AUTO (0) -#define MZ_ZIP64_FORCE (1) -#define MZ_ZIP64_DISABLE (2) - -/* MZ_HOST_SYSTEM */ -#define MZ_HOST_SYSTEM(VERSION_MADEBY) ((uint8_t)(VERSION_MADEBY >> 8)) -#define MZ_HOST_SYSTEM_MSDOS (0) -#define MZ_HOST_SYSTEM_UNIX (3) -#define MZ_HOST_SYSTEM_WINDOWS_NTFS (10) -#define MZ_HOST_SYSTEM_RISCOS (13) -#define MZ_HOST_SYSTEM_OSX_DARWIN (19) - -/* MZ_PKCRYPT */ -#define MZ_PKCRYPT_HEADER_SIZE (12) - -/* MZ_AES */ -#define MZ_AES_VERSION (1) -#define MZ_AES_ENCRYPTION_MODE_128 (0x01) -#define MZ_AES_ENCRYPTION_MODE_192 (0x02) -#define MZ_AES_ENCRYPTION_MODE_256 (0x03) -#define MZ_AES_KEY_LENGTH(MODE) (8 * (MODE & 3) + 8) -#define MZ_AES_KEY_LENGTH_MAX (32) -#define MZ_AES_BLOCK_SIZE (16) -#define MZ_AES_HEADER_SIZE(MODE) ((4 * (MODE & 3) + 4) + 2) -#define MZ_AES_FOOTER_SIZE (10) - -/* MZ_HASH */ -#define MZ_HASH_MD5 (10) -#define MZ_HASH_MD5_SIZE (16) -#define MZ_HASH_SHA1 (20) -#define MZ_HASH_SHA1_SIZE (20) -#define MZ_HASH_SHA224 (22) -#define MZ_HASH_SHA224_SIZE (28) -#define MZ_HASH_SHA256 (23) -#define MZ_HASH_SHA256_SIZE (32) -#define MZ_HASH_SHA384 (24) -#define MZ_HASH_SHA384_SIZE (48) -#define MZ_HASH_SHA512 (25) -#define MZ_HASH_SHA512_SIZE (64) -#define MZ_HASH_MAX_SIZE (256) - -/* MZ_ENCODING */ -#define MZ_ENCODING_CODEPAGE_437 (437) -#define MZ_ENCODING_CODEPAGE_932 (932) -#define MZ_ENCODING_CODEPAGE_936 (936) -#define MZ_ENCODING_CODEPAGE_950 (950) -#define MZ_ENCODING_UTF8 (65001) - -/* MZ_UTILITY */ -#define MZ_UNUSED(SYMBOL) ((void)SYMBOL) - -#if defined(_WIN32) && defined(MZ_EXPORTS) -#define MZ_EXPORT __declspec(dllexport) -#else -#define MZ_EXPORT -#endif - -/***************************************************************************/ - -#include /* size_t, NULL, malloc */ -#include /* time_t, time() */ -#include /* memset, strncpy, strlen */ -#include - -#if defined(HAVE_STDINT_H) -# include -#elif defined(__has_include) -# if __has_include() -# include -# endif -#endif - -#ifndef INT8_MAX -typedef signed char int8_t; -#endif -#ifndef INT16_MAX -typedef short int16_t; -#endif -#ifndef INT32_MAX -typedef int int32_t; -#endif -#ifndef INT64_MAX -typedef long long int64_t; -#endif -#ifndef UINT8_MAX -typedef unsigned char uint8_t; -#endif -#ifndef UINT16_MAX -typedef unsigned short uint16_t; -#endif -#ifndef UINT32_MAX -typedef unsigned int uint32_t; -#endif -#ifndef UINT64_MAX -typedef unsigned long long uint64_t; -#endif - -#if defined(HAVE_INTTYPES_H) -# include -#elif defined(__has_include) -# if __has_include() -# include -# endif -#endif - -#ifndef PRId8 -# define PRId8 "hhd" -#endif -#ifndef PRIu8 -# define PRIu8 "hhu" -#endif -#ifndef PRIx8 -# define PRIx8 "hhx" -#endif -#ifndef PRId16 -# define PRId16 "hd" -#endif -#ifndef PRIu16 -# define PRIu16 "hu" -#endif -#ifndef PRIx16 -# define PRIx16 "hx" -#endif -#ifndef PRId32 -# define PRId32 "d" -#endif -#ifndef PRIu32 -# define PRIu32 "u" -#endif -#ifndef PRIx32 -# define PRIx32 "x" -#endif -#if ULONG_MAX == 0xfffffffful -# ifndef PRId64 -# define PRId64 "ld" -# endif -# ifndef PRIu64 -# define PRIu64 "lu" -# endif -# ifndef PRIx64 -# define PRIx64 "lx" -# endif -#else -# ifndef PRId64 -# define PRId64 "lld" -# endif -# ifndef PRIu64 -# define PRIu64 "llu" -# endif -# ifndef PRIx64 -# define PRIx64 "llx" -# endif -#endif - -#ifndef INT16_MAX -# define INT16_MAX 32767 -#endif -#ifndef INT32_MAX -# define INT32_MAX 2147483647L -#endif -#ifndef INT64_MAX -# define INT64_MAX 9223372036854775807LL -#endif -#ifndef UINT16_MAX -# define UINT16_MAX 65535U -#endif -#ifndef UINT32_MAX -# define UINT32_MAX 4294967295UL -#endif -#ifndef UINT64_MAX -# define UINT64_MAX 18446744073709551615ULL -#endif - -/***************************************************************************/ - -#endif diff --git a/ios/CodePush/SSZipArchive/minizip/mz_compat.c b/ios/CodePush/SSZipArchive/minizip/mz_compat.c deleted file mode 100644 index 9f251d576..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_compat.c +++ /dev/null @@ -1,1306 +0,0 @@ -/* mz_compat.c -- Backwards compatible interface for older versions - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - Copyright (C) 1998-2010 Gilles Vollant - https://www.winimage.com/zLibDll/minizip.html - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. - - WARNING: Be very careful updating/overwriting this file. - It has specific changes for SSZipArchive support with some structs moved to SSZipCommon for public access -*/ - -#include "mz.h" -#include "mz_os.h" -#include "mz_strm.h" -#include "mz_strm_mem.h" -#include "mz_strm_os.h" -#include "mz_strm_zlib.h" -#include "mz_zip.h" - -#include /* SEEK */ - -#include "mz_compat.h" - -/***************************************************************************/ - -typedef struct mz_compat_s { - void *stream; - void *handle; - uint64_t entry_index; - int64_t entry_pos; - int64_t total_out; -} mz_compat; - -/***************************************************************************/ - -typedef struct mz_stream_ioapi_s { - mz_stream stream; - void *handle; - zlib_filefunc_def filefunc; - zlib_filefunc64_def filefunc64; -} mz_stream_ioapi; - -/***************************************************************************/ - -static int32_t mz_stream_ioapi_open(void *stream, const char *path, int32_t mode); -static int32_t mz_stream_ioapi_is_open(void *stream); -static int32_t mz_stream_ioapi_read(void *stream, void *buf, int32_t size); -static int32_t mz_stream_ioapi_write(void *stream, const void *buf, int32_t size); -static int64_t mz_stream_ioapi_tell(void *stream); -static int32_t mz_stream_ioapi_seek(void *stream, int64_t offset, int32_t origin); -static int32_t mz_stream_ioapi_close(void *stream); -static int32_t mz_stream_ioapi_error(void *stream); -static void *mz_stream_ioapi_create(void **stream); -static void mz_stream_ioapi_delete(void **stream); - -/***************************************************************************/ - -static mz_stream_vtbl mz_stream_ioapi_vtbl = { - mz_stream_ioapi_open, - mz_stream_ioapi_is_open, - mz_stream_ioapi_read, - mz_stream_ioapi_write, - mz_stream_ioapi_tell, - mz_stream_ioapi_seek, - mz_stream_ioapi_close, - mz_stream_ioapi_error, - mz_stream_ioapi_create, - mz_stream_ioapi_delete, - NULL, - NULL -}; - -/***************************************************************************/ - -static int32_t mz_stream_ioapi_open(void *stream, const char *path, int32_t mode) { - mz_stream_ioapi *ioapi = (mz_stream_ioapi *)stream; - int32_t ioapi_mode = 0; - - if ((mode & MZ_OPEN_MODE_READWRITE) == MZ_OPEN_MODE_READ) - ioapi_mode = ZLIB_FILEFUNC_MODE_READ; - else if (mode & MZ_OPEN_MODE_APPEND) - ioapi_mode = ZLIB_FILEFUNC_MODE_EXISTING; - else if (mode & MZ_OPEN_MODE_CREATE) - ioapi_mode = ZLIB_FILEFUNC_MODE_CREATE; - else - return MZ_OPEN_ERROR; - - if (ioapi->filefunc64.zopen64_file) - ioapi->handle = ioapi->filefunc64.zopen64_file(ioapi->filefunc64.opaque, path, ioapi_mode); - else if (ioapi->filefunc.zopen_file) - ioapi->handle = ioapi->filefunc.zopen_file(ioapi->filefunc.opaque, path, ioapi_mode); - - if (!ioapi->handle) - return MZ_PARAM_ERROR; - - return MZ_OK; -} - -static int32_t mz_stream_ioapi_is_open(void *stream) { - mz_stream_ioapi *ioapi = (mz_stream_ioapi *)stream; - if (!ioapi->handle) - return MZ_OPEN_ERROR; - return MZ_OK; -} - -static int32_t mz_stream_ioapi_read(void *stream, void *buf, int32_t size) { - mz_stream_ioapi *ioapi = (mz_stream_ioapi *)stream; - read_file_func zread = NULL; - void *opaque = NULL; - - if (mz_stream_ioapi_is_open(stream) != MZ_OK) - return MZ_OPEN_ERROR; - - if (ioapi->filefunc64.zread_file) { - zread = ioapi->filefunc64.zread_file; - opaque = ioapi->filefunc64.opaque; - } else if (ioapi->filefunc.zread_file) { - zread = ioapi->filefunc.zread_file; - opaque = ioapi->filefunc.opaque; - } else - return MZ_PARAM_ERROR; - - return (int32_t)zread(opaque, ioapi->handle, buf, size); -} - -static int32_t mz_stream_ioapi_write(void *stream, const void *buf, int32_t size) { - mz_stream_ioapi *ioapi = (mz_stream_ioapi *)stream; - write_file_func zwrite = NULL; - int32_t written = 0; - void *opaque = NULL; - - if (mz_stream_ioapi_is_open(stream) != MZ_OK) - return MZ_OPEN_ERROR; - - if (ioapi->filefunc64.zwrite_file) { - zwrite = ioapi->filefunc64.zwrite_file; - opaque = ioapi->filefunc64.opaque; - } else if (ioapi->filefunc.zwrite_file) { - zwrite = ioapi->filefunc.zwrite_file; - opaque = ioapi->filefunc.opaque; - } else - return MZ_PARAM_ERROR; - - written = (int32_t)zwrite(opaque, ioapi->handle, buf, size); - return written; -} - -static int64_t mz_stream_ioapi_tell(void *stream) { - mz_stream_ioapi *ioapi = (mz_stream_ioapi *)stream; - - if (mz_stream_ioapi_is_open(stream) != MZ_OK) - return MZ_OPEN_ERROR; - - if (ioapi->filefunc64.ztell64_file) - return ioapi->filefunc64.ztell64_file(ioapi->filefunc64.opaque, ioapi->handle); - else if (ioapi->filefunc.ztell_file) - return ioapi->filefunc.ztell_file(ioapi->filefunc.opaque, ioapi->handle); - - return MZ_INTERNAL_ERROR; -} - -static int32_t mz_stream_ioapi_seek(void *stream, int64_t offset, int32_t origin) { - mz_stream_ioapi *ioapi = (mz_stream_ioapi *)stream; - - if (mz_stream_ioapi_is_open(stream) != MZ_OK) - return MZ_OPEN_ERROR; - - if (ioapi->filefunc64.zseek64_file) { - if (ioapi->filefunc64.zseek64_file(ioapi->filefunc64.opaque, ioapi->handle, offset, origin) != 0) - return MZ_INTERNAL_ERROR; - } else if (ioapi->filefunc.zseek_file) { - if (ioapi->filefunc.zseek_file(ioapi->filefunc.opaque, ioapi->handle, (int32_t)offset, origin) != 0) - return MZ_INTERNAL_ERROR; - } else - return MZ_PARAM_ERROR; - - return MZ_OK; -} - -static int32_t mz_stream_ioapi_close(void *stream) { - mz_stream_ioapi *ioapi = (mz_stream_ioapi *)stream; - close_file_func zclose = NULL; - void *opaque = NULL; - - if (mz_stream_ioapi_is_open(stream) != MZ_OK) - return MZ_OPEN_ERROR; - - if (ioapi->filefunc.zclose_file) { - zclose = ioapi->filefunc.zclose_file; - opaque = ioapi->filefunc.opaque; - } else if (ioapi->filefunc64.zclose_file) { - zclose = ioapi->filefunc64.zclose_file; - opaque = ioapi->filefunc64.opaque; - } else - return MZ_PARAM_ERROR; - - if (zclose(opaque, ioapi->handle) != 0) - return MZ_CLOSE_ERROR; - ioapi->handle = NULL; - return MZ_OK; -} - -static int32_t mz_stream_ioapi_error(void *stream) { - mz_stream_ioapi *ioapi = (mz_stream_ioapi *)stream; - testerror_file_func zerror = NULL; - void *opaque = NULL; - - if (mz_stream_ioapi_is_open(stream) != MZ_OK) - return MZ_OPEN_ERROR; - - if (ioapi->filefunc.zerror_file) { - zerror = ioapi->filefunc.zerror_file; - opaque = ioapi->filefunc.opaque; - } else if (ioapi->filefunc64.zerror_file) { - zerror = ioapi->filefunc64.zerror_file; - opaque = ioapi->filefunc64.opaque; - } else - return MZ_PARAM_ERROR; - - return zerror(opaque, ioapi->handle); -} - -static int32_t mz_stream_ioapi_set_filefunc(void *stream, zlib_filefunc_def *filefunc) { - mz_stream_ioapi *ioapi = (mz_stream_ioapi *)stream; - memcpy(&ioapi->filefunc, filefunc, sizeof(zlib_filefunc_def)); - return MZ_OK; -} - -static int32_t mz_stream_ioapi_set_filefunc64(void *stream, zlib_filefunc64_def *filefunc) { - mz_stream_ioapi *ioapi = (mz_stream_ioapi *)stream; - memcpy(&ioapi->filefunc64, filefunc, sizeof(zlib_filefunc64_def)); - return MZ_OK; -} - -static void *mz_stream_ioapi_create(void **stream) { - mz_stream_ioapi *ioapi = NULL; - - ioapi = (mz_stream_ioapi *)calloc(1, sizeof(mz_stream_ioapi)); - if (ioapi) - ioapi->stream.vtbl = &mz_stream_ioapi_vtbl; - if (stream) - *stream = ioapi; - - return ioapi; -} - -static void mz_stream_ioapi_delete(void **stream) { - mz_stream_ioapi *ioapi = NULL; - if (!stream) - return; - ioapi = (mz_stream_ioapi *)*stream; - if (ioapi) - free(ioapi); - *stream = NULL; -} - -/***************************************************************************/ - -void fill_fopen_filefunc(zlib_filefunc_def *pzlib_filefunc_def) { - /* For 32-bit file support only, compile with MZ_FILE32_API */ - if (pzlib_filefunc_def) - memset(pzlib_filefunc_def, 0, sizeof(zlib_filefunc_def)); -} - -void fill_fopen64_filefunc(zlib_filefunc64_def *pzlib_filefunc_def) { - /* All mz_stream_os_* support large files if compilation supports it */ - if (pzlib_filefunc_def) - memset(pzlib_filefunc_def, 0, sizeof(zlib_filefunc64_def)); -} - -void fill_win32_filefunc(zlib_filefunc_def *pzlib_filefunc_def) { - /* Handled by mz_stream_os_win32 */ - if (pzlib_filefunc_def) - memset(pzlib_filefunc_def, 0, sizeof(zlib_filefunc_def)); -} - -void fill_win32_filefunc64(zlib_filefunc64_def *pzlib_filefunc_def) { - /* Automatically supported in mz_stream_os_win32 */ - if (pzlib_filefunc_def) - memset(pzlib_filefunc_def, 0, sizeof(zlib_filefunc64_def)); -} - -void fill_win32_filefunc64A(zlib_filefunc64_def *pzlib_filefunc_def) { - /* Automatically supported in mz_stream_os_win32 */ - if (pzlib_filefunc_def) - memset(pzlib_filefunc_def, 0, sizeof(zlib_filefunc64_def)); -} - -/* NOTE: fill_win32_filefunc64W is no longer necessary since wide-character - support is automatically handled by the underlying os stream. Do not - pass wide-characters to zipOpen or unzOpen. */ - -void fill_memory_filefunc(zlib_filefunc_def *pzlib_filefunc_def) { - /* Use opaque to indicate which stream interface to create */ - if (pzlib_filefunc_def) { - memset(pzlib_filefunc_def, 0, sizeof(zlib_filefunc_def)); - pzlib_filefunc_def->opaque = mz_stream_mem_get_interface(); - } -} - -/***************************************************************************/ - -static int32_t zipConvertAppendToStreamMode(int append) { - int32_t mode = MZ_OPEN_MODE_WRITE; - switch (append) { - case APPEND_STATUS_CREATE: - mode |= MZ_OPEN_MODE_CREATE; - break; - case APPEND_STATUS_CREATEAFTER: - mode |= MZ_OPEN_MODE_CREATE | MZ_OPEN_MODE_APPEND; - break; - case APPEND_STATUS_ADDINZIP: - mode |= MZ_OPEN_MODE_READ | MZ_OPEN_MODE_APPEND; - break; - } - return mode; -} - -zipFile zipOpen(const char *path, int append) { - return zipOpen2(path, append, NULL, NULL); -} - -zipFile zipOpen64(const void *path, int append) { - return zipOpen2(path, append, NULL, NULL); -} - -zipFile zipOpen2(const char *path, int append, const char **globalcomment, - zlib_filefunc_def *pzlib_filefunc_def) { - zipFile zip = NULL; - int32_t mode = zipConvertAppendToStreamMode(append); - void *stream = NULL; - - if (pzlib_filefunc_def) { - if (pzlib_filefunc_def->zopen_file) { - if (!mz_stream_ioapi_create(&stream)) - return NULL; - mz_stream_ioapi_set_filefunc(stream, pzlib_filefunc_def); - } else if (pzlib_filefunc_def->opaque) { - if (!mz_stream_create(&stream, (mz_stream_vtbl *)pzlib_filefunc_def->opaque)) - return NULL; - } - } - - if (!stream) { - if (!mz_stream_os_create(&stream)) - return NULL; - } - - if (mz_stream_open(stream, path, mode) != MZ_OK) { - mz_stream_delete(&stream); - return NULL; - } - - zip = zipOpen_MZ(stream, append, globalcomment); - - if (!zip) { - mz_stream_delete(&stream); - return NULL; - } - - return zip; -} - -zipFile zipOpen2_64(const void *path, int append, const char **globalcomment, - zlib_filefunc64_def *pzlib_filefunc_def) { - zipFile zip = NULL; - int32_t mode = zipConvertAppendToStreamMode(append); - void *stream = NULL; - - if (pzlib_filefunc_def) { - if (pzlib_filefunc_def->zopen64_file) { - if (!mz_stream_ioapi_create(&stream)) - return NULL; - mz_stream_ioapi_set_filefunc64(stream, pzlib_filefunc_def); - } else if (pzlib_filefunc_def->opaque) { - if (!mz_stream_create(&stream, (mz_stream_vtbl *)pzlib_filefunc_def->opaque)) - return NULL; - } - } - - if (!stream) { - if (!mz_stream_os_create(&stream)) - return NULL; - } - - if (mz_stream_open(stream, path, mode) != MZ_OK) { - mz_stream_delete(&stream); - return NULL; - } - - zip = zipOpen_MZ(stream, append, globalcomment); - - if (!zip) { - mz_stream_delete(&stream); - return NULL; - } - - return zip; -} - -zipFile zipOpen_MZ(void *stream, int append, const char **globalcomment) { - mz_compat *compat = NULL; - int32_t err = MZ_OK; - int32_t mode = zipConvertAppendToStreamMode(append); - void *handle = NULL; - - mz_zip_create(&handle); - err = mz_zip_open(handle, stream, mode); - - if (err != MZ_OK) { - mz_zip_delete(&handle); - return NULL; - } - - if (globalcomment) - mz_zip_get_comment(handle, globalcomment); - - compat = (mz_compat *)calloc(1, sizeof(mz_compat)); - if (compat) { - compat->handle = handle; - compat->stream = stream; - } else { - mz_zip_delete(&handle); - } - - return (zipFile)compat; -} - -void* zipGetHandle_MZ(zipFile file) { - mz_compat *compat = (mz_compat *)file; - if (!compat) - return NULL; - return compat->handle; -} - -void* zipGetStream_MZ(zipFile file) { - mz_compat *compat = (mz_compat *)file; - if (!compat) - return NULL; - return (void *)compat->stream; -} - -int zipOpenNewFileInZip5(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int raw, int windowBits, int memLevel, int strategy, const char *password, - unsigned long crc_for_crypting, signed char aes, unsigned long version_madeby, unsigned long flag_base, int zip64) { - mz_compat *compat = (mz_compat *)file; - mz_zip_file file_info; - - MZ_UNUSED(strategy); - MZ_UNUSED(memLevel); - MZ_UNUSED(windowBits); - MZ_UNUSED(size_extrafield_local); - MZ_UNUSED(extrafield_local); - MZ_UNUSED(crc_for_crypting); - - if (!compat) - return ZIP_PARAMERROR; - - memset(&file_info, 0, sizeof(file_info)); - - if (zipfi) { - uint64_t dos_date = 0; - - if (zipfi->mz_dos_date != 0) - dos_date = zipfi->mz_dos_date; - else - dos_date = mz_zip_tm_to_dosdate(&zipfi->tmz_date); - - file_info.modified_date = mz_zip_dosdate_to_time_t(dos_date); - file_info.external_fa = zipfi->external_fa; - file_info.internal_fa = zipfi->internal_fa; - } - - if (!filename) - filename = "-"; - - file_info.compression_method = (uint16_t)compression_method; - file_info.filename = filename; - /* file_info.extrafield_local = extrafield_local; */ - /* file_info.extrafield_local_size = size_extrafield_local; */ - file_info.extrafield = extrafield_global; - file_info.extrafield_size = size_extrafield_global; - file_info.version_madeby = (uint16_t)version_madeby; - file_info.comment = comment; - if (file_info.comment) - file_info.comment_size = (uint16_t)strlen(file_info.comment); - file_info.flag = (uint16_t)flag_base; - if (zip64) - file_info.zip64 = MZ_ZIP64_FORCE; - else - file_info.zip64 = MZ_ZIP64_DISABLE; -#ifdef HAVE_WZAES - if ((aes && password) || (raw && (file_info.flag & MZ_ZIP_FLAG_ENCRYPTED))) - file_info.aes_version = MZ_AES_VERSION; -#endif - - return mz_zip_entry_write_open(compat->handle, &file_info, (int16_t)level, (uint8_t)raw, password); -} - -int zipOpenNewFileInZip4_64(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int raw, int windowBits, int memLevel, int strategy, const char *password, - unsigned long crc_for_crypting, unsigned long version_madeby, unsigned long flag_base, int zip64) { - return zipOpenNewFileInZip5(file, filename, zipfi, extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, comment, compression_method, level, raw, windowBits, - memLevel, strategy, password, crc_for_crypting, 0, version_madeby, flag_base, zip64); -} - -int zipOpenNewFileInZip4(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int raw, int windowBits, int memLevel, int strategy, const char *password, - unsigned long crc_for_crypting, unsigned long version_madeby, unsigned long flag_base) { - return zipOpenNewFileInZip4_64(file, filename, zipfi, extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, comment, compression_method, level, raw, windowBits, - memLevel, strategy, password, crc_for_crypting, version_madeby, flag_base, 0); -} - -int zipOpenNewFileInZip3(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int raw, int windowBits, int memLevel, int strategy, const char *password, - unsigned long crc_for_crypting) { - return zipOpenNewFileInZip3_64(file, filename, zipfi, extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, comment, compression_method, level, raw, windowBits, - memLevel, strategy, password, crc_for_crypting, 0); -} - -int zipOpenNewFileInZip3_64(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int raw, int windowBits, int memLevel, int strategy, const char *password, - unsigned long crc_for_crypting, int zip64) { - return zipOpenNewFileInZip4_64(file, filename, zipfi, extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, comment, compression_method, level, raw, windowBits, - memLevel, strategy, password, crc_for_crypting, MZ_VERSION_MADEBY, 0, zip64); -} - -int zipOpenNewFileInZip2(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int raw) { - return zipOpenNewFileInZip3_64(file, filename, zipfi, extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, comment, compression_method, level, raw, - 0, 0, 0, NULL, 0, 0); -} - -int zipOpenNewFileInZip2_64(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int raw, int zip64) { - return zipOpenNewFileInZip3_64(file, filename, zipfi, extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, comment, compression_method, level, raw, 0, - 0, 0, NULL, 0, zip64); -} - -int zipOpenNewFileInZip(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level) { - return zipOpenNewFileInZip_64(file, filename, zipfi, extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, comment, compression_method, level, 0); -} - -int zipOpenNewFileInZip_64(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int zip64) { - return zipOpenNewFileInZip2_64(file, filename, zipfi, extrafield_local, size_extrafield_local, - extrafield_global, size_extrafield_global, comment, compression_method, level, 0, zip64); -} - -int zipWriteInFileInZip(zipFile file, const void *buf, uint32_t len) { - mz_compat *compat = (mz_compat *)file; - int32_t written = 0; - if (!compat || len >= INT32_MAX) - return ZIP_PARAMERROR; - written = mz_zip_entry_write(compat->handle, buf, (int32_t)len); - if ((written < 0) || ((uint32_t)written != len)) - return ZIP_ERRNO; - return ZIP_OK; -} - -int zipCloseFileInZipRaw(zipFile file, unsigned long uncompressed_size, uint32_t crc32) { - return zipCloseFileInZipRaw64(file, uncompressed_size, crc32); -} - -int zipCloseFileInZipRaw64(zipFile file, uint64_t uncompressed_size, uint32_t crc32) { - mz_compat *compat = (mz_compat *)file; - if (!compat) - return ZIP_PARAMERROR; - return mz_zip_entry_close_raw(compat->handle, (int64_t)uncompressed_size, crc32); -} - -int zipCloseFileInZip(zipFile file) { - return zipCloseFileInZip64(file); -} - -int zipCloseFileInZip64(zipFile file) { - mz_compat *compat = (mz_compat *)file; - if (!compat) - return ZIP_PARAMERROR; - return mz_zip_entry_close(compat->handle); -} - -int zipClose(zipFile file, const char *global_comment) { - return zipClose_64(file, global_comment); -} - -int zipClose_64(zipFile file, const char *global_comment) { - return zipClose2_64(file, global_comment, MZ_VERSION_MADEBY); -} - -int zipClose2_64(zipFile file, const char *global_comment, uint16_t version_madeby) { - mz_compat *compat = (mz_compat *)file; - int32_t err = MZ_OK; - - if (compat->handle) - err = zipClose2_MZ(file, global_comment, version_madeby); - - if (compat->stream) { - mz_stream_close(compat->stream); - mz_stream_delete(&compat->stream); - } - - free(compat); - - return err; -} - -/* Only closes the zip handle, does not close the stream */ -int zipClose_MZ(zipFile file, const char *global_comment) { - return zipClose2_MZ(file, global_comment, MZ_VERSION_MADEBY); -} - -/* Only closes the zip handle, does not close the stream */ -int zipClose2_MZ(zipFile file, const char *global_comment, uint16_t version_madeby) { - mz_compat *compat = (mz_compat *)file; - int32_t err = MZ_OK; - - if (!compat) - return ZIP_PARAMERROR; - if (!compat->handle) - return err; - - if (global_comment) - mz_zip_set_comment(compat->handle, global_comment); - - mz_zip_set_version_madeby(compat->handle, version_madeby); - err = mz_zip_close(compat->handle); - mz_zip_delete(&compat->handle); - - return err; -} - -/***************************************************************************/ - -unzFile unzOpen(const char *path) { - return unzOpen64(path); -} - -unzFile unzOpen64(const void *path) { - return unzOpen2(path, NULL); -} - -unzFile unzOpen2(const char *path, zlib_filefunc_def *pzlib_filefunc_def) { - unzFile unz = NULL; - void *stream = NULL; - - if (pzlib_filefunc_def) { - if (pzlib_filefunc_def->zopen_file) { - if (!mz_stream_ioapi_create(&stream)) - return NULL; - mz_stream_ioapi_set_filefunc(stream, pzlib_filefunc_def); - } else if (pzlib_filefunc_def->opaque) { - if (!mz_stream_create(&stream, (mz_stream_vtbl *)pzlib_filefunc_def->opaque)) - return NULL; - } - } - - if (!stream) { - if (!mz_stream_os_create(&stream)) - return NULL; - } - - if (mz_stream_open(stream, path, MZ_OPEN_MODE_READ) != MZ_OK) { - mz_stream_delete(&stream); - return NULL; - } - - unz = unzOpen_MZ(stream); - if (!unz) { - mz_stream_close(stream); - mz_stream_delete(&stream); - return NULL; - } - return unz; -} - -unzFile unzOpen2_64(const void *path, zlib_filefunc64_def *pzlib_filefunc_def) { - unzFile unz = NULL; - void *stream = NULL; - - if (pzlib_filefunc_def) { - if (pzlib_filefunc_def->zopen64_file) { - if (!mz_stream_ioapi_create(&stream)) - return NULL; - mz_stream_ioapi_set_filefunc64(stream, pzlib_filefunc_def); - } else if (pzlib_filefunc_def->opaque) { - if (!mz_stream_create(&stream, (mz_stream_vtbl *)pzlib_filefunc_def->opaque)) - return NULL; - } - } - - if (!stream) { - if (!mz_stream_os_create(&stream)) - return NULL; - } - - if (mz_stream_open(stream, path, MZ_OPEN_MODE_READ) != MZ_OK) { - mz_stream_delete(&stream); - return NULL; - } - - unz = unzOpen_MZ(stream); - if (!unz) { - mz_stream_close(stream); - mz_stream_delete(&stream); - return NULL; - } - return unz; -} - -void* unzGetHandle_MZ(unzFile file) { - mz_compat *compat = (mz_compat *)file; - if (!compat) - return NULL; - return compat->handle; -} - -void* unzGetStream_MZ(unzFile file) { - mz_compat *compat = (mz_compat *)file; - if (!compat) - return NULL; - return compat->stream; -} - -unzFile unzOpen_MZ(void *stream) { - mz_compat *compat = NULL; - int32_t err = MZ_OK; - void *handle = NULL; - - mz_zip_create(&handle); - err = mz_zip_open(handle, stream, MZ_OPEN_MODE_READ); - - if (err != MZ_OK) { - mz_zip_delete(&handle); - return NULL; - } - - compat = (mz_compat *)calloc(1, sizeof(mz_compat)); - if (compat) { - compat->handle = handle; - compat->stream = stream; - - mz_zip_goto_first_entry(compat->handle); - } else { - mz_zip_delete(&handle); - } - - return (unzFile)compat; -} - -int unzClose(unzFile file) { - mz_compat *compat = (mz_compat *)file; - int32_t err = MZ_OK; - - if (!compat) - return UNZ_PARAMERROR; - - if (compat->handle) - err = unzClose_MZ(file); - - if (compat->stream) { - mz_stream_close(compat->stream); - mz_stream_delete(&compat->stream); - } - - free(compat); - - return err; -} - -/* Only closes the zip handle, does not close the stream */ -int unzClose_MZ(unzFile file) { - mz_compat *compat = (mz_compat *)file; - int32_t err = MZ_OK; - - if (!compat) - return UNZ_PARAMERROR; - - err = mz_zip_close(compat->handle); - mz_zip_delete(&compat->handle); - - return err; -} - -int unzGetGlobalInfo(unzFile file, unz_global_info* pglobal_info32) { - mz_compat *compat = (mz_compat *)file; - unz_global_info64 global_info64; - int32_t err = MZ_OK; - - memset(pglobal_info32, 0, sizeof(unz_global_info)); - if (!compat) - return UNZ_PARAMERROR; - - err = unzGetGlobalInfo64(file, &global_info64); - if (err == MZ_OK) { - pglobal_info32->number_entry = (uint32_t)global_info64.number_entry; - pglobal_info32->size_comment = global_info64.size_comment; - pglobal_info32->number_disk_with_CD = global_info64.number_disk_with_CD; - } - return err; -} - -int unzGetGlobalInfo64(unzFile file, unz_global_info64 *pglobal_info) { - mz_compat *compat = (mz_compat *)file; - const char *comment_ptr = NULL; - int32_t err = MZ_OK; - - memset(pglobal_info, 0, sizeof(unz_global_info64)); - if (!compat) - return UNZ_PARAMERROR; - err = mz_zip_get_comment(compat->handle, &comment_ptr); - if (err == MZ_OK) - pglobal_info->size_comment = (uint16_t)strlen(comment_ptr); - if ((err == MZ_OK) || (err == MZ_EXIST_ERROR)) - err = mz_zip_get_number_entry(compat->handle, &pglobal_info->number_entry); - if (err == MZ_OK) - err = mz_zip_get_disk_number_with_cd(compat->handle, &pglobal_info->number_disk_with_CD); - return err; -} - -int unzGetGlobalComment(unzFile file, char *comment, unsigned long comment_size) { - mz_compat *compat = (mz_compat *)file; - const char *comment_ptr = NULL; - int32_t err = MZ_OK; - - if (!comment || !comment_size) - return UNZ_PARAMERROR; - err = mz_zip_get_comment(compat->handle, &comment_ptr); - if (err == MZ_OK) { - strncpy(comment, comment_ptr, comment_size - 1); - comment[comment_size - 1] = 0; - } - return err; -} - -int unzOpenCurrentFile3(unzFile file, int *method, int *level, int raw, const char *password) { - mz_compat *compat = (mz_compat *)file; - mz_zip_file *file_info = NULL; - int32_t err = MZ_OK; - void *stream = NULL; - - if (!compat) - return UNZ_PARAMERROR; - if (method) - *method = 0; - if (level) - *level = 0; - - if (mz_zip_entry_is_open(compat->handle) == MZ_OK) { - /* zlib minizip does not error out here if close returns errors */ - unzCloseCurrentFile(file); - } - - compat->total_out = 0; - err = mz_zip_entry_read_open(compat->handle, (uint8_t)raw, password); - if (err == MZ_OK) - err = mz_zip_entry_get_info(compat->handle, &file_info); - if (err == MZ_OK) { - if (method) { - *method = file_info->compression_method; - } - - if (level) { - *level = 6; - switch (file_info->flag & 0x06) { - case MZ_ZIP_FLAG_DEFLATE_SUPER_FAST: - *level = 1; - break; - case MZ_ZIP_FLAG_DEFLATE_FAST: - *level = 2; - break; - case MZ_ZIP_FLAG_DEFLATE_MAX: - *level = 9; - break; - } - } - } - if (err == MZ_OK) - err = mz_zip_get_stream(compat->handle, &stream); - if (err == MZ_OK) - compat->entry_pos = mz_stream_tell(stream); - return err; -} - -int unzOpenCurrentFile(unzFile file) { - return unzOpenCurrentFile3(file, NULL, NULL, 0, NULL); -} - -int unzOpenCurrentFilePassword(unzFile file, const char *password) { - return unzOpenCurrentFile3(file, NULL, NULL, 0, password); -} - -int unzOpenCurrentFile2(unzFile file, int *method, int *level, int raw) { - return unzOpenCurrentFile3(file, method, level, raw, NULL); -} - -int unzReadCurrentFile(unzFile file, void *buf, uint32_t len) { - mz_compat *compat = (mz_compat *)file; - int32_t err = MZ_OK; - if (!compat || len >= INT32_MAX) - return UNZ_PARAMERROR; - err = mz_zip_entry_read(compat->handle, buf, (int32_t)len); - if (err > 0) - compat->total_out += (uint32_t)err; - return err; -} - -int unzCloseCurrentFile(unzFile file) { - mz_compat *compat = (mz_compat *)file; - int32_t err = MZ_OK; - if (!compat) - return UNZ_PARAMERROR; - err = mz_zip_entry_close(compat->handle); - return err; -} - -int unzGetCurrentFileInfo(unzFile file, unz_file_info *pfile_info, char *filename, - unsigned long filename_size, void *extrafield, unsigned long extrafield_size, char *comment, - unsigned long comment_size) { - mz_compat *compat = (mz_compat *)file; - mz_zip_file *file_info = NULL; - uint16_t bytes_to_copy = 0; - int32_t err = MZ_OK; - - if (!compat) - return UNZ_PARAMERROR; - - err = mz_zip_entry_get_info(compat->handle, &file_info); - if (err != MZ_OK) - return err; - - if (pfile_info) { - pfile_info->version = file_info->version_madeby; - pfile_info->version_needed = file_info->version_needed; - pfile_info->flag = file_info->flag; - pfile_info->compression_method = file_info->compression_method; - pfile_info->mz_dos_date = mz_zip_time_t_to_dos_date(file_info->modified_date); - //mz_zip_time_t_to_tm(file_info->modified_date, &pfile_info->tmu_date); - //pfile_info->tmu_date.tm_year += 1900; - pfile_info->crc = file_info->crc; - - pfile_info->size_filename = file_info->filename_size; - pfile_info->size_file_extra = file_info->extrafield_size; - pfile_info->size_file_comment = file_info->comment_size; - - pfile_info->disk_num_start = (uint16_t)file_info->disk_number; - pfile_info->internal_fa = file_info->internal_fa; - pfile_info->external_fa = file_info->external_fa; - - pfile_info->compressed_size = (uint32_t)file_info->compressed_size; - pfile_info->uncompressed_size = (uint32_t)file_info->uncompressed_size; - } - if (filename_size > 0 && filename && file_info->filename) { - bytes_to_copy = (uint16_t)filename_size; - if (bytes_to_copy > file_info->filename_size) - bytes_to_copy = file_info->filename_size; - memcpy(filename, file_info->filename, bytes_to_copy); - if (bytes_to_copy < filename_size) - filename[bytes_to_copy] = 0; - } - if (extrafield_size > 0 && extrafield) { - bytes_to_copy = (uint16_t)extrafield_size; - if (bytes_to_copy > file_info->extrafield_size) - bytes_to_copy = file_info->extrafield_size; - memcpy(extrafield, file_info->extrafield, bytes_to_copy); - } - if (comment_size > 0 && comment && file_info->comment) { - bytes_to_copy = (uint16_t)comment_size; - if (bytes_to_copy > file_info->comment_size) - bytes_to_copy = file_info->comment_size; - memcpy(comment, file_info->comment, bytes_to_copy); - if (bytes_to_copy < comment_size) - comment[bytes_to_copy] = 0; - } - return err; -} - -int unzGetCurrentFileInfo64(unzFile file, unz_file_info64 * pfile_info, char *filename, - unsigned long filename_size, void *extrafield, unsigned long extrafield_size, char *comment, - unsigned long comment_size) { - mz_compat *compat = (mz_compat *)file; - mz_zip_file *file_info = NULL; - uint16_t bytes_to_copy = 0; - int32_t err = MZ_OK; - - if (!compat) - return UNZ_PARAMERROR; - - err = mz_zip_entry_get_info(compat->handle, &file_info); - if (err != MZ_OK) - return err; - - if (pfile_info) { - pfile_info->version = file_info->version_madeby; - pfile_info->version_needed = file_info->version_needed; - pfile_info->flag = file_info->flag; - pfile_info->compression_method = file_info->compression_method; - pfile_info->mz_dos_date = mz_zip_time_t_to_dos_date(file_info->modified_date); - //mz_zip_time_t_to_tm(file_info->modified_date, &pfile_info->tmu_date); - //pfile_info->tmu_date.tm_year += 1900; - pfile_info->crc = file_info->crc; - - pfile_info->size_filename = file_info->filename_size; - pfile_info->size_file_extra = file_info->extrafield_size; - pfile_info->size_file_comment = file_info->comment_size; - - pfile_info->disk_num_start = file_info->disk_number; - pfile_info->internal_fa = file_info->internal_fa; - pfile_info->external_fa = file_info->external_fa; - - pfile_info->compressed_size = (uint64_t)file_info->compressed_size; - pfile_info->uncompressed_size = (uint64_t)file_info->uncompressed_size; - } - if (filename_size > 0 && filename && file_info->filename) { - bytes_to_copy = (uint16_t)filename_size; - if (bytes_to_copy > file_info->filename_size) - bytes_to_copy = file_info->filename_size; - memcpy(filename, file_info->filename, bytes_to_copy); - if (bytes_to_copy < filename_size) - filename[bytes_to_copy] = 0; - } - if (extrafield_size > 0 && extrafield) { - bytes_to_copy = (uint16_t)extrafield_size; - if (bytes_to_copy > file_info->extrafield_size) - bytes_to_copy = file_info->extrafield_size; - memcpy(extrafield, file_info->extrafield, bytes_to_copy); - } - if (comment_size > 0 && comment && file_info->comment) { - bytes_to_copy = (uint16_t)comment_size; - if (bytes_to_copy > file_info->comment_size) - bytes_to_copy = file_info->comment_size; - memcpy(comment, file_info->comment, bytes_to_copy); - if (bytes_to_copy < comment_size) - comment[bytes_to_copy] = 0; - } - return err; -} - -int unzGoToFirstFile(unzFile file) { - mz_compat *compat = (mz_compat *)file; - if (!compat) - return UNZ_PARAMERROR; - compat->entry_index = 0; - return mz_zip_goto_first_entry(compat->handle); -} - -int unzGoToNextFile(unzFile file) { - mz_compat *compat = (mz_compat *)file; - int32_t err = MZ_OK; - if (!compat) - return UNZ_PARAMERROR; - err = mz_zip_goto_next_entry(compat->handle); - if (err != MZ_END_OF_LIST) - compat->entry_index += 1; - return err; -} - -int unzLocateFile(unzFile file, const char *filename, unzFileNameComparer filename_compare_func) { - mz_compat *compat = (mz_compat *)file; - mz_zip_file *file_info = NULL; - uint64_t preserve_index = 0; - int32_t err = MZ_OK; - int32_t result = 0; - - if (!compat) - return UNZ_PARAMERROR; - - preserve_index = compat->entry_index; - - err = mz_zip_goto_first_entry(compat->handle); - while (err == MZ_OK) { - err = mz_zip_entry_get_info(compat->handle, &file_info); - if (err != MZ_OK) - break; - - if ((intptr_t)filename_compare_func > 2) { - result = filename_compare_func(file, filename, file_info->filename); - } else { - int32_t case_sensitive = (int32_t)(intptr_t)filename_compare_func; - result = mz_path_compare_wc(filename, file_info->filename, !case_sensitive); - } - - if (result == 0) - return MZ_OK; - - err = mz_zip_goto_next_entry(compat->handle); - } - - compat->entry_index = preserve_index; - return err; -} - -/***************************************************************************/ - -int unzGetFilePos(unzFile file, unz_file_pos *file_pos) { - unz64_file_pos file_pos64; - int32_t err = 0; - - err = unzGetFilePos64(file, &file_pos64); - if (err < 0) - return err; - - file_pos->pos_in_zip_directory = (uint32_t)file_pos64.pos_in_zip_directory; - file_pos->num_of_file = (uint32_t)file_pos64.num_of_file; - return err; -} - -int unzGoToFilePos(unzFile file, unz_file_pos *file_pos) { - mz_compat *compat = (mz_compat *)file; - unz64_file_pos file_pos64; - - if (!compat || !file_pos) - return UNZ_PARAMERROR; - - file_pos64.pos_in_zip_directory = file_pos->pos_in_zip_directory; - file_pos64.num_of_file = file_pos->num_of_file; - - return unzGoToFilePos64(file, &file_pos64); -} - -int unzGetFilePos64(unzFile file, unz64_file_pos *file_pos) { - mz_compat *compat = (mz_compat *)file; - int64_t offset = 0; - - if (!compat || !file_pos) - return UNZ_PARAMERROR; - - offset = unzGetOffset64(file); - if (offset < 0) - return (int)offset; - - file_pos->pos_in_zip_directory = offset; - file_pos->num_of_file = compat->entry_index; - return UNZ_OK; -} - -int unzGoToFilePos64(unzFile file, const unz64_file_pos *file_pos) { - mz_compat *compat = (mz_compat *)file; - int32_t err = MZ_OK; - - if (!compat || !file_pos) - return UNZ_PARAMERROR; - - err = mz_zip_goto_entry(compat->handle, file_pos->pos_in_zip_directory); - if (err == MZ_OK) - compat->entry_index = file_pos->num_of_file; - return err; -} - -unsigned long unzGetOffset(unzFile file) { - return (uint32_t)unzGetOffset64(file); -} - -int64_t unzGetOffset64(unzFile file) { - mz_compat *compat = (mz_compat *)file; - if (!compat) - return UNZ_PARAMERROR; - return mz_zip_get_entry(compat->handle); -} - -int unzSetOffset(unzFile file, unsigned long pos) { - return unzSetOffset64(file, pos); -} - -int unzSetOffset64(unzFile file, int64_t pos) { - mz_compat *compat = (mz_compat *)file; - if (!compat) - return UNZ_PARAMERROR; - return (int)mz_zip_goto_entry(compat->handle, pos); -} - -int unzGetLocalExtrafield(unzFile file, void *buf, unsigned int len) { - mz_compat *compat = (mz_compat *)file; - mz_zip_file *file_info = NULL; - int32_t err = MZ_OK; - int32_t bytes_to_copy = 0; - - if (!compat || !buf || len >= INT32_MAX) - return UNZ_PARAMERROR; - - err = mz_zip_entry_get_local_info(compat->handle, &file_info); - if (err != MZ_OK) - return err; - - bytes_to_copy = (int32_t)len; - if (bytes_to_copy > file_info->extrafield_size) - bytes_to_copy = file_info->extrafield_size; - - memcpy(buf, file_info->extrafield, bytes_to_copy); - return MZ_OK; -} - -int32_t unzTell(unzFile file) { - return unztell(file); -} - -int32_t unztell(unzFile file) { - return (int32_t)unztell64(file); -} - -uint64_t unzTell64(unzFile file) { - return unztell64(file); -} - -uint64_t unztell64(unzFile file) { - mz_compat *compat = (mz_compat *)file; - if (!compat) - return UNZ_PARAMERROR; - return compat->total_out; -} - -int unzSeek(unzFile file, int32_t offset, int origin) { - return unzSeek64(file, offset, origin); -} - -int unzSeek64(unzFile file, int64_t offset, int origin) { - mz_compat *compat = (mz_compat *)file; - mz_zip_file *file_info = NULL; - int64_t position = 0; - int32_t err = MZ_OK; - void *stream = NULL; - - if (!compat) - return UNZ_PARAMERROR; - err = mz_zip_entry_get_info(compat->handle, &file_info); - if (err != MZ_OK) - return err; - if (file_info->compression_method != MZ_COMPRESS_METHOD_STORE) - return UNZ_ERRNO; - - if (origin == SEEK_SET) - position = offset; - else if (origin == SEEK_CUR) - position = compat->total_out + offset; - else if (origin == SEEK_END) - position = (int64_t)file_info->compressed_size + offset; - else - return UNZ_PARAMERROR; - - if (position > (int64_t)file_info->compressed_size) - return UNZ_PARAMERROR; - - err = mz_zip_get_stream(compat->handle, &stream); - if (err == MZ_OK) - err = mz_stream_seek(stream, compat->entry_pos + position, MZ_SEEK_SET); - if (err == MZ_OK) - compat->total_out = position; - return err; -} - -int unzEndOfFile(unzFile file) { - return unzeof(file); -} - -int unzeof(unzFile file) { - mz_compat *compat = (mz_compat *)file; - mz_zip_file *file_info = NULL; - int32_t err = MZ_OK; - - if (!compat) - return UNZ_PARAMERROR; - err = mz_zip_entry_get_info(compat->handle, &file_info); - if (err != MZ_OK) - return err; - if (compat->total_out == (int64_t)file_info->uncompressed_size) - return 1; - return 0; -} - -void* unzGetStream(unzFile file) { - mz_compat *compat = (mz_compat *)file; - if (!compat) - return NULL; - return (void *)compat->stream; -} - -/***************************************************************************/ diff --git a/ios/CodePush/SSZipArchive/minizip/mz_compat.h b/ios/CodePush/SSZipArchive/minizip/mz_compat.h deleted file mode 100644 index 6192166f5..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_compat.h +++ /dev/null @@ -1,346 +0,0 @@ -/* mz_compat.h -- Backwards compatible interface for older versions - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - Copyright (C) 1998-2010 Gilles Vollant - https://www.winimage.com/zLibDll/minizip.html - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. - - WARNING: Be very careful updating/overwriting this file. - It has specific changes for SSZipArchive support with some structs moved to SSZipCommon for public access -*/ - -#ifndef MZ_COMPAT_H -#define MZ_COMPAT_H - -#include "mz.h" -#include "../SSZipCommon.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************************/ - -#if defined(HAVE_ZLIB) && defined(MAX_MEM_LEVEL) -#ifndef DEF_MEM_LEVEL -# if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -# else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -# endif -#endif -#endif -#ifndef MAX_WBITS -#define MAX_WBITS 15 //removed () to suppress warning about ambiguous expansion of macro -SSZipArchive -#endif -#ifndef DEF_MEM_LEVEL -#define DEF_MEM_LEVEL (8) -#endif - -#ifndef ZEXPORT -# define ZEXPORT MZ_EXPORT -#endif - -/***************************************************************************/ - -#if defined(STRICTZIP) || defined(STRICTZIPUNZIP) -/* like the STRICT of WIN32, we define a pointer that cannot be converted - from (void*) without cast */ -typedef struct TagzipFile__ { int unused; } zip_file__; -typedef zip_file__ *zipFile; -#else -typedef void *zipFile; -#endif - -/***************************************************************************/ - -typedef uint64_t ZPOS64_T; - -#ifndef ZCALLBACK -#define ZCALLBACK -#endif - -typedef void* (ZCALLBACK *open_file_func) (void *opaque, const char *filename, int mode); -typedef void* (ZCALLBACK *open64_file_func) (void *opaque, const void *filename, int mode); -typedef unsigned long (ZCALLBACK *read_file_func) (void *opaque, void *stream, void* buf, unsigned long size); -typedef unsigned long (ZCALLBACK *write_file_func) (void *opaque, void *stream, const void* buf, - unsigned long size); -typedef int (ZCALLBACK *close_file_func) (void *opaque, void *stream); -typedef int (ZCALLBACK *testerror_file_func)(void *opaque, void *stream); -typedef long (ZCALLBACK *tell_file_func) (void *opaque, void *stream); -typedef ZPOS64_T (ZCALLBACK *tell64_file_func) (void *opaque, void *stream); -typedef long (ZCALLBACK *seek_file_func) (void *opaque, void *stream, unsigned long offset, int origin); -typedef long (ZCALLBACK *seek64_file_func) (void *opaque, void *stream, ZPOS64_T offset, int origin); - -typedef struct zlib_filefunc_def_s -{ - open_file_func zopen_file; - read_file_func zread_file; - write_file_func zwrite_file; - tell_file_func ztell_file; - seek_file_func zseek_file; - close_file_func zclose_file; - testerror_file_func zerror_file; - void* opaque; -} zlib_filefunc_def; - -typedef struct zlib_filefunc64_def_s -{ - open64_file_func zopen64_file; - read_file_func zread_file; - write_file_func zwrite_file; - tell64_file_func ztell64_file; - seek64_file_func zseek64_file; - close_file_func zclose_file; - testerror_file_func zerror_file; - void* opaque; -} zlib_filefunc64_def; - -/***************************************************************************/ - -#define ZLIB_FILEFUNC_SEEK_SET (0) -#define ZLIB_FILEFUNC_SEEK_CUR (1) -#define ZLIB_FILEFUNC_SEEK_END (2) - -#define ZLIB_FILEFUNC_MODE_READ (1) -#define ZLIB_FILEFUNC_MODE_WRITE (2) -#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3) - -#define ZLIB_FILEFUNC_MODE_EXISTING (4) -#define ZLIB_FILEFUNC_MODE_CREATE (8) - -/***************************************************************************/ - -ZEXPORT void fill_fopen_filefunc(zlib_filefunc_def *pzlib_filefunc_def); -ZEXPORT void fill_fopen64_filefunc(zlib_filefunc64_def *pzlib_filefunc_def); -ZEXPORT void fill_win32_filefunc(zlib_filefunc_def *pzlib_filefunc_def); -ZEXPORT void fill_win32_filefunc64(zlib_filefunc64_def *pzlib_filefunc_def); -ZEXPORT void fill_win32_filefunc64A(zlib_filefunc64_def *pzlib_filefunc_def); -ZEXPORT void fill_memory_filefunc(zlib_filefunc_def *pzlib_filefunc_def); - -/***************************************************************************/ - - -// SSZipArchive 2.x+ uses dos_date -#define MZ_COMPAT_VERSION 120 - -#if MZ_COMPAT_VERSION <= 110 -#define mz_dos_date dosDate -#else -#define mz_dos_date dos_date -#endif - -typedef struct tm tm_unz; -typedef struct tm tm_zip; - -typedef struct { - uint32_t mz_dos_date; - struct tm tmz_date; - uint16_t internal_fa; /* internal file attributes 2 bytes */ - uint32_t external_fa; /* external file attributes 4 bytes */ -} zip_fileinfo; - -typedef const char *zipcharpc; - -/***************************************************************************/ - -#define ZIP_OK (0) -#define ZIP_EOF (0) -#define ZIP_ERRNO (-1) -#define ZIP_PARAMERROR (-102) -#define ZIP_BADZIPFILE (-103) -#define ZIP_INTERNALERROR (-104) - -#ifndef Z_DEFLATED -#define Z_DEFLATED 8 //removed () to suppress warning about ambiguous expansion of macro -SSZipArchive -#endif -#define Z_BZIP2ED (12) - -#define APPEND_STATUS_CREATE (0) -#define APPEND_STATUS_CREATEAFTER (1) -#define APPEND_STATUS_ADDINZIP (2) - -/***************************************************************************/ -/* Writing a zip file */ - -ZEXPORT zipFile zipOpen(const char *path, int append); -ZEXPORT zipFile zipOpen64(const void *path, int append); -ZEXPORT zipFile zipOpen2(const char *path, int append, const char **globalcomment, - zlib_filefunc_def *pzlib_filefunc_def); - -ZEXPORT zipFile zipOpen2_64(const void *path, int append, const char **globalcomment, - zlib_filefunc64_def *pzlib_filefunc_def); -ZEXPORT zipFile zipOpen_MZ(void *stream, int append, const char **globalcomment); - -ZEXPORT void* zipGetHandle_MZ(zipFile); -ZEXPORT void* zipGetStream_MZ(zipFile file); - -ZEXPORT int zipOpenNewFileInZip(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level); -ZEXPORT int zipOpenNewFileInZip_64(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int zip64); -ZEXPORT int zipOpenNewFileInZip2(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int raw); -ZEXPORT int zipOpenNewFileInZip2_64(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int raw, int zip64); -ZEXPORT int zipOpenNewFileInZip3(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int raw, int windowBits, int memLevel, int strategy, const char *password, - unsigned long crc_for_crypting); -ZEXPORT int zipOpenNewFileInZip3_64(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int raw, int windowBits, int memLevel, int strategy, const char *password, - unsigned long crc_for_crypting, int zip64); -ZEXPORT int zipOpenNewFileInZip4(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int raw, int windowBits, int memLevel, int strategy, const char *password, - unsigned long crc_for_crypting, unsigned long version_madeby, unsigned long flag_base); -ZEXPORT int zipOpenNewFileInZip4_64(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int raw, int windowBits, int memLevel, int strategy, const char *password, - unsigned long crc_for_crypting, unsigned long version_madeby, unsigned long flag_base, int zip64); -ZEXPORT int zipOpenNewFileInZip5(zipFile file, const char *filename, const zip_fileinfo *zipfi, - const void *extrafield_local, uint16_t size_extrafield_local, const void *extrafield_global, - uint16_t size_extrafield_global, const char *comment, int compression_method, int level, - int raw, int windowBits, int memLevel, int strategy, const char *password, - unsigned long crc_for_crypting, signed char aes, unsigned long version_madeby, unsigned long flag_base, int zip64); - -ZEXPORT int zipWriteInFileInZip(zipFile file, const void *buf, uint32_t len); - -ZEXPORT int zipCloseFileInZipRaw(zipFile file, unsigned long uncompressed_size, uint32_t crc32); -ZEXPORT int zipCloseFileInZipRaw64(zipFile file, uint64_t uncompressed_size, uint32_t crc32); -ZEXPORT int zipCloseFileInZip(zipFile file); -ZEXPORT int zipCloseFileInZip64(zipFile file); - -ZEXPORT int zipClose(zipFile file, const char *global_comment); -ZEXPORT int zipClose_64(zipFile file, const char *global_comment); -ZEXPORT int zipClose2_64(zipFile file, const char *global_comment, uint16_t version_madeby); - int zipClose_MZ(zipFile file, const char *global_comment); - int zipClose2_MZ(zipFile file, const char *global_comment, uint16_t version_madeby); - -/***************************************************************************/ - -#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP) -/* like the STRICT of WIN32, we define a pointer that cannot be converted - from (void*) without cast */ -typedef struct TagunzFile__ { int unused; } unz_file__; -typedef unz_file__ *unzFile; -#else -typedef void *unzFile; -#endif - -/***************************************************************************/ - -#define UNZ_OK (0) -#define UNZ_END_OF_LIST_OF_FILE (-100) -#define UNZ_ERRNO (-1) -#define UNZ_EOF (0) -#define UNZ_PARAMERROR (-102) -#define UNZ_BADZIPFILE (-103) -#define UNZ_INTERNALERROR (-104) -#define UNZ_CRCERROR (-105) -#define UNZ_BADPASSWORD (-106) - -/***************************************************************************/ - -typedef int (*unzFileNameComparer)(unzFile file, const char *filename1, const char *filename2); -typedef int (*unzIteratorFunction)(unzFile file); -typedef int (*unzIteratorFunction2)(unzFile file, unz_file_info64 *pfile_info, char *filename, - uint16_t filename_size, void *extrafield, uint16_t extrafield_size, char *comment, - uint16_t comment_size); - -/***************************************************************************/ -/* Reading a zip file */ - -ZEXPORT unzFile unzOpen(const char *path); -ZEXPORT unzFile unzOpen64(const void *path); -ZEXPORT unzFile unzOpen2(const char *path, zlib_filefunc_def *pzlib_filefunc_def); -ZEXPORT unzFile unzOpen2_64(const void *path, zlib_filefunc64_def *pzlib_filefunc_def); - unzFile unzOpen_MZ(void *stream); - -ZEXPORT int unzClose(unzFile file); -ZEXPORT int unzClose_MZ(unzFile file); - -ZEXPORT void* unzGetHandle_MZ(unzFile file); -ZEXPORT void* unzGetStream_MZ(zipFile file); - -ZEXPORT int unzGetGlobalInfo(unzFile file, unz_global_info* pglobal_info32); -ZEXPORT int unzGetGlobalInfo64(unzFile file, unz_global_info64 *pglobal_info); -ZEXPORT int unzGetGlobalComment(unzFile file, char *comment, unsigned long comment_size); - -ZEXPORT int unzOpenCurrentFile(unzFile file); -ZEXPORT int unzOpenCurrentFilePassword(unzFile file, const char *password); -ZEXPORT int unzOpenCurrentFile2(unzFile file, int *method, int *level, int raw); -ZEXPORT int unzOpenCurrentFile3(unzFile file, int *method, int *level, int raw, const char *password); -ZEXPORT int unzReadCurrentFile(unzFile file, void *buf, uint32_t len); -ZEXPORT int unzCloseCurrentFile(unzFile file); - -ZEXPORT int unzGetCurrentFileInfo(unzFile file, unz_file_info *pfile_info, char *filename, - unsigned long filename_size, void *extrafield, unsigned long extrafield_size, char *comment, - unsigned long comment_size); -ZEXPORT int unzGetCurrentFileInfo64(unzFile file, unz_file_info64 * pfile_info, char *filename, - unsigned long filename_size, void *extrafield, unsigned long extrafield_size, char *comment, - unsigned long comment_size); - -ZEXPORT int unzGoToFirstFile(unzFile file); -ZEXPORT int unzGoToNextFile(unzFile file); -ZEXPORT int unzLocateFile(unzFile file, const char *filename, unzFileNameComparer filename_compare_func); - -ZEXPORT int unzGetLocalExtrafield(unzFile file, void *buf, unsigned int len); - -/***************************************************************************/ -/* Raw access to zip file */ - -typedef struct unz_file_pos_s { - uint32_t pos_in_zip_directory; /* offset in zip file directory */ - uint32_t num_of_file; /* # of file */ -} unz_file_pos; - -ZEXPORT int unzGetFilePos(unzFile file, unz_file_pos *file_pos); -ZEXPORT int unzGoToFilePos(unzFile file, unz_file_pos *file_pos); - -typedef struct unz64_file_pos_s { - int64_t pos_in_zip_directory; /* offset in zip file directory */ - uint64_t num_of_file; /* # of file */ -} unz64_file_pos; - -ZEXPORT int unzGetFilePos64(unzFile file, unz64_file_pos *file_pos); -ZEXPORT int unzGoToFilePos64(unzFile file, const unz64_file_pos *file_pos); - -ZEXPORT int64_t unzGetOffset64(unzFile file); -ZEXPORT unsigned long - unzGetOffset(unzFile file); -ZEXPORT int unzSetOffset64(unzFile file, int64_t pos); -ZEXPORT int unzSetOffset(unzFile file, unsigned long pos); -ZEXPORT int32_t unztell(unzFile file); -ZEXPORT int32_t unzTell(unzFile file); -ZEXPORT uint64_t unztell64(unzFile file); -ZEXPORT uint64_t unzTell64(unzFile file); -ZEXPORT int unzSeek(unzFile file, int32_t offset, int origin); -ZEXPORT int unzSeek64(unzFile file, int64_t offset, int origin); -ZEXPORT int unzEndOfFile(unzFile file); -ZEXPORT int unzeof(unzFile file); -ZEXPORT void* unzGetStream(unzFile file); - -/***************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/CodePush/SSZipArchive/minizip/mz_crypt.c b/ios/CodePush/SSZipArchive/minizip/mz_crypt.c deleted file mode 100644 index 86b97d909..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +++ /dev/null @@ -1,187 +0,0 @@ -/* mz_crypt.c -- Crypto/hash functions - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#include "mz.h" -#include "mz_os.h" -#include "mz_crypt.h" - -#if defined(HAVE_ZLIB) -# if !defined(ZLIB_COMPAT) -# include "zlib-ng.h" -# define ZLIB_PREFIX(x) zng_##x -# else -# include "zlib.h" -# define ZLIB_PREFIX(x) x -# endif -#elif defined(HAVE_LZMA) -# include "lzma.h" -#endif - -/***************************************************************************/ - -#if defined(MZ_ZIP_NO_CRYPTO) -int32_t mz_crypt_rand(uint8_t *buf, int32_t size) { - return mz_os_rand(buf, size); -} -#endif - -uint32_t mz_crypt_crc32_update(uint32_t value, const uint8_t *buf, int32_t size) { -#if defined(HAVE_ZLIB) - /* Define z_crc_t in zlib 1.2.5 and less or if using zlib-ng */ -# if (ZLIB_VERNUM < 0x1270) - typedef unsigned long z_crc_t; -# else - typedef uint32_t z_crc_t; -# endif - return (uint32_t)ZLIB_PREFIX(crc32)((z_crc_t)value, buf, (uInt)size); -#elif defined(HAVE_LZMA) - return (uint32_t)lzma_crc32(buf, (size_t)size, (uint32_t)value); -#else - static uint32_t crc32_table[256] = { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, - 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, - 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, - 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, - 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, - 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, - 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, - 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, - 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, - 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, - 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, - 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, - 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, - 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, - 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, - 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, - 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, - 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, - 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, - 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, - 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, - 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, - 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, - 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, - 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, - 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, - 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d - }; - value = ~value; - - while (size > 0) { - value = (value >> 8) ^ crc32_table[(value ^ *buf) & 0xFF]; - - buf += 1; - size -= 1; - } - - return ~value; -#endif -} - -#if defined(HAVE_WZAES) -int32_t mz_crypt_pbkdf2(uint8_t *password, int32_t password_length, uint8_t *salt, - int32_t salt_length, uint16_t iteration_count, uint8_t *key, uint16_t key_length) { - void *hmac1 = NULL; - void *hmac2 = NULL; - void *hmac3 = NULL; - int32_t err = MZ_OK; - uint16_t i = 0; - uint16_t j = 0; - uint16_t k = 0; - uint16_t block_count = 0; - uint8_t uu[MZ_HASH_SHA1_SIZE]; - uint8_t ux[MZ_HASH_SHA1_SIZE]; - - if (!password || !salt || !key) - return MZ_PARAM_ERROR; - - memset(key, 0, key_length); - - mz_crypt_hmac_create(&hmac1); - mz_crypt_hmac_create(&hmac2); - mz_crypt_hmac_create(&hmac3); - - mz_crypt_hmac_set_algorithm(hmac1, MZ_HASH_SHA1); - mz_crypt_hmac_set_algorithm(hmac2, MZ_HASH_SHA1); - mz_crypt_hmac_set_algorithm(hmac3, MZ_HASH_SHA1); - - err = mz_crypt_hmac_init(hmac1, password, password_length); - if (err == MZ_OK) - err = mz_crypt_hmac_init(hmac2, password, password_length); - if (err == MZ_OK) - err = mz_crypt_hmac_update(hmac2, salt, salt_length); - - block_count = 1 + ((uint16_t)key_length - 1) / MZ_HASH_SHA1_SIZE; - - for (i = 0; (err == MZ_OK) && (i < block_count); i += 1) { - memset(ux, 0, sizeof(ux)); - - err = mz_crypt_hmac_copy(hmac2, hmac3); - if (err != MZ_OK) - break; - - uu[0] = (uint8_t)((i + 1) >> 24); - uu[1] = (uint8_t)((i + 1) >> 16); - uu[2] = (uint8_t)((i + 1) >> 8); - uu[3] = (uint8_t)(i + 1); - - for (j = 0, k = 4; j < iteration_count; j += 1) { - err = mz_crypt_hmac_update(hmac3, uu, k); - if (err == MZ_OK) - err = mz_crypt_hmac_end(hmac3, uu, sizeof(uu)); - if (err != MZ_OK) - break; - - for (k = 0; k < MZ_HASH_SHA1_SIZE; k += 1) - ux[k] ^= uu[k]; - - err = mz_crypt_hmac_copy(hmac1, hmac3); - if (err != MZ_OK) - break; - } - - if (err != MZ_OK) - break; - - j = 0; - k = i * MZ_HASH_SHA1_SIZE; - - while (j < MZ_HASH_SHA1_SIZE && k < key_length) - key[k++] = ux[j++]; - } - - /* hmac3 uses the same provider as hmac2, so it must be deleted - before the context is destroyed. */ - mz_crypt_hmac_delete(&hmac3); - mz_crypt_hmac_delete(&hmac1); - mz_crypt_hmac_delete(&hmac2); - - return err; -} -#endif - -/***************************************************************************/ diff --git a/ios/CodePush/SSZipArchive/minizip/mz_crypt.h b/ios/CodePush/SSZipArchive/minizip/mz_crypt.h deleted file mode 100644 index de9ccd669..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +++ /dev/null @@ -1,65 +0,0 @@ -/* mz_crypt.h -- Crypto/hash functions - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#ifndef MZ_CRYPT_H -#define MZ_CRYPT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************************/ - -uint32_t mz_crypt_crc32_update(uint32_t value, const uint8_t *buf, int32_t size); - -int32_t mz_crypt_pbkdf2(uint8_t *password, int32_t password_length, uint8_t *salt, - int32_t salt_length, uint16_t iteration_count, uint8_t *key, uint16_t key_length); - -/***************************************************************************/ - -int32_t mz_crypt_rand(uint8_t *buf, int32_t size); - -void mz_crypt_sha_reset(void *handle); -int32_t mz_crypt_sha_begin(void *handle); -int32_t mz_crypt_sha_update(void *handle, const void *buf, int32_t size); -int32_t mz_crypt_sha_end(void *handle, uint8_t *digest, int32_t digest_size); -void mz_crypt_sha_set_algorithm(void *handle, uint16_t algorithm); -void* mz_crypt_sha_create(void **handle); -void mz_crypt_sha_delete(void **handle); - -void mz_crypt_aes_reset(void *handle); -int32_t mz_crypt_aes_encrypt(void *handle, uint8_t *buf, int32_t size); -int32_t mz_crypt_aes_decrypt(void *handle, uint8_t *buf, int32_t size); -int32_t mz_crypt_aes_set_encrypt_key(void *handle, const void *key, int32_t key_length); -int32_t mz_crypt_aes_set_decrypt_key(void *handle, const void *key, int32_t key_length); -void mz_crypt_aes_set_mode(void *handle, int32_t mode); -void* mz_crypt_aes_create(void **handle); -void mz_crypt_aes_delete(void **handle); - -void mz_crypt_hmac_reset(void *handle); -int32_t mz_crypt_hmac_init(void *handle, const void *key, int32_t key_length); -int32_t mz_crypt_hmac_update(void *handle, const void *buf, int32_t size); -int32_t mz_crypt_hmac_end(void *handle, uint8_t *digest, int32_t digest_size); -int32_t mz_crypt_hmac_copy(void *src_handle, void *target_handle); -void mz_crypt_hmac_set_algorithm(void *handle, uint16_t algorithm); -void* mz_crypt_hmac_create(void **handle); -void mz_crypt_hmac_delete(void **handle); - -int32_t mz_crypt_sign(uint8_t *message, int32_t message_size, uint8_t *cert_data, int32_t cert_data_size, - const char *cert_pwd, uint8_t **signature, int32_t *signature_size); -int32_t mz_crypt_sign_verify(uint8_t *message, int32_t message_size, uint8_t *signature, int32_t signature_size); - -/***************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c b/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c deleted file mode 100644 index 6acab3e17..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +++ /dev/null @@ -1,526 +0,0 @@ -/* mz_crypt_apple.c -- Crypto/hash functions for Apple - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#include "mz.h" - -#include -#include -#include -#include -#include -#include - -/***************************************************************************/ - -int32_t mz_crypt_rand(uint8_t *buf, int32_t size) { - if (SecRandomCopyBytes(kSecRandomDefault, size, buf) != errSecSuccess) - return 0; - return size; -} - -/***************************************************************************/ - -typedef struct mz_crypt_sha_s { - union { - CC_SHA1_CTX ctx1; - CC_SHA256_CTX ctx256; - CC_SHA512_CTX ctx512; - }; - int32_t error; - int32_t initialized; - uint16_t algorithm; -} mz_crypt_sha; - -/***************************************************************************/ - -static const uint8_t mz_crypt_sha_digest_size[] = { - MZ_HASH_SHA1_SIZE, 0, MZ_HASH_SHA224_SIZE, - MZ_HASH_SHA256_SIZE, MZ_HASH_SHA384_SIZE, MZ_HASH_SHA512_SIZE -}; - -/***************************************************************************/ - -void mz_crypt_sha_reset(void *handle) { - mz_crypt_sha *sha = (mz_crypt_sha *)handle; - - sha->error = 0; - sha->initialized = 0; -} - -int32_t mz_crypt_sha_begin(void *handle) { - mz_crypt_sha *sha = (mz_crypt_sha *)handle; - - if (!sha) - return MZ_PARAM_ERROR; - - mz_crypt_sha_reset(handle); - - switch (sha->algorithm) { - case MZ_HASH_SHA1: - sha->error = CC_SHA1_Init(&sha->ctx1); - break; - case MZ_HASH_SHA224: - sha->error = CC_SHA224_Init(&sha->ctx256); - break; - case MZ_HASH_SHA256: - sha->error = CC_SHA256_Init(&sha->ctx256); - break; - case MZ_HASH_SHA384: - sha->error = CC_SHA384_Init(&sha->ctx512); - break; - case MZ_HASH_SHA512: - sha->error = CC_SHA512_Init(&sha->ctx512); - break; - default: - return MZ_PARAM_ERROR; - } - - if (!sha->error) - return MZ_HASH_ERROR; - - sha->initialized = 1; - return MZ_OK; -} - -int32_t mz_crypt_sha_update(void *handle, const void *buf, int32_t size) { - mz_crypt_sha *sha = (mz_crypt_sha *)handle; - - if (!sha || !buf || !sha->initialized) - return MZ_PARAM_ERROR; - - switch (sha->algorithm) { - case MZ_HASH_SHA1: - sha->error = CC_SHA1_Update(&sha->ctx1, buf, size); - break; - case MZ_HASH_SHA224: - sha->error = CC_SHA224_Update(&sha->ctx256, buf, size); - break; - case MZ_HASH_SHA256: - sha->error = CC_SHA256_Update(&sha->ctx256, buf, size); - break; - case MZ_HASH_SHA384: - sha->error = CC_SHA384_Update(&sha->ctx512, buf, size); - break; - case MZ_HASH_SHA512: - sha->error = CC_SHA512_Update(&sha->ctx512, buf, size); - break; - } - - if (!sha->error) - return MZ_HASH_ERROR; - - return size; -} - -int32_t mz_crypt_sha_end(void *handle, uint8_t *digest, int32_t digest_size) { - mz_crypt_sha *sha = (mz_crypt_sha *)handle; - - if (!sha || !digest || !sha->initialized) - return MZ_PARAM_ERROR; - if (digest_size < mz_crypt_sha_digest_size[sha->algorithm - MZ_HASH_SHA1]) - return MZ_PARAM_ERROR; - - switch (sha->algorithm) { - case MZ_HASH_SHA1: - sha->error = CC_SHA1_Final(digest, &sha->ctx1); - break; - case MZ_HASH_SHA224: - sha->error = CC_SHA224_Final(digest, &sha->ctx256); - break; - case MZ_HASH_SHA256: - sha->error = CC_SHA256_Final(digest, &sha->ctx256); - break; - case MZ_HASH_SHA384: - sha->error = CC_SHA384_Final(digest, &sha->ctx512); - break; - case MZ_HASH_SHA512: - sha->error = CC_SHA512_Final(digest, &sha->ctx512); - break; - } - - if (!sha->error) - return MZ_HASH_ERROR; - - return MZ_OK; -} - -void mz_crypt_sha_set_algorithm(void *handle, uint16_t algorithm) { - mz_crypt_sha *sha = (mz_crypt_sha *)handle; - if (MZ_HASH_SHA1 <= algorithm && algorithm <= MZ_HASH_SHA512) - sha->algorithm = algorithm; -} - -void *mz_crypt_sha_create(void **handle) { - mz_crypt_sha *sha = NULL; - - sha = (mz_crypt_sha *)calloc(1, sizeof(mz_crypt_sha)); - if (sha) { - memset(sha, 0, sizeof(mz_crypt_sha)); - sha->algorithm = MZ_HASH_SHA256; - } - if (handle) - *handle = sha; - - return sha; -} - -void mz_crypt_sha_delete(void **handle) { - mz_crypt_sha *sha = NULL; - if (!handle) - return; - sha = (mz_crypt_sha *)*handle; - if (sha) { - mz_crypt_sha_reset(*handle); - free(sha); - } - *handle = NULL; -} - -/***************************************************************************/ - -typedef struct mz_crypt_aes_s { - CCCryptorRef crypt; - int32_t mode; - int32_t error; -} mz_crypt_aes; - -/***************************************************************************/ - -void mz_crypt_aes_reset(void *handle) { - mz_crypt_aes *aes = (mz_crypt_aes *)handle; - - if (aes->crypt) - CCCryptorRelease(aes->crypt); - aes->crypt = NULL; -} - -int32_t mz_crypt_aes_encrypt(void *handle, uint8_t *buf, int32_t size) { - mz_crypt_aes *aes = (mz_crypt_aes *)handle; - size_t data_moved = 0; - - if (!aes || !buf) - return MZ_PARAM_ERROR; - if (size != MZ_AES_BLOCK_SIZE) - return MZ_PARAM_ERROR; - - aes->error = CCCryptorUpdate(aes->crypt, buf, size, buf, size, &data_moved); - - if (aes->error != kCCSuccess) - return MZ_HASH_ERROR; - - return size; -} - -int32_t mz_crypt_aes_decrypt(void *handle, uint8_t *buf, int32_t size) { - mz_crypt_aes *aes = (mz_crypt_aes *)handle; - size_t data_moved = 0; - - if (!aes || !buf) - return MZ_PARAM_ERROR; - if (size != MZ_AES_BLOCK_SIZE) - return MZ_PARAM_ERROR; - - aes->error = CCCryptorUpdate(aes->crypt, buf, size, buf, size, &data_moved); - - if (aes->error != kCCSuccess) - return MZ_HASH_ERROR; - - return size; -} - -int32_t mz_crypt_aes_set_encrypt_key(void *handle, const void *key, int32_t key_length) { - mz_crypt_aes *aes = (mz_crypt_aes *)handle; - - if (!aes || !key || !key_length) - return MZ_PARAM_ERROR; - - mz_crypt_aes_reset(handle); - - aes->error = CCCryptorCreate(kCCEncrypt, kCCAlgorithmAES, kCCOptionECBMode, - key, key_length, NULL, &aes->crypt); - - if (aes->error != kCCSuccess) - return MZ_HASH_ERROR; - - return MZ_OK; -} - -int32_t mz_crypt_aes_set_decrypt_key(void *handle, const void *key, int32_t key_length) { - mz_crypt_aes *aes = (mz_crypt_aes *)handle; - - if (!aes || !key || !key_length) - return MZ_PARAM_ERROR; - - mz_crypt_aes_reset(handle); - - aes->error = CCCryptorCreate(kCCDecrypt, kCCAlgorithmAES, kCCOptionECBMode, - key, key_length, NULL, &aes->crypt); - - if (aes->error != kCCSuccess) - return MZ_HASH_ERROR; - - return MZ_OK; -} - -void mz_crypt_aes_set_mode(void *handle, int32_t mode) { - mz_crypt_aes *aes = (mz_crypt_aes *)handle; - aes->mode = mode; -} - -void *mz_crypt_aes_create(void **handle) { - mz_crypt_aes *aes = NULL; - - aes = (mz_crypt_aes *)calloc(1, sizeof(mz_crypt_aes)); - if (handle) - *handle = aes; - - return aes; -} - -void mz_crypt_aes_delete(void **handle) { - mz_crypt_aes *aes = NULL; - if (!handle) - return; - aes = (mz_crypt_aes *)*handle; - if (aes) { - mz_crypt_aes_reset(*handle); - free(aes); - } - *handle = NULL; -} - -/***************************************************************************/ - -typedef struct mz_crypt_hmac_s { - CCHmacContext ctx; - int32_t initialized; - int32_t error; - uint16_t algorithm; -} mz_crypt_hmac; - -/***************************************************************************/ - -static void mz_crypt_hmac_free(void *handle) { - mz_crypt_hmac *hmac = (mz_crypt_hmac *)handle; - memset(&hmac->ctx, 0, sizeof(hmac->ctx)); -} - -void mz_crypt_hmac_reset(void *handle) { - mz_crypt_hmac *hmac = (mz_crypt_hmac *)handle; - mz_crypt_hmac_free(handle); - hmac->error = 0; -} - -int32_t mz_crypt_hmac_init(void *handle, const void *key, int32_t key_length) { - mz_crypt_hmac *hmac = (mz_crypt_hmac *)handle; - CCHmacAlgorithm algorithm = 0; - - if (!hmac || !key) - return MZ_PARAM_ERROR; - - mz_crypt_hmac_reset(handle); - - if (hmac->algorithm == MZ_HASH_SHA1) - algorithm = kCCHmacAlgSHA1; - else if (hmac->algorithm == MZ_HASH_SHA256) - algorithm = kCCHmacAlgSHA256; - else - return MZ_PARAM_ERROR; - - CCHmacInit(&hmac->ctx, algorithm, key, key_length); - return MZ_OK; -} - -int32_t mz_crypt_hmac_update(void *handle, const void *buf, int32_t size) { - mz_crypt_hmac *hmac = (mz_crypt_hmac *)handle; - - if (!hmac || !buf) - return MZ_PARAM_ERROR; - - CCHmacUpdate(&hmac->ctx, buf, size); - return MZ_OK; -} - -int32_t mz_crypt_hmac_end(void *handle, uint8_t *digest, int32_t digest_size) { - mz_crypt_hmac *hmac = (mz_crypt_hmac *)handle; - - if (!hmac || !digest) - return MZ_PARAM_ERROR; - - if (hmac->algorithm == MZ_HASH_SHA1) { - if (digest_size < MZ_HASH_SHA1_SIZE) - return MZ_BUF_ERROR; - CCHmacFinal(&hmac->ctx, digest); - } else { - if (digest_size < MZ_HASH_SHA256_SIZE) - return MZ_BUF_ERROR; - CCHmacFinal(&hmac->ctx, digest); - } - - return MZ_OK; -} - -void mz_crypt_hmac_set_algorithm(void *handle, uint16_t algorithm) { - mz_crypt_hmac *hmac = (mz_crypt_hmac *)handle; - hmac->algorithm = algorithm; -} - -int32_t mz_crypt_hmac_copy(void *src_handle, void *target_handle) { - mz_crypt_hmac *source = (mz_crypt_hmac *)src_handle; - mz_crypt_hmac *target = (mz_crypt_hmac *)target_handle; - - if (!source || !target) - return MZ_PARAM_ERROR; - - memcpy(&target->ctx, &source->ctx, sizeof(CCHmacContext)); - return MZ_OK; -} - -void *mz_crypt_hmac_create(void **handle) { - mz_crypt_hmac *hmac = NULL; - - hmac = (mz_crypt_hmac *)calloc(1, sizeof(mz_crypt_hmac)); - if (hmac) - hmac->algorithm = MZ_HASH_SHA256; - if (handle) - *handle = hmac; - - return hmac; -} - -void mz_crypt_hmac_delete(void **handle) { - mz_crypt_hmac *hmac = NULL; - if (!handle) - return; - hmac = (mz_crypt_hmac *)*handle; - if (hmac) { - mz_crypt_hmac_free(*handle); - free(hmac); - } - *handle = NULL; -} - -/***************************************************************************/ - -#if defined(MZ_ZIP_SIGNING) -int32_t mz_crypt_sign(uint8_t *message, int32_t message_size, uint8_t *cert_data, int32_t cert_data_size, - const char *cert_pwd, uint8_t **signature, int32_t *signature_size) { - CFStringRef password_ref = NULL; - CFDictionaryRef options_dict = NULL; - CFDictionaryRef identity_trust = NULL; - CFDataRef signature_out = NULL; - CFDataRef pkcs12_data = NULL; - CFArrayRef items = 0; - SecIdentityRef identity = NULL; - SecTrustRef trust = NULL; - OSStatus status = noErr; - const void *options_key[2] = {kSecImportExportPassphrase, kSecReturnRef}; - const void *options_values[2] = {0, kCFBooleanTrue}; - int32_t err = MZ_SIGN_ERROR; - - if (!message || !cert_data || !signature || !signature_size) - return MZ_PARAM_ERROR; - - *signature = NULL; - *signature_size = 0; - - password_ref = CFStringCreateWithCString(0, cert_pwd, kCFStringEncodingUTF8); - options_values[0] = password_ref; - - options_dict = CFDictionaryCreate(0, options_key, options_values, 2, 0, 0); - if (options_dict) - pkcs12_data = CFDataCreate(0, cert_data, cert_data_size); - if (pkcs12_data) - status = SecPKCS12Import(pkcs12_data, options_dict, &items); - if (status == noErr) - identity_trust = CFArrayGetValueAtIndex(items, 0); - if (identity_trust) - identity = (SecIdentityRef)CFDictionaryGetValue(identity_trust, kSecImportItemIdentity); - if (identity) - trust = (SecTrustRef)CFDictionaryGetValue(identity_trust, kSecImportItemTrust); - if (trust) { - status = CMSEncodeContent(identity, NULL, NULL, FALSE, 0, message, message_size, &signature_out); - - if (status == errSecSuccess) { - *signature_size = CFDataGetLength(signature_out); - *signature = (uint8_t *)malloc(*signature_size); - - memcpy(*signature, CFDataGetBytePtr(signature_out), *signature_size); - - err = MZ_OK; - } - } - - if (signature_out) - CFRelease(signature_out); - if (items) - CFRelease(items); - if (pkcs12_data) - CFRelease(pkcs12_data); - if (options_dict) - CFRelease(options_dict); - if (password_ref) - CFRelease(password_ref); - - return err; -} - -int32_t mz_crypt_sign_verify(uint8_t *message, int32_t message_size, uint8_t *signature, int32_t signature_size) { - CMSDecoderRef decoder = NULL; - CMSSignerStatus signer_status = 0; - CFDataRef message_out = NULL; - SecPolicyRef trust_policy = NULL; - OSStatus status = noErr; - OSStatus verify_status = noErr; - size_t signer_count = 0; - size_t i = 0; - int32_t err = MZ_SIGN_ERROR; - - if (!message || !signature) - return MZ_PARAM_ERROR; - - status = CMSDecoderCreate(&decoder); - if (status == errSecSuccess) - status = CMSDecoderUpdateMessage(decoder, signature, signature_size); - if (status == errSecSuccess) - status = CMSDecoderFinalizeMessage(decoder); - if (status == errSecSuccess) - trust_policy = SecPolicyCreateBasicX509(); - - if (status == errSecSuccess && trust_policy) { - CMSDecoderGetNumSigners(decoder, &signer_count); - if (signer_count > 0) - err = MZ_OK; - for (i = 0; i < signer_count; i += 1) { - status = CMSDecoderCopySignerStatus(decoder, i, trust_policy, TRUE, &signer_status, NULL, &verify_status); - if (status != errSecSuccess || verify_status != 0 || signer_status != kCMSSignerValid) { - err = MZ_SIGN_ERROR; - break; - } - } - } - - if (err == MZ_OK) { - status = CMSDecoderCopyContent(decoder, &message_out); - if ((status != errSecSuccess) || - (CFDataGetLength(message_out) != message_size) || - (memcmp(message, CFDataGetBytePtr(message_out), message_size) != 0)) - err = MZ_SIGN_ERROR; - } - - if (trust_policy) - CFRelease(trust_policy); - if (decoder) - CFRelease(decoder); - - return err; -} - -#endif diff --git a/ios/CodePush/SSZipArchive/minizip/mz_os.c b/ios/CodePush/SSZipArchive/minizip/mz_os.c deleted file mode 100644 index afbbdb40a..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_os.c +++ /dev/null @@ -1,348 +0,0 @@ -/* mz_os.c -- System functions - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - Copyright (C) 1998-2010 Gilles Vollant - https://www.winimage.com/zLibDll/minizip.html - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#include "mz.h" -#include "mz_crypt.h" -#include "mz_os.h" -#include "mz_strm.h" -#include "mz_strm_os.h" - -#include /* tolower */ - -/***************************************************************************/ - -int32_t mz_path_combine(char *path, const char *join, int32_t max_path) { - int32_t path_len = 0; - - if (!path || !join || !max_path) - return MZ_PARAM_ERROR; - - path_len = (int32_t)strlen(path); - - if (path_len == 0) { - strncpy(path, join, max_path - 1); - path[max_path - 1] = 0; - } else { - mz_path_append_slash(path, max_path, MZ_PATH_SLASH_PLATFORM); - path_len = (int32_t)strlen(path); - if (max_path > path_len) - strncat(path, join, max_path - path_len - 1); - } - - return MZ_OK; -} - -int32_t mz_path_append_slash(char *path, int32_t max_path, char slash) { - int32_t path_len = (int32_t)strlen(path); - if ((path_len + 2) >= max_path) - return MZ_BUF_ERROR; - if (path[path_len - 1] != '\\' && path[path_len - 1] != '/') { - path[path_len] = slash; - path[path_len + 1] = 0; - } - return MZ_OK; -} - -int32_t mz_path_remove_slash(char *path) { - int32_t path_len = (int32_t)strlen(path); - while (path_len > 0) { - if (path[path_len - 1] == '\\' || path[path_len - 1] == '/') - path[path_len - 1] = 0; - else - break; - - path_len -= 1; - } - return MZ_OK; -} - -int32_t mz_path_has_slash(const char *path) { - int32_t path_len = (int32_t)strlen(path); - if (path[path_len - 1] != '\\' && path[path_len - 1] != '/') - return MZ_EXIST_ERROR; - return MZ_OK; -} - -int32_t mz_path_convert_slashes(char *path, char slash) { - int32_t i = 0; - - for (i = 0; i < (int32_t)strlen(path); i += 1) { - if (path[i] == '\\' || path[i] == '/') - path[i] = slash; - } - return MZ_OK; -} - -int32_t mz_path_compare_wc(const char *path, const char *wildcard, uint8_t ignore_case) { - while (*path != 0) { - switch (*wildcard) { - case '*': - - if (*(wildcard + 1) == 0) - return MZ_OK; - - while (*path != 0) { - if (mz_path_compare_wc(path, (wildcard + 1), ignore_case) == MZ_OK) - return MZ_OK; - - path += 1; - } - - return MZ_EXIST_ERROR; - - default: - /* Ignore differences in path slashes on platforms */ - if ((*path == '\\' && *wildcard == '/') || (*path == '/' && *wildcard == '\\')) - break; - - if (ignore_case) { - if (tolower(*path) != tolower(*wildcard)) - return MZ_EXIST_ERROR; - } else { - if (*path != *wildcard) - return MZ_EXIST_ERROR; - } - - break; - } - - path += 1; - wildcard += 1; - } - - if ((*wildcard != 0) && (*wildcard != '*')) - return MZ_EXIST_ERROR; - - return MZ_OK; -} - -int32_t mz_path_resolve(const char *path, char *output, int32_t max_output) { - const char *source = path; - const char *check = output; - char *target = output; - - if (max_output <= 0) - return MZ_PARAM_ERROR; - - while (*source != 0 && max_output > 1) { - check = source; - if ((*check == '\\') || (*check == '/')) - check += 1; - - if ((source == path) || (target == output) || (check != source)) { - /* Skip double paths */ - if ((*check == '\\') || (*check == '/')) { - source += 1; - continue; - } - if (*check == '.') { - check += 1; - - /* Remove . if at end of string and not at the beginning */ - if ((*check == 0) && (source != path && target != output)) { - /* Copy last slash */ - *target = *source; - target += 1; - max_output -= 1; - source += (check - source); - continue; - } - /* Remove . if not at end of string */ - else if ((*check == '\\') || (*check == '/')) { - source += (check - source); - /* Skip slash if at beginning of string */ - if (target == output && *source != 0) - source += 1; - continue; - } - /* Go to parent directory .. */ - else if (*check == '.') { - check += 1; - if ((*check == 0) || (*check == '\\' || *check == '/')) { - source += (check - source); - - /* Search backwards for previous slash */ - if (target != output) { - target -= 1; - do { - if ((*target == '\\') || (*target == '/')) - break; - - target -= 1; - max_output += 1; - } while (target > output); - } - - if ((target == output) && (*source != 0)) - source += 1; - if ((*target == '\\' || *target == '/') && (*source == 0)) - target += 1; - - *target = 0; - continue; - } - } - } - } - - *target = *source; - - source += 1; - target += 1; - max_output -= 1; - } - - *target = 0; - - if (*path == 0) - return MZ_INTERNAL_ERROR; - - return MZ_OK; -} - -int32_t mz_path_remove_filename(char *path) { - char *path_ptr = NULL; - - if (!path) - return MZ_PARAM_ERROR; - - path_ptr = path + strlen(path) - 1; - - while (path_ptr > path) { - if ((*path_ptr == '/') || (*path_ptr == '\\')) { - *path_ptr = 0; - break; - } - - path_ptr -= 1; - } - - if (path_ptr == path) - *path_ptr = 0; - - return MZ_OK; -} - -int32_t mz_path_remove_extension(char *path) { - char *path_ptr = NULL; - - if (!path) - return MZ_PARAM_ERROR; - - path_ptr = path + strlen(path) - 1; - - while (path_ptr > path) { - if ((*path_ptr == '/') || (*path_ptr == '\\')) - break; - if (*path_ptr == '.') { - *path_ptr = 0; - break; - } - - path_ptr -= 1; - } - - if (path_ptr == path) - *path_ptr = 0; - - return MZ_OK; -} - -int32_t mz_path_get_filename(const char *path, const char **filename) { - const char *match = NULL; - - if (!path || !filename) - return MZ_PARAM_ERROR; - - *filename = NULL; - - for (match = path; *match != 0; match += 1) { - if ((*match == '\\') || (*match == '/')) - *filename = match + 1; - } - - if (!*filename) - return MZ_EXIST_ERROR; - - return MZ_OK; -} - -int32_t mz_dir_make(const char *path) { - int32_t err = MZ_OK; - char *current_dir = NULL; - char *match = NULL; - char hold = 0; - - current_dir = strdup(path); - if (!current_dir) - return MZ_MEM_ERROR; - - mz_path_remove_slash(current_dir); - - err = mz_os_make_dir(current_dir); - if (err != MZ_OK) { - match = current_dir + 1; - while (1) { - while (*match != 0 && *match != '\\' && *match != '/') - match += 1; - hold = *match; - *match = 0; - - err = mz_os_make_dir(current_dir); - if (err != MZ_OK) - break; - if (hold == 0) - break; - - *match = hold; - match += 1; - } - } - - free(current_dir); - return err; -} - -int32_t mz_file_get_crc(const char *path, uint32_t *result_crc) { - void *stream = NULL; - uint32_t crc32 = 0; - int32_t read = 0; - int32_t err = MZ_OK; - uint8_t buf[16384]; - - mz_stream_os_create(&stream); - - err = mz_stream_os_open(stream, path, MZ_OPEN_MODE_READ); - - if (err == MZ_OK) { - do { - read = mz_stream_os_read(stream, buf, sizeof(buf)); - - if (read < 0) { - err = read; - break; - } - - crc32 = mz_crypt_crc32_update(crc32, buf, read); - } while ((err == MZ_OK) && (read > 0)); - - mz_stream_os_close(stream); - } - - *result_crc = crc32; - - mz_stream_os_delete(&stream); - - return err; -} - -/***************************************************************************/ diff --git a/ios/CodePush/SSZipArchive/minizip/mz_os.h b/ios/CodePush/SSZipArchive/minizip/mz_os.h deleted file mode 100644 index 4505bc393..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_os.h +++ /dev/null @@ -1,176 +0,0 @@ -/* mz_os.h -- System functions - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#ifndef MZ_OS_H -#define MZ_OS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************************/ - -#if defined(__APPLE__) -# define MZ_VERSION_MADEBY_HOST_SYSTEM (MZ_HOST_SYSTEM_OSX_DARWIN) -#elif defined(__riscos__) -# define MZ_VERSION_MADEBY_HOST_SYSTEM (MZ_HOST_SYSTEM_RISCOS) -#elif defined(_WIN32) -# define MZ_VERSION_MADEBY_HOST_SYSTEM (MZ_HOST_SYSTEM_WINDOWS_NTFS) -#else -# define MZ_VERSION_MADEBY_HOST_SYSTEM (MZ_HOST_SYSTEM_UNIX) -#endif - -#if defined(HAVE_LZMA) || defined(HAVE_LIBCOMP) -# define MZ_VERSION_MADEBY_ZIP_VERSION (63) -#elif defined(HAVE_WZAES) -# define MZ_VERSION_MADEBY_ZIP_VERSION (51) -#elif defined(HAVE_BZIP2) -# define MZ_VERSION_MADEBY_ZIP_VERSION (46) -#else -# define MZ_VERSION_MADEBY_ZIP_VERSION (45) -#endif - -#define MZ_VERSION_MADEBY ((MZ_VERSION_MADEBY_HOST_SYSTEM << 8) | \ - (MZ_VERSION_MADEBY_ZIP_VERSION)) - -#define MZ_PATH_SLASH_UNIX ('/') -#define MZ_PATH_SLASH_WINDOWS ('\\') -#if defined(_WIN32) -# define MZ_PATH_SLASH_PLATFORM (MZ_PATH_SLASH_WINDOWS) -#else -# define MZ_PATH_SLASH_PLATFORM (MZ_PATH_SLASH_UNIX) -#endif - -/***************************************************************************/ - -#if defined(_WIN32) -struct dirent { - char d_name[256]; -}; -typedef void* DIR; -#else -#include -#endif - -/***************************************************************************/ -/* Shared functions */ - -int32_t mz_path_combine(char *path, const char *join, int32_t max_path); -/* Combines two paths */ - -int32_t mz_path_append_slash(char *path, int32_t max_path, char slash); -/* Appends a path slash on to the end of the path */ - -int32_t mz_path_remove_slash(char *path); -/* Removes a path slash from the end of the path */ - -int32_t mz_path_has_slash(const char *path); -/* Returns whether or not the path ends with slash */ - -int32_t mz_path_convert_slashes(char *path, char slash); -/* Converts the slashes in a path */ - -int32_t mz_path_compare_wc(const char *path, const char *wildcard, uint8_t ignore_case); -/* Compare two paths with wildcard */ - -int32_t mz_path_resolve(const char *path, char *target, int32_t max_target); -/* Resolves path */ - -int32_t mz_path_remove_filename(char *path); -/* Remove the filename from a path */ - -int32_t mz_path_remove_extension(char *path); -/* Remove the extension from a path */ - -int32_t mz_path_get_filename(const char *path, const char **filename); -/* Get the filename from a path */ - -int32_t mz_dir_make(const char *path); -/* Creates a directory recursively */ - -int32_t mz_file_get_crc(const char *path, uint32_t *result_crc); -/* Gets the crc32 hash of a file */ - -/***************************************************************************/ -/* Platform specific functions */ - -wchar_t *mz_os_unicode_string_create(const char *string, int32_t encoding); -/* Create unicode string from a utf8 string */ - -void mz_os_unicode_string_delete(wchar_t **string); -/* Delete a unicode string that was created */ - -uint8_t *mz_os_utf8_string_create(const char *string, int32_t encoding); -/* Create a utf8 string from a string with another encoding */ - -void mz_os_utf8_string_delete(uint8_t **string); -/* Delete a utf8 string that was created */ - -int32_t mz_os_rand(uint8_t *buf, int32_t size); -/* Random number generator (not cryptographically secure) */ - -int32_t mz_os_rename(const char *source_path, const char *target_path); -/* Rename a file */ - -int32_t mz_os_unlink(const char *path); -/* Delete an existing file */ - -int32_t mz_os_file_exists(const char *path); -/* Check to see if a file exists */ - -int64_t mz_os_get_file_size(const char *path); -/* Gets the length of a file */ - -int32_t mz_os_get_file_date(const char *path, time_t *modified_date, time_t *accessed_date, time_t *creation_date); -/* Gets a file's modified, access, and creation dates if supported */ - -int32_t mz_os_set_file_date(const char *path, time_t modified_date, time_t accessed_date, time_t creation_date); -/* Sets a file's modified, access, and creation dates if supported */ - -int32_t mz_os_get_file_attribs(const char *path, uint32_t *attributes); -/* Gets a file's attributes */ - -int32_t mz_os_set_file_attribs(const char *path, uint32_t attributes); -/* Sets a file's attributes */ - -int32_t mz_os_make_dir(const char *path); -/* Recursively creates a directory */ - -DIR* mz_os_open_dir(const char *path); -/* Opens a directory for listing */ -struct -dirent* mz_os_read_dir(DIR *dir); -/* Reads a directory listing entry */ - -int32_t mz_os_close_dir(DIR *dir); -/* Closes a directory that has been opened for listing */ - -int32_t mz_os_is_dir(const char *path); -/* Checks to see if path is a directory */ - -int32_t mz_os_is_symlink(const char *path); -/* Checks to see if path is a symbolic link */ - -int32_t mz_os_make_symlink(const char *path, const char *target_path); -/* Creates a symbolic link pointing to a target */ - -int32_t mz_os_read_symlink(const char *path, char *target_path, int32_t max_target_path); -/* Gets the target path for a symbolic link */ - -uint64_t mz_os_ms_time(void); -/* Gets the time in milliseconds */ - -/***************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c b/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c deleted file mode 100644 index 980ffbf1e..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +++ /dev/null @@ -1,350 +0,0 @@ -/* mz_os_posix.c -- System functions for posix - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#include "mz.h" -#include "mz_strm.h" -#include "mz_os.h" - -#include /* rename */ -#include -#if defined(HAVE_ICONV) -#include -#endif - -#include -#include - -#ifndef _WIN32 -# include -# include -#endif -#if defined(__APPLE__) -# include -# include -#endif - -#if defined(HAVE_GETRANDOM) -# include -#endif -#if defined(HAVE_LIBBSD) -# include /* arc4random_buf */ -#endif - -/***************************************************************************/ - -#if defined(HAVE_ICONV) -uint8_t *mz_os_utf8_string_create(const char *string, int32_t encoding) { - iconv_t cd; - const char *from_encoding = NULL; - size_t result = 0; - size_t string_length = 0; - size_t string_utf8_size = 0; - uint8_t *string_utf8 = NULL; - uint8_t *string_utf8_ptr = NULL; - - if (!string) - return NULL; - - if (encoding == MZ_ENCODING_CODEPAGE_437) - from_encoding = "CP437"; - else if (encoding == MZ_ENCODING_CODEPAGE_932) - from_encoding = "CP932"; - else if (encoding == MZ_ENCODING_CODEPAGE_936) - from_encoding = "CP936"; - else if (encoding == MZ_ENCODING_CODEPAGE_950) - from_encoding = "CP950"; - else if (encoding == MZ_ENCODING_UTF8) - from_encoding = "UTF-8"; - else - return NULL; - - cd = iconv_open("UTF-8", from_encoding); - if (cd == (iconv_t)-1) - return NULL; - - string_length = strlen(string); - string_utf8_size = string_length * 2; - string_utf8 = (uint8_t *)calloc((int32_t)(string_utf8_size + 1), sizeof(char)); - string_utf8_ptr = string_utf8; - - if (string_utf8) { - result = iconv(cd, (char **)&string, &string_length, - (char **)&string_utf8_ptr, &string_utf8_size); - } - - iconv_close(cd); - - if (result == (size_t)-1) { - free(string_utf8); - string_utf8 = NULL; - } - - return string_utf8; -} -#else -uint8_t *mz_os_utf8_string_create(const char *string, int32_t encoding) { - return (uint8_t *)strdup(string); -} -#endif - -void mz_os_utf8_string_delete(uint8_t **string) { - if (string) { - free(*string); - *string = NULL; - } -} - -/***************************************************************************/ - -#if defined(HAVE_GETRANDOM) -int32_t mz_os_rand(uint8_t *buf, int32_t size) { - int32_t left = size; - int32_t written = 0; - - while (left > 0) { - written = getrandom(buf, left, 0); - if (written < 0) - return MZ_INTERNAL_ERROR; - - buf += written; - left -= written; - } - return size - left; -} -#elif defined(HAVE_ARC4RANDOM_BUF) -int32_t mz_os_rand(uint8_t *buf, int32_t size) { - if (size < 0) - return 0; - arc4random_buf(buf, (uint32_t)size); - return size; -} -#elif defined(HAVE_ARC4RANDOM) -int32_t mz_os_rand(uint8_t *buf, int32_t size) { - int32_t left = size; - for (; left > 2; left -= 3, buf += 3) { - uint32_t val = arc4random(); - - buf[0] = (val) & 0xFF; - buf[1] = (val >> 8) & 0xFF; - buf[2] = (val >> 16) & 0xFF; - } - for (; left > 0; left--, buf++) { - *buf = arc4random() & 0xFF; - } - return size - left; -} -#else -int32_t mz_os_rand(uint8_t *buf, int32_t size) { - static unsigned calls = 0; - int32_t i = 0; - - /* Ensure different random header each time */ - if (++calls == 1) { - #define PI_SEED 3141592654UL - srand((unsigned)(time(NULL) ^ PI_SEED)); - } - - while (i < size) - buf[i++] = (rand() >> 7) & 0xff; - - return size; -} -#endif - -int32_t mz_os_rename(const char *source_path, const char *target_path) { - if (rename(source_path, target_path) == -1) - return MZ_EXIST_ERROR; - - return MZ_OK; -} - -int32_t mz_os_unlink(const char *path) { - if (unlink(path) == -1) - return MZ_EXIST_ERROR; - - return MZ_OK; -} - -int32_t mz_os_file_exists(const char *path) { - struct stat path_stat; - - memset(&path_stat, 0, sizeof(path_stat)); - if (stat(path, &path_stat) == 0) - return MZ_OK; - return MZ_EXIST_ERROR; -} - -int64_t mz_os_get_file_size(const char *path) { - struct stat path_stat; - - memset(&path_stat, 0, sizeof(path_stat)); - if (stat(path, &path_stat) == 0) { - /* Stat returns size taken up by directory entry, so return 0 */ - if (S_ISDIR(path_stat.st_mode)) - return 0; - - return path_stat.st_size; - } - - return 0; -} - -int32_t mz_os_get_file_date(const char *path, time_t *modified_date, time_t *accessed_date, time_t *creation_date) { - struct stat path_stat; - char *name = NULL; - int32_t err = MZ_INTERNAL_ERROR; - - memset(&path_stat, 0, sizeof(path_stat)); - - if (strcmp(path, "-") != 0) { - /* Not all systems allow stat'ing a file with / appended */ - name = strdup(path); - mz_path_remove_slash(name); - - if (stat(name, &path_stat) == 0) { - if (modified_date) - *modified_date = path_stat.st_mtime; - if (accessed_date) - *accessed_date = path_stat.st_atime; - /* Creation date not supported */ - if (creation_date) - *creation_date = 0; - - err = MZ_OK; - } - - free(name); - } - - return err; -} - -int32_t mz_os_set_file_date(const char *path, time_t modified_date, time_t accessed_date, time_t creation_date) { - struct utimbuf ut; - - ut.actime = accessed_date; - ut.modtime = modified_date; - - /* Creation date not supported */ - MZ_UNUSED(creation_date); - - if (utime(path, &ut) != 0) - return MZ_INTERNAL_ERROR; - - return MZ_OK; -} - -int32_t mz_os_get_file_attribs(const char *path, uint32_t *attributes) { - struct stat path_stat; - int32_t err = MZ_OK; - - memset(&path_stat, 0, sizeof(path_stat)); - if (lstat(path, &path_stat) == -1) - err = MZ_INTERNAL_ERROR; - *attributes = path_stat.st_mode; - return err; -} - -int32_t mz_os_set_file_attribs(const char *path, uint32_t attributes) { - int32_t err = MZ_OK; - - if (chmod(path, (mode_t)attributes) == -1) - err = MZ_INTERNAL_ERROR; - - return err; -} - -int32_t mz_os_make_dir(const char *path) { - int32_t err = 0; - - err = mkdir(path, 0755); - - if (err != 0 && errno != EEXIST) - return MZ_INTERNAL_ERROR; - - return MZ_OK; -} - -DIR* mz_os_open_dir(const char *path) { - return opendir(path); -} - -struct dirent* mz_os_read_dir(DIR *dir) { - if (!dir) - return NULL; - return readdir(dir); -} - -int32_t mz_os_close_dir(DIR *dir) { - if (!dir) - return MZ_PARAM_ERROR; - if (closedir(dir) == -1) - return MZ_INTERNAL_ERROR; - return MZ_OK; -} - -int32_t mz_os_is_dir(const char *path) { - struct stat path_stat; - - memset(&path_stat, 0, sizeof(path_stat)); - stat(path, &path_stat); - if (S_ISDIR(path_stat.st_mode)) - return MZ_OK; - - return MZ_EXIST_ERROR; -} - -int32_t mz_os_is_symlink(const char *path) { - struct stat path_stat; - - memset(&path_stat, 0, sizeof(path_stat)); - lstat(path, &path_stat); - if (S_ISLNK(path_stat.st_mode)) - return MZ_OK; - - return MZ_EXIST_ERROR; -} - -int32_t mz_os_make_symlink(const char *path, const char *target_path) { - if (symlink(target_path, path) != 0) - return MZ_INTERNAL_ERROR; - return MZ_OK; -} - -int32_t mz_os_read_symlink(const char *path, char *target_path, int32_t max_target_path) { - size_t length = 0; - - length = (size_t)readlink(path, target_path, max_target_path - 1); - if (length == (size_t)-1) - return MZ_EXIST_ERROR; - - target_path[length] = 0; - return MZ_OK; -} - -uint64_t mz_os_ms_time(void) { - struct timespec ts; - -#if defined(__APPLE__) - clock_serv_t cclock; - mach_timespec_t mts; - - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); - clock_get_time(cclock, &mts); - mach_port_deallocate(mach_task_self(), cclock); - - ts.tv_sec = mts.tv_sec; - ts.tv_nsec = mts.tv_nsec; -#else - clock_gettime(CLOCK_MONOTONIC, &ts); -#endif - - return ((uint64_t)ts.tv_sec * 1000) + ((uint64_t)ts.tv_nsec / 1000000); -} diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm.c b/ios/CodePush/SSZipArchive/minizip/mz_strm.c deleted file mode 100644 index 35d4c62fd..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm.c +++ /dev/null @@ -1,556 +0,0 @@ -/* mz_strm.c -- Stream interface - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#include "mz.h" -#include "mz_strm.h" - -/***************************************************************************/ - -#define MZ_STREAM_FIND_SIZE (1024) - -/***************************************************************************/ - -int32_t mz_stream_open(void *stream, const char *path, int32_t mode) { - mz_stream *strm = (mz_stream *)stream; - if (!strm || !strm->vtbl || !strm->vtbl->open) - return MZ_STREAM_ERROR; - return strm->vtbl->open(strm, path, mode); -} - -int32_t mz_stream_is_open(void *stream) { - mz_stream *strm = (mz_stream *)stream; - if (!strm || !strm->vtbl || !strm->vtbl->is_open) - return MZ_STREAM_ERROR; - return strm->vtbl->is_open(strm); -} - -int32_t mz_stream_read(void *stream, void *buf, int32_t size) { - mz_stream *strm = (mz_stream *)stream; - if (!strm || !strm->vtbl || !strm->vtbl->read) - return MZ_PARAM_ERROR; - if (mz_stream_is_open(stream) != MZ_OK) - return MZ_STREAM_ERROR; - return strm->vtbl->read(strm, buf, size); -} - -static int32_t mz_stream_read_value(void *stream, uint64_t *value, int32_t len) { - uint8_t buf[8]; - int32_t n = 0; - int32_t i = 0; - - *value = 0; - if (mz_stream_read(stream, buf, len) == len) { - for (n = 0; n < len; n += 1, i += 8) - *value += ((uint64_t)buf[n]) << i; - } else if (mz_stream_error(stream)) - return MZ_STREAM_ERROR; - else - return MZ_END_OF_STREAM; - - return MZ_OK; -} - -int32_t mz_stream_read_uint8(void *stream, uint8_t *value) { - int32_t err = MZ_OK; - uint64_t value64 = 0; - - *value = 0; - err = mz_stream_read_value(stream, &value64, sizeof(uint8_t)); - if (err == MZ_OK) - *value = (uint8_t)value64; - return err; -} - -int32_t mz_stream_read_uint16(void *stream, uint16_t *value) { - int32_t err = MZ_OK; - uint64_t value64 = 0; - - *value = 0; - err = mz_stream_read_value(stream, &value64, sizeof(uint16_t)); - if (err == MZ_OK) - *value = (uint16_t)value64; - return err; -} - -int32_t mz_stream_read_uint32(void *stream, uint32_t *value) { - int32_t err = MZ_OK; - uint64_t value64 = 0; - - *value = 0; - err = mz_stream_read_value(stream, &value64, sizeof(uint32_t)); - if (err == MZ_OK) - *value = (uint32_t)value64; - return err; -} - -int32_t mz_stream_read_int64(void *stream, int64_t *value) { - return mz_stream_read_value(stream, (uint64_t *)value, sizeof(uint64_t)); -} - -int32_t mz_stream_read_uint64(void *stream, uint64_t *value) { - return mz_stream_read_value(stream, value, sizeof(uint64_t)); -} - -int32_t mz_stream_write(void *stream, const void *buf, int32_t size) { - mz_stream *strm = (mz_stream *)stream; - if (size == 0) - return size; - if (!strm || !strm->vtbl || !strm->vtbl->write) - return MZ_PARAM_ERROR; - if (mz_stream_is_open(stream) != MZ_OK) - return MZ_STREAM_ERROR; - return strm->vtbl->write(strm, buf, size); -} - -static int32_t mz_stream_write_value(void *stream, uint64_t value, int32_t len) { - uint8_t buf[8]; - int32_t n = 0; - - for (n = 0; n < len; n += 1) { - buf[n] = (uint8_t)(value & 0xff); - value >>= 8; - } - - if (value != 0) { - /* Data overflow - hack for ZIP64 (X Roche) */ - for (n = 0; n < len; n += 1) - buf[n] = 0xff; - } - - if (mz_stream_write(stream, buf, len) != len) - return MZ_STREAM_ERROR; - - return MZ_OK; -} - -int32_t mz_stream_write_uint8(void *stream, uint8_t value) { - return mz_stream_write_value(stream, value, sizeof(uint8_t)); -} - -int32_t mz_stream_write_uint16(void *stream, uint16_t value) { - return mz_stream_write_value(stream, value, sizeof(uint16_t)); -} - -int32_t mz_stream_write_uint32(void *stream, uint32_t value) { - return mz_stream_write_value(stream, value, sizeof(uint32_t)); -} - -int32_t mz_stream_write_int64(void *stream, int64_t value) { - return mz_stream_write_value(stream, (uint64_t)value, sizeof(uint64_t)); -} - -int32_t mz_stream_write_uint64(void *stream, uint64_t value) { - return mz_stream_write_value(stream, value, sizeof(uint64_t)); -} - -int32_t mz_stream_copy(void *target, void *source, int32_t len) { - return mz_stream_copy_stream(target, NULL, source, NULL, len); -} - -int32_t mz_stream_copy_to_end(void *target, void *source) { - return mz_stream_copy_stream_to_end(target, NULL, source, NULL); -} - -int32_t mz_stream_copy_stream(void *target, mz_stream_write_cb write_cb, void *source, - mz_stream_read_cb read_cb, int32_t len) { - uint8_t buf[16384]; - int32_t bytes_to_copy = 0; - int32_t read = 0; - int32_t written = 0; - - if (!write_cb) - write_cb = mz_stream_write; - if (!read_cb) - read_cb = mz_stream_read; - - while (len > 0) { - bytes_to_copy = len; - if (bytes_to_copy > (int32_t)sizeof(buf)) - bytes_to_copy = sizeof(buf); - read = read_cb(source, buf, bytes_to_copy); - if (read <= 0) - return MZ_STREAM_ERROR; - written = write_cb(target, buf, read); - if (written != read) - return MZ_STREAM_ERROR; - len -= read; - } - - return MZ_OK; -} - -int32_t mz_stream_copy_stream_to_end(void *target, mz_stream_write_cb write_cb, void *source, - mz_stream_read_cb read_cb) { - uint8_t buf[16384]; - int32_t read = 0; - int32_t written = 0; - - if (!write_cb) - write_cb = mz_stream_write; - if (!read_cb) - read_cb = mz_stream_read; - - read = read_cb(source, buf, sizeof(buf)); - while (read > 0) { - written = write_cb(target, buf, read); - if (written != read) - return MZ_STREAM_ERROR; - read = read_cb(source, buf, sizeof(buf)); - } - - if (read < 0) - return MZ_STREAM_ERROR; - - return MZ_OK; -} - -int64_t mz_stream_tell(void *stream) { - mz_stream *strm = (mz_stream *)stream; - if (!strm || !strm->vtbl || !strm->vtbl->tell) - return MZ_PARAM_ERROR; - if (mz_stream_is_open(stream) != MZ_OK) - return MZ_STREAM_ERROR; - return strm->vtbl->tell(strm); -} - -int32_t mz_stream_seek(void *stream, int64_t offset, int32_t origin) { - mz_stream *strm = (mz_stream *)stream; - if (!strm || !strm->vtbl || !strm->vtbl->seek) - return MZ_PARAM_ERROR; - if (mz_stream_is_open(stream) != MZ_OK) - return MZ_STREAM_ERROR; - if (origin == MZ_SEEK_SET && offset < 0) - return MZ_SEEK_ERROR; - return strm->vtbl->seek(strm, offset, origin); -} - -int32_t mz_stream_find(void *stream, const void *find, int32_t find_size, int64_t max_seek, int64_t *position) { - uint8_t buf[MZ_STREAM_FIND_SIZE]; - int32_t buf_pos = 0; - int32_t read_size = sizeof(buf); - int32_t read = 0; - int64_t read_pos = 0; - int64_t start_pos = 0; - int64_t disk_pos = 0; - int32_t i = 0; - uint8_t first = 1; - int32_t err = MZ_OK; - - if (!stream || !find || !position) - return MZ_PARAM_ERROR; - if (find_size < 0 || find_size >= (int32_t)sizeof(buf)) - return MZ_PARAM_ERROR; - - *position = -1; - - start_pos = mz_stream_tell(stream); - - while (read_pos < max_seek) { - if (read_size > (int32_t)(max_seek - read_pos - buf_pos) && (max_seek - read_pos - buf_pos) < (int64_t)sizeof(buf)) - read_size = (int32_t)(max_seek - read_pos - buf_pos); - - read = mz_stream_read(stream, buf + buf_pos, read_size); - if ((read <= 0) || (read + buf_pos < find_size)) - break; - - for (i = 0; i <= read + buf_pos - find_size; i += 1) { - if (memcmp(&buf[i], find, find_size) != 0) - continue; - - disk_pos = mz_stream_tell(stream); - - /* Seek to position on disk where the data was found */ - err = mz_stream_seek(stream, disk_pos - ((int64_t)read + buf_pos - i), MZ_SEEK_SET); - if (err != MZ_OK) - return MZ_EXIST_ERROR; - - *position = start_pos + read_pos + i; - return MZ_OK; - } - - if (first) { - read -= find_size; - read_size -= find_size; - buf_pos = find_size; - first = 0; - } - - memmove(buf, buf + read, find_size); - read_pos += read; - } - - return MZ_EXIST_ERROR; -} - -int32_t mz_stream_find_reverse(void *stream, const void *find, int32_t find_size, int64_t max_seek, int64_t *position) { - uint8_t buf[MZ_STREAM_FIND_SIZE]; - int32_t buf_pos = 0; - int32_t read_size = MZ_STREAM_FIND_SIZE; - int64_t read_pos = 0; - int32_t read = 0; - int64_t start_pos = 0; - int64_t disk_pos = 0; - uint8_t first = 1; - int32_t i = 0; - int32_t err = MZ_OK; - - if (!stream || !find || !position) - return MZ_PARAM_ERROR; - if (find_size < 0 || find_size >= (int32_t)sizeof(buf)) - return MZ_PARAM_ERROR; - - *position = -1; - - start_pos = mz_stream_tell(stream); - - while (read_pos < max_seek) { - if (read_size > (int32_t)(max_seek - read_pos) && (max_seek - read_pos) < (int64_t)sizeof(buf)) - read_size = (int32_t)(max_seek - read_pos); - - if (mz_stream_seek(stream, start_pos - (read_pos + read_size), MZ_SEEK_SET) != MZ_OK) - break; - read = mz_stream_read(stream, buf, read_size); - if ((read <= 0) || (read + buf_pos < find_size)) - break; - if (read + buf_pos < MZ_STREAM_FIND_SIZE) - memmove(buf + MZ_STREAM_FIND_SIZE - (read + buf_pos), buf, read); - - for (i = find_size; i <= (read + buf_pos); i += 1) { - if (memcmp(&buf[MZ_STREAM_FIND_SIZE - i], find, find_size) != 0) - continue; - - disk_pos = mz_stream_tell(stream); - - /* Seek to position on disk where the data was found */ - err = mz_stream_seek(stream, disk_pos + buf_pos - i, MZ_SEEK_SET); - if (err != MZ_OK) - return MZ_EXIST_ERROR; - - *position = start_pos - (read_pos - buf_pos + i); - return MZ_OK; - } - - if (first) { - read -= find_size; - read_size -= find_size; - buf_pos = find_size; - first = 0; - } - - if (read == 0) - break; - - memmove(buf + read_size, buf, find_size); - read_pos += read; - } - - return MZ_EXIST_ERROR; -} - -int32_t mz_stream_close(void *stream) { - mz_stream *strm = (mz_stream *)stream; - if (!strm || !strm->vtbl || !strm->vtbl->close) - return MZ_PARAM_ERROR; - if (mz_stream_is_open(stream) != MZ_OK) - return MZ_STREAM_ERROR; - return strm->vtbl->close(strm); -} - -int32_t mz_stream_error(void *stream) { - mz_stream *strm = (mz_stream *)stream; - if (!strm || !strm->vtbl || !strm->vtbl->error) - return MZ_PARAM_ERROR; - return strm->vtbl->error(strm); -} - -int32_t mz_stream_set_base(void *stream, void *base) { - mz_stream *strm = (mz_stream *)stream; - strm->base = (mz_stream *)base; - return MZ_OK; -} - -void* mz_stream_get_interface(void *stream) { - mz_stream *strm = (mz_stream *)stream; - if (!strm || !strm->vtbl) - return NULL; - return (void *)strm->vtbl; -} - -int32_t mz_stream_get_prop_int64(void *stream, int32_t prop, int64_t *value) { - mz_stream *strm = (mz_stream *)stream; - if (!strm || !strm->vtbl || !strm->vtbl->get_prop_int64) - return MZ_PARAM_ERROR; - return strm->vtbl->get_prop_int64(stream, prop, value); -} - -int32_t mz_stream_set_prop_int64(void *stream, int32_t prop, int64_t value) { - mz_stream *strm = (mz_stream *)stream; - if (!strm || !strm->vtbl || !strm->vtbl->set_prop_int64) - return MZ_PARAM_ERROR; - return strm->vtbl->set_prop_int64(stream, prop, value); -} - -void *mz_stream_create(void **stream, mz_stream_vtbl *vtbl) { - if (!stream || !vtbl || !vtbl->create) - return NULL; - return vtbl->create(stream); -} - -void mz_stream_delete(void **stream) { - mz_stream *strm = NULL; - if (!stream) - return; - strm = (mz_stream *)*stream; - if (strm && strm->vtbl && strm->vtbl->destroy) - strm->vtbl->destroy(stream); - *stream = NULL; -} - -/***************************************************************************/ - -typedef struct mz_stream_raw_s { - mz_stream stream; - int64_t total_in; - int64_t total_out; - int64_t max_total_in; -} mz_stream_raw; - -/***************************************************************************/ - -int32_t mz_stream_raw_open(void *stream, const char *path, int32_t mode) { - MZ_UNUSED(stream); - MZ_UNUSED(path); - MZ_UNUSED(mode); - - return MZ_OK; -} - -int32_t mz_stream_raw_is_open(void *stream) { - mz_stream_raw *raw = (mz_stream_raw *)stream; - return mz_stream_is_open(raw->stream.base); -} - -int32_t mz_stream_raw_read(void *stream, void *buf, int32_t size) { - mz_stream_raw *raw = (mz_stream_raw *)stream; - int32_t bytes_to_read = size; - int32_t read = 0; - - if (raw->max_total_in > 0) { - if ((int64_t)bytes_to_read > (raw->max_total_in - raw->total_in)) - bytes_to_read = (int32_t)(raw->max_total_in - raw->total_in); - } - - read = mz_stream_read(raw->stream.base, buf, bytes_to_read); - - if (read > 0) { - raw->total_in += read; - raw->total_out += read; - } - - return read; -} - -int32_t mz_stream_raw_write(void *stream, const void *buf, int32_t size) { - mz_stream_raw *raw = (mz_stream_raw *)stream; - int32_t written = 0; - - written = mz_stream_write(raw->stream.base, buf, size); - - if (written > 0) { - raw->total_out += written; - raw->total_in += written; - } - - return written; -} - -int64_t mz_stream_raw_tell(void *stream) { - mz_stream_raw *raw = (mz_stream_raw *)stream; - return mz_stream_tell(raw->stream.base); -} - -int32_t mz_stream_raw_seek(void *stream, int64_t offset, int32_t origin) { - mz_stream_raw *raw = (mz_stream_raw *)stream; - return mz_stream_seek(raw->stream.base, offset, origin); -} - -int32_t mz_stream_raw_close(void *stream) { - MZ_UNUSED(stream); - return MZ_OK; -} - -int32_t mz_stream_raw_error(void *stream) { - mz_stream_raw *raw = (mz_stream_raw *)stream; - return mz_stream_error(raw->stream.base); -} - -int32_t mz_stream_raw_get_prop_int64(void *stream, int32_t prop, int64_t *value) { - mz_stream_raw *raw = (mz_stream_raw *)stream; - switch (prop) { - case MZ_STREAM_PROP_TOTAL_IN: - *value = raw->total_in; - return MZ_OK; - case MZ_STREAM_PROP_TOTAL_OUT: - *value = raw->total_out; - return MZ_OK; - } - return MZ_EXIST_ERROR; -} - -int32_t mz_stream_raw_set_prop_int64(void *stream, int32_t prop, int64_t value) { - mz_stream_raw *raw = (mz_stream_raw *)stream; - switch (prop) { - case MZ_STREAM_PROP_TOTAL_IN_MAX: - raw->max_total_in = value; - return MZ_OK; - } - return MZ_EXIST_ERROR; -} - -/***************************************************************************/ - -static mz_stream_vtbl mz_stream_raw_vtbl = { - mz_stream_raw_open, - mz_stream_raw_is_open, - mz_stream_raw_read, - mz_stream_raw_write, - mz_stream_raw_tell, - mz_stream_raw_seek, - mz_stream_raw_close, - mz_stream_raw_error, - mz_stream_raw_create, - mz_stream_raw_delete, - mz_stream_raw_get_prop_int64, - mz_stream_raw_set_prop_int64 -}; - -/***************************************************************************/ - -void *mz_stream_raw_create(void **stream) { - mz_stream_raw *raw = NULL; - - raw = (mz_stream_raw *)calloc(1, sizeof(mz_stream_raw)); - if (raw) - raw->stream.vtbl = &mz_stream_raw_vtbl; - if (stream) - *stream = raw; - - return raw; -} - -void mz_stream_raw_delete(void **stream) { - mz_stream_raw *raw = NULL; - if (!stream) - return; - raw = (mz_stream_raw *)*stream; - if (raw) - free(raw); - *stream = NULL; -} diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm.h b/ios/CodePush/SSZipArchive/minizip/mz_strm.h deleted file mode 100644 index 5f88015d0..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm.h +++ /dev/null @@ -1,132 +0,0 @@ -/* mz_strm.h -- Stream interface - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#ifndef MZ_STREAM_H -#define MZ_STREAM_H - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************************/ - -#define MZ_STREAM_PROP_TOTAL_IN (1) -#define MZ_STREAM_PROP_TOTAL_IN_MAX (2) -#define MZ_STREAM_PROP_TOTAL_OUT (3) -#define MZ_STREAM_PROP_TOTAL_OUT_MAX (4) -#define MZ_STREAM_PROP_HEADER_SIZE (5) -#define MZ_STREAM_PROP_FOOTER_SIZE (6) -#define MZ_STREAM_PROP_DISK_SIZE (7) -#define MZ_STREAM_PROP_DISK_NUMBER (8) -#define MZ_STREAM_PROP_COMPRESS_LEVEL (9) -#define MZ_STREAM_PROP_COMPRESS_METHOD (10) -#define MZ_STREAM_PROP_COMPRESS_WINDOW (11) - -/***************************************************************************/ - -typedef int32_t (*mz_stream_open_cb) (void *stream, const char *path, int32_t mode); -typedef int32_t (*mz_stream_is_open_cb) (void *stream); -typedef int32_t (*mz_stream_read_cb) (void *stream, void *buf, int32_t size); -typedef int32_t (*mz_stream_write_cb) (void *stream, const void *buf, int32_t size); -typedef int64_t (*mz_stream_tell_cb) (void *stream); -typedef int32_t (*mz_stream_seek_cb) (void *stream, int64_t offset, int32_t origin); -typedef int32_t (*mz_stream_close_cb) (void *stream); -typedef int32_t (*mz_stream_error_cb) (void *stream); -typedef void* (*mz_stream_create_cb) (void **stream); -typedef void (*mz_stream_destroy_cb) (void **stream); - -typedef int32_t (*mz_stream_get_prop_int64_cb) (void *stream, int32_t prop, int64_t *value); -typedef int32_t (*mz_stream_set_prop_int64_cb) (void *stream, int32_t prop, int64_t value); - -typedef int32_t (*mz_stream_find_cb) (void *stream, const void *find, int32_t find_size, - int64_t max_seek, int64_t *position); - -/***************************************************************************/ - -typedef struct mz_stream_vtbl_s { - mz_stream_open_cb open; - mz_stream_is_open_cb is_open; - mz_stream_read_cb read; - mz_stream_write_cb write; - mz_stream_tell_cb tell; - mz_stream_seek_cb seek; - mz_stream_close_cb close; - mz_stream_error_cb error; - mz_stream_create_cb create; - mz_stream_destroy_cb destroy; - - mz_stream_get_prop_int64_cb get_prop_int64; - mz_stream_set_prop_int64_cb set_prop_int64; -} mz_stream_vtbl; - -typedef struct mz_stream_s { - mz_stream_vtbl *vtbl; - struct mz_stream_s *base; -} mz_stream; - -/***************************************************************************/ - -int32_t mz_stream_open(void *stream, const char *path, int32_t mode); -int32_t mz_stream_is_open(void *stream); -int32_t mz_stream_read(void *stream, void *buf, int32_t size); -int32_t mz_stream_read_uint8(void *stream, uint8_t *value); -int32_t mz_stream_read_uint16(void *stream, uint16_t *value); -int32_t mz_stream_read_uint32(void *stream, uint32_t *value); -int32_t mz_stream_read_int64(void *stream, int64_t *value); -int32_t mz_stream_read_uint64(void *stream, uint64_t *value); -int32_t mz_stream_write(void *stream, const void *buf, int32_t size); -int32_t mz_stream_write_uint8(void *stream, uint8_t value); -int32_t mz_stream_write_uint16(void *stream, uint16_t value); -int32_t mz_stream_write_uint32(void *stream, uint32_t value); -int32_t mz_stream_write_int64(void *stream, int64_t value); -int32_t mz_stream_write_uint64(void *stream, uint64_t value); -int32_t mz_stream_copy(void *target, void *source, int32_t len); -int32_t mz_stream_copy_to_end(void *target, void *source); -int32_t mz_stream_copy_stream(void *target, mz_stream_write_cb write_cb, void *source, mz_stream_read_cb read_cb, int32_t len); -int32_t mz_stream_copy_stream_to_end(void *target, mz_stream_write_cb write_cb, void *source, mz_stream_read_cb read_cb); -int64_t mz_stream_tell(void *stream); -int32_t mz_stream_seek(void *stream, int64_t offset, int32_t origin); -int32_t mz_stream_find(void *stream, const void *find, int32_t find_size, int64_t max_seek, int64_t *position); -int32_t mz_stream_find_reverse(void *stream, const void *find, int32_t find_size, int64_t max_seek, int64_t *position); -int32_t mz_stream_close(void *stream); -int32_t mz_stream_error(void *stream); - -int32_t mz_stream_set_base(void *stream, void *base); -void* mz_stream_get_interface(void *stream); -int32_t mz_stream_get_prop_int64(void *stream, int32_t prop, int64_t *value); -int32_t mz_stream_set_prop_int64(void *stream, int32_t prop, int64_t value); - -void* mz_stream_create(void **stream, mz_stream_vtbl *vtbl); -void mz_stream_delete(void **stream); - -/***************************************************************************/ - -int32_t mz_stream_raw_open(void *stream, const char *filename, int32_t mode); -int32_t mz_stream_raw_is_open(void *stream); -int32_t mz_stream_raw_read(void *stream, void *buf, int32_t size); -int32_t mz_stream_raw_write(void *stream, const void *buf, int32_t size); -int64_t mz_stream_raw_tell(void *stream); -int32_t mz_stream_raw_seek(void *stream, int64_t offset, int32_t origin); -int32_t mz_stream_raw_close(void *stream); -int32_t mz_stream_raw_error(void *stream); - -int32_t mz_stream_raw_get_prop_int64(void *stream, int32_t prop, int64_t *value); -int32_t mz_stream_raw_set_prop_int64(void *stream, int32_t prop, int64_t value); - -void* mz_stream_raw_create(void **stream); -void mz_stream_raw_delete(void **stream); - -/***************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c b/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c deleted file mode 100644 index 3081d5372..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +++ /dev/null @@ -1,383 +0,0 @@ -/* mz_strm_buf.c -- Stream for buffering reads/writes - part of the minizip-ng project - - This version of ioapi is designed to buffer IO. - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#include "mz.h" -#include "mz_strm.h" -#include "mz_strm_buf.h" - -/***************************************************************************/ - -static mz_stream_vtbl mz_stream_buffered_vtbl = { - mz_stream_buffered_open, - mz_stream_buffered_is_open, - mz_stream_buffered_read, - mz_stream_buffered_write, - mz_stream_buffered_tell, - mz_stream_buffered_seek, - mz_stream_buffered_close, - mz_stream_buffered_error, - mz_stream_buffered_create, - mz_stream_buffered_delete, - NULL, - NULL -}; - -/***************************************************************************/ - -typedef struct mz_stream_buffered_s { - mz_stream stream; - int32_t error; - char readbuf[INT16_MAX]; - int32_t readbuf_len; - int32_t readbuf_pos; - int32_t readbuf_hits; - int32_t readbuf_misses; - char writebuf[INT16_MAX]; - int32_t writebuf_len; - int32_t writebuf_pos; - int32_t writebuf_hits; - int32_t writebuf_misses; - int64_t position; -} mz_stream_buffered; - -/***************************************************************************/ - -#if 0 -# define mz_stream_buffered_print printf -#else -# define mz_stream_buffered_print(fmt,...) -#endif - -/***************************************************************************/ - -static int32_t mz_stream_buffered_reset(void *stream) { - mz_stream_buffered *buffered = (mz_stream_buffered *)stream; - - buffered->readbuf_len = 0; - buffered->readbuf_pos = 0; - buffered->writebuf_len = 0; - buffered->writebuf_pos = 0; - buffered->position = 0; - - return MZ_OK; -} - -int32_t mz_stream_buffered_open(void *stream, const char *path, int32_t mode) { - mz_stream_buffered *buffered = (mz_stream_buffered *)stream; - mz_stream_buffered_print("Buffered - Open (mode %" PRId32 ")\n", mode); - mz_stream_buffered_reset(buffered); - return mz_stream_open(buffered->stream.base, path, mode); -} - -int32_t mz_stream_buffered_is_open(void *stream) { - mz_stream_buffered *buffered = (mz_stream_buffered *)stream; - return mz_stream_is_open(buffered->stream.base); -} - -static int32_t mz_stream_buffered_flush(void *stream, int32_t *written) { - mz_stream_buffered *buffered = (mz_stream_buffered *)stream; - int32_t total_bytes_written = 0; - int32_t bytes_to_write = buffered->writebuf_len; - int32_t bytes_left_to_write = buffered->writebuf_len; - int32_t bytes_written = 0; - - *written = 0; - - while (bytes_left_to_write > 0) { - bytes_written = mz_stream_write(buffered->stream.base, - buffered->writebuf + (bytes_to_write - bytes_left_to_write), bytes_left_to_write); - - if (bytes_written != bytes_left_to_write) - return MZ_WRITE_ERROR; - - buffered->writebuf_misses += 1; - - mz_stream_buffered_print("Buffered - Write flush (%" PRId32 ":%" PRId32 " len %" PRId32 ")\n", - bytes_to_write, bytes_left_to_write, buffered->writebuf_len); - - total_bytes_written += bytes_written; - bytes_left_to_write -= bytes_written; - buffered->position += bytes_written; - } - - buffered->writebuf_len = 0; - buffered->writebuf_pos = 0; - - *written = total_bytes_written; - return MZ_OK; -} - -int32_t mz_stream_buffered_read(void *stream, void *buf, int32_t size) { - mz_stream_buffered *buffered = (mz_stream_buffered *)stream; - int32_t buf_len = 0; - int32_t bytes_to_read = 0; - int32_t bytes_to_copy = 0; - int32_t bytes_left_to_read = size; - int32_t bytes_read = 0; - int32_t bytes_flushed = 0; - - mz_stream_buffered_print("Buffered - Read (size %" PRId32 " pos %" PRId64 ")\n", size, buffered->position); - - if (buffered->writebuf_len > 0) { - int64_t position = buffered->position + buffered->writebuf_pos - - mz_stream_buffered_print("Buffered - Switch from write to read, flushing (pos %" PRId64 ")\n", position); - - mz_stream_buffered_flush(stream, &bytes_flushed); - mz_stream_buffered_seek(stream, position, MZ_SEEK_SET); - } - - while (bytes_left_to_read > 0) { - if ((buffered->readbuf_len == 0) || (buffered->readbuf_pos == buffered->readbuf_len)) { - if (buffered->readbuf_len == sizeof(buffered->readbuf)) { - buffered->readbuf_pos = 0; - buffered->readbuf_len = 0; - } - - bytes_to_read = (int32_t)sizeof(buffered->readbuf) - (buffered->readbuf_len - buffered->readbuf_pos); - bytes_read = mz_stream_read(buffered->stream.base, buffered->readbuf + buffered->readbuf_pos, bytes_to_read); - if (bytes_read < 0) - return bytes_read; - - buffered->readbuf_misses += 1; - buffered->readbuf_len += bytes_read; - buffered->position += bytes_read; - - mz_stream_buffered_print("Buffered - Filled (read %" PRId32 "/%" PRId32 " buf %" PRId32 ":%" PRId32 " pos %" PRId64 ")\n", - bytes_read, bytes_to_read, buffered->readbuf_pos, buffered->readbuf_len, buffered->position); - - if (bytes_read == 0) - break; - } - - if ((buffered->readbuf_len - buffered->readbuf_pos) > 0) { - bytes_to_copy = buffered->readbuf_len - buffered->readbuf_pos; - if (bytes_to_copy > bytes_left_to_read) - bytes_to_copy = bytes_left_to_read; - - memcpy((char *)buf + buf_len, buffered->readbuf + buffered->readbuf_pos, bytes_to_copy); - - buf_len += bytes_to_copy; - bytes_left_to_read -= bytes_to_copy; - - buffered->readbuf_hits += 1; - buffered->readbuf_pos += bytes_to_copy; - - mz_stream_buffered_print("Buffered - Emptied (copied %" PRId32 " remaining %" PRId32 " buf %" PRId32 ":%" PRId32 " pos %" PRId64 ")\n", - bytes_to_copy, bytes_left_to_read, buffered->readbuf_pos, buffered->readbuf_len, buffered->position); - } - } - - return size - bytes_left_to_read; -} - -int32_t mz_stream_buffered_write(void *stream, const void *buf, int32_t size) { - mz_stream_buffered *buffered = (mz_stream_buffered *)stream; - int32_t bytes_to_write = size; - int32_t bytes_left_to_write = size; - int32_t bytes_to_copy = 0; - int32_t bytes_used = 0; - int32_t bytes_flushed = 0; - int32_t err = MZ_OK; - - - mz_stream_buffered_print("Buffered - Write (size %" PRId32 " len %" PRId32 " pos %" PRId64 ")\n", - size, buffered->writebuf_len, buffered->position); - - if (buffered->readbuf_len > 0) { - buffered->position -= buffered->readbuf_len; - buffered->position += buffered->readbuf_pos; - - buffered->readbuf_len = 0; - buffered->readbuf_pos = 0; - - mz_stream_buffered_print("Buffered - Switch from read to write (pos %" PRId64 ")\n", buffered->position); - - err = mz_stream_seek(buffered->stream.base, buffered->position, MZ_SEEK_SET); - if (err != MZ_OK) - return err; - } - - while (bytes_left_to_write > 0) { - bytes_used = buffered->writebuf_len; - if (bytes_used > buffered->writebuf_pos) - bytes_used = buffered->writebuf_pos; - bytes_to_copy = (int32_t)sizeof(buffered->writebuf) - bytes_used; - if (bytes_to_copy > bytes_left_to_write) - bytes_to_copy = bytes_left_to_write; - - if (bytes_to_copy == 0) { - err = mz_stream_buffered_flush(stream, &bytes_flushed); - if (err != MZ_OK) - return err; - if (bytes_flushed == 0) - return 0; - - continue; - } - - memcpy(buffered->writebuf + buffered->writebuf_pos, - (const char *)buf + (bytes_to_write - bytes_left_to_write), bytes_to_copy); - - mz_stream_buffered_print("Buffered - Write copy (remaining %" PRId32 " write %" PRId32 ":%" PRId32 " len %" PRId32 ")\n", - bytes_to_copy, bytes_to_write, bytes_left_to_write, buffered->writebuf_len); - - bytes_left_to_write -= bytes_to_copy; - - buffered->writebuf_pos += bytes_to_copy; - buffered->writebuf_hits += 1; - if (buffered->writebuf_pos > buffered->writebuf_len) - buffered->writebuf_len += buffered->writebuf_pos - buffered->writebuf_len; - } - - return size - bytes_left_to_write; -} - -int64_t mz_stream_buffered_tell(void *stream) { - mz_stream_buffered *buffered = (mz_stream_buffered *)stream; - int64_t position = mz_stream_tell(buffered->stream.base); - - buffered->position = position; - - mz_stream_buffered_print("Buffered - Tell (pos %" PRId64 " readpos %" PRId32 " writepos %" PRId32 ")\n", - buffered->position, buffered->readbuf_pos, buffered->writebuf_pos); - - if (buffered->readbuf_len > 0) - position -= ((int64_t)buffered->readbuf_len - buffered->readbuf_pos); - if (buffered->writebuf_len > 0) - position += buffered->writebuf_pos; - return position; -} - -int32_t mz_stream_buffered_seek(void *stream, int64_t offset, int32_t origin) { - mz_stream_buffered *buffered = (mz_stream_buffered *)stream; - int32_t bytes_flushed = 0; - int32_t err = MZ_OK; - - mz_stream_buffered_print("Buffered - Seek (origin %" PRId32 " offset %" PRId64 " pos %" PRId64 ")\n", - origin, offset, buffered->position); - - switch (origin) { - case MZ_SEEK_SET: - - if ((buffered->readbuf_len > 0) && (offset < buffered->position) && - (offset >= buffered->position - buffered->readbuf_len)) { - buffered->readbuf_pos = (int32_t)(offset - (buffered->position - buffered->readbuf_len)); - return MZ_OK; - } - if (buffered->writebuf_len > 0) { - if ((offset >= buffered->position) && (offset <= buffered->position + buffered->writebuf_len)) { - buffered->writebuf_pos = (int32_t)(offset - buffered->position); - return MZ_OK; - } - } - - err = mz_stream_buffered_flush(stream, &bytes_flushed); - if (err != MZ_OK) - return err; - - buffered->position = offset; - break; - - case MZ_SEEK_CUR: - - if (buffered->readbuf_len > 0) { - if (offset <= ((int64_t)buffered->readbuf_len - buffered->readbuf_pos)) { - buffered->readbuf_pos += (uint32_t)offset; - return MZ_OK; - } - offset -= ((int64_t)buffered->readbuf_len - buffered->readbuf_pos); - buffered->position += offset; - } - if (buffered->writebuf_len > 0) { - if (offset <= ((int64_t)buffered->writebuf_len - buffered->writebuf_pos)) { - buffered->writebuf_pos += (uint32_t)offset; - return MZ_OK; - } - /* offset -= (buffered->writebuf_len - buffered->writebuf_pos); */ - } - - err = mz_stream_buffered_flush(stream, &bytes_flushed); - if (err != MZ_OK) - return err; - - break; - - case MZ_SEEK_END: - - if (buffered->writebuf_len > 0) { - buffered->writebuf_pos = buffered->writebuf_len; - return MZ_OK; - } - break; - } - - buffered->readbuf_len = 0; - buffered->readbuf_pos = 0; - buffered->writebuf_len = 0; - buffered->writebuf_pos = 0; - - return mz_stream_seek(buffered->stream.base, offset, origin); -} - -int32_t mz_stream_buffered_close(void *stream) { - mz_stream_buffered *buffered = (mz_stream_buffered *)stream; - int32_t bytes_flushed = 0; - - mz_stream_buffered_flush(stream, &bytes_flushed); - mz_stream_buffered_print("Buffered - Close (flushed %" PRId32 ")\n", bytes_flushed); - - if (buffered->readbuf_hits + buffered->readbuf_misses > 0) { - mz_stream_buffered_print("Buffered - Read efficiency %.02f%%\n", - (buffered->readbuf_hits / ((float)buffered->readbuf_hits + buffered->readbuf_misses)) * 100); - } - - if (buffered->writebuf_hits + buffered->writebuf_misses > 0) { - mz_stream_buffered_print("Buffered - Write efficiency %.02f%%\n", - (buffered->writebuf_hits / ((float)buffered->writebuf_hits + buffered->writebuf_misses)) * 100); - } - - mz_stream_buffered_reset(buffered); - - return mz_stream_close(buffered->stream.base); -} - -int32_t mz_stream_buffered_error(void *stream) { - mz_stream_buffered *buffered = (mz_stream_buffered *)stream; - return mz_stream_error(buffered->stream.base); -} - -void *mz_stream_buffered_create(void **stream) { - mz_stream_buffered *buffered = NULL; - - buffered = (mz_stream_buffered *)calloc(1, sizeof(mz_stream_buffered)); - if (buffered) - buffered->stream.vtbl = &mz_stream_buffered_vtbl; - if (stream) - *stream = buffered; - - return buffered; -} - -void mz_stream_buffered_delete(void **stream) { - mz_stream_buffered *buffered = NULL; - if (!stream) - return; - buffered = (mz_stream_buffered *)*stream; - if (buffered) - free(buffered); - *stream = NULL; -} - -void *mz_stream_buffered_get_interface(void) { - return (void *)&mz_stream_buffered_vtbl; -} diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h b/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h deleted file mode 100644 index 93eea268b..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +++ /dev/null @@ -1,42 +0,0 @@ -/* mz_strm_buf.h -- Stream for buffering reads/writes - part of the minizip-ng project - - This version of ioapi is designed to buffer IO. - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#ifndef MZ_STREAM_BUFFERED_H -#define MZ_STREAM_BUFFERED_H - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************************/ - -int32_t mz_stream_buffered_open(void *stream, const char *path, int32_t mode); -int32_t mz_stream_buffered_is_open(void *stream); -int32_t mz_stream_buffered_read(void *stream, void *buf, int32_t size); -int32_t mz_stream_buffered_write(void *stream, const void *buf, int32_t size); -int64_t mz_stream_buffered_tell(void *stream); -int32_t mz_stream_buffered_seek(void *stream, int64_t offset, int32_t origin); -int32_t mz_stream_buffered_close(void *stream); -int32_t mz_stream_buffered_error(void *stream); - -void* mz_stream_buffered_create(void **stream); -void mz_stream_buffered_delete(void **stream); - -void* mz_stream_buffered_get_interface(void); - -/***************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c b/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c deleted file mode 100644 index 9a78dc1bd..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +++ /dev/null @@ -1,269 +0,0 @@ -/* mz_strm_mem.c -- Stream for memory access - part of the minizip-ng project - - This interface is designed to access memory rather than files. - We do use a region of memory to put data in to and take it out of. - - Based on Unzip ioapi.c version 0.22, May 19th, 2003 - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - Copyright (C) 2003 Justin Fletcher - Copyright (C) 1998-2003 Gilles Vollant - https://www.winimage.com/zLibDll/minizip.html - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#include "mz.h" -#include "mz_strm.h" -#include "mz_strm_mem.h" - -/***************************************************************************/ - -static mz_stream_vtbl mz_stream_mem_vtbl = { - mz_stream_mem_open, - mz_stream_mem_is_open, - mz_stream_mem_read, - mz_stream_mem_write, - mz_stream_mem_tell, - mz_stream_mem_seek, - mz_stream_mem_close, - mz_stream_mem_error, - mz_stream_mem_create, - mz_stream_mem_delete, - NULL, - NULL -}; - -/***************************************************************************/ - -typedef struct mz_stream_mem_s { - mz_stream stream; - int32_t mode; - uint8_t *buffer; /* Memory buffer pointer */ - int32_t size; /* Size of the memory buffer */ - int32_t limit; /* Furthest we've written */ - int32_t position; /* Current position in the memory */ - int32_t grow_size; /* Size to grow when full */ -} mz_stream_mem; - -/***************************************************************************/ - -static int32_t mz_stream_mem_set_size(void *stream, int32_t size) { - mz_stream_mem *mem = (mz_stream_mem *)stream; - int32_t new_size = size; - uint8_t *new_buf = NULL; - - new_buf = (uint8_t *)malloc((uint32_t)new_size); - if (!new_buf) - return MZ_BUF_ERROR; - - if (mem->buffer) { - memcpy(new_buf, mem->buffer, mem->size); - free(mem->buffer); - } - - mem->buffer = new_buf; - mem->size = new_size; - return MZ_OK; -} - -int32_t mz_stream_mem_open(void *stream, const char *path, int32_t mode) { - mz_stream_mem *mem = (mz_stream_mem *)stream; - int32_t err = MZ_OK; - - MZ_UNUSED(path); - - mem->mode = mode; - mem->limit = 0; - mem->position = 0; - - if (mem->mode & MZ_OPEN_MODE_CREATE) - err = mz_stream_mem_set_size(stream, mem->grow_size); - else - mem->limit = mem->size; - - return err; -} - -int32_t mz_stream_mem_is_open(void *stream) { - mz_stream_mem *mem = (mz_stream_mem *)stream; - if (!mem->buffer) - return MZ_OPEN_ERROR; - return MZ_OK; -} - -int32_t mz_stream_mem_read(void *stream, void *buf, int32_t size) { - mz_stream_mem *mem = (mz_stream_mem *)stream; - - if (size > mem->size - mem->position) - size = mem->size - mem->position; - if (mem->position + size > mem->limit) - size = mem->limit - mem->position; - - if (size <= 0) - return 0; - - memcpy(buf, mem->buffer + mem->position, size); - mem->position += size; - - return size; -} - -int32_t mz_stream_mem_write(void *stream, const void *buf, int32_t size) { - mz_stream_mem *mem = (mz_stream_mem *)stream; - int32_t new_size = 0; - int32_t err = MZ_OK; - - if (!size) - return size; - - if (size > mem->size - mem->position) { - if (mem->mode & MZ_OPEN_MODE_CREATE) { - new_size = mem->size; - if (size < mem->grow_size) - new_size += mem->grow_size; - else - new_size += size; - - err = mz_stream_mem_set_size(stream, new_size); - if (err != MZ_OK) - return err; - } else { - size = mem->size - mem->position; - } - } - - memcpy(mem->buffer + mem->position, buf, size); - - mem->position += size; - if (mem->position > mem->limit) - mem->limit = mem->position; - - return size; -} - -int64_t mz_stream_mem_tell(void *stream) { - mz_stream_mem *mem = (mz_stream_mem *)stream; - return mem->position; -} - -int32_t mz_stream_mem_seek(void *stream, int64_t offset, int32_t origin) { - mz_stream_mem *mem = (mz_stream_mem *)stream; - int64_t new_pos = 0; - int32_t err = MZ_OK; - - switch (origin) { - case MZ_SEEK_CUR: - new_pos = mem->position + offset; - break; - case MZ_SEEK_END: - new_pos = mem->limit + offset; - break; - case MZ_SEEK_SET: - new_pos = offset; - break; - default: - return MZ_SEEK_ERROR; - } - - if (new_pos > mem->size) { - if ((mem->mode & MZ_OPEN_MODE_CREATE) == 0) - return MZ_SEEK_ERROR; - - err = mz_stream_mem_set_size(stream, (int32_t)new_pos); - if (err != MZ_OK) - return err; - } else if (new_pos < 0) { - return MZ_SEEK_ERROR; - } - - mem->position = (int32_t)new_pos; - return MZ_OK; -} - -int32_t mz_stream_mem_close(void *stream) { - MZ_UNUSED(stream); - - /* We never return errors */ - return MZ_OK; -} - -int32_t mz_stream_mem_error(void *stream) { - MZ_UNUSED(stream); - - /* We never return errors */ - return MZ_OK; -} - -void mz_stream_mem_set_buffer(void *stream, void *buf, int32_t size) { - mz_stream_mem *mem = (mz_stream_mem *)stream; - mem->buffer = (uint8_t *)buf; - mem->size = size; - mem->limit = size; -} - -int32_t mz_stream_mem_get_buffer(void *stream, const void **buf) { - return mz_stream_mem_get_buffer_at(stream, 0, buf); -} - -int32_t mz_stream_mem_get_buffer_at(void *stream, int64_t position, const void **buf) { - mz_stream_mem *mem = (mz_stream_mem *)stream; - if (!buf || position < 0 || !mem->buffer|| mem->size < position) - return MZ_SEEK_ERROR; - *buf = mem->buffer + position; - return MZ_OK; -} - -int32_t mz_stream_mem_get_buffer_at_current(void *stream, const void **buf) { - mz_stream_mem *mem = (mz_stream_mem *)stream; - return mz_stream_mem_get_buffer_at(stream, mem->position, buf); -} - -void mz_stream_mem_get_buffer_length(void *stream, int32_t *length) { - mz_stream_mem *mem = (mz_stream_mem *)stream; - *length = mem->limit; -} - -void mz_stream_mem_set_buffer_limit(void *stream, int32_t limit) { - mz_stream_mem *mem = (mz_stream_mem *)stream; - mem->limit = limit; -} - -void mz_stream_mem_set_grow_size(void *stream, int32_t grow_size) { - mz_stream_mem *mem = (mz_stream_mem *)stream; - mem->grow_size = grow_size; -} - -void *mz_stream_mem_create(void **stream) { - mz_stream_mem *mem = NULL; - - mem = (mz_stream_mem *)calloc(1, sizeof(mz_stream_mem)); - if (mem) { - mem->stream.vtbl = &mz_stream_mem_vtbl; - mem->grow_size = 4096; - } - if (stream) - *stream = mem; - - return mem; -} - -void mz_stream_mem_delete(void **stream) { - mz_stream_mem *mem = NULL; - if (!stream) - return; - mem = (mz_stream_mem *)*stream; - if (mem) { - if ((mem->mode & MZ_OPEN_MODE_CREATE) && (mem->buffer)) - free(mem->buffer); - free(mem); - } - *stream = NULL; -} - -void *mz_stream_mem_get_interface(void) { - return (void *)&mz_stream_mem_vtbl; -} diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h b/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h deleted file mode 100644 index 22a12deae..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +++ /dev/null @@ -1,48 +0,0 @@ -/* mz_strm_mem.h -- Stream for memory access - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#ifndef MZ_STREAM_MEM_H -#define MZ_STREAM_MEM_H - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************************/ - -int32_t mz_stream_mem_open(void *stream, const char *filename, int32_t mode); -int32_t mz_stream_mem_is_open(void *stream); -int32_t mz_stream_mem_read(void *stream, void *buf, int32_t size); -int32_t mz_stream_mem_write(void *stream, const void *buf, int32_t size); -int64_t mz_stream_mem_tell(void *stream); -int32_t mz_stream_mem_seek(void *stream, int64_t offset, int32_t origin); -int32_t mz_stream_mem_close(void *stream); -int32_t mz_stream_mem_error(void *stream); - -void mz_stream_mem_set_buffer(void *stream, void *buf, int32_t size); -int32_t mz_stream_mem_get_buffer(void *stream, const void **buf); -int32_t mz_stream_mem_get_buffer_at(void *stream, int64_t position, const void **buf); -int32_t mz_stream_mem_get_buffer_at_current(void *stream, const void **buf); -void mz_stream_mem_get_buffer_length(void *stream, int32_t *length); -void mz_stream_mem_set_buffer_limit(void *stream, int32_t limit); -void mz_stream_mem_set_grow_size(void *stream, int32_t grow_size); - -void* mz_stream_mem_create(void **stream); -void mz_stream_mem_delete(void **stream); - -void* mz_stream_mem_get_interface(void); - -/***************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h b/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h deleted file mode 100644 index 83d292b95..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +++ /dev/null @@ -1,40 +0,0 @@ -/* mz_sstrm_os.h -- Stream for filesystem access - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#ifndef MZ_STREAM_OS_H -#define MZ_STREAM_OS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************************/ - -int32_t mz_stream_os_open(void *stream, const char *path, int32_t mode); -int32_t mz_stream_os_is_open(void *stream); -int32_t mz_stream_os_read(void *stream, void *buf, int32_t size); -int32_t mz_stream_os_write(void *stream, const void *buf, int32_t size); -int64_t mz_stream_os_tell(void *stream); -int32_t mz_stream_os_seek(void *stream, int64_t offset, int32_t origin); -int32_t mz_stream_os_close(void *stream); -int32_t mz_stream_os_error(void *stream); - -void* mz_stream_os_create(void **stream); -void mz_stream_os_delete(void **stream); - -void* mz_stream_os_get_interface(void); - -/***************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c b/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c deleted file mode 100644 index 60ff502de..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +++ /dev/null @@ -1,203 +0,0 @@ -/* mz_strm_posix.c -- Stream for filesystem access for posix/linux - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - Modifications for Zip64 support - Copyright (C) 2009-2010 Mathias Svensson - http://result42.com - Copyright (C) 1998-2010 Gilles Vollant - https://www.winimage.com/zLibDll/minizip.html - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#include "mz.h" -#include "mz_strm.h" -#include "mz_strm_os.h" - -#include /* fopen, fread.. */ -#include - -/***************************************************************************/ - -#define fopen64 fopen -#ifndef MZ_FILE32_API -# ifndef NO_FSEEKO -# define ftello64 ftello -# define fseeko64 fseeko -# elif defined(_MSC_VER) && (_MSC_VER >= 1400) -# define ftello64 _ftelli64 -# define fseeko64 _fseeki64 -# endif -#endif -#ifndef ftello64 -# define ftello64 ftell -#endif -#ifndef fseeko64 -# define fseeko64 fseek -#endif - -/***************************************************************************/ - -static mz_stream_vtbl mz_stream_os_vtbl = { - mz_stream_os_open, - mz_stream_os_is_open, - mz_stream_os_read, - mz_stream_os_write, - mz_stream_os_tell, - mz_stream_os_seek, - mz_stream_os_close, - mz_stream_os_error, - mz_stream_os_create, - mz_stream_os_delete, - NULL, - NULL -}; - -/***************************************************************************/ - -typedef struct mz_stream_posix_s { - mz_stream stream; - int32_t error; - FILE *handle; -} mz_stream_posix; - -/***************************************************************************/ - -int32_t mz_stream_os_open(void *stream, const char *path, int32_t mode) { - mz_stream_posix *posix = (mz_stream_posix *)stream; - const char *mode_fopen = NULL; - - if (!path) - return MZ_PARAM_ERROR; - - if ((mode & MZ_OPEN_MODE_READWRITE) == MZ_OPEN_MODE_READ) - mode_fopen = "rb"; - else if (mode & MZ_OPEN_MODE_APPEND) - mode_fopen = "r+b"; - else if (mode & MZ_OPEN_MODE_CREATE) - mode_fopen = "wb"; - else - return MZ_OPEN_ERROR; - - posix->handle = fopen64(path, mode_fopen); - if (!posix->handle) { - posix->error = errno; - return MZ_OPEN_ERROR; - } - - if (mode & MZ_OPEN_MODE_APPEND) - return mz_stream_os_seek(stream, 0, MZ_SEEK_END); - - return MZ_OK; -} - -int32_t mz_stream_os_is_open(void *stream) { - mz_stream_posix *posix = (mz_stream_posix *)stream; - if (!posix->handle) - return MZ_OPEN_ERROR; - return MZ_OK; -} - -int32_t mz_stream_os_read(void *stream, void *buf, int32_t size) { - mz_stream_posix *posix = (mz_stream_posix *)stream; - int32_t read = (int32_t)fread(buf, 1, (size_t)size, posix->handle); - if (read < size && ferror(posix->handle)) { - posix->error = errno; - return MZ_READ_ERROR; - } - return read; -} - -int32_t mz_stream_os_write(void *stream, const void *buf, int32_t size) { - mz_stream_posix *posix = (mz_stream_posix *)stream; - int32_t written = (int32_t)fwrite(buf, 1, (size_t)size, posix->handle); - if (written < size && ferror(posix->handle)) { - posix->error = errno; - return MZ_WRITE_ERROR; - } - return written; -} - -int64_t mz_stream_os_tell(void *stream) { - mz_stream_posix *posix = (mz_stream_posix *)stream; - int64_t position = ftello64(posix->handle); - if (position == -1) { - posix->error = errno; - return MZ_TELL_ERROR; - } - return position; -} - -int32_t mz_stream_os_seek(void *stream, int64_t offset, int32_t origin) { - mz_stream_posix *posix = (mz_stream_posix *)stream; - int32_t fseek_origin = 0; - - switch (origin) { - case MZ_SEEK_CUR: - fseek_origin = SEEK_CUR; - break; - case MZ_SEEK_END: - fseek_origin = SEEK_END; - break; - case MZ_SEEK_SET: - fseek_origin = SEEK_SET; - break; - default: - return MZ_SEEK_ERROR; - } - - if (fseeko64(posix->handle, offset, fseek_origin) != 0) { - posix->error = errno; - return MZ_SEEK_ERROR; - } - - return MZ_OK; -} - -int32_t mz_stream_os_close(void *stream) { - mz_stream_posix *posix = (mz_stream_posix *)stream; - int32_t closed = 0; - if (posix->handle) { - closed = fclose(posix->handle); - posix->handle = NULL; - } - if (closed != 0) { - posix->error = errno; - return MZ_CLOSE_ERROR; - } - return MZ_OK; -} - -int32_t mz_stream_os_error(void *stream) { - mz_stream_posix *posix = (mz_stream_posix *)stream; - return posix->error; -} - -void *mz_stream_os_create(void **stream) { - mz_stream_posix *posix = NULL; - - posix = (mz_stream_posix *)calloc(1, sizeof(mz_stream_posix)); - if (posix) - posix->stream.vtbl = &mz_stream_os_vtbl; - if (stream) - *stream = posix; - - return posix; -} - -void mz_stream_os_delete(void **stream) { - mz_stream_posix *posix = NULL; - if (!stream) - return; - posix = (mz_stream_posix *)*stream; - if (posix) - free(posix); - *stream = NULL; -} - -void *mz_stream_os_get_interface(void) { - return (void *)&mz_stream_os_vtbl; -} diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c b/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c deleted file mode 100644 index 1791b15ae..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +++ /dev/null @@ -1,334 +0,0 @@ -/* mz_strm_pkcrypt.c -- Code for traditional PKWARE encryption - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - Copyright (C) 1998-2005 Gilles Vollant - Modifications for Info-ZIP crypting - https://www.winimage.com/zLibDll/minizip.html - Copyright (C) 2003 Terry Thorsen - - This code is a modified version of crypting code in Info-ZIP distribution - - Copyright (C) 1990-2000 Info-ZIP. All rights reserved. - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. - - This encryption code is a direct transcription of the algorithm from - Roger Schlafly, described by Phil Katz in the file appnote.txt. This - file (appnote.txt) is distributed with the PKZIP program (even in the - version without encryption capabilities). -*/ - -#include "mz.h" -#include "mz_crypt.h" -#include "mz_strm.h" -#include "mz_strm_pkcrypt.h" - -/***************************************************************************/ - -static mz_stream_vtbl mz_stream_pkcrypt_vtbl = { - mz_stream_pkcrypt_open, - mz_stream_pkcrypt_is_open, - mz_stream_pkcrypt_read, - mz_stream_pkcrypt_write, - mz_stream_pkcrypt_tell, - mz_stream_pkcrypt_seek, - mz_stream_pkcrypt_close, - mz_stream_pkcrypt_error, - mz_stream_pkcrypt_create, - mz_stream_pkcrypt_delete, - mz_stream_pkcrypt_get_prop_int64, - mz_stream_pkcrypt_set_prop_int64 -}; - -/***************************************************************************/ - -typedef struct mz_stream_pkcrypt_s { - mz_stream stream; - int32_t error; - int16_t initialized; - uint8_t buffer[UINT16_MAX]; - int64_t total_in; - int64_t max_total_in; - int64_t total_out; - uint32_t keys[3]; /* keys defining the pseudo-random sequence */ - uint8_t verify1; - uint8_t verify2; - const char *password; -} mz_stream_pkcrypt; - -/***************************************************************************/ - -#define mz_stream_pkcrypt_decode(strm, c) \ - (mz_stream_pkcrypt_update_keys(strm, \ - c ^= mz_stream_pkcrypt_decrypt_byte(strm))) - -#define mz_stream_pkcrypt_encode(strm, c, t) \ - (t = mz_stream_pkcrypt_decrypt_byte(strm), \ - mz_stream_pkcrypt_update_keys(strm, (uint8_t)c), (uint8_t)(t^(c))) - -/***************************************************************************/ - -static uint8_t mz_stream_pkcrypt_decrypt_byte(void *stream) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - - unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an */ - /* unpredictable manner on 16-bit systems; not a problem */ - /* with any known compiler so far, though. */ - - temp = pkcrypt->keys[2] | 2; - return (uint8_t)(((temp * (temp ^ 1)) >> 8) & 0xff); -} - -static uint8_t mz_stream_pkcrypt_update_keys(void *stream, uint8_t c) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - uint8_t buf = c; - - pkcrypt->keys[0] = (uint32_t)~mz_crypt_crc32_update(~pkcrypt->keys[0], &buf, 1); - - pkcrypt->keys[1] += pkcrypt->keys[0] & 0xff; - pkcrypt->keys[1] *= 134775813L; - pkcrypt->keys[1] += 1; - - buf = (uint8_t)(pkcrypt->keys[1] >> 24); - pkcrypt->keys[2] = (uint32_t)~mz_crypt_crc32_update(~pkcrypt->keys[2], &buf, 1); - - return (uint8_t)c; -} - -static void mz_stream_pkcrypt_init_keys(void *stream, const char *password) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - - pkcrypt->keys[0] = 305419896L; - pkcrypt->keys[1] = 591751049L; - pkcrypt->keys[2] = 878082192L; - - while (*password != 0) { - mz_stream_pkcrypt_update_keys(stream, (uint8_t)*password); - password += 1; - } -} - -/***************************************************************************/ - -int32_t mz_stream_pkcrypt_open(void *stream, const char *path, int32_t mode) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - uint16_t t = 0; - int16_t i = 0; - uint8_t verify1 = 0; - uint8_t verify2 = 0; - uint8_t header[MZ_PKCRYPT_HEADER_SIZE]; - const char *password = path; - - pkcrypt->total_in = 0; - pkcrypt->total_out = 0; - pkcrypt->initialized = 0; - - if (mz_stream_is_open(pkcrypt->stream.base) != MZ_OK) - return MZ_OPEN_ERROR; - - if (!password) - password = pkcrypt->password; - if (!password) - return MZ_PARAM_ERROR; - - mz_stream_pkcrypt_init_keys(stream, password); - - if (mode & MZ_OPEN_MODE_WRITE) { - /* First generate RAND_HEAD_LEN - 2 random bytes. */ - mz_crypt_rand(header, MZ_PKCRYPT_HEADER_SIZE - 2); - - /* Encrypt random header (last two bytes is high word of crc) */ - for (i = 0; i < MZ_PKCRYPT_HEADER_SIZE - 2; i++) - header[i] = mz_stream_pkcrypt_encode(stream, header[i], t); - - header[i++] = mz_stream_pkcrypt_encode(stream, pkcrypt->verify1, t); - header[i++] = mz_stream_pkcrypt_encode(stream, pkcrypt->verify2, t); - - if (mz_stream_write(pkcrypt->stream.base, header, sizeof(header)) != sizeof(header)) - return MZ_WRITE_ERROR; - - pkcrypt->total_out += MZ_PKCRYPT_HEADER_SIZE; - } else if (mode & MZ_OPEN_MODE_READ) { - if (mz_stream_read(pkcrypt->stream.base, header, sizeof(header)) != sizeof(header)) - return MZ_READ_ERROR; - - for (i = 0; i < MZ_PKCRYPT_HEADER_SIZE - 2; i++) - header[i] = mz_stream_pkcrypt_decode(stream, header[i]); - - verify1 = mz_stream_pkcrypt_decode(stream, header[i++]); - verify2 = mz_stream_pkcrypt_decode(stream, header[i++]); - - /* Older versions used 2 byte check, newer versions use 1 byte check. */ - MZ_UNUSED(verify1); - if ((verify2 != 0) && (verify2 != pkcrypt->verify2)) - return MZ_PASSWORD_ERROR; - - pkcrypt->total_in += MZ_PKCRYPT_HEADER_SIZE; - } - - pkcrypt->initialized = 1; - return MZ_OK; -} - -int32_t mz_stream_pkcrypt_is_open(void *stream) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - if (!pkcrypt->initialized) - return MZ_OPEN_ERROR; - return MZ_OK; -} - -int32_t mz_stream_pkcrypt_read(void *stream, void *buf, int32_t size) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - uint8_t *buf_ptr = (uint8_t *)buf; - int32_t bytes_to_read = size; - int32_t read = 0; - int32_t i = 0; - - if ((int64_t)bytes_to_read > (pkcrypt->max_total_in - pkcrypt->total_in)) - bytes_to_read = (int32_t)(pkcrypt->max_total_in - pkcrypt->total_in); - - read = mz_stream_read(pkcrypt->stream.base, buf, bytes_to_read); - - for (i = 0; i < read; i++) - buf_ptr[i] = mz_stream_pkcrypt_decode(stream, buf_ptr[i]); - - if (read > 0) - pkcrypt->total_in += read; - - return read; -} - -int32_t mz_stream_pkcrypt_write(void *stream, const void *buf, int32_t size) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - const uint8_t *buf_ptr = (const uint8_t *)buf; - int32_t bytes_to_write = sizeof(pkcrypt->buffer); - int32_t total_written = 0; - int32_t written = 0; - int32_t i = 0; - uint16_t t = 0; - - if (size < 0) - return MZ_PARAM_ERROR; - - do { - if (bytes_to_write > (size - total_written)) - bytes_to_write = (size - total_written); - - for (i = 0; i < bytes_to_write; i += 1) { - pkcrypt->buffer[i] = mz_stream_pkcrypt_encode(stream, *buf_ptr, t); - buf_ptr += 1; - } - - written = mz_stream_write(pkcrypt->stream.base, pkcrypt->buffer, bytes_to_write); - if (written < 0) - return written; - - total_written += written; - } while (total_written < size && written > 0); - - pkcrypt->total_out += total_written; - return total_written; -} - -int64_t mz_stream_pkcrypt_tell(void *stream) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - return mz_stream_tell(pkcrypt->stream.base); -} - -int32_t mz_stream_pkcrypt_seek(void *stream, int64_t offset, int32_t origin) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - return mz_stream_seek(pkcrypt->stream.base, offset, origin); -} - -int32_t mz_stream_pkcrypt_close(void *stream) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - pkcrypt->initialized = 0; - return MZ_OK; -} - -int32_t mz_stream_pkcrypt_error(void *stream) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - return pkcrypt->error; -} - -void mz_stream_pkcrypt_set_password(void *stream, const char *password) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - pkcrypt->password = password; -} - -void mz_stream_pkcrypt_set_verify(void *stream, uint8_t verify1, uint8_t verify2) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - pkcrypt->verify1 = verify1; - pkcrypt->verify2 = verify2; -} - -void mz_stream_pkcrypt_get_verify(void *stream, uint8_t *verify1, uint8_t *verify2) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - *verify1 = pkcrypt->verify1; - *verify2 = pkcrypt->verify2; -} - -int32_t mz_stream_pkcrypt_get_prop_int64(void *stream, int32_t prop, int64_t *value) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - switch (prop) { - case MZ_STREAM_PROP_TOTAL_IN: - *value = pkcrypt->total_in; - break; - case MZ_STREAM_PROP_TOTAL_OUT: - *value = pkcrypt->total_out; - break; - case MZ_STREAM_PROP_TOTAL_IN_MAX: - *value = pkcrypt->max_total_in; - break; - case MZ_STREAM_PROP_HEADER_SIZE: - *value = MZ_PKCRYPT_HEADER_SIZE; - break; - case MZ_STREAM_PROP_FOOTER_SIZE: - *value = 0; - break; - default: - return MZ_EXIST_ERROR; - } - return MZ_OK; -} - -int32_t mz_stream_pkcrypt_set_prop_int64(void *stream, int32_t prop, int64_t value) { - mz_stream_pkcrypt *pkcrypt = (mz_stream_pkcrypt *)stream; - switch (prop) { - case MZ_STREAM_PROP_TOTAL_IN_MAX: - pkcrypt->max_total_in = value; - break; - default: - return MZ_EXIST_ERROR; - } - return MZ_OK; -} - -void *mz_stream_pkcrypt_create(void **stream) { - mz_stream_pkcrypt *pkcrypt = NULL; - - pkcrypt = (mz_stream_pkcrypt *)calloc(1, sizeof(mz_stream_pkcrypt)); - if (pkcrypt) - pkcrypt->stream.vtbl = &mz_stream_pkcrypt_vtbl; - if (stream) - *stream = pkcrypt; - - return pkcrypt; -} - -void mz_stream_pkcrypt_delete(void **stream) { - mz_stream_pkcrypt *pkcrypt = NULL; - if (!stream) - return; - pkcrypt = (mz_stream_pkcrypt *)*stream; - if (pkcrypt) - free(pkcrypt); - *stream = NULL; -} - -void *mz_stream_pkcrypt_get_interface(void) { - return (void *)&mz_stream_pkcrypt_vtbl; -} diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h b/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h deleted file mode 100644 index 1d6fb465c..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +++ /dev/null @@ -1,46 +0,0 @@ -/* mz_strm_pkcrypt.h -- Code for traditional PKWARE encryption - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#ifndef MZ_STREAM_PKCRYPT_H -#define MZ_STREAM_PKCRYPT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************************/ - -int32_t mz_stream_pkcrypt_open(void *stream, const char *filename, int32_t mode); -int32_t mz_stream_pkcrypt_is_open(void *stream); -int32_t mz_stream_pkcrypt_read(void *stream, void *buf, int32_t size); -int32_t mz_stream_pkcrypt_write(void *stream, const void *buf, int32_t size); -int64_t mz_stream_pkcrypt_tell(void *stream); -int32_t mz_stream_pkcrypt_seek(void *stream, int64_t offset, int32_t origin); -int32_t mz_stream_pkcrypt_close(void *stream); -int32_t mz_stream_pkcrypt_error(void *stream); - -void mz_stream_pkcrypt_set_password(void *stream, const char *password); -void mz_stream_pkcrypt_set_verify(void *stream, uint8_t verify1, uint8_t verify2); -void mz_stream_pkcrypt_get_verify(void *stream, uint8_t *verify1, uint8_t *verify2); -int32_t mz_stream_pkcrypt_get_prop_int64(void *stream, int32_t prop, int64_t *value); -int32_t mz_stream_pkcrypt_set_prop_int64(void *stream, int32_t prop, int64_t value); - -void* mz_stream_pkcrypt_create(void **stream); -void mz_stream_pkcrypt_delete(void **stream); - -void* mz_stream_pkcrypt_get_interface(void); - -/***************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c b/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c deleted file mode 100644 index faf833fe0..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +++ /dev/null @@ -1,429 +0,0 @@ -/* mz_strm_split.c -- Stream for split files - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#include "mz.h" -#include "mz_os.h" -#include "mz_strm.h" -#include "mz_strm_split.h" - -#include /* snprintf */ - -#if defined(_MSC_VER) && (_MSC_VER < 1900) -# define snprintf _snprintf -#endif - -/***************************************************************************/ - -#define MZ_ZIP_MAGIC_DISKHEADER (0x08074b50) - -/***************************************************************************/ - -static mz_stream_vtbl mz_stream_split_vtbl = { - mz_stream_split_open, - mz_stream_split_is_open, - mz_stream_split_read, - mz_stream_split_write, - mz_stream_split_tell, - mz_stream_split_seek, - mz_stream_split_close, - mz_stream_split_error, - mz_stream_split_create, - mz_stream_split_delete, - mz_stream_split_get_prop_int64, - mz_stream_split_set_prop_int64 -}; - -/***************************************************************************/ - -typedef struct mz_stream_split_s { - mz_stream stream; - int32_t is_open; - int64_t disk_size; - int64_t total_in; - int64_t total_in_disk; - int64_t total_out; - int64_t total_out_disk; - int32_t mode; - char *path_cd; - char *path_disk; - uint32_t path_disk_size; - int32_t number_disk; - int32_t current_disk; - int64_t current_disk_size; - int32_t reached_end; -} mz_stream_split; - -/***************************************************************************/ - -#if 0 -# define mz_stream_split_print printf -#else -# define mz_stream_split_print(fmt, ...) -#endif - -/***************************************************************************/ - -static int32_t mz_stream_split_open_disk(void *stream, int32_t number_disk) { - mz_stream_split *split = (mz_stream_split *)stream; - uint32_t magic = 0; - int64_t position = 0; - int32_t i = 0; - int32_t err = MZ_OK; - int16_t disk_part = 0; - - /* Check if we are reading or writing a disk part or the cd disk */ - if (number_disk >= 0) { - if ((split->mode & MZ_OPEN_MODE_WRITE) == 0) - disk_part = MZ_OPEN_MODE_READ; - else if (split->disk_size > 0) - disk_part = MZ_OPEN_MODE_WRITE; - } - - /* Construct disk path */ - if (disk_part > 0) { - for (i = (int32_t)strlen(split->path_disk) - 1; i >= 0; i -= 1) { - if (split->path_disk[i] != '.') - continue; - snprintf(&split->path_disk[i], split->path_disk_size - (uint32_t)i, - ".z%02" PRId32, number_disk + 1); - break; - } - } else { - strncpy(split->path_disk, split->path_cd, split->path_disk_size - 1); - split->path_disk[split->path_disk_size - 1] = 0; - } - - mz_stream_split_print("Split - Goto disk - %s (disk %" PRId32 ")\n", split->path_disk, number_disk); - - /* If disk part doesn't exist during reading then return MZ_EXIST_ERROR */ - if (disk_part == MZ_OPEN_MODE_READ) - err = mz_os_file_exists(split->path_disk); - - if (err == MZ_OK) - err = mz_stream_open(split->stream.base, split->path_disk, split->mode); - - if (err == MZ_OK) { - split->total_in_disk = 0; - split->total_out_disk = 0; - split->current_disk = number_disk; - - if (split->mode & MZ_OPEN_MODE_WRITE) { - if ((split->current_disk == 0) && (split->disk_size > 0)) { - err = mz_stream_write_uint32(split->stream.base, MZ_ZIP_MAGIC_DISKHEADER); - - split->total_out_disk += 4; - split->total_out += split->total_out_disk; - } - } else if (split->mode & MZ_OPEN_MODE_READ) { - if (split->current_disk == 0) { - err = mz_stream_read_uint32(split->stream.base, &magic); - if (magic != MZ_ZIP_MAGIC_DISKHEADER) - err = MZ_FORMAT_ERROR; - } - } - } - - if (err == MZ_OK) { - /* Get the size of the current disk we are on */ - position = mz_stream_tell(split->stream.base); - mz_stream_seek(split->stream.base, 0, MZ_SEEK_END); - split->current_disk_size = mz_stream_tell(split->stream.base); - mz_stream_seek(split->stream.base, position, MZ_SEEK_SET); - - split->is_open = 1; - } - - return err; -} - -static int32_t mz_stream_split_close_disk(void *stream) { - mz_stream_split *split = (mz_stream_split *)stream; - - if (mz_stream_is_open(split->stream.base) != MZ_OK) - return MZ_OK; - - mz_stream_split_print("Split - Close disk\n"); - return mz_stream_close(split->stream.base); -} - -static int32_t mz_stream_split_goto_disk(void *stream, int32_t number_disk) { - mz_stream_split *split = (mz_stream_split *)stream; - int32_t err = MZ_OK; - int32_t err_is_open = MZ_OK; - - err_is_open = mz_stream_is_open(split->stream.base); - - if ((split->disk_size == 0) && (split->mode & MZ_OPEN_MODE_WRITE)) { - if (err_is_open != MZ_OK) - err = mz_stream_split_open_disk(stream, number_disk); - } else if ((number_disk != split->current_disk) || (err_is_open != MZ_OK)) { - err = mz_stream_split_close_disk(stream); - if (err == MZ_OK) { - err = mz_stream_split_open_disk(stream, number_disk); - if (err == MZ_OK) - split->number_disk = number_disk; - } - } - - return err; -} - -int32_t mz_stream_split_open(void *stream, const char *path, int32_t mode) { - mz_stream_split *split = (mz_stream_split *)stream; - int32_t number_disk = 0; - - split->mode = mode; - split->path_cd = strdup(path); - - if (!split->path_cd) - return MZ_MEM_ERROR; - - mz_stream_split_print("Split - Open - %s (disk %" PRId32 ")\n", split->path_cd, number_disk); - - split->path_disk_size = (uint32_t)strlen(path) + 10; - split->path_disk = (char *)malloc(split->path_disk_size); - - if (!split->path_disk) { - free(split->path_cd); - return MZ_MEM_ERROR; - } - - strncpy(split->path_disk, path, split->path_disk_size - 1); - split->path_disk[split->path_disk_size - 1] = 0; - - if ((mode & MZ_OPEN_MODE_WRITE) && ((mode & MZ_OPEN_MODE_APPEND) == 0)) { - number_disk = 0; - split->current_disk = -1; - } else { - number_disk = -1; - split->current_disk = 0; - } - - return mz_stream_split_goto_disk(stream, number_disk); -} - -int32_t mz_stream_split_is_open(void *stream) { - mz_stream_split *split = (mz_stream_split *)stream; - if (split->is_open != 1) - return MZ_OPEN_ERROR; - return MZ_OK; -} - -int32_t mz_stream_split_read(void *stream, void *buf, int32_t size) { - mz_stream_split *split = (mz_stream_split *)stream; - int32_t bytes_left = size; - int32_t read = 0; - int32_t err = MZ_OK; - uint8_t *buf_ptr = (uint8_t *)buf; - - err = mz_stream_split_goto_disk(stream, split->number_disk); - if (err != MZ_OK) - return err; - - while (bytes_left > 0) { - read = mz_stream_read(split->stream.base, buf_ptr, bytes_left); - - mz_stream_split_print("Split - Read disk - %" PRId32 "\n", read); - - if (read < 0) - return read; - if (read == 0) { - if (split->current_disk < 0) /* No more disks to goto */ - break; - err = mz_stream_split_goto_disk(stream, split->current_disk + 1); - if (err == MZ_EXIST_ERROR) { - split->current_disk = -1; - break; - } - if (err != MZ_OK) - return err; - } - - bytes_left -= read; - buf_ptr += read; - split->total_in += read; - split->total_in_disk += read; - } - return size - bytes_left; -} - -int32_t mz_stream_split_write(void *stream, const void *buf, int32_t size) { - mz_stream_split *split = (mz_stream_split *)stream; - int64_t position = 0; - int32_t written = 0; - int32_t bytes_left = size; - int32_t bytes_to_write = 0; - int32_t bytes_avail = 0; - int32_t number_disk = -1; - int32_t err = MZ_OK; - const uint8_t *buf_ptr = (const uint8_t *)buf; - - position = mz_stream_tell(split->stream.base); - - while (bytes_left > 0) { - bytes_to_write = bytes_left; - - if (split->disk_size > 0) { - if ((split->total_out_disk == split->disk_size && split->total_out > 0) || - (split->number_disk == -1 && split->number_disk != split->current_disk)) { - if (split->number_disk != -1) - number_disk = split->current_disk + 1; - - err = mz_stream_split_goto_disk(stream, number_disk); - if (err != MZ_OK) - return err; - - position = 0; - } - - if (split->number_disk != -1) { - bytes_avail = (int32_t)(split->disk_size - split->total_out_disk); - if (bytes_to_write > bytes_avail) - bytes_to_write = bytes_avail; - } - } - - written = mz_stream_write(split->stream.base, buf_ptr, bytes_to_write); - if (written != bytes_to_write) - return MZ_WRITE_ERROR; - - mz_stream_split_print("Split - Write disk - %" PRId32 "\n", written); - - bytes_left -= written; - buf_ptr += written; - - split->total_out += written; - split->total_out_disk += written; - - position += written; - if (position > split->current_disk_size) - split->current_disk_size = position; - } - - return size - bytes_left; -} - -int64_t mz_stream_split_tell(void *stream) { - mz_stream_split *split = (mz_stream_split *)stream; - int32_t err = MZ_OK; - err = mz_stream_split_goto_disk(stream, split->number_disk); - if (err != MZ_OK) - return err; - return mz_stream_tell(split->stream.base); -} - -int32_t mz_stream_split_seek(void *stream, int64_t offset, int32_t origin) { - mz_stream_split *split = (mz_stream_split *)stream; - int64_t disk_left = 0; - int64_t position = 0; - int32_t err = MZ_OK; - - err = mz_stream_split_goto_disk(stream, split->number_disk); - - if (err != MZ_OK) - return err; - - mz_stream_split_print("Split - Seek disk - %" PRId64 " (origin %" PRId32 ")\n", offset, origin); - - if ((origin == MZ_SEEK_CUR) && (split->number_disk != -1)) { - position = mz_stream_tell(split->stream.base); - disk_left = split->current_disk_size - position; - - while (offset > disk_left) { - err = mz_stream_split_goto_disk(stream, split->current_disk + 1); - if (err != MZ_OK) - return err; - - offset -= disk_left; - disk_left = split->current_disk_size; - } - } - - return mz_stream_seek(split->stream.base, offset, origin); -} - -int32_t mz_stream_split_close(void *stream) { - mz_stream_split *split = (mz_stream_split *)stream; - int32_t err = MZ_OK; - - err = mz_stream_split_close_disk(stream); - split->is_open = 0; - return err; -} - -int32_t mz_stream_split_error(void *stream) { - mz_stream_split *split = (mz_stream_split *)stream; - return mz_stream_error(split->stream.base); -} - -int32_t mz_stream_split_get_prop_int64(void *stream, int32_t prop, int64_t *value) { - mz_stream_split *split = (mz_stream_split *)stream; - switch (prop) { - case MZ_STREAM_PROP_TOTAL_OUT: - *value = split->total_out; - break; - case MZ_STREAM_PROP_DISK_NUMBER: - *value = split->number_disk; - break; - case MZ_STREAM_PROP_DISK_SIZE: - *value = split->disk_size; - break; - default: - return MZ_EXIST_ERROR; - } - return MZ_OK; -} - -int32_t mz_stream_split_set_prop_int64(void *stream, int32_t prop, int64_t value) { - mz_stream_split *split = (mz_stream_split *)stream; - switch (prop) { - case MZ_STREAM_PROP_DISK_NUMBER: - split->number_disk = (int32_t)value; - break; - case MZ_STREAM_PROP_DISK_SIZE: - split->disk_size = value; - break; - default: - return MZ_EXIST_ERROR; - } - return MZ_OK; -} - -void *mz_stream_split_create(void **stream) { - mz_stream_split *split = NULL; - - split = (mz_stream_split *)calloc(1, sizeof(mz_stream_split)); - if (split) - split->stream.vtbl = &mz_stream_split_vtbl; - if (stream) - *stream = split; - - return split; -} - -void mz_stream_split_delete(void **stream) { - mz_stream_split *split = NULL; - if (!stream) - return; - split = (mz_stream_split *)*stream; - if (split) { - if (split->path_cd) - free(split->path_cd); - if (split->path_disk) - free(split->path_disk); - - free(split); - } - *stream = NULL; -} - -void *mz_stream_split_get_interface(void) { - return (void *)&mz_stream_split_vtbl; -} diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h b/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h deleted file mode 100644 index d03054b56..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +++ /dev/null @@ -1,43 +0,0 @@ -/* mz_strm_split.h -- Stream for split files - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#ifndef MZ_STREAM_SPLIT_H -#define MZ_STREAM_SPLIT_H - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************************/ - -int32_t mz_stream_split_open(void *stream, const char *filename, int32_t mode); -int32_t mz_stream_split_is_open(void *stream); -int32_t mz_stream_split_read(void *stream, void *buf, int32_t size); -int32_t mz_stream_split_write(void *stream, const void *buf, int32_t size); -int64_t mz_stream_split_tell(void *stream); -int32_t mz_stream_split_seek(void *stream, int64_t offset, int32_t origin); -int32_t mz_stream_split_close(void *stream); -int32_t mz_stream_split_error(void *stream); - -int32_t mz_stream_split_get_prop_int64(void *stream, int32_t prop, int64_t *value); -int32_t mz_stream_split_set_prop_int64(void *stream, int32_t prop, int64_t value); - -void* mz_stream_split_create(void **stream); -void mz_stream_split_delete(void **stream); - -void* mz_stream_split_get_interface(void); - -/***************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c b/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c deleted file mode 100644 index bf2deb76b..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +++ /dev/null @@ -1,360 +0,0 @@ -/* mz_strm_wzaes.c -- Stream for WinZip AES encryption - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - Copyright (C) 1998-2010 Brian Gladman, Worcester, UK - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#include "mz.h" -#include "mz_crypt.h" -#include "mz_strm.h" -#include "mz_strm_wzaes.h" - -/***************************************************************************/ - -#define MZ_AES_KEYING_ITERATIONS (1000) -#define MZ_AES_SALT_LENGTH(MODE) (4 * (MODE & 3) + 4) -#define MZ_AES_SALT_LENGTH_MAX (16) -#define MZ_AES_PW_LENGTH_MAX (128) -#define MZ_AES_PW_VERIFY_SIZE (2) -#define MZ_AES_AUTHCODE_SIZE (10) - -/***************************************************************************/ - -static mz_stream_vtbl mz_stream_wzaes_vtbl = { - mz_stream_wzaes_open, - mz_stream_wzaes_is_open, - mz_stream_wzaes_read, - mz_stream_wzaes_write, - mz_stream_wzaes_tell, - mz_stream_wzaes_seek, - mz_stream_wzaes_close, - mz_stream_wzaes_error, - mz_stream_wzaes_create, - mz_stream_wzaes_delete, - mz_stream_wzaes_get_prop_int64, - mz_stream_wzaes_set_prop_int64 -}; - -/***************************************************************************/ - -typedef struct mz_stream_wzaes_s { - mz_stream stream; - int32_t mode; - int32_t error; - int16_t initialized; - uint8_t buffer[UINT16_MAX]; - int64_t total_in; - int64_t max_total_in; - int64_t total_out; - int16_t encryption_mode; - const char *password; - void *aes; - uint32_t crypt_pos; - uint8_t crypt_block[MZ_AES_BLOCK_SIZE]; - void *hmac; - uint8_t nonce[MZ_AES_BLOCK_SIZE]; -} mz_stream_wzaes; - -/***************************************************************************/ - -int32_t mz_stream_wzaes_open(void *stream, const char *path, int32_t mode) { - mz_stream_wzaes *wzaes = (mz_stream_wzaes *)stream; - uint16_t salt_length = 0; - uint16_t password_length = 0; - uint16_t key_length = 0; - uint8_t kbuf[2 * MZ_AES_KEY_LENGTH_MAX + MZ_AES_PW_VERIFY_SIZE]; - uint8_t verify[MZ_AES_PW_VERIFY_SIZE]; - uint8_t verify_expected[MZ_AES_PW_VERIFY_SIZE]; - uint8_t salt_value[MZ_AES_SALT_LENGTH_MAX]; - const char *password = path; - - wzaes->total_in = 0; - wzaes->total_out = 0; - wzaes->initialized = 0; - - if (mz_stream_is_open(wzaes->stream.base) != MZ_OK) - return MZ_OPEN_ERROR; - - if (!password) - password = wzaes->password; - if (!password) - return MZ_PARAM_ERROR; - password_length = (uint16_t)strlen(password); - if (password_length > MZ_AES_PW_LENGTH_MAX) - return MZ_PARAM_ERROR; - - if (wzaes->encryption_mode < 1 || wzaes->encryption_mode > 3) - return MZ_PARAM_ERROR; - - salt_length = MZ_AES_SALT_LENGTH(wzaes->encryption_mode); - - if (mode & MZ_OPEN_MODE_WRITE) { - mz_crypt_rand(salt_value, salt_length); - } else if (mode & MZ_OPEN_MODE_READ) { - if (mz_stream_read(wzaes->stream.base, salt_value, salt_length) != salt_length) - return MZ_READ_ERROR; - } - - key_length = MZ_AES_KEY_LENGTH(wzaes->encryption_mode); - - /* Derive the encryption and authentication keys and the password verifier */ - mz_crypt_pbkdf2((uint8_t *)password, password_length, salt_value, salt_length, - MZ_AES_KEYING_ITERATIONS, kbuf, 2 * key_length + MZ_AES_PW_VERIFY_SIZE); - - /* Initialize the encryption nonce and buffer pos */ - wzaes->crypt_pos = MZ_AES_BLOCK_SIZE; - memset(wzaes->nonce, 0, sizeof(wzaes->nonce)); - - /* Initialize for encryption using key 1 */ - mz_crypt_aes_reset(wzaes->aes); - mz_crypt_aes_set_mode(wzaes->aes, wzaes->encryption_mode); - mz_crypt_aes_set_encrypt_key(wzaes->aes, kbuf, key_length); - - /* Initialize for authentication using key 2 */ - mz_crypt_hmac_reset(wzaes->hmac); - mz_crypt_hmac_set_algorithm(wzaes->hmac, MZ_HASH_SHA1); - mz_crypt_hmac_init(wzaes->hmac, kbuf + key_length, key_length); - - memcpy(verify, kbuf + (2 * key_length), MZ_AES_PW_VERIFY_SIZE); - - if (mode & MZ_OPEN_MODE_WRITE) { - if (mz_stream_write(wzaes->stream.base, salt_value, salt_length) != salt_length) - return MZ_WRITE_ERROR; - - wzaes->total_out += salt_length; - - if (mz_stream_write(wzaes->stream.base, verify, MZ_AES_PW_VERIFY_SIZE) != MZ_AES_PW_VERIFY_SIZE) - return MZ_WRITE_ERROR; - - wzaes->total_out += MZ_AES_PW_VERIFY_SIZE; - } else if (mode & MZ_OPEN_MODE_READ) { - wzaes->total_in += salt_length; - - if (mz_stream_read(wzaes->stream.base, verify_expected, MZ_AES_PW_VERIFY_SIZE) != MZ_AES_PW_VERIFY_SIZE) - return MZ_READ_ERROR; - - wzaes->total_in += MZ_AES_PW_VERIFY_SIZE; - - if (memcmp(verify_expected, verify, MZ_AES_PW_VERIFY_SIZE) != 0) - return MZ_PASSWORD_ERROR; - } - - wzaes->mode = mode; - wzaes->initialized = 1; - - return MZ_OK; -} - -int32_t mz_stream_wzaes_is_open(void *stream) { - mz_stream_wzaes *wzaes = (mz_stream_wzaes *)stream; - if (!wzaes->initialized) - return MZ_OPEN_ERROR; - return MZ_OK; -} - -static int32_t mz_stream_wzaes_ctr_encrypt(void *stream, uint8_t *buf, int32_t size) { - mz_stream_wzaes *wzaes = (mz_stream_wzaes *)stream; - uint32_t pos = wzaes->crypt_pos; - uint32_t i = 0; - int32_t err = MZ_OK; - - while (i < (uint32_t)size) { - if (pos == MZ_AES_BLOCK_SIZE) { - uint32_t j = 0; - - /* Increment encryption nonce */ - while (j < 8 && !++wzaes->nonce[j]) - j += 1; - - /* Encrypt the nonce to form next xor buffer */ - memcpy(wzaes->crypt_block, wzaes->nonce, MZ_AES_BLOCK_SIZE); - mz_crypt_aes_encrypt(wzaes->aes, wzaes->crypt_block, sizeof(wzaes->crypt_block)); - pos = 0; - } - - buf[i++] ^= wzaes->crypt_block[pos++]; - } - - wzaes->crypt_pos = pos; - return err; -} - -int32_t mz_stream_wzaes_read(void *stream, void *buf, int32_t size) { - mz_stream_wzaes *wzaes = (mz_stream_wzaes *)stream; - int64_t max_total_in = 0; - int32_t bytes_to_read = size; - int32_t read = 0; - - max_total_in = wzaes->max_total_in - MZ_AES_FOOTER_SIZE; - if ((int64_t)bytes_to_read > (max_total_in - wzaes->total_in)) - bytes_to_read = (int32_t)(max_total_in - wzaes->total_in); - - read = mz_stream_read(wzaes->stream.base, buf, bytes_to_read); - - if (read > 0) { - mz_crypt_hmac_update(wzaes->hmac, (uint8_t *)buf, read); - mz_stream_wzaes_ctr_encrypt(stream, (uint8_t *)buf, read); - - wzaes->total_in += read; - } - - return read; -} - -int32_t mz_stream_wzaes_write(void *stream, const void *buf, int32_t size) { - mz_stream_wzaes *wzaes = (mz_stream_wzaes *)stream; - const uint8_t *buf_ptr = (const uint8_t *)buf; - int32_t bytes_to_write = sizeof(wzaes->buffer); - int32_t total_written = 0; - int32_t written = 0; - - if (size < 0) - return MZ_PARAM_ERROR; - - do { - if (bytes_to_write > (size - total_written)) - bytes_to_write = (size - total_written); - - memcpy(wzaes->buffer, buf_ptr, bytes_to_write); - buf_ptr += bytes_to_write; - - mz_stream_wzaes_ctr_encrypt(stream, (uint8_t *)wzaes->buffer, bytes_to_write); - mz_crypt_hmac_update(wzaes->hmac, wzaes->buffer, bytes_to_write); - - written = mz_stream_write(wzaes->stream.base, wzaes->buffer, bytes_to_write); - if (written < 0) - return written; - - total_written += written; - } while (total_written < size && written > 0); - - wzaes->total_out += total_written; - return total_written; -} - -int64_t mz_stream_wzaes_tell(void *stream) { - mz_stream_wzaes *wzaes = (mz_stream_wzaes *)stream; - return mz_stream_tell(wzaes->stream.base); -} - -int32_t mz_stream_wzaes_seek(void *stream, int64_t offset, int32_t origin) { - mz_stream_wzaes *wzaes = (mz_stream_wzaes *)stream; - return mz_stream_seek(wzaes->stream.base, offset, origin); -} - -int32_t mz_stream_wzaes_close(void *stream) { - mz_stream_wzaes *wzaes = (mz_stream_wzaes *)stream; - uint8_t expected_hash[MZ_AES_AUTHCODE_SIZE]; - uint8_t computed_hash[MZ_HASH_SHA1_SIZE]; - - mz_crypt_hmac_end(wzaes->hmac, computed_hash, sizeof(computed_hash)); - - if (wzaes->mode & MZ_OPEN_MODE_WRITE) { - if (mz_stream_write(wzaes->stream.base, computed_hash, MZ_AES_AUTHCODE_SIZE) != MZ_AES_AUTHCODE_SIZE) - return MZ_WRITE_ERROR; - - wzaes->total_out += MZ_AES_AUTHCODE_SIZE; - } else if (wzaes->mode & MZ_OPEN_MODE_READ) { - if (mz_stream_read(wzaes->stream.base, expected_hash, MZ_AES_AUTHCODE_SIZE) != MZ_AES_AUTHCODE_SIZE) - return MZ_READ_ERROR; - - wzaes->total_in += MZ_AES_AUTHCODE_SIZE; - - /* If entire entry was not read this will fail */ - if (memcmp(computed_hash, expected_hash, MZ_AES_AUTHCODE_SIZE) != 0) - return MZ_CRC_ERROR; - } - - wzaes->initialized = 0; - return MZ_OK; -} - -int32_t mz_stream_wzaes_error(void *stream) { - mz_stream_wzaes *wzaes = (mz_stream_wzaes *)stream; - return wzaes->error; -} - -void mz_stream_wzaes_set_password(void *stream, const char *password) { - mz_stream_wzaes *wzaes = (mz_stream_wzaes *)stream; - wzaes->password = password; -} - -void mz_stream_wzaes_set_encryption_mode(void *stream, int16_t encryption_mode) { - mz_stream_wzaes *wzaes = (mz_stream_wzaes *)stream; - wzaes->encryption_mode = encryption_mode; -} - -int32_t mz_stream_wzaes_get_prop_int64(void *stream, int32_t prop, int64_t *value) { - mz_stream_wzaes *wzaes = (mz_stream_wzaes *)stream; - switch (prop) { - case MZ_STREAM_PROP_TOTAL_IN: - *value = wzaes->total_in; - break; - case MZ_STREAM_PROP_TOTAL_OUT: - *value = wzaes->total_out; - break; - case MZ_STREAM_PROP_TOTAL_IN_MAX: - *value = wzaes->max_total_in; - break; - case MZ_STREAM_PROP_HEADER_SIZE: - *value = MZ_AES_SALT_LENGTH((int64_t)wzaes->encryption_mode) + MZ_AES_PW_VERIFY_SIZE; - break; - case MZ_STREAM_PROP_FOOTER_SIZE: - *value = MZ_AES_AUTHCODE_SIZE; - break; - default: - return MZ_EXIST_ERROR; - } - return MZ_OK; -} - -int32_t mz_stream_wzaes_set_prop_int64(void *stream, int32_t prop, int64_t value) { - mz_stream_wzaes *wzaes = (mz_stream_wzaes *)stream; - switch (prop) { - case MZ_STREAM_PROP_TOTAL_IN_MAX: - wzaes->max_total_in = value; - break; - default: - return MZ_EXIST_ERROR; - } - return MZ_OK; -} - -void *mz_stream_wzaes_create(void **stream) { - mz_stream_wzaes *wzaes = NULL; - - wzaes = (mz_stream_wzaes *)calloc(1, sizeof(mz_stream_wzaes)); - if (wzaes) { - wzaes->stream.vtbl = &mz_stream_wzaes_vtbl; - wzaes->encryption_mode = MZ_AES_ENCRYPTION_MODE_256; - - mz_crypt_hmac_create(&wzaes->hmac); - mz_crypt_aes_create(&wzaes->aes); - } - if (stream) - *stream = wzaes; - - return wzaes; -} - -void mz_stream_wzaes_delete(void **stream) { - mz_stream_wzaes *wzaes = NULL; - if (!stream) - return; - wzaes = (mz_stream_wzaes *)*stream; - if (wzaes) { - mz_crypt_aes_delete(&wzaes->aes); - mz_crypt_hmac_delete(&wzaes->hmac); - free(wzaes); - } - *stream = NULL; -} - -void *mz_stream_wzaes_get_interface(void) { - return (void *)&mz_stream_wzaes_vtbl; -} diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h b/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h deleted file mode 100644 index 5163c80c8..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +++ /dev/null @@ -1,46 +0,0 @@ -/* mz_strm_wzaes.h -- Stream for WinZIP AES encryption - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#ifndef MZ_STREAM_WZAES_SHA1_H -#define MZ_STREAM_WZAES_SHA1_H - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************************/ - -int32_t mz_stream_wzaes_open(void *stream, const char *filename, int32_t mode); -int32_t mz_stream_wzaes_is_open(void *stream); -int32_t mz_stream_wzaes_read(void *stream, void *buf, int32_t size); -int32_t mz_stream_wzaes_write(void *stream, const void *buf, int32_t size); -int64_t mz_stream_wzaes_tell(void *stream); -int32_t mz_stream_wzaes_seek(void *stream, int64_t offset, int32_t origin); -int32_t mz_stream_wzaes_close(void *stream); -int32_t mz_stream_wzaes_error(void *stream); - -void mz_stream_wzaes_set_password(void *stream, const char *password); -void mz_stream_wzaes_set_encryption_mode(void *stream, int16_t encryption_mode); - -int32_t mz_stream_wzaes_get_prop_int64(void *stream, int32_t prop, int64_t *value); -int32_t mz_stream_wzaes_set_prop_int64(void *stream, int32_t prop, int64_t value); - -void* mz_stream_wzaes_create(void **stream); -void mz_stream_wzaes_delete(void **stream); - -void* mz_stream_wzaes_get_interface(void); - -/***************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c b/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c deleted file mode 100644 index b7ac4d1a6..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +++ /dev/null @@ -1,389 +0,0 @@ -/* mz_strm_zlib.c -- Stream for zlib inflate/deflate - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#include "mz.h" -#include "mz_strm.h" -#include "mz_strm_zlib.h" - -#if !defined(ZLIB_COMPAT) -# include "zlib-ng.h" -#else -# include "zlib.h" -#endif - -/***************************************************************************/ - -#if !defined(ZLIB_COMPAT) -# define ZLIB_PREFIX(x) zng_ ## x - typedef zng_stream zlib_stream; -#else -# define ZLIB_PREFIX(x) x - typedef z_stream zlib_stream; -#endif - -#if !defined(DEF_MEM_LEVEL) -# if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -# else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -# endif -#endif - -/***************************************************************************/ - -static mz_stream_vtbl mz_stream_zlib_vtbl = { - mz_stream_zlib_open, - mz_stream_zlib_is_open, - mz_stream_zlib_read, - mz_stream_zlib_write, - mz_stream_zlib_tell, - mz_stream_zlib_seek, - mz_stream_zlib_close, - mz_stream_zlib_error, - mz_stream_zlib_create, - mz_stream_zlib_delete, - mz_stream_zlib_get_prop_int64, - mz_stream_zlib_set_prop_int64 -}; - -/***************************************************************************/ - -typedef struct mz_stream_zlib_s { - mz_stream stream; - zlib_stream zstream; - uint8_t buffer[INT16_MAX]; - int32_t buffer_len; - int64_t total_in; - int64_t total_out; - int64_t max_total_in; - int8_t initialized; - int16_t level; - int32_t window_bits; - int32_t mode; - int32_t error; -} mz_stream_zlib; - -/***************************************************************************/ - -int32_t mz_stream_zlib_open(void *stream, const char *path, int32_t mode) { - mz_stream_zlib *zlib = (mz_stream_zlib *)stream; - - MZ_UNUSED(path); - - zlib->zstream.data_type = Z_BINARY; - zlib->zstream.zalloc = Z_NULL; - zlib->zstream.zfree = Z_NULL; - zlib->zstream.opaque = Z_NULL; - zlib->zstream.total_in = 0; - zlib->zstream.total_out = 0; - - zlib->total_in = 0; - zlib->total_out = 0; - - if (mode & MZ_OPEN_MODE_WRITE) { -#ifdef MZ_ZIP_NO_COMPRESSION - return MZ_SUPPORT_ERROR; -#else - zlib->zstream.next_out = zlib->buffer; - zlib->zstream.avail_out = sizeof(zlib->buffer); - - zlib->error = ZLIB_PREFIX(deflateInit2)(&zlib->zstream, (int8_t)zlib->level, Z_DEFLATED, - zlib->window_bits, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); -#endif - } else if (mode & MZ_OPEN_MODE_READ) { -#ifdef MZ_ZIP_NO_DECOMPRESSION - return MZ_SUPPORT_ERROR; -#else - zlib->zstream.next_in = zlib->buffer; - zlib->zstream.avail_in = 0; - - zlib->error = ZLIB_PREFIX(inflateInit2)(&zlib->zstream, zlib->window_bits); -#endif - } - - if (zlib->error != Z_OK) - return MZ_OPEN_ERROR; - - zlib->initialized = 1; - zlib->mode = mode; - return MZ_OK; -} - -int32_t mz_stream_zlib_is_open(void *stream) { - mz_stream_zlib *zlib = (mz_stream_zlib *)stream; - if (zlib->initialized != 1) - return MZ_OPEN_ERROR; - return MZ_OK; -} - -int32_t mz_stream_zlib_read(void *stream, void *buf, int32_t size) { -#ifdef MZ_ZIP_NO_DECOMPRESSION - MZ_UNUSED(stream); - MZ_UNUSED(buf); - MZ_UNUSED(size); - return MZ_SUPPORT_ERROR; -#else - mz_stream_zlib *zlib = (mz_stream_zlib *)stream; - uint64_t total_in_before = 0; - uint64_t total_in_after = 0; - uint64_t total_out_before = 0; - uint64_t total_out_after = 0; - uint32_t total_in = 0; - uint32_t total_out = 0; - uint32_t in_bytes = 0; - uint32_t out_bytes = 0; - int32_t bytes_to_read = sizeof(zlib->buffer); - int32_t read = 0; - int32_t err = Z_OK; - - zlib->zstream.next_out = (Bytef *)buf; - zlib->zstream.avail_out = (uInt)size; - - do { - if (zlib->zstream.avail_in == 0) { - if (zlib->max_total_in > 0) { - if ((int64_t)bytes_to_read > (zlib->max_total_in - zlib->total_in)) - bytes_to_read = (int32_t)(zlib->max_total_in - zlib->total_in); - } - - read = mz_stream_read(zlib->stream.base, zlib->buffer, bytes_to_read); - - if (read < 0) - return read; - - zlib->zstream.next_in = zlib->buffer; - zlib->zstream.avail_in = read; - } - - total_in_before = zlib->zstream.avail_in; - total_out_before = zlib->zstream.total_out; - - err = ZLIB_PREFIX(inflate)(&zlib->zstream, Z_SYNC_FLUSH); - if ((err >= Z_OK) && (zlib->zstream.msg)) { - zlib->error = Z_DATA_ERROR; - break; - } - - total_in_after = zlib->zstream.avail_in; - total_out_after = zlib->zstream.total_out; - - in_bytes = (uint32_t)(total_in_before - total_in_after); - out_bytes = (uint32_t)(total_out_after - total_out_before); - - total_in += in_bytes; - total_out += out_bytes; - - zlib->total_in += in_bytes; - zlib->total_out += out_bytes; - - if (err == Z_STREAM_END) - break; - if (err != Z_OK) { - zlib->error = err; - break; - } - } while (zlib->zstream.avail_out > 0); - - if (zlib->error != 0) { - /* Zlib errors are compatible with MZ */ - return zlib->error; - } - - return total_out; -#endif -} - -#ifndef MZ_ZIP_NO_COMPRESSION -static int32_t mz_stream_zlib_flush(void *stream) { - mz_stream_zlib *zlib = (mz_stream_zlib *)stream; - if (mz_stream_write(zlib->stream.base, zlib->buffer, zlib->buffer_len) != zlib->buffer_len) - return MZ_WRITE_ERROR; - return MZ_OK; -} - -static int32_t mz_stream_zlib_deflate(void *stream, int flush) { - mz_stream_zlib *zlib = (mz_stream_zlib *)stream; - uint64_t total_out_before = 0; - uint64_t total_out_after = 0; - int32_t out_bytes = 0; - int32_t err = Z_OK; - - do { - if (zlib->zstream.avail_out == 0) { - err = mz_stream_zlib_flush(zlib); - if (err != MZ_OK) - return err; - - zlib->zstream.avail_out = sizeof(zlib->buffer); - zlib->zstream.next_out = zlib->buffer; - - zlib->buffer_len = 0; - } - - total_out_before = zlib->zstream.total_out; - err = ZLIB_PREFIX(deflate)(&zlib->zstream, flush); - total_out_after = zlib->zstream.total_out; - - out_bytes = (uint32_t)(total_out_after - total_out_before); - - zlib->buffer_len += out_bytes; - zlib->total_out += out_bytes; - - if (err == Z_STREAM_END) - break; - if (err != Z_OK) { - zlib->error = err; - return MZ_DATA_ERROR; - } - } while ((zlib->zstream.avail_in > 0) || (flush == Z_FINISH && err == Z_OK)); - - return MZ_OK; -} -#endif - -int32_t mz_stream_zlib_write(void *stream, const void *buf, int32_t size) { -#ifdef MZ_ZIP_NO_COMPRESSION - MZ_UNUSED(stream); - MZ_UNUSED(buf); - MZ_UNUSED(size); - return MZ_SUPPORT_ERROR; -#else - mz_stream_zlib *zlib = (mz_stream_zlib *)stream; - int32_t err = MZ_OK; - - zlib->zstream.next_in = (Bytef *)(intptr_t)buf; - zlib->zstream.avail_in = (uInt)size; - - err = mz_stream_zlib_deflate(stream, Z_NO_FLUSH); - if (err != MZ_OK) { - return err; - } - - zlib->total_in += size; - return size; -#endif -} - -int64_t mz_stream_zlib_tell(void *stream) { - MZ_UNUSED(stream); - - return MZ_TELL_ERROR; -} - -int32_t mz_stream_zlib_seek(void *stream, int64_t offset, int32_t origin) { - MZ_UNUSED(stream); - MZ_UNUSED(offset); - MZ_UNUSED(origin); - - return MZ_SEEK_ERROR; -} - -int32_t mz_stream_zlib_close(void *stream) { - mz_stream_zlib *zlib = (mz_stream_zlib *)stream; - - if (zlib->mode & MZ_OPEN_MODE_WRITE) { -#ifdef MZ_ZIP_NO_COMPRESSION - return MZ_SUPPORT_ERROR; -#else - mz_stream_zlib_deflate(stream, Z_FINISH); - mz_stream_zlib_flush(stream); - - ZLIB_PREFIX(deflateEnd)(&zlib->zstream); -#endif - } else if (zlib->mode & MZ_OPEN_MODE_READ) { -#ifdef MZ_ZIP_NO_DECOMPRESSION - return MZ_SUPPORT_ERROR; -#else - ZLIB_PREFIX(inflateEnd)(&zlib->zstream); -#endif - } - - zlib->initialized = 0; - - if (zlib->error != Z_OK) - return MZ_CLOSE_ERROR; - return MZ_OK; -} - -int32_t mz_stream_zlib_error(void *stream) { - mz_stream_zlib *zlib = (mz_stream_zlib *)stream; - return zlib->error; -} - -int32_t mz_stream_zlib_get_prop_int64(void *stream, int32_t prop, int64_t *value) { - mz_stream_zlib *zlib = (mz_stream_zlib *)stream; - switch (prop) { - case MZ_STREAM_PROP_TOTAL_IN: - *value = zlib->total_in; - break; - case MZ_STREAM_PROP_TOTAL_IN_MAX: - *value = zlib->max_total_in; - break; - case MZ_STREAM_PROP_TOTAL_OUT: - *value = zlib->total_out; - break; - case MZ_STREAM_PROP_HEADER_SIZE: - *value = 0; - break; - case MZ_STREAM_PROP_COMPRESS_WINDOW: - *value = zlib->window_bits; - break; - default: - return MZ_EXIST_ERROR; - } - return MZ_OK; -} - -int32_t mz_stream_zlib_set_prop_int64(void *stream, int32_t prop, int64_t value) { - mz_stream_zlib *zlib = (mz_stream_zlib *)stream; - switch (prop) { - case MZ_STREAM_PROP_COMPRESS_LEVEL: - zlib->level = (int16_t)value; - break; - case MZ_STREAM_PROP_TOTAL_IN_MAX: - zlib->max_total_in = value; - break; - case MZ_STREAM_PROP_COMPRESS_WINDOW: - zlib->window_bits = (int32_t)value; - break; - default: - return MZ_EXIST_ERROR; - } - return MZ_OK; -} - -void *mz_stream_zlib_create(void **stream) { - mz_stream_zlib *zlib = NULL; - - zlib = (mz_stream_zlib *)calloc(1, sizeof(mz_stream_zlib)); - if (zlib) { - zlib->stream.vtbl = &mz_stream_zlib_vtbl; - zlib->level = Z_DEFAULT_COMPRESSION; - zlib->window_bits = -MAX_WBITS; - } - if (stream) - *stream = zlib; - - return zlib; -} - -void mz_stream_zlib_delete(void **stream) { - mz_stream_zlib *zlib = NULL; - if (!stream) - return; - zlib = (mz_stream_zlib *)*stream; - if (zlib) - free(zlib); - *stream = NULL; -} - -void *mz_stream_zlib_get_interface(void) { - return (void *)&mz_stream_zlib_vtbl; -} diff --git a/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h b/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h deleted file mode 100644 index 4bdcdf813..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +++ /dev/null @@ -1,43 +0,0 @@ -/* mz_strm_zlib.h -- Stream for zlib inflate/deflate - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#ifndef MZ_STREAM_ZLIB_H -#define MZ_STREAM_ZLIB_H - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************************/ - -int32_t mz_stream_zlib_open(void *stream, const char *filename, int32_t mode); -int32_t mz_stream_zlib_is_open(void *stream); -int32_t mz_stream_zlib_read(void *stream, void *buf, int32_t size); -int32_t mz_stream_zlib_write(void *stream, const void *buf, int32_t size); -int64_t mz_stream_zlib_tell(void *stream); -int32_t mz_stream_zlib_seek(void *stream, int64_t offset, int32_t origin); -int32_t mz_stream_zlib_close(void *stream); -int32_t mz_stream_zlib_error(void *stream); - -int32_t mz_stream_zlib_get_prop_int64(void *stream, int32_t prop, int64_t *value); -int32_t mz_stream_zlib_set_prop_int64(void *stream, int32_t prop, int64_t value); - -void* mz_stream_zlib_create(void **stream); -void mz_stream_zlib_delete(void **stream); - -void* mz_stream_zlib_get_interface(void); - -/***************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/CodePush/SSZipArchive/minizip/mz_zip.c b/ios/CodePush/SSZipArchive/minizip/mz_zip.c deleted file mode 100644 index e80550f0e..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_zip.c +++ /dev/null @@ -1,2782 +0,0 @@ -/* zip.c -- Zip manipulation - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - Copyright (C) 2009-2010 Mathias Svensson - Modifications for Zip64 support - http://result42.com - Copyright (C) 2007-2008 Even Rouault - Modifications of Unzip for Zip64 - Copyright (C) 1998-2010 Gilles Vollant - https://www.winimage.com/zLibDll/minizip.html - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#include "mz.h" -#include "mz_crypt.h" -#include "mz_strm.h" -#ifdef HAVE_BZIP2 -# include "mz_strm_bzip.h" -#endif -#ifdef HAVE_LIBCOMP -# include "mz_strm_libcomp.h" -#endif -#ifdef HAVE_LZMA -# include "mz_strm_lzma.h" -#endif -#include "mz_strm_mem.h" -#ifdef HAVE_PKCRYPT -# include "mz_strm_pkcrypt.h" -#endif -#ifdef HAVE_WZAES -# include "mz_strm_wzaes.h" -#endif -#ifdef HAVE_ZLIB -# include "mz_strm_zlib.h" -#endif -#ifdef HAVE_ZSTD -# include "mz_strm_zstd.h" -#endif - -#include "mz_zip.h" - -#include /* tolower */ -#include /* snprintf */ - -#if defined(_MSC_VER) || defined(__MINGW32__) -# define localtime_r(t1, t2) (localtime_s(t2, t1) == 0 ? t1 : NULL) -#endif -#if defined(_MSC_VER) && (_MSC_VER < 1900) -# define snprintf _snprintf -#endif - -/***************************************************************************/ - -#define MZ_ZIP_MAGIC_LOCALHEADER (0x04034b50) -#define MZ_ZIP_MAGIC_LOCALHEADERU8 { 0x50, 0x4b, 0x03, 0x04 } -#define MZ_ZIP_MAGIC_CENTRALHEADER (0x02014b50) -#define MZ_ZIP_MAGIC_CENTRALHEADERU8 { 0x50, 0x4b, 0x01, 0x02 } -#define MZ_ZIP_MAGIC_ENDHEADER (0x06054b50) -#define MZ_ZIP_MAGIC_ENDHEADERU8 { 0x50, 0x4b, 0x05, 0x06 } -#define MZ_ZIP_MAGIC_ENDHEADER64 (0x06064b50) -#define MZ_ZIP_MAGIC_ENDLOCHEADER64 (0x07064b50) -#define MZ_ZIP_MAGIC_DATADESCRIPTOR (0x08074b50) -#define MZ_ZIP_MAGIC_DATADESCRIPTORU8 { 0x50, 0x4b, 0x07, 0x08 } - -#define MZ_ZIP_SIZE_LD_ITEM (30) -#define MZ_ZIP_SIZE_CD_ITEM (46) -#define MZ_ZIP_SIZE_CD_LOCATOR64 (20) -#define MZ_ZIP_SIZE_MAX_DATA_DESCRIPTOR (24) - -#define MZ_ZIP_OFFSET_CRC_SIZES (14) -#define MZ_ZIP_UNCOMPR_SIZE64_CUSHION (2 * 1024 * 1024) - -#ifndef MZ_ZIP_EOCD_MAX_BACK -#define MZ_ZIP_EOCD_MAX_BACK (1 << 20) -#endif - -/***************************************************************************/ - -typedef struct mz_zip_s { - mz_zip_file file_info; - mz_zip_file local_file_info; - - void *stream; /* main stream */ - void *cd_stream; /* pointer to the stream with the cd */ - void *cd_mem_stream; /* memory stream for central directory */ - void *compress_stream; /* compression stream */ - void *crypt_stream; /* encryption stream */ - void *file_info_stream; /* memory stream for storing file info */ - void *local_file_info_stream; /* memory stream for storing local file info */ - - int32_t open_mode; - uint8_t recover; - uint8_t data_descriptor; - - uint32_t disk_number_with_cd; /* number of the disk with the central dir */ - int64_t disk_offset_shift; /* correction for zips that have wrong offset start of cd */ - - int64_t cd_start_pos; /* pos of the first file in the central dir stream */ - int64_t cd_current_pos; /* pos of the current file in the central dir */ - int64_t cd_offset; /* offset of start of central directory */ - int64_t cd_size; /* size of the central directory */ - uint32_t cd_signature; /* signature of central directory */ - - uint8_t entry_scanned; /* entry header information read ok */ - uint8_t entry_opened; /* entry is open for read/write */ - uint8_t entry_raw; /* entry opened with raw mode */ - uint32_t entry_crc32; /* entry crc32 */ - - uint64_t number_entry; - - uint16_t version_madeby; - char *comment; -} mz_zip; - -/***************************************************************************/ - -#if 0 -# define mz_zip_print printf -#else -# define mz_zip_print(fmt, ...) -#endif - -/***************************************************************************/ - -/* Locate the end of central directory */ -static int32_t mz_zip_search_eocd(void *stream, int64_t *central_pos) { - int64_t file_size = 0; - int64_t max_back = MZ_ZIP_EOCD_MAX_BACK; - uint8_t find[4] = MZ_ZIP_MAGIC_ENDHEADERU8; - int32_t err = MZ_OK; - - err = mz_stream_seek(stream, 0, MZ_SEEK_END); - if (err != MZ_OK) - return err; - - file_size = mz_stream_tell(stream); - - if (max_back <= 0 || max_back > file_size) - max_back = file_size; - - return mz_stream_find_reverse(stream, (const void *)find, sizeof(find), max_back, central_pos); -} - -/* Locate the end of central directory 64 of a zip file */ -static int32_t mz_zip_search_zip64_eocd(void *stream, const int64_t end_central_offset, int64_t *central_pos) { - int64_t offset = 0; - uint32_t value32 = 0; - int32_t err = MZ_OK; - - *central_pos = 0; - - /* Zip64 end of central directory locator */ - err = mz_stream_seek(stream, end_central_offset - MZ_ZIP_SIZE_CD_LOCATOR64, MZ_SEEK_SET); - /* Read locator signature */ - if (err == MZ_OK) { - err = mz_stream_read_uint32(stream, &value32); - if (value32 != MZ_ZIP_MAGIC_ENDLOCHEADER64) - err = MZ_FORMAT_ERROR; - } - /* Number of the disk with the start of the zip64 end of central directory */ - if (err == MZ_OK) - err = mz_stream_read_uint32(stream, &value32); - /* Relative offset of the zip64 end of central directory record8 */ - if (err == MZ_OK) - err = mz_stream_read_uint64(stream, (uint64_t *)&offset); - /* Total number of disks */ - if (err == MZ_OK) - err = mz_stream_read_uint32(stream, &value32); - /* Goto end of central directory record */ - if (err == MZ_OK) - err = mz_stream_seek(stream, (int64_t)offset, MZ_SEEK_SET); - /* The signature */ - if (err == MZ_OK) { - err = mz_stream_read_uint32(stream, &value32); - if (value32 != MZ_ZIP_MAGIC_ENDHEADER64) - err = MZ_FORMAT_ERROR; - } - - if (err == MZ_OK) - *central_pos = offset; - - return err; -} - -#ifdef HAVE_PKCRYPT -/* Get PKWARE traditional encryption verifier */ -static uint16_t mz_zip_get_pk_verify(uint32_t dos_date, uint64_t crc, uint16_t flag) -{ - /* Info-ZIP modification to ZipCrypto format: if bit 3 of the general - * purpose bit flag is set, it uses high byte of 16-bit File Time. */ - if (flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR) - return ((dos_date >> 16) & 0xff) << 8 | ((dos_date >> 8) & 0xff); - return ((crc >> 16) & 0xff) << 8 | ((crc >> 24) & 0xff); -} -#endif - -/* Get info about the current file in the zip file */ -static int32_t mz_zip_entry_read_header(void *stream, uint8_t local, mz_zip_file *file_info, void *file_extra_stream) { - uint64_t ntfs_time = 0; - uint32_t reserved = 0; - uint32_t magic = 0; - uint32_t dos_date = 0; - uint32_t field_pos = 0; - uint16_t field_type = 0; - uint16_t field_length = 0; - uint32_t field_length_read = 0; - uint16_t ntfs_attrib_id = 0; - uint16_t ntfs_attrib_size = 0; - uint16_t linkname_size; - uint16_t value16 = 0; - uint32_t value32 = 0; - int64_t extrafield_pos = 0; - int64_t comment_pos = 0; - int64_t linkname_pos = 0; - int64_t saved_pos = 0; - int32_t err = MZ_OK; - char *linkname = NULL; - - memset(file_info, 0, sizeof(mz_zip_file)); - - /* Check the magic */ - err = mz_stream_read_uint32(stream, &magic); - if (err == MZ_END_OF_STREAM) - err = MZ_END_OF_LIST; - else if (magic == MZ_ZIP_MAGIC_ENDHEADER || magic == MZ_ZIP_MAGIC_ENDHEADER64) - err = MZ_END_OF_LIST; - else if ((local) && (magic != MZ_ZIP_MAGIC_LOCALHEADER)) - err = MZ_FORMAT_ERROR; - else if ((!local) && (magic != MZ_ZIP_MAGIC_CENTRALHEADER)) - err = MZ_FORMAT_ERROR; - - /* Read header fields */ - if (err == MZ_OK) { - if (!local) - err = mz_stream_read_uint16(stream, &file_info->version_madeby); - if (err == MZ_OK) - err = mz_stream_read_uint16(stream, &file_info->version_needed); - if (err == MZ_OK) - err = mz_stream_read_uint16(stream, &file_info->flag); - if (err == MZ_OK) - err = mz_stream_read_uint16(stream, &file_info->compression_method); - if (err == MZ_OK) { - err = mz_stream_read_uint32(stream, &dos_date); - file_info->modified_date = mz_zip_dosdate_to_time_t(dos_date); - } - if (err == MZ_OK) - err = mz_stream_read_uint32(stream, &file_info->crc); -#ifdef HAVE_PKCRYPT - if (err == MZ_OK && file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) { - /* Use dos_date from header instead of derived from time in zip extensions */ - file_info->pk_verify = mz_zip_get_pk_verify(dos_date, file_info->crc, file_info->flag); - } -#endif - if (err == MZ_OK) { - err = mz_stream_read_uint32(stream, &value32); - file_info->compressed_size = value32; - } - if (err == MZ_OK) { - err = mz_stream_read_uint32(stream, &value32); - file_info->uncompressed_size = value32; - } - if (err == MZ_OK) - err = mz_stream_read_uint16(stream, &file_info->filename_size); - if (err == MZ_OK) - err = mz_stream_read_uint16(stream, &file_info->extrafield_size); - if (!local) { - if (err == MZ_OK) - err = mz_stream_read_uint16(stream, &file_info->comment_size); - if (err == MZ_OK) { - err = mz_stream_read_uint16(stream, &value16); - file_info->disk_number = value16; - } - if (err == MZ_OK) - err = mz_stream_read_uint16(stream, &file_info->internal_fa); - if (err == MZ_OK) - err = mz_stream_read_uint32(stream, &file_info->external_fa); - if (err == MZ_OK) { - err = mz_stream_read_uint32(stream, &value32); - file_info->disk_offset = value32; - } - } - } - - if (err == MZ_OK) - err = mz_stream_seek(file_extra_stream, 0, MZ_SEEK_SET); - - /* Copy variable length data to memory stream for later retrieval */ - if ((err == MZ_OK) && (file_info->filename_size > 0)) - err = mz_stream_copy(file_extra_stream, stream, file_info->filename_size); - mz_stream_write_uint8(file_extra_stream, 0); - extrafield_pos = mz_stream_tell(file_extra_stream); - - if ((err == MZ_OK) && (file_info->extrafield_size > 0)) - err = mz_stream_copy(file_extra_stream, stream, file_info->extrafield_size); - mz_stream_write_uint8(file_extra_stream, 0); - - comment_pos = mz_stream_tell(file_extra_stream); - if ((err == MZ_OK) && (file_info->comment_size > 0)) - err = mz_stream_copy(file_extra_stream, stream, file_info->comment_size); - mz_stream_write_uint8(file_extra_stream, 0); - - linkname_pos = mz_stream_tell(file_extra_stream); - /* Overwrite if we encounter UNIX1 extra block */ - mz_stream_write_uint8(file_extra_stream, 0); - - if ((err == MZ_OK) && (file_info->extrafield_size > 0)) { - /* Seek to and parse the extra field */ - err = mz_stream_seek(file_extra_stream, extrafield_pos, MZ_SEEK_SET); - - while ((err == MZ_OK) && (field_pos + 4 <= file_info->extrafield_size)) { - err = mz_zip_extrafield_read(file_extra_stream, &field_type, &field_length); - if (err != MZ_OK) - break; - field_pos += 4; - - /* Don't allow field length to exceed size of remaining extrafield */ - if (field_length > (file_info->extrafield_size - field_pos)) - field_length = (uint16_t)(file_info->extrafield_size - field_pos); - - /* Read ZIP64 extra field */ - if ((field_type == MZ_ZIP_EXTENSION_ZIP64) && (field_length >= 8)) { - if ((err == MZ_OK) && (file_info->uncompressed_size == UINT32_MAX)) { - err = mz_stream_read_int64(file_extra_stream, &file_info->uncompressed_size); - if (file_info->uncompressed_size < 0) - err = MZ_FORMAT_ERROR; - } - if ((err == MZ_OK) && (file_info->compressed_size == UINT32_MAX)) { - err = mz_stream_read_int64(file_extra_stream, &file_info->compressed_size); - if (file_info->compressed_size < 0) - err = MZ_FORMAT_ERROR; - } - if ((err == MZ_OK) && (file_info->disk_offset == UINT32_MAX)) { - err = mz_stream_read_int64(file_extra_stream, &file_info->disk_offset); - if (file_info->disk_offset < 0) - err = MZ_FORMAT_ERROR; - } - if ((err == MZ_OK) && (file_info->disk_number == UINT16_MAX)) - err = mz_stream_read_uint32(file_extra_stream, &file_info->disk_number); - } - /* Read NTFS extra field */ - else if ((field_type == MZ_ZIP_EXTENSION_NTFS) && (field_length > 4)) { - if (err == MZ_OK) - err = mz_stream_read_uint32(file_extra_stream, &reserved); - field_length_read = 4; - - while ((err == MZ_OK) && (field_length_read + 4 <= field_length)) { - err = mz_stream_read_uint16(file_extra_stream, &ntfs_attrib_id); - if (err == MZ_OK) - err = mz_stream_read_uint16(file_extra_stream, &ntfs_attrib_size); - field_length_read += 4; - - if ((err == MZ_OK) && (ntfs_attrib_id == 0x01) && (ntfs_attrib_size == 24)) { - err = mz_stream_read_uint64(file_extra_stream, &ntfs_time); - mz_zip_ntfs_to_unix_time(ntfs_time, &file_info->modified_date); - - if (err == MZ_OK) { - err = mz_stream_read_uint64(file_extra_stream, &ntfs_time); - mz_zip_ntfs_to_unix_time(ntfs_time, &file_info->accessed_date); - } - if (err == MZ_OK) { - err = mz_stream_read_uint64(file_extra_stream, &ntfs_time); - mz_zip_ntfs_to_unix_time(ntfs_time, &file_info->creation_date); - } - } else if ((err == MZ_OK) && (field_length_read + ntfs_attrib_size <= field_length)) { - err = mz_stream_seek(file_extra_stream, ntfs_attrib_size, MZ_SEEK_CUR); - } - - field_length_read += ntfs_attrib_size; - } - } - /* Read UNIX1 extra field */ - else if ((field_type == MZ_ZIP_EXTENSION_UNIX1) && (field_length >= 12)) { - if (err == MZ_OK) { - err = mz_stream_read_uint32(file_extra_stream, &value32); - if (err == MZ_OK && file_info->accessed_date == 0) - file_info->accessed_date = value32; - } - if (err == MZ_OK) { - err = mz_stream_read_uint32(file_extra_stream, &value32); - if (err == MZ_OK && file_info->modified_date == 0) - file_info->modified_date = value32; - } - if (err == MZ_OK) - err = mz_stream_read_uint16(file_extra_stream, &value16); /* User id */ - if (err == MZ_OK) - err = mz_stream_read_uint16(file_extra_stream, &value16); /* Group id */ - - /* Copy linkname to end of file extra stream so we can return null - terminated string */ - linkname_size = field_length - 12; - if ((err == MZ_OK) && (linkname_size > 0)) { - linkname = (char *)malloc(linkname_size); - if (linkname) { - if (mz_stream_read(file_extra_stream, linkname, linkname_size) != linkname_size) - err = MZ_READ_ERROR; - if (err == MZ_OK) { - saved_pos = mz_stream_tell(file_extra_stream); - - mz_stream_seek(file_extra_stream, linkname_pos, MZ_SEEK_SET); - mz_stream_write(file_extra_stream, linkname, linkname_size); - mz_stream_write_uint8(file_extra_stream, 0); - - mz_stream_seek(file_extra_stream, saved_pos, MZ_SEEK_SET); - } - free(linkname); - } - } - } -#ifdef HAVE_WZAES - /* Read AES extra field */ - else if ((field_type == MZ_ZIP_EXTENSION_AES) && (field_length == 7)) { - uint8_t value8 = 0; - /* Verify version info */ - err = mz_stream_read_uint16(file_extra_stream, &value16); - /* Support AE-1 and AE-2 */ - if (value16 != 1 && value16 != 2) - err = MZ_FORMAT_ERROR; - file_info->aes_version = value16; - if (err == MZ_OK) - err = mz_stream_read_uint8(file_extra_stream, &value8); - if ((char)value8 != 'A') - err = MZ_FORMAT_ERROR; - if (err == MZ_OK) - err = mz_stream_read_uint8(file_extra_stream, &value8); - if ((char)value8 != 'E') - err = MZ_FORMAT_ERROR; - /* Get AES encryption strength and actual compression method */ - if (err == MZ_OK) { - err = mz_stream_read_uint8(file_extra_stream, &value8); - file_info->aes_encryption_mode = value8; - } - if (err == MZ_OK) { - err = mz_stream_read_uint16(file_extra_stream, &value16); - file_info->compression_method = value16; - } - } -#endif - else if (field_length > 0) { - err = mz_stream_seek(file_extra_stream, field_length, MZ_SEEK_CUR); - } - - field_pos += field_length; - } - } - - /* Get pointers to variable length data */ - mz_stream_mem_get_buffer(file_extra_stream, (const void **)&file_info->filename); - mz_stream_mem_get_buffer_at(file_extra_stream, extrafield_pos, (const void **)&file_info->extrafield); - mz_stream_mem_get_buffer_at(file_extra_stream, comment_pos, (const void **)&file_info->comment); - mz_stream_mem_get_buffer_at(file_extra_stream, linkname_pos, (const void **)&file_info->linkname); - - /* Set to empty string just in-case */ - if (!file_info->filename) - file_info->filename = ""; - if (!file_info->extrafield) - file_info->extrafield_size = 0; - if (!file_info->comment) - file_info->comment = ""; - if (!file_info->linkname) - file_info->linkname = ""; - - if (err == MZ_OK) { - mz_zip_print("Zip - Entry - Read header - %s (local %" PRId8 ")\n", - file_info->filename, local); - mz_zip_print("Zip - Entry - Read header compress (ucs %" PRId64 " cs %" PRId64 " crc 0x%08" PRIx32 ")\n", - file_info->uncompressed_size, file_info->compressed_size, file_info->crc); - if (!local) { - mz_zip_print("Zip - Entry - Read header disk (disk %" PRIu32 " offset %" PRId64 ")\n", - file_info->disk_number, file_info->disk_offset); - } - mz_zip_print("Zip - Entry - Read header variable (fnl %" PRId32 " efs %" PRId32 " cms %" PRId32 ")\n", - file_info->filename_size, file_info->extrafield_size, file_info->comment_size); - } - - return err; -} - -static int32_t mz_zip_entry_read_descriptor(void *stream, uint8_t zip64, uint32_t *crc32, int64_t *compressed_size, int64_t *uncompressed_size) { - uint32_t value32 = 0; - int64_t value64 = 0; - int32_t err = MZ_OK; - - err = mz_stream_read_uint32(stream, &value32); - if (value32 != MZ_ZIP_MAGIC_DATADESCRIPTOR) - err = MZ_FORMAT_ERROR; - if (err == MZ_OK) - err = mz_stream_read_uint32(stream, &value32); - if (err == MZ_OK && crc32) - *crc32 = value32; - if (err == MZ_OK) { - /* If zip 64 extension is enabled then read as 8 byte */ - if (!zip64) { - err = mz_stream_read_uint32(stream, &value32); - value64 = value32; - } else { - err = mz_stream_read_int64(stream, &value64); - if (value64 < 0) - err = MZ_FORMAT_ERROR; - } - if (err == MZ_OK && compressed_size) - *compressed_size = value64; - } - if (err == MZ_OK) { - if (!zip64) { - err = mz_stream_read_uint32(stream, &value32); - value64 = value32; - } else { - err = mz_stream_read_int64(stream, &value64); - if (value64 < 0) - err = MZ_FORMAT_ERROR; - } - if (err == MZ_OK && uncompressed_size) - *uncompressed_size = value64; - } - - return err; -} - -static int32_t mz_zip_entry_write_crc_sizes(void *stream, uint8_t zip64, uint8_t mask, mz_zip_file *file_info) { - int32_t err = MZ_OK; - - if (mask) - err = mz_stream_write_uint32(stream, 0); - else - err = mz_stream_write_uint32(stream, file_info->crc); /* crc */ - - /* For backwards-compatibility with older zip applications we set all sizes to UINT32_MAX - * when zip64 is needed, instead of only setting sizes larger than UINT32_MAX. */ - - if (err == MZ_OK) { - if (zip64) /* compr size */ - err = mz_stream_write_uint32(stream, UINT32_MAX); - else - err = mz_stream_write_uint32(stream, (uint32_t)file_info->compressed_size); - } - if (err == MZ_OK) { - if (mask) /* uncompr size */ - err = mz_stream_write_uint32(stream, 0); - else if (zip64) - err = mz_stream_write_uint32(stream, UINT32_MAX); - else - err = mz_stream_write_uint32(stream, (uint32_t)file_info->uncompressed_size); - } - return err; -} - -static int32_t mz_zip_entry_needs_zip64(mz_zip_file *file_info, uint8_t local, uint8_t *zip64) { - uint32_t max_uncompressed_size = UINT32_MAX; - uint8_t needs_zip64 = 0; - - if (!zip64) - return MZ_PARAM_ERROR; - - *zip64 = 0; - - if (local) { - /* At local header we might not know yet whether compressed size will overflow unsigned - 32-bit integer which might happen for high entropy data so we give it some cushion */ - - max_uncompressed_size -= MZ_ZIP_UNCOMPR_SIZE64_CUSHION; - } - - needs_zip64 = (file_info->uncompressed_size >= max_uncompressed_size) || - (file_info->compressed_size >= UINT32_MAX); - - if (!local) { - /* Disk offset and number only used in central directory header */ - needs_zip64 |= (file_info->disk_offset >= UINT32_MAX) || - (file_info->disk_number >= UINT16_MAX); - } - - if (file_info->zip64 == MZ_ZIP64_AUTO) { - /* If uncompressed size is unknown, assume zip64 for 64-bit data descriptors */ - if (local && file_info->uncompressed_size == 0) { - /* Don't use zip64 for local header directory entries */ - if (mz_zip_attrib_is_dir(file_info->external_fa, file_info->version_madeby) != MZ_OK) { - *zip64 = 1; - } - } - *zip64 |= needs_zip64; - } else if (file_info->zip64 == MZ_ZIP64_FORCE) { - *zip64 = 1; - } else if (file_info->zip64 == MZ_ZIP64_DISABLE) { - /* Zip64 extension is required to zip file */ - if (needs_zip64) - return MZ_PARAM_ERROR; - } - - return MZ_OK; -} - -static int32_t mz_zip_entry_write_header(void *stream, uint8_t local, mz_zip_file *file_info) { - uint64_t ntfs_time = 0; - uint32_t reserved = 0; - uint32_t dos_date = 0; - uint16_t extrafield_size = 0; - uint16_t field_type = 0; - uint16_t field_length = 0; - uint16_t field_length_zip64 = 0; - uint16_t field_length_ntfs = 0; - uint16_t field_length_aes = 0; - uint16_t field_length_unix1 = 0; - uint16_t filename_size = 0; - uint16_t filename_length = 0; - uint16_t linkname_size = 0; - uint16_t version_needed = 0; - int32_t comment_size = 0; - int32_t err = MZ_OK; - int32_t err_mem = MZ_OK; - uint8_t zip64 = 0; - uint8_t skip_aes = 0; - uint8_t mask = 0; - uint8_t write_end_slash = 0; - const char *filename = NULL; - char masked_name[64]; - void *file_extra_stream = NULL; - - if (!file_info) - return MZ_PARAM_ERROR; - - if ((local) && (file_info->flag & MZ_ZIP_FLAG_MASK_LOCAL_INFO)) - mask = 1; - - /* Determine if zip64 extra field is necessary */ - err = mz_zip_entry_needs_zip64(file_info, local, &zip64); - if (err != MZ_OK) - return err; - - /* Start calculating extra field sizes */ - if (zip64) { - /* Both compressed and uncompressed sizes must be included (at least in local header) */ - field_length_zip64 = 8 + 8; - if ((!local) && (file_info->disk_offset >= UINT32_MAX)) - field_length_zip64 += 8; - - extrafield_size += 4; - extrafield_size += field_length_zip64; - } - - /* Calculate extra field size and check for duplicates */ - if (file_info->extrafield_size > 0) { - mz_stream_mem_create(&file_extra_stream); - mz_stream_mem_set_buffer(file_extra_stream, (void *)file_info->extrafield, - file_info->extrafield_size); - - do { - err_mem = mz_stream_read_uint16(file_extra_stream, &field_type); - if (err_mem == MZ_OK) - err_mem = mz_stream_read_uint16(file_extra_stream, &field_length); - if (err_mem != MZ_OK) - break; - - /* Prefer incoming aes extensions over ours */ - if (field_type == MZ_ZIP_EXTENSION_AES) - skip_aes = 1; - - /* Prefer our zip64, ntfs, unix1 extension over incoming */ - if (field_type != MZ_ZIP_EXTENSION_ZIP64 && field_type != MZ_ZIP_EXTENSION_NTFS && - field_type != MZ_ZIP_EXTENSION_UNIX1) - extrafield_size += 4 + field_length; - - if (err_mem == MZ_OK) - err_mem = mz_stream_seek(file_extra_stream, field_length, MZ_SEEK_CUR); - } while (err_mem == MZ_OK); - } - -#ifdef HAVE_WZAES - if (!skip_aes) { - if ((file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) && (file_info->aes_version)) { - field_length_aes = 1 + 1 + 1 + 2 + 2; - extrafield_size += 4 + field_length_aes; - } - } -#else - MZ_UNUSED(field_length_aes); - MZ_UNUSED(skip_aes); -#endif - /* NTFS timestamps */ - if ((file_info->modified_date != 0) && - (file_info->accessed_date != 0) && - (file_info->creation_date != 0) && (!mask)) { - field_length_ntfs = 8 + 8 + 8 + 4 + 2 + 2; - extrafield_size += 4 + field_length_ntfs; - } - - /* Unix1 symbolic links */ - if (file_info->linkname && *file_info->linkname != 0) { - linkname_size = (uint16_t)strlen(file_info->linkname); - field_length_unix1 = 12 + linkname_size; - extrafield_size += 4 + field_length_unix1; - } - - if (local) - err = mz_stream_write_uint32(stream, MZ_ZIP_MAGIC_LOCALHEADER); - else { - err = mz_stream_write_uint32(stream, MZ_ZIP_MAGIC_CENTRALHEADER); - if (err == MZ_OK) - err = mz_stream_write_uint16(stream, file_info->version_madeby); - } - - /* Calculate version needed to extract */ - if (err == MZ_OK) { - version_needed = file_info->version_needed; - if (version_needed == 0) { - version_needed = 20; - if (zip64) - version_needed = 45; -#ifdef HAVE_WZAES - if ((file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) && (file_info->aes_version)) - version_needed = 51; -#endif -#if defined(HAVE_LZMA) || defined(HAVE_LIBCOMP) - if ((file_info->compression_method == MZ_COMPRESS_METHOD_LZMA) || - (file_info->compression_method == MZ_COMPRESS_METHOD_XZ)) - version_needed = 63; -#endif - } - err = mz_stream_write_uint16(stream, version_needed); - } - if (err == MZ_OK) - err = mz_stream_write_uint16(stream, file_info->flag); - if (err == MZ_OK) { -#ifdef HAVE_WZAES - if ((file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) && (file_info->aes_version)) - err = mz_stream_write_uint16(stream, MZ_COMPRESS_METHOD_AES); - else -#endif - err = mz_stream_write_uint16(stream, file_info->compression_method); - } - if (err == MZ_OK) { - if (file_info->modified_date != 0 && !mask) - dos_date = mz_zip_time_t_to_dos_date(file_info->modified_date); - err = mz_stream_write_uint32(stream, dos_date); - } - - if (err == MZ_OK) - err = mz_zip_entry_write_crc_sizes(stream, zip64, mask, file_info); - - if (mask) { - snprintf(masked_name, sizeof(masked_name), "%" PRIx32 "_%" PRIx64, - file_info->disk_number, file_info->disk_offset); - filename = masked_name; - } else { - filename = file_info->filename; - } - - filename_length = (uint16_t)strlen(filename); - filename_size += filename_length; - - if ((mz_zip_attrib_is_dir(file_info->external_fa, file_info->version_madeby) == MZ_OK) && - ((filename[filename_length - 1] != '/') && (filename[filename_length - 1] != '\\'))) { - filename_size += 1; - write_end_slash = 1; - } - - if (err == MZ_OK) - err = mz_stream_write_uint16(stream, filename_size); - if (err == MZ_OK) - err = mz_stream_write_uint16(stream, extrafield_size); - - if (!local) { - if (file_info->comment) { - comment_size = (int32_t)strlen(file_info->comment); - if (comment_size > UINT16_MAX) - comment_size = UINT16_MAX; - } - if (err == MZ_OK) - err = mz_stream_write_uint16(stream, (uint16_t)comment_size); - if (err == MZ_OK) - err = mz_stream_write_uint16(stream, (uint16_t)file_info->disk_number); - if (err == MZ_OK) - err = mz_stream_write_uint16(stream, file_info->internal_fa); - if (err == MZ_OK) - err = mz_stream_write_uint32(stream, file_info->external_fa); - if (err == MZ_OK) { - if (file_info->disk_offset >= UINT32_MAX) - err = mz_stream_write_uint32(stream, UINT32_MAX); - else - err = mz_stream_write_uint32(stream, (uint32_t)file_info->disk_offset); - } - } - - if (err == MZ_OK) { - const char *backslash = NULL; - const char *next = filename; - int32_t left = filename_length; - - /* Ensure all slashes are written as forward slashes according to 4.4.17.1 */ - while ((err == MZ_OK) && (backslash = strrchr(next, '\\'))) { - int32_t part_length = (int32_t)(backslash - next); - - if (mz_stream_write(stream, next, part_length) != part_length || - mz_stream_write(stream, "/", 1) != 1) - err = MZ_WRITE_ERROR; - - left -= part_length + 1; - next = backslash + 1; - } - - if (err == MZ_OK && left > 0) { - if (mz_stream_write(stream, next, left) != left) - err = MZ_WRITE_ERROR; - } - - /* Ensure that directories have a slash appended to them for compatibility */ - if (err == MZ_OK && write_end_slash) - err = mz_stream_write_uint8(stream, '/'); - } - - /* Write ZIP64 extra field first so we can update sizes later if data descriptor not used */ - if ((err == MZ_OK) && (zip64)) { - err = mz_zip_extrafield_write(stream, MZ_ZIP_EXTENSION_ZIP64, field_length_zip64); - if (err == MZ_OK) { - if (mask) - err = mz_stream_write_int64(stream, 0); - else - err = mz_stream_write_int64(stream, file_info->uncompressed_size); - } - if (err == MZ_OK) - err = mz_stream_write_int64(stream, file_info->compressed_size); - if ((err == MZ_OK) && (!local) && (file_info->disk_offset >= UINT32_MAX)) - err = mz_stream_write_int64(stream, file_info->disk_offset); - if ((err == MZ_OK) && (!local) && (file_info->disk_number >= UINT16_MAX)) - err = mz_stream_write_uint32(stream, file_info->disk_number); - } - /* Write NTFS extra field */ - if ((err == MZ_OK) && (field_length_ntfs > 0)) { - err = mz_zip_extrafield_write(stream, MZ_ZIP_EXTENSION_NTFS, field_length_ntfs); - if (err == MZ_OK) - err = mz_stream_write_uint32(stream, reserved); - if (err == MZ_OK) - err = mz_stream_write_uint16(stream, 0x01); - if (err == MZ_OK) - err = mz_stream_write_uint16(stream, field_length_ntfs - 8); - if (err == MZ_OK) { - mz_zip_unix_to_ntfs_time(file_info->modified_date, &ntfs_time); - err = mz_stream_write_uint64(stream, ntfs_time); - } - if (err == MZ_OK) { - mz_zip_unix_to_ntfs_time(file_info->accessed_date, &ntfs_time); - err = mz_stream_write_uint64(stream, ntfs_time); - } - if (err == MZ_OK) { - mz_zip_unix_to_ntfs_time(file_info->creation_date, &ntfs_time); - err = mz_stream_write_uint64(stream, ntfs_time); - } - } - /* Write UNIX extra block extra field */ - if ((err == MZ_OK) && (field_length_unix1 > 0)) { - err = mz_zip_extrafield_write(stream, MZ_ZIP_EXTENSION_UNIX1, field_length_unix1); - if (err == MZ_OK) - err = mz_stream_write_uint32(stream, (uint32_t)file_info->accessed_date); - if (err == MZ_OK) - err = mz_stream_write_uint32(stream, (uint32_t)file_info->modified_date); - if (err == MZ_OK) /* User id */ - err = mz_stream_write_uint16(stream, 0); - if (err == MZ_OK) /* Group id */ - err = mz_stream_write_uint16(stream, 0); - if (err == MZ_OK && linkname_size > 0) { - if (mz_stream_write(stream, file_info->linkname, linkname_size) != linkname_size) - err = MZ_WRITE_ERROR; - } - } -#ifdef HAVE_WZAES - /* Write AES extra field */ - if ((err == MZ_OK) && (!skip_aes) && (file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) && (file_info->aes_version)) { - err = mz_zip_extrafield_write(stream, MZ_ZIP_EXTENSION_AES, field_length_aes); - if (err == MZ_OK) - err = mz_stream_write_uint16(stream, file_info->aes_version); - if (err == MZ_OK) - err = mz_stream_write_uint8(stream, 'A'); - if (err == MZ_OK) - err = mz_stream_write_uint8(stream, 'E'); - if (err == MZ_OK) - err = mz_stream_write_uint8(stream, file_info->aes_encryption_mode); - if (err == MZ_OK) - err = mz_stream_write_uint16(stream, file_info->compression_method); - } -#endif - - if (file_info->extrafield_size > 0) { - err_mem = mz_stream_mem_seek(file_extra_stream, 0, MZ_SEEK_SET); - while (err == MZ_OK && err_mem == MZ_OK) { - err_mem = mz_stream_read_uint16(file_extra_stream, &field_type); - if (err_mem == MZ_OK) - err_mem = mz_stream_read_uint16(file_extra_stream, &field_length); - if (err_mem != MZ_OK) - break; - - /* Prefer our zip 64, ntfs, unix1 extensions over incoming */ - if (field_type == MZ_ZIP_EXTENSION_ZIP64 || field_type == MZ_ZIP_EXTENSION_NTFS || - field_type == MZ_ZIP_EXTENSION_UNIX1) { - err_mem = mz_stream_seek(file_extra_stream, field_length, MZ_SEEK_CUR); - continue; - } - - err = mz_stream_write_uint16(stream, field_type); - if (err == MZ_OK) - err = mz_stream_write_uint16(stream, field_length); - if (err == MZ_OK) - err = mz_stream_copy(stream, file_extra_stream, field_length); - } - - mz_stream_mem_delete(&file_extra_stream); - } - - if (err == MZ_OK && !local && file_info->comment) { - if (mz_stream_write(stream, file_info->comment, file_info->comment_size) != file_info->comment_size) - err = MZ_WRITE_ERROR; - } - - return err; -} - -static int32_t mz_zip_entry_write_descriptor(void *stream, uint8_t zip64, uint32_t crc32, int64_t compressed_size, int64_t uncompressed_size) { - int32_t err = MZ_OK; - - err = mz_stream_write_uint32(stream, MZ_ZIP_MAGIC_DATADESCRIPTOR); - if (err == MZ_OK) - err = mz_stream_write_uint32(stream, crc32); - - /* Store data descriptor as 8 bytes if zip 64 extension enabled */ - if (err == MZ_OK) { - /* Zip 64 extension is enabled when uncompressed size is > UINT32_MAX */ - if (!zip64) - err = mz_stream_write_uint32(stream, (uint32_t)compressed_size); - else - err = mz_stream_write_int64(stream, compressed_size); - } - if (err == MZ_OK) { - if (!zip64) - err = mz_stream_write_uint32(stream, (uint32_t)uncompressed_size); - else - err = mz_stream_write_int64(stream, uncompressed_size); - } - - return err; -} - -static int32_t mz_zip_read_cd(void *handle) { - mz_zip *zip = (mz_zip *)handle; - uint64_t number_entry_cd64 = 0; - uint64_t number_entry_cd = 0; - int64_t eocd_pos = 0; - int64_t eocd_pos64 = 0; - int64_t value64i = 0; - uint16_t value16 = 0; - uint32_t value32 = 0; - uint64_t value64 = 0; - uint16_t comment_size = 0; - int32_t comment_read = 0; - int32_t err = MZ_OK; - - if (!zip) - return MZ_PARAM_ERROR; - - /* Read and cache central directory records */ - err = mz_zip_search_eocd(zip->stream, &eocd_pos); - if (err == MZ_OK) { - /* The signature, already checked */ - err = mz_stream_read_uint32(zip->stream, &value32); - /* Number of this disk */ - if (err == MZ_OK) - err = mz_stream_read_uint16(zip->stream, &value16); - /* Number of the disk with the start of the central directory */ - if (err == MZ_OK) - err = mz_stream_read_uint16(zip->stream, &value16); - zip->disk_number_with_cd = value16; - /* Total number of entries in the central dir on this disk */ - if (err == MZ_OK) - err = mz_stream_read_uint16(zip->stream, &value16); - zip->number_entry = value16; - /* Total number of entries in the central dir */ - if (err == MZ_OK) - err = mz_stream_read_uint16(zip->stream, &value16); - number_entry_cd = value16; - if (number_entry_cd != zip->number_entry) - err = MZ_FORMAT_ERROR; - /* Size of the central directory */ - if (err == MZ_OK) - err = mz_stream_read_uint32(zip->stream, &value32); - if (err == MZ_OK) - zip->cd_size = value32; - /* Offset of start of central directory with respect to the starting disk number */ - if (err == MZ_OK) - err = mz_stream_read_uint32(zip->stream, &value32); - if (err == MZ_OK) - zip->cd_offset = value32; - /* Zip file global comment length */ - if (err == MZ_OK) - err = mz_stream_read_uint16(zip->stream, &comment_size); - if ((err == MZ_OK) && (comment_size > 0)) { - zip->comment = (char *)malloc(comment_size + 1); - if (zip->comment) { - comment_read = mz_stream_read(zip->stream, zip->comment, comment_size); - /* Don't fail if incorrect comment length read, not critical */ - if (comment_read < 0) - comment_read = 0; - zip->comment[comment_read] = 0; - } - } - - if ((err == MZ_OK) && ((number_entry_cd == UINT16_MAX) || (zip->cd_offset == UINT32_MAX))) { - /* Format should be Zip64, as the central directory or file size is too large */ - if (mz_zip_search_zip64_eocd(zip->stream, eocd_pos, &eocd_pos64) == MZ_OK) { - eocd_pos = eocd_pos64; - - err = mz_stream_seek(zip->stream, eocd_pos, MZ_SEEK_SET); - /* The signature, already checked */ - if (err == MZ_OK) - err = mz_stream_read_uint32(zip->stream, &value32); - /* Size of zip64 end of central directory record */ - if (err == MZ_OK) - err = mz_stream_read_uint64(zip->stream, &value64); - /* Version made by */ - if (err == MZ_OK) - err = mz_stream_read_uint16(zip->stream, &zip->version_madeby); - /* Version needed to extract */ - if (err == MZ_OK) - err = mz_stream_read_uint16(zip->stream, &value16); - /* Number of this disk */ - if (err == MZ_OK) - err = mz_stream_read_uint32(zip->stream, &value32); - /* Number of the disk with the start of the central directory */ - if (err == MZ_OK) - err = mz_stream_read_uint32(zip->stream, &zip->disk_number_with_cd); - /* Total number of entries in the central directory on this disk */ - if (err == MZ_OK) - err = mz_stream_read_uint64(zip->stream, &zip->number_entry); - /* Total number of entries in the central directory */ - if (err == MZ_OK) - err = mz_stream_read_uint64(zip->stream, &number_entry_cd64); - if (zip->number_entry != number_entry_cd64) - err = MZ_FORMAT_ERROR; - /* Size of the central directory */ - if (err == MZ_OK) { - err = mz_stream_read_int64(zip->stream, &zip->cd_size); - if (zip->cd_size < 0) - err = MZ_FORMAT_ERROR; - } - /* Offset of start of central directory with respect to the starting disk number */ - if (err == MZ_OK) { - err = mz_stream_read_int64(zip->stream, &zip->cd_offset); - if (zip->cd_offset < 0) - err = MZ_FORMAT_ERROR; - } - } else if ((zip->number_entry == UINT16_MAX) || (number_entry_cd != zip->number_entry) || - (zip->cd_size == UINT16_MAX) || (zip->cd_offset == UINT32_MAX)) { - err = MZ_FORMAT_ERROR; - } - } - } - - if (err == MZ_OK) { - mz_zip_print("Zip - Read cd (disk %" PRId32 " entries %" PRId64 " offset %" PRId64 " size %" PRId64 ")\n", - zip->disk_number_with_cd, zip->number_entry, zip->cd_offset, zip->cd_size); - - /* Verify central directory signature exists at offset */ - err = mz_stream_seek(zip->stream, zip->cd_offset, MZ_SEEK_SET); - if (err == MZ_OK) - err = mz_stream_read_uint32(zip->stream, &zip->cd_signature); - if ((err == MZ_OK) && (zip->cd_signature != MZ_ZIP_MAGIC_CENTRALHEADER)) { - /* If cd exists in large file and no zip-64 support, error for recover */ - if (eocd_pos > UINT32_MAX && eocd_pos64 == 0) - err = MZ_FORMAT_ERROR; - /* If cd not found attempt to seek backward to find it */ - if (err == MZ_OK) - err = mz_stream_seek(zip->stream, eocd_pos - zip->cd_size, MZ_SEEK_SET); - if (err == MZ_OK) - err = mz_stream_read_uint32(zip->stream, &zip->cd_signature); - if ((err == MZ_OK) && (zip->cd_signature == MZ_ZIP_MAGIC_CENTRALHEADER)) { - /* If found compensate for incorrect locations */ - value64i = zip->cd_offset; - zip->cd_offset = eocd_pos - zip->cd_size; - /* Assume disk has prepended data */ - zip->disk_offset_shift = zip->cd_offset - value64i; - } - } - } - - if (err == MZ_OK) { - if (eocd_pos < zip->cd_offset) { - /* End of central dir should always come after central dir */ - err = MZ_FORMAT_ERROR; - } else if ((uint64_t)eocd_pos < (uint64_t)zip->cd_offset + zip->cd_size) { - /* Truncate size of cd if incorrect size or offset provided */ - zip->cd_size = eocd_pos - zip->cd_offset; - } - } - - return err; -} - -static int32_t mz_zip_write_cd(void *handle) { - mz_zip *zip = (mz_zip *)handle; - int64_t zip64_eocd_pos_inzip = 0; - int64_t disk_number = 0; - int64_t disk_size = 0; - int32_t comment_size = 0; - int32_t err = MZ_OK; - - if (!zip) - return MZ_PARAM_ERROR; - - if (mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, &disk_number) == MZ_OK) - zip->disk_number_with_cd = (uint32_t)disk_number; - if (mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_SIZE, &disk_size) == MZ_OK && disk_size > 0) - zip->disk_number_with_cd += 1; - mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, -1); - if ((zip->disk_number_with_cd > 0) && (zip->open_mode & MZ_OPEN_MODE_APPEND)) { - // Overwrite existing central directory if using split disks - mz_stream_seek(zip->stream, 0, MZ_SEEK_SET); - } - - zip->cd_offset = mz_stream_tell(zip->stream); - mz_stream_seek(zip->cd_mem_stream, 0, MZ_SEEK_END); - zip->cd_size = (uint32_t)mz_stream_tell(zip->cd_mem_stream); - mz_stream_seek(zip->cd_mem_stream, 0, MZ_SEEK_SET); - - err = mz_stream_copy(zip->stream, zip->cd_mem_stream, (int32_t)zip->cd_size); - - mz_zip_print("Zip - Write cd (disk %" PRId32 " entries %" PRId64 " offset %" PRId64 " size %" PRId64 ")\n", - zip->disk_number_with_cd, zip->number_entry, zip->cd_offset, zip->cd_size); - - if (zip->cd_size == 0 && zip->number_entry > 0) { - // Zip does not contain central directory, open with recovery option - return MZ_FORMAT_ERROR; - } - - /* Write the ZIP64 central directory header */ - if (zip->cd_offset >= UINT32_MAX || zip->number_entry >= UINT16_MAX) { - zip64_eocd_pos_inzip = mz_stream_tell(zip->stream); - - err = mz_stream_write_uint32(zip->stream, MZ_ZIP_MAGIC_ENDHEADER64); - - /* Size of this 'zip64 end of central directory' */ - if (err == MZ_OK) - err = mz_stream_write_uint64(zip->stream, (uint64_t)44); - /* Version made by */ - if (err == MZ_OK) - err = mz_stream_write_uint16(zip->stream, zip->version_madeby); - /* Version needed */ - if (err == MZ_OK) - err = mz_stream_write_uint16(zip->stream, (uint16_t)45); - /* Number of this disk */ - if (err == MZ_OK) - err = mz_stream_write_uint32(zip->stream, zip->disk_number_with_cd); - /* Number of the disk with the start of the central directory */ - if (err == MZ_OK) - err = mz_stream_write_uint32(zip->stream, zip->disk_number_with_cd); - /* Total number of entries in the central dir on this disk */ - if (err == MZ_OK) - err = mz_stream_write_uint64(zip->stream, zip->number_entry); - /* Total number of entries in the central dir */ - if (err == MZ_OK) - err = mz_stream_write_uint64(zip->stream, zip->number_entry); - /* Size of the central directory */ - if (err == MZ_OK) - err = mz_stream_write_int64(zip->stream, zip->cd_size); - /* Offset of start of central directory with respect to the starting disk number */ - if (err == MZ_OK) - err = mz_stream_write_int64(zip->stream, zip->cd_offset); - if (err == MZ_OK) - err = mz_stream_write_uint32(zip->stream, MZ_ZIP_MAGIC_ENDLOCHEADER64); - - /* Number of the disk with the start of the central directory */ - if (err == MZ_OK) - err = mz_stream_write_uint32(zip->stream, zip->disk_number_with_cd); - /* Relative offset to the end of zip64 central directory */ - if (err == MZ_OK) - err = mz_stream_write_int64(zip->stream, zip64_eocd_pos_inzip); - /* Number of the disk with the start of the central directory */ - if (err == MZ_OK) - err = mz_stream_write_uint32(zip->stream, zip->disk_number_with_cd + 1); - } - - /* Write the central directory header */ - - /* Signature */ - if (err == MZ_OK) - err = mz_stream_write_uint32(zip->stream, MZ_ZIP_MAGIC_ENDHEADER); - /* Number of this disk */ - if (err == MZ_OK) - err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->disk_number_with_cd); - /* Number of the disk with the start of the central directory */ - if (err == MZ_OK) - err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->disk_number_with_cd); - /* Total number of entries in the central dir on this disk */ - if (err == MZ_OK) { - if (zip->number_entry >= UINT16_MAX) - err = mz_stream_write_uint16(zip->stream, UINT16_MAX); - else - err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->number_entry); - } - /* Total number of entries in the central dir */ - if (err == MZ_OK) { - if (zip->number_entry >= UINT16_MAX) - err = mz_stream_write_uint16(zip->stream, UINT16_MAX); - else - err = mz_stream_write_uint16(zip->stream, (uint16_t)zip->number_entry); - } - /* Size of the central directory */ - if (err == MZ_OK) - err = mz_stream_write_uint32(zip->stream, (uint32_t)zip->cd_size); - /* Offset of start of central directory with respect to the starting disk number */ - if (err == MZ_OK) { - if (zip->cd_offset >= UINT32_MAX) - err = mz_stream_write_uint32(zip->stream, UINT32_MAX); - else - err = mz_stream_write_uint32(zip->stream, (uint32_t)zip->cd_offset); - } - - /* Write global comment */ - if (zip->comment) { - comment_size = (int32_t)strlen(zip->comment); - if (comment_size > UINT16_MAX) - comment_size = UINT16_MAX; - } - if (err == MZ_OK) - err = mz_stream_write_uint16(zip->stream, (uint16_t)comment_size); - if (err == MZ_OK) { - if (mz_stream_write(zip->stream, zip->comment, comment_size) != comment_size) - err = MZ_READ_ERROR; - } - return err; -} - -static int32_t mz_zip_recover_cd(void *handle) { - mz_zip *zip = (mz_zip *)handle; - mz_zip_file local_file_info; - void *local_file_info_stream = NULL; - void *cd_mem_stream = NULL; - uint64_t number_entry = 0; - int64_t descriptor_pos = 0; - int64_t next_header_pos = 0; - int64_t disk_offset = 0; - int64_t disk_number = 0; - int64_t compressed_pos = 0; - int64_t compressed_end_pos = 0; - int64_t compressed_size = 0; - int64_t uncompressed_size = 0; - uint8_t descriptor_magic[4] = MZ_ZIP_MAGIC_DATADESCRIPTORU8; - uint8_t local_header_magic[4] = MZ_ZIP_MAGIC_LOCALHEADERU8; - uint8_t central_header_magic[4] = MZ_ZIP_MAGIC_CENTRALHEADERU8; - uint32_t crc32 = 0; - int32_t disk_number_with_cd = 0; - int32_t err = MZ_OK; - uint8_t zip64 = 0; - uint8_t eof = 0; - - mz_zip_print("Zip - Recover - Start\n"); - - mz_zip_get_cd_mem_stream(handle, &cd_mem_stream); - - /* Determine if we are on a split disk or not */ - mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, 0); - if (mz_stream_tell(zip->stream) < 0) { - mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, -1); - mz_stream_seek(zip->stream, 0, MZ_SEEK_SET); - } else - disk_number_with_cd = 1; - - if (mz_stream_is_open(cd_mem_stream) != MZ_OK) - err = mz_stream_mem_open(cd_mem_stream, NULL, MZ_OPEN_MODE_CREATE); - - mz_stream_mem_create(&local_file_info_stream); - mz_stream_mem_open(local_file_info_stream, NULL, MZ_OPEN_MODE_CREATE); - - if (err == MZ_OK) { - err = mz_stream_find(zip->stream, (const void *)local_header_magic, sizeof(local_header_magic), - INT64_MAX, &next_header_pos); - } - - while (err == MZ_OK && !eof) { - /* Get current offset and disk number for central dir record */ - disk_offset = mz_stream_tell(zip->stream); - mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, &disk_number); - - /* Read local headers */ - memset(&local_file_info, 0, sizeof(local_file_info)); - err = mz_zip_entry_read_header(zip->stream, 1, &local_file_info, local_file_info_stream); - if (err != MZ_OK) - break; - - local_file_info.disk_offset = disk_offset; - if (disk_number < 0) - disk_number = 0; - local_file_info.disk_number = (uint32_t)disk_number; - - compressed_pos = mz_stream_tell(zip->stream); - - if ((err == MZ_OK) && (local_file_info.compressed_size > 0)) { - mz_stream_seek(zip->stream, local_file_info.compressed_size, MZ_SEEK_CUR); - } - - for (;;) { - /* Search for the next local header */ - err = mz_stream_find(zip->stream, (const void *)local_header_magic, sizeof(local_header_magic), - INT64_MAX, &next_header_pos); - - if (err == MZ_EXIST_ERROR) { - mz_stream_seek(zip->stream, compressed_pos, MZ_SEEK_SET); - - /* Search for central dir if no local header found */ - err = mz_stream_find(zip->stream, (const void *)central_header_magic, sizeof(central_header_magic), - INT64_MAX, &next_header_pos); - - if (err == MZ_EXIST_ERROR) { - /* Get end of stream if no central header found */ - mz_stream_seek(zip->stream, 0, MZ_SEEK_END); - next_header_pos = mz_stream_tell(zip->stream); - } - - eof = 1; - } - - if (local_file_info.flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR || local_file_info.compressed_size == 0) { - /* Search backwards for the descriptor, seeking too far back will be incorrect if compressed size is small */ - err = mz_stream_find_reverse(zip->stream, (const void *)descriptor_magic, sizeof(descriptor_magic), - MZ_ZIP_SIZE_MAX_DATA_DESCRIPTOR, &descriptor_pos); - if (err == MZ_OK) { - if (mz_zip_extrafield_contains(local_file_info.extrafield, - local_file_info.extrafield_size, MZ_ZIP_EXTENSION_ZIP64, NULL) == MZ_OK) - zip64 = 1; - - err = mz_zip_entry_read_descriptor(zip->stream, zip64, &crc32, - &compressed_size, &uncompressed_size); - - if (err == MZ_OK) { - if (local_file_info.crc == 0) - local_file_info.crc = crc32; - if (local_file_info.compressed_size == 0) - local_file_info.compressed_size = compressed_size; - if (local_file_info.uncompressed_size == 0) - local_file_info.uncompressed_size = uncompressed_size; - } - - compressed_end_pos = descriptor_pos; - } else if (eof) { - compressed_end_pos = next_header_pos; - } else if (local_file_info.flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR) { - /* Wrong local file entry found, keep searching */ - next_header_pos += 1; - mz_stream_seek(zip->stream, next_header_pos, MZ_SEEK_SET); - continue; - } - } else { - compressed_end_pos = next_header_pos; - } - - break; - } - - compressed_size = compressed_end_pos - compressed_pos; - - if (compressed_size > UINT32_MAX) { - /* Update sizes if 4GB file is written with no ZIP64 support */ - if (local_file_info.uncompressed_size < UINT32_MAX) { - local_file_info.compressed_size = compressed_size; - local_file_info.uncompressed_size = 0; - } - } - - mz_zip_print("Zip - Recover - Entry %s (csize %" PRId64 " usize %" PRId64 " flags 0x%" PRIx16 ")\n", - local_file_info.filename, local_file_info.compressed_size, local_file_info.uncompressed_size, - local_file_info.flag); - - /* Rewrite central dir with local headers and offsets */ - err = mz_zip_entry_write_header(cd_mem_stream, 0, &local_file_info); - if (err == MZ_OK) - number_entry += 1; - - err = mz_stream_seek(zip->stream, next_header_pos, MZ_SEEK_SET); - } - - mz_stream_mem_delete(&local_file_info_stream); - - mz_zip_print("Zip - Recover - Complete (cddisk %" PRId32 " entries %" PRId64 ")\n", - disk_number_with_cd, number_entry); - - if (number_entry == 0) - return err; - - /* Set new upper seek boundary for central dir mem stream */ - disk_offset = mz_stream_tell(cd_mem_stream); - mz_stream_mem_set_buffer_limit(cd_mem_stream, (int32_t)disk_offset); - - /* Set new central directory info */ - mz_zip_set_cd_stream(handle, 0, cd_mem_stream); - mz_zip_set_number_entry(handle, number_entry); - mz_zip_set_disk_number_with_cd(handle, disk_number_with_cd); - - return MZ_OK; -} - -void *mz_zip_create(void **handle) { - mz_zip *zip = NULL; - - zip = (mz_zip *)calloc(1, sizeof(mz_zip)); - if (zip) - zip->data_descriptor = 1; - if (handle) - *handle = zip; - - return zip; -} - -void mz_zip_delete(void **handle) { - mz_zip *zip = NULL; - if (!handle) - return; - zip = (mz_zip *)*handle; - if (zip) { - free(zip); - } - *handle = NULL; -} - -int32_t mz_zip_open(void *handle, void *stream, int32_t mode) { - mz_zip *zip = (mz_zip *)handle; - int32_t err = MZ_OK; - - if (!zip) - return MZ_PARAM_ERROR; - - mz_zip_print("Zip - Open\n"); - - zip->stream = stream; - - mz_stream_mem_create(&zip->cd_mem_stream); - - if (mode & MZ_OPEN_MODE_WRITE) { - mz_stream_mem_open(zip->cd_mem_stream, NULL, MZ_OPEN_MODE_CREATE); - zip->cd_stream = zip->cd_mem_stream; - } else { - zip->cd_stream = stream; - } - - if ((mode & MZ_OPEN_MODE_READ) || (mode & MZ_OPEN_MODE_APPEND)) { - if ((mode & MZ_OPEN_MODE_CREATE) == 0) { - err = mz_zip_read_cd(zip); - if (err != MZ_OK) { - mz_zip_print("Zip - Error detected reading cd (%" PRId32 ")\n", err); - if (zip->recover && mz_zip_recover_cd(zip) == MZ_OK) - err = MZ_OK; - } - } - - if ((err == MZ_OK) && (mode & MZ_OPEN_MODE_APPEND)) { - if (zip->cd_size > 0) { - /* Store central directory in memory */ - err = mz_stream_seek(zip->stream, zip->cd_offset, MZ_SEEK_SET); - if (err == MZ_OK) - err = mz_stream_copy(zip->cd_mem_stream, zip->stream, (int32_t)zip->cd_size); - if (err == MZ_OK) - err = mz_stream_seek(zip->stream, zip->cd_offset, MZ_SEEK_SET); - } else { - if (zip->cd_signature == MZ_ZIP_MAGIC_ENDHEADER) { - /* If tiny zip then overwrite end header */ - err = mz_stream_seek(zip->stream, zip->cd_offset, MZ_SEEK_SET); - } else { - /* If no central directory, append new zip to end of file */ - err = mz_stream_seek(zip->stream, 0, MZ_SEEK_END); - } - } - - if (zip->disk_number_with_cd > 0) { - /* Move to last disk to begin appending */ - mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, zip->disk_number_with_cd - 1); - } - } else { - zip->cd_start_pos = zip->cd_offset; - } - } - - if (err != MZ_OK) { - mz_zip_close(zip); - return err; - } - - /* Memory streams used to store variable length file info data */ - mz_stream_mem_create(&zip->file_info_stream); - mz_stream_mem_open(zip->file_info_stream, NULL, MZ_OPEN_MODE_CREATE); - - mz_stream_mem_create(&zip->local_file_info_stream); - mz_stream_mem_open(zip->local_file_info_stream, NULL, MZ_OPEN_MODE_CREATE); - - zip->open_mode = mode; - - return err; -} - -int32_t mz_zip_close(void *handle) { - mz_zip *zip = (mz_zip *)handle; - int32_t err = MZ_OK; - - if (!zip) - return MZ_PARAM_ERROR; - - mz_zip_print("Zip - Close\n"); - - if (mz_zip_entry_is_open(handle) == MZ_OK) - err = mz_zip_entry_close(handle); - - if ((err == MZ_OK) && (zip->open_mode & MZ_OPEN_MODE_WRITE)) - err = mz_zip_write_cd(handle); - - if (zip->cd_mem_stream) { - mz_stream_close(zip->cd_mem_stream); - mz_stream_delete(&zip->cd_mem_stream); - } - - if (zip->file_info_stream) { - mz_stream_mem_close(zip->file_info_stream); - mz_stream_mem_delete(&zip->file_info_stream); - } - if (zip->local_file_info_stream) { - mz_stream_mem_close(zip->local_file_info_stream); - mz_stream_mem_delete(&zip->local_file_info_stream); - } - - if (zip->comment) { - free(zip->comment); - zip->comment = NULL; - } - - zip->stream = NULL; - zip->cd_stream = NULL; - - return err; -} - -int32_t mz_zip_get_comment(void *handle, const char **comment) { - mz_zip *zip = (mz_zip *)handle; - if (!zip || !comment) - return MZ_PARAM_ERROR; - if (!zip->comment) - return MZ_EXIST_ERROR; - *comment = zip->comment; - return MZ_OK; -} - -int32_t mz_zip_set_comment(void *handle, const char *comment) { - mz_zip *zip = (mz_zip *)handle; - int32_t comment_size = 0; - if (!zip || !comment) - return MZ_PARAM_ERROR; - if (zip->comment) - free(zip->comment); - comment_size = (int32_t)strlen(comment); - if (comment_size > UINT16_MAX) - return MZ_PARAM_ERROR; - zip->comment = (char *)calloc(comment_size + 1, sizeof(char)); - if (!zip->comment) - return MZ_MEM_ERROR; - strncpy(zip->comment, comment, comment_size); - return MZ_OK; -} - -int32_t mz_zip_get_version_madeby(void *handle, uint16_t *version_madeby) { - mz_zip *zip = (mz_zip *)handle; - if (!zip || !version_madeby) - return MZ_PARAM_ERROR; - *version_madeby = zip->version_madeby; - return MZ_OK; -} - -int32_t mz_zip_set_version_madeby(void *handle, uint16_t version_madeby) { - mz_zip *zip = (mz_zip *)handle; - if (!zip) - return MZ_PARAM_ERROR; - zip->version_madeby = version_madeby; - return MZ_OK; -} - -int32_t mz_zip_set_recover(void *handle, uint8_t recover) { - mz_zip *zip = (mz_zip *)handle; - if (!zip) - return MZ_PARAM_ERROR; - zip->recover = recover; - return MZ_OK; -} - -int32_t mz_zip_set_data_descriptor(void *handle, uint8_t data_descriptor) { - mz_zip *zip = (mz_zip *)handle; - if (!zip) - return MZ_PARAM_ERROR; - zip->data_descriptor = data_descriptor; - return MZ_OK; -} - -int32_t mz_zip_get_stream(void *handle, void **stream) { - mz_zip *zip = (mz_zip *)handle; - if (!zip || !stream) - return MZ_PARAM_ERROR; - *stream = zip->stream; - if (!*stream) - return MZ_EXIST_ERROR; - return MZ_OK; -} - -int32_t mz_zip_set_cd_stream(void *handle, int64_t cd_start_pos, void *cd_stream) { - mz_zip *zip = (mz_zip *)handle; - if (!zip || !cd_stream) - return MZ_PARAM_ERROR; - zip->cd_offset = 0; - zip->cd_stream = cd_stream; - zip->cd_start_pos = cd_start_pos; - return MZ_OK; -} - -int32_t mz_zip_get_cd_mem_stream(void *handle, void **cd_mem_stream) { - mz_zip *zip = (mz_zip *)handle; - if (!zip || !cd_mem_stream) - return MZ_PARAM_ERROR; - *cd_mem_stream = zip->cd_mem_stream; - if (!*cd_mem_stream) - return MZ_EXIST_ERROR; - return MZ_OK; -} - -int32_t mz_zip_set_number_entry(void *handle, uint64_t number_entry) { - mz_zip *zip = (mz_zip *)handle; - if (!zip) - return MZ_PARAM_ERROR; - zip->number_entry = number_entry; - return MZ_OK; -} - -int32_t mz_zip_get_number_entry(void *handle, uint64_t *number_entry) { - mz_zip *zip = (mz_zip *)handle; - if (!zip || !number_entry) - return MZ_PARAM_ERROR; - *number_entry = zip->number_entry; - return MZ_OK; -} - -int32_t mz_zip_set_disk_number_with_cd(void *handle, uint32_t disk_number_with_cd) { - mz_zip *zip = (mz_zip *)handle; - if (!zip) - return MZ_PARAM_ERROR; - zip->disk_number_with_cd = disk_number_with_cd; - return MZ_OK; -} - -int32_t mz_zip_get_disk_number_with_cd(void *handle, uint32_t *disk_number_with_cd) { - mz_zip *zip = (mz_zip *)handle; - if (!zip || !disk_number_with_cd) - return MZ_PARAM_ERROR; - *disk_number_with_cd = zip->disk_number_with_cd; - return MZ_OK; -} - -static int32_t mz_zip_entry_close_int(void *handle) { - mz_zip *zip = (mz_zip *)handle; - - if (zip->crypt_stream) - mz_stream_delete(&zip->crypt_stream); - zip->crypt_stream = NULL; - if (zip->compress_stream) - mz_stream_delete(&zip->compress_stream); - zip->compress_stream = NULL; - - zip->entry_opened = 0; - - return MZ_OK; -} - -static int32_t mz_zip_entry_open_int(void *handle, uint8_t raw, int16_t compress_level, const char *password) { - mz_zip *zip = (mz_zip *)handle; - int64_t max_total_in = 0; - int64_t header_size = 0; - int64_t footer_size = 0; - int32_t err = MZ_OK; - uint8_t use_crypt = 0; - - if (!zip) - return MZ_PARAM_ERROR; - - switch (zip->file_info.compression_method) { - case MZ_COMPRESS_METHOD_STORE: - case MZ_COMPRESS_METHOD_DEFLATE: -#ifdef HAVE_BZIP2 - case MZ_COMPRESS_METHOD_BZIP2: -#endif -#ifdef HAVE_LZMA - case MZ_COMPRESS_METHOD_LZMA: -#endif -#if defined(HAVE_LZMA) || defined(HAVE_LIBCOMP) - case MZ_COMPRESS_METHOD_XZ: -#endif -#ifdef HAVE_ZSTD - case MZ_COMPRESS_METHOD_ZSTD: -#endif - err = MZ_OK; - break; - default: - return MZ_SUPPORT_ERROR; - } - -#ifndef HAVE_WZAES - if (zip->file_info.aes_version) - return MZ_SUPPORT_ERROR; -#endif - - zip->entry_raw = raw; - - if ((zip->file_info.flag & MZ_ZIP_FLAG_ENCRYPTED) && (password)) { - if (zip->open_mode & MZ_OPEN_MODE_WRITE) { - /* Encrypt only when we are not trying to write raw and password is supplied. */ - if (!zip->entry_raw) - use_crypt = 1; - } else if (zip->open_mode & MZ_OPEN_MODE_READ) { - /* Decrypt only when password is supplied. Don't error when password */ - /* is not supplied as we may want to read the raw encrypted data. */ - use_crypt = 1; - } - } - - if ((err == MZ_OK) && (use_crypt)) { -#ifdef HAVE_WZAES - if (zip->file_info.aes_version) { - mz_stream_wzaes_create(&zip->crypt_stream); - mz_stream_wzaes_set_password(zip->crypt_stream, password); - mz_stream_wzaes_set_encryption_mode(zip->crypt_stream, zip->file_info.aes_encryption_mode); - } else -#endif - { -#ifdef HAVE_PKCRYPT - uint8_t verify1 = (uint8_t)((zip->file_info.pk_verify >> 8) & 0xff); - uint8_t verify2 = (uint8_t)((zip->file_info.pk_verify) & 0xff); - - mz_stream_pkcrypt_create(&zip->crypt_stream); - mz_stream_pkcrypt_set_password(zip->crypt_stream, password); - mz_stream_pkcrypt_set_verify(zip->crypt_stream, verify1, verify2); -#endif - } - } - - if (err == MZ_OK) { - if (!zip->crypt_stream) - mz_stream_raw_create(&zip->crypt_stream); - - mz_stream_set_base(zip->crypt_stream, zip->stream); - - err = mz_stream_open(zip->crypt_stream, NULL, zip->open_mode); - } - - if (err == MZ_OK) { - if (zip->entry_raw || zip->file_info.compression_method == MZ_COMPRESS_METHOD_STORE) - mz_stream_raw_create(&zip->compress_stream); -#ifdef HAVE_ZLIB - else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_DEFLATE) - mz_stream_zlib_create(&zip->compress_stream); -#endif -#ifdef HAVE_BZIP2 - else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_BZIP2) - mz_stream_bzip_create(&zip->compress_stream); -#endif -#ifdef HAVE_LIBCOMP - else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_DEFLATE || - zip->file_info.compression_method == MZ_COMPRESS_METHOD_XZ) { - mz_stream_libcomp_create(&zip->compress_stream); - mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_COMPRESS_METHOD, - zip->file_info.compression_method); - } -#endif -#ifdef HAVE_LZMA - else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_LZMA || - zip->file_info.compression_method == MZ_COMPRESS_METHOD_XZ) { - mz_stream_lzma_create(&zip->compress_stream); - mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_COMPRESS_METHOD, - zip->file_info.compression_method); - } -#endif -#ifdef HAVE_ZSTD - else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_ZSTD) - mz_stream_zstd_create(&zip->compress_stream); -#endif - else - err = MZ_PARAM_ERROR; - } - - if (err == MZ_OK) { - if (zip->open_mode & MZ_OPEN_MODE_WRITE) { - mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_COMPRESS_LEVEL, compress_level); - } else { - int32_t set_end_of_stream = 0; - -#ifndef HAVE_LIBCOMP - if (zip->entry_raw || - zip->file_info.compression_method == MZ_COMPRESS_METHOD_STORE || - zip->file_info.flag & MZ_ZIP_FLAG_ENCRYPTED) -#endif - { - max_total_in = zip->file_info.compressed_size; - mz_stream_set_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_TOTAL_IN_MAX, max_total_in); - - if (mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_HEADER_SIZE, &header_size) == MZ_OK) - max_total_in -= header_size; - if (mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_FOOTER_SIZE, &footer_size) == MZ_OK) - max_total_in -= footer_size; - - mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_IN_MAX, max_total_in); - } - - switch (zip->file_info.compression_method) { - case MZ_COMPRESS_METHOD_LZMA: - case MZ_COMPRESS_METHOD_XZ: - set_end_of_stream = (zip->file_info.flag & MZ_ZIP_FLAG_LZMA_EOS_MARKER); - break; - case MZ_COMPRESS_METHOD_ZSTD: - set_end_of_stream = 1; - break; - } - - if (set_end_of_stream) { - mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_IN_MAX, zip->file_info.compressed_size); - mz_stream_set_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_OUT_MAX, zip->file_info.uncompressed_size); - } - } - - mz_stream_set_base(zip->compress_stream, zip->crypt_stream); - - err = mz_stream_open(zip->compress_stream, NULL, zip->open_mode); - } - - if (err == MZ_OK) { - zip->entry_opened = 1; - zip->entry_crc32 = 0; - } else { - mz_zip_entry_close_int(handle); - } - - return err; -} - -int32_t mz_zip_entry_is_open(void *handle) { - mz_zip *zip = (mz_zip *)handle; - if (!zip) - return MZ_PARAM_ERROR; - if (zip->entry_opened == 0) - return MZ_EXIST_ERROR; - return MZ_OK; -} - -int32_t mz_zip_entry_read_open(void *handle, uint8_t raw, const char *password) { - mz_zip *zip = (mz_zip *)handle; - int32_t err = MZ_OK; - int32_t err_shift = MZ_OK; - -#if defined(MZ_ZIP_NO_ENCRYPTION) - if (password) - return MZ_SUPPORT_ERROR; -#endif - if (!zip || !zip->entry_scanned) - return MZ_PARAM_ERROR; - if ((zip->open_mode & MZ_OPEN_MODE_READ) == 0) - return MZ_PARAM_ERROR; - - mz_zip_print("Zip - Entry - Read open (raw %" PRId32 ")\n", raw); - - err = mz_zip_entry_seek_local_header(handle); - if (err == MZ_OK) - err = mz_zip_entry_read_header(zip->stream, 1, &zip->local_file_info, zip->local_file_info_stream); - - if (err == MZ_FORMAT_ERROR && zip->disk_offset_shift > 0) { - /* Perhaps we didn't compensated correctly for incorrect cd offset */ - err_shift = mz_stream_seek(zip->stream, zip->file_info.disk_offset, MZ_SEEK_SET); - if (err_shift == MZ_OK) - err_shift = mz_zip_entry_read_header(zip->stream, 1, &zip->local_file_info, zip->local_file_info_stream); - if (err_shift == MZ_OK) { - zip->disk_offset_shift = 0; - err = err_shift; - } - } - -#ifdef MZ_ZIP_NO_DECOMPRESSION - if (!raw && zip->file_info.compression_method != MZ_COMPRESS_METHOD_STORE) - err = MZ_SUPPORT_ERROR; -#endif - if (err == MZ_OK) - err = mz_zip_entry_open_int(handle, raw, 0, password); - - return err; -} - -int32_t mz_zip_entry_write_open(void *handle, const mz_zip_file *file_info, int16_t compress_level, uint8_t raw, const char *password) { - mz_zip *zip = (mz_zip *)handle; - int64_t filename_pos = -1; - int64_t extrafield_pos = 0; - int64_t comment_pos = 0; - int64_t linkname_pos = 0; - int64_t disk_number = 0; - uint8_t is_dir = 0; - int32_t err = MZ_OK; - -#if defined(MZ_ZIP_NO_ENCRYPTION) - if (password) - return MZ_SUPPORT_ERROR; -#endif - if (!zip || !file_info || !file_info->filename) - return MZ_PARAM_ERROR; - - if (mz_zip_entry_is_open(handle) == MZ_OK) { - err = mz_zip_entry_close(handle); - if (err != MZ_OK) - return err; - } - - memcpy(&zip->file_info, file_info, sizeof(mz_zip_file)); - - mz_zip_print("Zip - Entry - Write open - %s (level %" PRId16 " raw %" PRId8 ")\n", - zip->file_info.filename, compress_level, raw); - - mz_stream_seek(zip->file_info_stream, 0, MZ_SEEK_SET); - mz_stream_write(zip->file_info_stream, file_info, sizeof(mz_zip_file)); - - /* Copy filename, extrafield, and comment internally */ - filename_pos = mz_stream_tell(zip->file_info_stream); - if (file_info->filename) - mz_stream_write(zip->file_info_stream, file_info->filename, (int32_t)strlen(file_info->filename)); - mz_stream_write_uint8(zip->file_info_stream, 0); - - extrafield_pos = mz_stream_tell(zip->file_info_stream); - if (file_info->extrafield) - mz_stream_write(zip->file_info_stream, file_info->extrafield, file_info->extrafield_size); - mz_stream_write_uint8(zip->file_info_stream, 0); - - comment_pos = mz_stream_tell(zip->file_info_stream); - if (file_info->comment) - mz_stream_write(zip->file_info_stream, file_info->comment, file_info->comment_size); - mz_stream_write_uint8(zip->file_info_stream, 0); - - linkname_pos = mz_stream_tell(zip->file_info_stream); - if (file_info->linkname) - mz_stream_write(zip->file_info_stream, file_info->linkname, (int32_t)strlen(file_info->linkname)); - mz_stream_write_uint8(zip->file_info_stream, 0); - - mz_stream_mem_get_buffer_at(zip->file_info_stream, filename_pos, (const void **)&zip->file_info.filename); - mz_stream_mem_get_buffer_at(zip->file_info_stream, extrafield_pos, (const void **)&zip->file_info.extrafield); - mz_stream_mem_get_buffer_at(zip->file_info_stream, comment_pos, (const void **)&zip->file_info.comment); - mz_stream_mem_get_buffer_at(zip->file_info_stream, linkname_pos, (const void **)&zip->file_info.linkname); - - if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_DEFLATE) { - if ((compress_level == 8) || (compress_level == 9)) - zip->file_info.flag |= MZ_ZIP_FLAG_DEFLATE_MAX; - if (compress_level == 2) - zip->file_info.flag |= MZ_ZIP_FLAG_DEFLATE_FAST; - if (compress_level == 1) - zip->file_info.flag |= MZ_ZIP_FLAG_DEFLATE_SUPER_FAST; - } -#if defined(HAVE_LZMA) || defined(HAVE_LIBCOMP) - else if (zip->file_info.compression_method == MZ_COMPRESS_METHOD_LZMA || - zip->file_info.compression_method == MZ_COMPRESS_METHOD_XZ) - zip->file_info.flag |= MZ_ZIP_FLAG_LZMA_EOS_MARKER; -#endif - - if (mz_zip_attrib_is_dir(zip->file_info.external_fa, zip->file_info.version_madeby) == MZ_OK) - is_dir = 1; - - if (!is_dir) { - if (zip->data_descriptor) - zip->file_info.flag |= MZ_ZIP_FLAG_DATA_DESCRIPTOR; - if (password) - zip->file_info.flag |= MZ_ZIP_FLAG_ENCRYPTED; - } - - mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, &disk_number); - zip->file_info.disk_number = (uint32_t)disk_number; - zip->file_info.disk_offset = mz_stream_tell(zip->stream); - - if (zip->file_info.flag & MZ_ZIP_FLAG_ENCRYPTED) { -#ifdef HAVE_PKCRYPT - /* Pre-calculated CRC value is required for PKWARE traditional encryption */ - uint32_t dos_date = mz_zip_time_t_to_dos_date(zip->file_info.modified_date); - zip->file_info.pk_verify = mz_zip_get_pk_verify(dos_date, zip->file_info.crc, zip->file_info.flag); -#endif -#ifdef HAVE_WZAES - if (zip->file_info.aes_version && zip->file_info.aes_encryption_mode == 0) - zip->file_info.aes_encryption_mode = MZ_AES_ENCRYPTION_MODE_256; -#endif - } - - zip->file_info.crc = 0; - zip->file_info.compressed_size = 0; - - if ((compress_level == 0) || (is_dir)) - zip->file_info.compression_method = MZ_COMPRESS_METHOD_STORE; - -#ifdef MZ_ZIP_NO_COMPRESSION - if (zip->file_info.compression_method != MZ_COMPRESS_METHOD_STORE) - err = MZ_SUPPORT_ERROR; -#endif - if (err == MZ_OK) - err = mz_zip_entry_write_header(zip->stream, 1, &zip->file_info); - if (err == MZ_OK) - err = mz_zip_entry_open_int(handle, raw, compress_level, password); - - return err; -} - -int32_t mz_zip_entry_read(void *handle, void *buf, int32_t len) { - mz_zip *zip = (mz_zip *)handle; - int32_t read = 0; - - if (!zip || mz_zip_entry_is_open(handle) != MZ_OK) - return MZ_PARAM_ERROR; - if (UINT_MAX == UINT16_MAX && len > UINT16_MAX) /* zlib limitation */ - return MZ_PARAM_ERROR; - if (len == 0) - return MZ_PARAM_ERROR; - - if (zip->file_info.compressed_size == 0) - return 0; - - /* Read entire entry even if uncompressed_size = 0, otherwise */ - /* aes encryption validation will fail if compressed_size > 0 */ - read = mz_stream_read(zip->compress_stream, buf, len); - if (read > 0) - zip->entry_crc32 = mz_crypt_crc32_update(zip->entry_crc32, buf, read); - - mz_zip_print("Zip - Entry - Read - %" PRId32 " (max %" PRId32 ")\n", read, len); - - return read; -} - -int32_t mz_zip_entry_write(void *handle, const void *buf, int32_t len) { - mz_zip *zip = (mz_zip *)handle; - int32_t written = 0; - - if (!zip || mz_zip_entry_is_open(handle) != MZ_OK) - return MZ_PARAM_ERROR; - written = mz_stream_write(zip->compress_stream, buf, len); - if (written > 0) - zip->entry_crc32 = mz_crypt_crc32_update(zip->entry_crc32, buf, written); - - mz_zip_print("Zip - Entry - Write - %" PRId32 " (max %" PRId32 ")\n", written, len); - - return written; -} - -int32_t mz_zip_entry_read_close(void *handle, uint32_t *crc32, int64_t *compressed_size, - int64_t *uncompressed_size) { - mz_zip *zip = (mz_zip *)handle; - int64_t total_in = 0; - int32_t err = MZ_OK; - uint8_t zip64 = 0; - - if (!zip || mz_zip_entry_is_open(handle) != MZ_OK) - return MZ_PARAM_ERROR; - - mz_stream_close(zip->compress_stream); - - mz_zip_print("Zip - Entry - Read Close\n"); - - if (crc32) - *crc32 = zip->file_info.crc; - if (compressed_size) - *compressed_size = zip->file_info.compressed_size; - if (uncompressed_size) - *uncompressed_size = zip->file_info.uncompressed_size; - - mz_stream_get_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_IN, &total_in); - - if ((zip->file_info.flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR) && - ((zip->file_info.flag & MZ_ZIP_FLAG_MASK_LOCAL_INFO) == 0) && - (crc32 || compressed_size || uncompressed_size)) { - /* Check to see if data descriptor is zip64 bit format or not */ - if (mz_zip_extrafield_contains(zip->local_file_info.extrafield, - zip->local_file_info.extrafield_size, MZ_ZIP_EXTENSION_ZIP64, NULL) == MZ_OK) - zip64 = 1; - - err = mz_zip_entry_seek_local_header(handle); - - /* Seek to end of compressed stream since we might have over-read during compression */ - if (err == MZ_OK) - err = mz_stream_seek(zip->stream, MZ_ZIP_SIZE_LD_ITEM + - (int64_t)zip->local_file_info.filename_size + - (int64_t)zip->local_file_info.extrafield_size + - total_in, MZ_SEEK_CUR); - - /* Read data descriptor */ - if (err == MZ_OK) - err = mz_zip_entry_read_descriptor(zip->stream, zip64, - crc32, compressed_size, uncompressed_size); - } - - /* If entire entry was not read verification will fail */ - if ((err == MZ_OK) && (total_in == zip->file_info.compressed_size) && (!zip->entry_raw)) { -#ifdef HAVE_WZAES - /* AES zip version AE-1 will expect a valid crc as well */ - if (zip->file_info.aes_version <= 0x0001) -#endif - { - if (zip->entry_crc32 != zip->file_info.crc) { - mz_zip_print("Zip - Entry - Crc failed (actual 0x%08" PRIx32 " expected 0x%08" PRIx32 ")\n", - zip->entry_crc32, zip->file_info.crc); - - err = MZ_CRC_ERROR; - } - } - } - - mz_zip_entry_close_int(handle); - - return err; -} - -int32_t mz_zip_entry_write_close(void *handle, uint32_t crc32, int64_t compressed_size, - int64_t uncompressed_size) { - mz_zip *zip = (mz_zip *)handle; - int64_t end_disk_number = 0; - int32_t err = MZ_OK; - uint8_t zip64 = 0; - - if (!zip || mz_zip_entry_is_open(handle) != MZ_OK) - return MZ_PARAM_ERROR; - - mz_stream_close(zip->compress_stream); - - if (!zip->entry_raw) - crc32 = zip->entry_crc32; - - mz_zip_print("Zip - Entry - Write Close (crc 0x%08" PRIx32 " cs %" PRId64 " ucs %" PRId64 ")\n", - crc32, compressed_size, uncompressed_size); - - /* If sizes are not set, then read them from the compression stream */ - if (compressed_size < 0) - mz_stream_get_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_OUT, &compressed_size); - if (uncompressed_size < 0) - mz_stream_get_prop_int64(zip->compress_stream, MZ_STREAM_PROP_TOTAL_IN, &uncompressed_size); - - if (zip->file_info.flag & MZ_ZIP_FLAG_ENCRYPTED) { - mz_stream_set_base(zip->crypt_stream, zip->stream); - err = mz_stream_close(zip->crypt_stream); - - mz_stream_get_prop_int64(zip->crypt_stream, MZ_STREAM_PROP_TOTAL_OUT, &compressed_size); - } - - mz_zip_entry_needs_zip64(&zip->file_info, 1, &zip64); - - if ((err == MZ_OK) && (zip->file_info.flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR)) { - /* Determine if we need to write data descriptor in zip64 format, - if local extrafield was saved with zip64 extrafield */ - - if (zip->file_info.flag & MZ_ZIP_FLAG_MASK_LOCAL_INFO) - err = mz_zip_entry_write_descriptor(zip->stream, - zip64, 0, compressed_size, 0); - else - err = mz_zip_entry_write_descriptor(zip->stream, - zip64, crc32, compressed_size, uncompressed_size); - } - - /* Write file info to central directory */ - - mz_zip_print("Zip - Entry - Write cd (ucs %" PRId64 " cs %" PRId64 " crc 0x%08" PRIx32 ")\n", - uncompressed_size, compressed_size, crc32); - - zip->file_info.crc = crc32; - zip->file_info.compressed_size = compressed_size; - zip->file_info.uncompressed_size = uncompressed_size; - - if (err == MZ_OK) - err = mz_zip_entry_write_header(zip->cd_mem_stream, 0, &zip->file_info); - - /* Update local header with crc32 and sizes */ - if ((err == MZ_OK) && ((zip->file_info.flag & MZ_ZIP_FLAG_DATA_DESCRIPTOR) == 0) && - ((zip->file_info.flag & MZ_ZIP_FLAG_MASK_LOCAL_INFO) == 0)) { - /* Save the disk number and position we are to seek back after updating local header */ - int64_t end_pos = mz_stream_tell(zip->stream); - mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, &end_disk_number); - - err = mz_zip_entry_seek_local_header(handle); - - if (err == MZ_OK) { - /* Seek to crc32 and sizes offset in local header */ - err = mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, zip->file_info.disk_number); - if (err == MZ_OK) - err = mz_stream_seek(zip->stream, zip->file_info.disk_offset + MZ_ZIP_OFFSET_CRC_SIZES, MZ_SEEK_SET); - } - - if (err == MZ_OK) - err = mz_zip_entry_write_crc_sizes(zip->stream, zip64, 0, &zip->file_info); - - /* Seek to and update zip64 extension sizes */ - if ((err == MZ_OK) && (zip64)) { - int64_t filename_size = zip->file_info.filename_size; - - if (filename_size == 0) - filename_size = strlen(zip->file_info.filename); - - /* Since we write zip64 extension first we know its offset */ - err = mz_stream_seek(zip->stream, 2 + 2 + filename_size + 4, MZ_SEEK_CUR); - - if (err == MZ_OK) - err = mz_stream_write_uint64(zip->stream, zip->file_info.uncompressed_size); - if (err == MZ_OK) - err = mz_stream_write_uint64(zip->stream, zip->file_info.compressed_size); - } - - mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, end_disk_number); - mz_stream_seek(zip->stream, end_pos, MZ_SEEK_SET); - } - - zip->number_entry += 1; - - mz_zip_entry_close_int(handle); - - return err; -} - -int32_t mz_zip_entry_seek_local_header(void *handle) { - mz_zip *zip = (mz_zip *)handle; - int64_t disk_size = 0; - uint32_t disk_number = zip->file_info.disk_number; - - if (disk_number == zip->disk_number_with_cd) { - mz_stream_get_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_SIZE, &disk_size); - if ((disk_size == 0) || ((zip->open_mode & MZ_OPEN_MODE_WRITE) == 0)) - disk_number = (uint32_t)-1; - } - - mz_stream_set_prop_int64(zip->stream, MZ_STREAM_PROP_DISK_NUMBER, disk_number); - - mz_zip_print("Zip - Entry - Seek local (disk %" PRId32 " offset %" PRId64 ")\n", - disk_number, zip->file_info.disk_offset); - - /* Guard against seek overflows */ - if ((zip->disk_offset_shift > 0) && - (zip->file_info.disk_offset > (INT64_MAX - zip->disk_offset_shift))) - return MZ_FORMAT_ERROR; - - return mz_stream_seek(zip->stream, zip->file_info.disk_offset + zip->disk_offset_shift, MZ_SEEK_SET); -} - -int32_t mz_zip_entry_get_compress_stream(void *handle, void **compress_stream) { - mz_zip *zip = (mz_zip *)handle; - if (!zip || !compress_stream) - return MZ_PARAM_ERROR; - *compress_stream = zip->compress_stream; - if (!*compress_stream) - return MZ_EXIST_ERROR; - return MZ_OK; -} - -int32_t mz_zip_entry_close(void *handle) { - return mz_zip_entry_close_raw(handle, UINT64_MAX, 0); -} - -int32_t mz_zip_entry_close_raw(void *handle, int64_t uncompressed_size, uint32_t crc32) { - mz_zip *zip = (mz_zip *)handle; - int32_t err = MZ_OK; - - if (!zip || mz_zip_entry_is_open(handle) != MZ_OK) - return MZ_PARAM_ERROR; - - if (zip->open_mode & MZ_OPEN_MODE_WRITE) - err = mz_zip_entry_write_close(handle, crc32, UINT64_MAX, uncompressed_size); - else - err = mz_zip_entry_read_close(handle, NULL, NULL, NULL); - - return err; -} - -int32_t mz_zip_entry_is_dir(void *handle) { - mz_zip *zip = (mz_zip *)handle; - int32_t filename_length = 0; - - if (!zip || !zip->entry_scanned) - return MZ_PARAM_ERROR; - if (mz_zip_attrib_is_dir(zip->file_info.external_fa, zip->file_info.version_madeby) == MZ_OK) - return MZ_OK; - - filename_length = (int32_t)strlen(zip->file_info.filename); - if (filename_length > 0) { - if ((zip->file_info.filename[filename_length - 1] == '/') || - (zip->file_info.filename[filename_length - 1] == '\\')) - return MZ_OK; - } - return MZ_EXIST_ERROR; -} - -int32_t mz_zip_entry_is_symlink(void *handle) { - mz_zip *zip = (mz_zip *)handle; - - if (!zip || !zip->entry_scanned) - return MZ_PARAM_ERROR; - if (mz_zip_attrib_is_symlink(zip->file_info.external_fa, zip->file_info.version_madeby) != MZ_OK) - return MZ_EXIST_ERROR; - - return MZ_OK; -} - -int32_t mz_zip_entry_get_info(void *handle, mz_zip_file **file_info) { - mz_zip *zip = (mz_zip *)handle; - - if (!zip) - return MZ_PARAM_ERROR; - - if ((zip->open_mode & MZ_OPEN_MODE_WRITE) == 0) { - if (!zip->entry_scanned) - return MZ_PARAM_ERROR; - } - - *file_info = &zip->file_info; - return MZ_OK; -} - -int32_t mz_zip_entry_get_local_info(void *handle, mz_zip_file **local_file_info) { - mz_zip *zip = (mz_zip *)handle; - if (!zip || mz_zip_entry_is_open(handle) != MZ_OK) - return MZ_PARAM_ERROR; - *local_file_info = &zip->local_file_info; - return MZ_OK; -} - -int32_t mz_zip_entry_set_extrafield(void *handle, const uint8_t *extrafield, uint16_t extrafield_size) { - mz_zip *zip = (mz_zip *)handle; - - if (!zip || mz_zip_entry_is_open(handle) != MZ_OK) - return MZ_PARAM_ERROR; - - zip->file_info.extrafield = extrafield; - zip->file_info.extrafield_size = extrafield_size; - return MZ_OK; -} - -static int32_t mz_zip_goto_next_entry_int(void *handle) { - mz_zip *zip = (mz_zip *)handle; - int32_t err = MZ_OK; - - if (!zip) - return MZ_PARAM_ERROR; - - zip->entry_scanned = 0; - - mz_stream_set_prop_int64(zip->cd_stream, MZ_STREAM_PROP_DISK_NUMBER, -1); - - err = mz_stream_seek(zip->cd_stream, zip->cd_current_pos, MZ_SEEK_SET); - if (err == MZ_OK) - err = mz_zip_entry_read_header(zip->cd_stream, 0, &zip->file_info, zip->file_info_stream); - if (err == MZ_OK) - zip->entry_scanned = 1; - return err; -} - -int64_t mz_zip_get_entry(void *handle) { - mz_zip *zip = (mz_zip *)handle; - - if (!zip) - return MZ_PARAM_ERROR; - - return zip->cd_current_pos; -} - -int32_t mz_zip_goto_entry(void *handle, int64_t cd_pos) { - mz_zip *zip = (mz_zip *)handle; - - if (!zip) - return MZ_PARAM_ERROR; - - if (cd_pos < zip->cd_start_pos || cd_pos > zip->cd_start_pos + zip->cd_size) - return MZ_PARAM_ERROR; - - zip->cd_current_pos = cd_pos; - - return mz_zip_goto_next_entry_int(handle); -} - -int32_t mz_zip_goto_first_entry(void *handle) { - mz_zip *zip = (mz_zip *)handle; - - if (!zip) - return MZ_PARAM_ERROR; - - zip->cd_current_pos = zip->cd_start_pos; - - return mz_zip_goto_next_entry_int(handle); -} - -int32_t mz_zip_goto_next_entry(void *handle) { - mz_zip *zip = (mz_zip *)handle; - - if (!zip) - return MZ_PARAM_ERROR; - - zip->cd_current_pos += (int64_t)MZ_ZIP_SIZE_CD_ITEM + zip->file_info.filename_size + - zip->file_info.extrafield_size + zip->file_info.comment_size; - - return mz_zip_goto_next_entry_int(handle); -} - -int32_t mz_zip_locate_entry(void *handle, const char *filename, uint8_t ignore_case) { - mz_zip *zip = (mz_zip *)handle; - int32_t err = MZ_OK; - int32_t result = 0; - - if (!zip || !filename) - return MZ_PARAM_ERROR; - - /* If we are already on the current entry, no need to search */ - if (zip->entry_scanned && zip->file_info.filename) { - result = mz_zip_path_compare(zip->file_info.filename, filename, ignore_case); - if (result == 0) - return MZ_OK; - } - - /* Search all entries starting at the first */ - err = mz_zip_goto_first_entry(handle); - while (err == MZ_OK) { - result = mz_zip_path_compare(zip->file_info.filename, filename, ignore_case); - if (result == 0) - return MZ_OK; - - err = mz_zip_goto_next_entry(handle); - } - - return err; -} - -int32_t mz_zip_locate_first_entry(void *handle, void *userdata, mz_zip_locate_entry_cb cb) { - mz_zip *zip = (mz_zip *)handle; - int32_t err = MZ_OK; - int32_t result = 0; - - /* Search first entry looking for match */ - err = mz_zip_goto_first_entry(handle); - if (err != MZ_OK) - return err; - - result = cb(handle, userdata, &zip->file_info); - if (result == 0) - return MZ_OK; - - return mz_zip_locate_next_entry(handle, userdata, cb); -} - -int32_t mz_zip_locate_next_entry(void *handle, void *userdata, mz_zip_locate_entry_cb cb) { - mz_zip *zip = (mz_zip *)handle; - int32_t err = MZ_OK; - int32_t result = 0; - - /* Search next entries looking for match */ - err = mz_zip_goto_next_entry(handle); - while (err == MZ_OK) { - result = cb(handle, userdata, &zip->file_info); - if (result == 0) - return MZ_OK; - - err = mz_zip_goto_next_entry(handle); - } - - return err; -} - -/***************************************************************************/ - -int32_t mz_zip_attrib_is_dir(uint32_t attrib, int32_t version_madeby) { - uint32_t posix_attrib = 0; - uint8_t system = MZ_HOST_SYSTEM(version_madeby); - int32_t err = MZ_OK; - - err = mz_zip_attrib_convert(system, attrib, MZ_HOST_SYSTEM_UNIX, &posix_attrib); - if (err == MZ_OK) { - if ((posix_attrib & 0170000) == 0040000) /* S_ISDIR */ - return MZ_OK; - } - - return MZ_EXIST_ERROR; -} - -int32_t mz_zip_attrib_is_symlink(uint32_t attrib, int32_t version_madeby) { - uint32_t posix_attrib = 0; - uint8_t system = MZ_HOST_SYSTEM(version_madeby); - int32_t err = MZ_OK; - - err = mz_zip_attrib_convert(system, attrib, MZ_HOST_SYSTEM_UNIX, &posix_attrib); - if (err == MZ_OK) { - if ((posix_attrib & 0170000) == 0120000) /* S_ISLNK */ - return MZ_OK; - } - - return MZ_EXIST_ERROR; -} - -int32_t mz_zip_attrib_convert(uint8_t src_sys, uint32_t src_attrib, uint8_t target_sys, uint32_t *target_attrib) { - if (!target_attrib) - return MZ_PARAM_ERROR; - - *target_attrib = 0; - - if ((src_sys == MZ_HOST_SYSTEM_MSDOS) || (src_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS)) { - if ((target_sys == MZ_HOST_SYSTEM_MSDOS) || (target_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS)) { - *target_attrib = src_attrib; - return MZ_OK; - } - if ((target_sys == MZ_HOST_SYSTEM_UNIX) || (target_sys == MZ_HOST_SYSTEM_OSX_DARWIN) || (target_sys == MZ_HOST_SYSTEM_RISCOS)) - return mz_zip_attrib_win32_to_posix(src_attrib, target_attrib); - } else if ((src_sys == MZ_HOST_SYSTEM_UNIX) || (src_sys == MZ_HOST_SYSTEM_OSX_DARWIN) || (src_sys == MZ_HOST_SYSTEM_RISCOS)) { - /* If high bytes are set, it contains unix specific attributes */ - if ((src_attrib >> 16) != 0) - src_attrib >>= 16; - - if ((target_sys == MZ_HOST_SYSTEM_UNIX) || (target_sys == MZ_HOST_SYSTEM_OSX_DARWIN) || (target_sys == MZ_HOST_SYSTEM_RISCOS)) { - *target_attrib = src_attrib; - return MZ_OK; - } - if ((target_sys == MZ_HOST_SYSTEM_MSDOS) || (target_sys == MZ_HOST_SYSTEM_WINDOWS_NTFS)) - return mz_zip_attrib_posix_to_win32(src_attrib, target_attrib); - } - - return MZ_SUPPORT_ERROR; -} - -int32_t mz_zip_attrib_posix_to_win32(uint32_t posix_attrib, uint32_t *win32_attrib) { - if (!win32_attrib) - return MZ_PARAM_ERROR; - - *win32_attrib = 0; - - /* S_IWUSR | S_IWGRP | S_IWOTH | S_IXUSR | S_IXGRP | S_IXOTH */ - if ((posix_attrib & 0000333) == 0 && (posix_attrib & 0000444) != 0) - *win32_attrib |= 0x01; /* FILE_ATTRIBUTE_READONLY */ - /* S_IFLNK */ - if ((posix_attrib & 0170000) == 0120000) - *win32_attrib |= 0x400; /* FILE_ATTRIBUTE_REPARSE_POINT */ - /* S_IFDIR */ - else if ((posix_attrib & 0170000) == 0040000) - *win32_attrib |= 0x10; /* FILE_ATTRIBUTE_DIRECTORY */ - /* S_IFREG */ - else - *win32_attrib |= 0x80; /* FILE_ATTRIBUTE_NORMAL */ - - return MZ_OK; -} - -int32_t mz_zip_attrib_win32_to_posix(uint32_t win32_attrib, uint32_t *posix_attrib) { - if (!posix_attrib) - return MZ_PARAM_ERROR; - - *posix_attrib = 0000444; /* S_IRUSR | S_IRGRP | S_IROTH */ - /* FILE_ATTRIBUTE_READONLY */ - if ((win32_attrib & 0x01) == 0) - *posix_attrib |= 0000222; /* S_IWUSR | S_IWGRP | S_IWOTH */ - /* FILE_ATTRIBUTE_REPARSE_POINT */ - if ((win32_attrib & 0x400) == 0x400) - *posix_attrib |= 0120000; /* S_IFLNK */ - /* FILE_ATTRIBUTE_DIRECTORY */ - else if ((win32_attrib & 0x10) == 0x10) - *posix_attrib |= 0040111; /* S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH */ - else - *posix_attrib |= 0100000; /* S_IFREG */ - - return MZ_OK; -} - -/***************************************************************************/ - -int32_t mz_zip_extrafield_find(void *stream, uint16_t type, int32_t max_seek, uint16_t *length) { - int32_t err = MZ_OK; - uint16_t field_type = 0; - uint16_t field_length = 0; - - if (max_seek < 4) - return MZ_EXIST_ERROR; - - do { - err = mz_stream_read_uint16(stream, &field_type); - if (err == MZ_OK) - err = mz_stream_read_uint16(stream, &field_length); - if (err != MZ_OK) - break; - - if (type == field_type) { - if (length) - *length = field_length; - return MZ_OK; - } - - max_seek -= field_length - 4; - if (max_seek < 0) - return MZ_EXIST_ERROR; - - err = mz_stream_seek(stream, field_length, MZ_SEEK_CUR); - } while (err == MZ_OK); - - return MZ_EXIST_ERROR; -} - -int32_t mz_zip_extrafield_contains(const uint8_t *extrafield, int32_t extrafield_size, - uint16_t type, uint16_t *length) { - void *file_extra_stream = NULL; - int32_t err = MZ_OK; - - if (!extrafield || !extrafield_size) - return MZ_PARAM_ERROR; - - mz_stream_mem_create(&file_extra_stream); - mz_stream_mem_set_buffer(file_extra_stream, (void *)extrafield, extrafield_size); - - err = mz_zip_extrafield_find(file_extra_stream, type, extrafield_size, length); - - mz_stream_mem_delete(&file_extra_stream); - - return err; -} - -int32_t mz_zip_extrafield_read(void *stream, uint16_t *type, uint16_t *length) { - int32_t err = MZ_OK; - if (!type || !length) - return MZ_PARAM_ERROR; - err = mz_stream_read_uint16(stream, type); - if (err == MZ_OK) - err = mz_stream_read_uint16(stream, length); - return err; -} - -int32_t mz_zip_extrafield_write(void *stream, uint16_t type, uint16_t length) { - int32_t err = MZ_OK; - err = mz_stream_write_uint16(stream, type); - if (err == MZ_OK) - err = mz_stream_write_uint16(stream, length); - return err; -} - -/***************************************************************************/ - -static int32_t mz_zip_invalid_date(const struct tm *ptm) { -#define datevalue_in_range(min, max, value) ((min) <= (value) && (value) <= (max)) - return (!datevalue_in_range(0, 127 + 80, ptm->tm_year) || /* 1980-based year, allow 80 extra */ - !datevalue_in_range(0, 11, ptm->tm_mon) || - !datevalue_in_range(1, 31, ptm->tm_mday) || - !datevalue_in_range(0, 23, ptm->tm_hour) || - !datevalue_in_range(0, 59, ptm->tm_min) || - !datevalue_in_range(0, 59, ptm->tm_sec)); -#undef datevalue_in_range -} - -static void mz_zip_dosdate_to_raw_tm(uint64_t dos_date, struct tm *ptm) { - uint64_t date = (uint64_t)(dos_date >> 16); - - ptm->tm_mday = (uint16_t)(date & 0x1f); - ptm->tm_mon = (uint16_t)(((date & 0x1E0) / 0x20) - 1); - ptm->tm_year = (uint16_t)(((date & 0x0FE00) / 0x0200) + 80); - ptm->tm_hour = (uint16_t)((dos_date & 0xF800) / 0x800); - ptm->tm_min = (uint16_t)((dos_date & 0x7E0) / 0x20); - ptm->tm_sec = (uint16_t)(2 * (dos_date & 0x1f)); - ptm->tm_isdst = -1; -} - -int32_t mz_zip_dosdate_to_tm(uint64_t dos_date, struct tm *ptm) { - if (!ptm) - return MZ_PARAM_ERROR; - - mz_zip_dosdate_to_raw_tm(dos_date, ptm); - - if (mz_zip_invalid_date(ptm)) { - /* Invalid date stored, so don't return it */ - memset(ptm, 0, sizeof(struct tm)); - return MZ_FORMAT_ERROR; - } - return MZ_OK; -} - -time_t mz_zip_dosdate_to_time_t(uint64_t dos_date) { - struct tm ptm; - mz_zip_dosdate_to_raw_tm(dos_date, &ptm); - return mktime(&ptm); -} - -int32_t mz_zip_time_t_to_tm(time_t unix_time, struct tm *ptm) { - struct tm ltm; - if (!ptm) - return MZ_PARAM_ERROR; - if (!localtime_r(&unix_time, <m)) { /* Returns a 1900-based year */ - /* Invalid date stored, so don't return it */ - memset(ptm, 0, sizeof(struct tm)); - return MZ_INTERNAL_ERROR; - } - memcpy(ptm, <m, sizeof(struct tm)); - return MZ_OK; -} - -uint32_t mz_zip_time_t_to_dos_date(time_t unix_time) { - struct tm ptm; - mz_zip_time_t_to_tm(unix_time, &ptm); - return mz_zip_tm_to_dosdate((const struct tm *)&ptm); -} - -uint32_t mz_zip_tm_to_dosdate(const struct tm *ptm) { - struct tm fixed_tm; - - /* Years supported: */ - - /* [00, 79] (assumed to be between 2000 and 2079) */ - /* [80, 207] (assumed to be between 1980 and 2107, typical output of old */ - /* software that does 'year-1900' to get a double digit year) */ - /* [1980, 2107] (due to format limitations, only years 1980-2107 can be stored.) */ - - memcpy(&fixed_tm, ptm, sizeof(struct tm)); - if (fixed_tm.tm_year >= 1980) /* range [1980, 2107] */ - fixed_tm.tm_year -= 1980; - else if (fixed_tm.tm_year >= 80) /* range [80, 207] */ - fixed_tm.tm_year -= 80; - else /* range [00, 79] */ - fixed_tm.tm_year += 20; - - if (mz_zip_invalid_date(&fixed_tm)) - return 0; - - return (((uint32_t)fixed_tm.tm_mday + (32 * ((uint32_t)fixed_tm.tm_mon + 1)) + (512 * (uint32_t)fixed_tm.tm_year)) << 16) | - (((uint32_t)fixed_tm.tm_sec / 2) + (32 * (uint32_t)fixed_tm.tm_min) + (2048 * (uint32_t)fixed_tm.tm_hour)); -} - -int32_t mz_zip_ntfs_to_unix_time(uint64_t ntfs_time, time_t *unix_time) { - *unix_time = (time_t)((ntfs_time - 116444736000000000LL) / 10000000); - return MZ_OK; -} - -int32_t mz_zip_unix_to_ntfs_time(time_t unix_time, uint64_t *ntfs_time) { - *ntfs_time = ((uint64_t)unix_time * 10000000) + 116444736000000000LL; - return MZ_OK; -} - -/***************************************************************************/ - -int32_t mz_zip_path_compare(const char *path1, const char *path2, uint8_t ignore_case) { - do { - if ((*path1 == '\\' && *path2 == '/') || - (*path2 == '\\' && *path1 == '/')) { - /* Ignore comparison of path slashes */ - } else if (ignore_case) { - if (tolower(*path1) != tolower(*path2)) - break; - } else if (*path1 != *path2) { - break; - } - - path1 += 1; - path2 += 1; - } while (*path1 != 0 && *path2 != 0); - - if (ignore_case) - return (int32_t)(tolower(*path1) - tolower(*path2)); - - return (int32_t)(*path1 - *path2); -} - -/***************************************************************************/ - -const char* mz_zip_get_compression_method_string(int32_t compression_method) -{ - const char *method = "?"; - switch (compression_method) { - case MZ_COMPRESS_METHOD_STORE: - method = "stored"; - break; - case MZ_COMPRESS_METHOD_DEFLATE: - method = "deflate"; - break; - case MZ_COMPRESS_METHOD_BZIP2: - method = "bzip2"; - break; - case MZ_COMPRESS_METHOD_LZMA: - method = "lzma"; - break; - case MZ_COMPRESS_METHOD_XZ: - method = "xz"; - break; - case MZ_COMPRESS_METHOD_ZSTD: - method = "zstd"; - break; - } - return method; -} - -/***************************************************************************/ diff --git a/ios/CodePush/SSZipArchive/minizip/mz_zip.h b/ios/CodePush/SSZipArchive/minizip/mz_zip.h deleted file mode 100644 index 65be301af..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_zip.h +++ /dev/null @@ -1,262 +0,0 @@ -/* mz_zip.h -- Zip manipulation - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - Copyright (C) 2009-2010 Mathias Svensson - Modifications for Zip64 support - http://result42.com - Copyright (C) 1998-2010 Gilles Vollant - https://www.winimage.com/zLibDll/minizip.html - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#ifndef MZ_ZIP_H -#define MZ_ZIP_H - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************************/ - -typedef struct mz_zip_file_s { - uint16_t version_madeby; /* version made by */ - uint16_t version_needed; /* version needed to extract */ - uint16_t flag; /* general purpose bit flag */ - uint16_t compression_method; /* compression method */ - time_t modified_date; /* last modified date in unix time */ - time_t accessed_date; /* last accessed date in unix time */ - time_t creation_date; /* creation date in unix time */ - uint32_t crc; /* crc-32 */ - int64_t compressed_size; /* compressed size */ - int64_t uncompressed_size; /* uncompressed size */ - uint16_t filename_size; /* filename length */ - uint16_t extrafield_size; /* extra field length */ - uint16_t comment_size; /* file comment length */ - uint32_t disk_number; /* disk number start */ - int64_t disk_offset; /* relative offset of local header */ - uint16_t internal_fa; /* internal file attributes */ - uint32_t external_fa; /* external file attributes */ - - const char *filename; /* filename utf8 null-terminated string */ - const uint8_t *extrafield; /* extrafield data */ - const char *comment; /* comment utf8 null-terminated string */ - const char *linkname; /* sym-link filename utf8 null-terminated string */ - - uint16_t zip64; /* zip64 extension mode */ - uint16_t aes_version; /* winzip aes extension if not 0 */ - uint8_t aes_encryption_mode; /* winzip aes encryption mode */ - uint16_t pk_verify; /* pkware encryption verifier */ - -} mz_zip_file, mz_zip_entry; - -/***************************************************************************/ - -typedef int32_t (*mz_zip_locate_entry_cb)(void *handle, void *userdata, mz_zip_file *file_info); - -/***************************************************************************/ - -void * mz_zip_create(void **handle); -/* Create zip instance for opening */ - -void mz_zip_delete(void **handle); -/* Delete zip object */ - -int32_t mz_zip_open(void *handle, void *stream, int32_t mode); -/* Create a zip file, no delete file in zip functionality */ - -int32_t mz_zip_close(void *handle); -/* Close the zip file */ - -int32_t mz_zip_get_comment(void *handle, const char **comment); -/* Get a pointer to the global comment */ - -int32_t mz_zip_set_comment(void *handle, const char *comment); -/* Sets the global comment used for writing zip file */ - -int32_t mz_zip_get_version_madeby(void *handle, uint16_t *version_madeby); -/* Get the version made by */ - -int32_t mz_zip_set_version_madeby(void *handle, uint16_t version_madeby); -/* Sets the version made by used for writing zip file */ - -int32_t mz_zip_set_recover(void *handle, uint8_t recover); -/* Sets the ability to recover the central dir by reading local file headers */ - -int32_t mz_zip_set_data_descriptor(void *handle, uint8_t data_descriptor); -/* Sets the use of data descriptor flag when writing zip entries */ - -int32_t mz_zip_get_stream(void *handle, void **stream); -/* Get a pointer to the stream used to open */ - -int32_t mz_zip_set_cd_stream(void *handle, int64_t cd_start_pos, void *cd_stream); -/* Sets the stream to use for reading the central dir */ - -int32_t mz_zip_get_cd_mem_stream(void *handle, void **cd_mem_stream); -/* Get a pointer to the stream used to store the central dir in memory */ - -int32_t mz_zip_set_number_entry(void *handle, uint64_t number_entry); -/* Sets the total number of entries */ - -int32_t mz_zip_get_number_entry(void *handle, uint64_t *number_entry); -/* Get the total number of entries */ - -int32_t mz_zip_set_disk_number_with_cd(void *handle, uint32_t disk_number_with_cd); -/* Sets the disk number containing the central directory record */ - -int32_t mz_zip_get_disk_number_with_cd(void *handle, uint32_t *disk_number_with_cd); -/* Get the disk number containing the central directory record */ - -/***************************************************************************/ - -int32_t mz_zip_entry_is_open(void *handle); -/* Check to see if entry is open for read/write */ - -int32_t mz_zip_entry_read_open(void *handle, uint8_t raw, const char *password); -/* Open for reading the current file in the zip file */ - -int32_t mz_zip_entry_read(void *handle, void *buf, int32_t len); -/* Read bytes from the current file in the zip file */ - -int32_t mz_zip_entry_read_close(void *handle, uint32_t *crc32, int64_t *compressed_size, - int64_t *uncompressed_size); -/* Close the current file for reading and get data descriptor values */ - -int32_t mz_zip_entry_write_open(void *handle, const mz_zip_file *file_info, - int16_t compress_level, uint8_t raw, const char *password); -/* Open for writing the current file in the zip file */ - -int32_t mz_zip_entry_write(void *handle, const void *buf, int32_t len); -/* Write bytes from the current file in the zip file */ - -int32_t mz_zip_entry_write_close(void *handle, uint32_t crc32, int64_t compressed_size, - int64_t uncompressed_size); -/* Close the current file for writing and set data descriptor values */ - -int32_t mz_zip_entry_seek_local_header(void *handle); -/* Seeks to the local header for the entry */ - -int32_t mz_zip_entry_get_compress_stream(void *handle, void **compress_stream); -/* Get a pointer to the compression stream used for the current entry */ - -int32_t mz_zip_entry_close_raw(void *handle, int64_t uncompressed_size, uint32_t crc32); -/* Close the current file in the zip file where raw is compressed data */ - -int32_t mz_zip_entry_close(void *handle); -/* Close the current file in the zip file */ - -/***************************************************************************/ - -int32_t mz_zip_entry_is_dir(void *handle); -/* Checks to see if the entry is a directory */ - -int32_t mz_zip_entry_is_symlink(void *handle); -/* Checks to see if the entry is a symbolic link */ - -int32_t mz_zip_entry_get_info(void *handle, mz_zip_file **file_info); -/* Get info about the current file, only valid while current entry is open */ - -int32_t mz_zip_entry_get_local_info(void *handle, mz_zip_file **local_file_info); -/* Get local info about the current file, only valid while current entry is being read */ - -int32_t mz_zip_entry_set_extrafield(void *handle, const uint8_t *extrafield, uint16_t extrafield_size); -/* Sets or updates the extra field for the entry to be used before writing cd */ - -int64_t mz_zip_get_entry(void *handle); -/* Return offset of the current entry in the zip file */ - -int32_t mz_zip_goto_entry(void *handle, int64_t cd_pos); -/* Go to specified entry in the zip file */ - -int32_t mz_zip_goto_first_entry(void *handle); -/* Go to the first entry in the zip file */ - -int32_t mz_zip_goto_next_entry(void *handle); -/* Go to the next entry in the zip file or MZ_END_OF_LIST if reaching the end */ - -int32_t mz_zip_locate_entry(void *handle, const char *filename, uint8_t ignore_case); -/* Locate the file with the specified name in the zip file or MZ_END_LIST if not found */ - -int32_t mz_zip_locate_first_entry(void *handle, void *userdata, mz_zip_locate_entry_cb cb); -/* Locate the first matching entry based on a match callback */ - -int32_t mz_zip_locate_next_entry(void *handle, void *userdata, mz_zip_locate_entry_cb cb); -/* Locate the next matching entry based on a match callback */ - -/***************************************************************************/ - -int32_t mz_zip_attrib_is_dir(uint32_t attrib, int32_t version_madeby); -/* Checks to see if the attribute is a directory based on platform */ - -int32_t mz_zip_attrib_is_symlink(uint32_t attrib, int32_t version_madeby); -/* Checks to see if the attribute is a symbolic link based on platform */ - -int32_t mz_zip_attrib_convert(uint8_t src_sys, uint32_t src_attrib, uint8_t target_sys, - uint32_t *target_attrib); -/* Converts file attributes from one host system to another */ - -int32_t mz_zip_attrib_posix_to_win32(uint32_t posix_attrib, uint32_t *win32_attrib); -/* Converts posix file attributes to win32 file attributes */ - -int32_t mz_zip_attrib_win32_to_posix(uint32_t win32_attrib, uint32_t *posix_attrib); -/* Converts win32 file attributes to posix file attributes */ - -/***************************************************************************/ - -int32_t mz_zip_extrafield_find(void *stream, uint16_t type, int32_t max_seek, uint16_t *length); -/* Seeks to extra field by its type and returns its length */ - -int32_t mz_zip_extrafield_contains(const uint8_t *extrafield, int32_t extrafield_size, - uint16_t type, uint16_t *length); -/* Gets whether an extrafield exists and its size */ - -int32_t mz_zip_extrafield_read(void *stream, uint16_t *type, uint16_t *length); -/* Reads an extrafield header from a stream */ - -int32_t mz_zip_extrafield_write(void *stream, uint16_t type, uint16_t length); -/* Writes an extrafield header to a stream */ - -/***************************************************************************/ - -int32_t mz_zip_dosdate_to_tm(uint64_t dos_date, struct tm *ptm); -/* Convert dos date/time format to struct tm */ - -time_t mz_zip_dosdate_to_time_t(uint64_t dos_date); -/* Convert dos date/time format to time_t */ - -int32_t mz_zip_time_t_to_tm(time_t unix_time, struct tm *ptm); -/* Convert time_t to time struct */ - -uint32_t mz_zip_time_t_to_dos_date(time_t unix_time); -/* Convert time_t to dos date/time format */ - -uint32_t mz_zip_tm_to_dosdate(const struct tm *ptm); -/* Convert struct tm to dos date/time format */ - -int32_t mz_zip_ntfs_to_unix_time(uint64_t ntfs_time, time_t *unix_time); -/* Convert ntfs time to unix time */ - -int32_t mz_zip_unix_to_ntfs_time(time_t unix_time, uint64_t *ntfs_time); -/* Convert unix time to ntfs time */ - -/***************************************************************************/ - -int32_t mz_zip_path_compare(const char *path1, const char *path2, uint8_t ignore_case); -/* Compare two paths without regard to slashes */ - -/***************************************************************************/ - -const -char* mz_zip_get_compression_method_string(int32_t compression_method); -/* Gets a string representing the compression method */ - -/***************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif /* _ZIP_H */ diff --git a/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c b/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c deleted file mode 100644 index 05390cc6a..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +++ /dev/null @@ -1,1942 +0,0 @@ -/* mz_zip_rw.c -- Zip reader/writer - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#include "mz.h" -#include "mz_crypt.h" -#include "mz_os.h" -#include "mz_strm.h" -#include "mz_strm_buf.h" -#include "mz_strm_mem.h" -#include "mz_strm_os.h" -#include "mz_strm_split.h" -#include "mz_strm_wzaes.h" -#include "mz_zip.h" - -#include "mz_zip_rw.h" - -/***************************************************************************/ - -#define MZ_DEFAULT_PROGRESS_INTERVAL (1000u) - -#define MZ_ZIP_CD_FILENAME ("__cdcd__") - -/***************************************************************************/ - -typedef struct mz_zip_reader_s { - void *zip_handle; - void *file_stream; - void *buffered_stream; - void *split_stream; - void *mem_stream; - void *hash; - uint16_t hash_algorithm; - uint16_t hash_digest_size; - mz_zip_file *file_info; - const char *pattern; - uint8_t pattern_ignore_case; - const char *password; - void *overwrite_userdata; - mz_zip_reader_overwrite_cb - overwrite_cb; - void *password_userdata; - mz_zip_reader_password_cb - password_cb; - void *progress_userdata; - mz_zip_reader_progress_cb - progress_cb; - uint32_t progress_cb_interval_ms; - void *entry_userdata; - mz_zip_reader_entry_cb - entry_cb; - uint8_t raw; - uint8_t buffer[UINT16_MAX]; - int32_t encoding; - uint8_t sign_required; - uint8_t cd_verified; - uint8_t cd_zipped; - uint8_t entry_verified; - uint8_t recover; -} mz_zip_reader; - -/***************************************************************************/ - -int32_t mz_zip_reader_is_open(void *handle) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - if (!reader) - return MZ_PARAM_ERROR; - if (!reader->zip_handle) - return MZ_PARAM_ERROR; - return MZ_OK; -} - -int32_t mz_zip_reader_open(void *handle, void *stream) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - int32_t err = MZ_OK; - - reader->cd_verified = 0; - reader->cd_zipped = 0; - - mz_zip_create(&reader->zip_handle); - mz_zip_set_recover(reader->zip_handle, reader->recover); - - err = mz_zip_open(reader->zip_handle, stream, MZ_OPEN_MODE_READ); - - if (err != MZ_OK) { - mz_zip_reader_close(handle); - return err; - } - - mz_zip_reader_unzip_cd(reader); - return MZ_OK; -} - -int32_t mz_zip_reader_open_file(void *handle, const char *path) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - int32_t err = MZ_OK; - - mz_zip_reader_close(handle); - - mz_stream_os_create(&reader->file_stream); - mz_stream_buffered_create(&reader->buffered_stream); - mz_stream_split_create(&reader->split_stream); - - mz_stream_set_base(reader->buffered_stream, reader->file_stream); - mz_stream_set_base(reader->split_stream, reader->buffered_stream); - - err = mz_stream_open(reader->split_stream, path, MZ_OPEN_MODE_READ); - if (err == MZ_OK) - err = mz_zip_reader_open(handle, reader->split_stream); - return err; -} - -int32_t mz_zip_reader_open_file_in_memory(void *handle, const char *path) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - void *file_stream = NULL; - int64_t file_size = 0; - int32_t err = 0; - - mz_zip_reader_close(handle); - - mz_stream_os_create(&file_stream); - - err = mz_stream_os_open(file_stream, path, MZ_OPEN_MODE_READ); - - if (err != MZ_OK) { - mz_stream_os_delete(&file_stream); - mz_zip_reader_close(handle); - return err; - } - - mz_stream_os_seek(file_stream, 0, MZ_SEEK_END); - file_size = mz_stream_os_tell(file_stream); - mz_stream_os_seek(file_stream, 0, MZ_SEEK_SET); - - if ((file_size <= 0) || (file_size > UINT32_MAX)) { - /* Memory size is too large or too small */ - - mz_stream_os_close(file_stream); - mz_stream_os_delete(&file_stream); - mz_zip_reader_close(handle); - return MZ_MEM_ERROR; - } - - mz_stream_mem_create(&reader->mem_stream); - mz_stream_mem_set_grow_size(reader->mem_stream, (int32_t)file_size); - mz_stream_mem_open(reader->mem_stream, NULL, MZ_OPEN_MODE_CREATE); - - err = mz_stream_copy(reader->mem_stream, file_stream, (int32_t)file_size); - - mz_stream_os_close(file_stream); - mz_stream_os_delete(&file_stream); - - if (err == MZ_OK) - err = mz_zip_reader_open(handle, reader->mem_stream); - if (err != MZ_OK) - mz_zip_reader_close(handle); - - return err; -} - -int32_t mz_zip_reader_open_buffer(void *handle, uint8_t *buf, int32_t len, uint8_t copy) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - int32_t err = MZ_OK; - - mz_zip_reader_close(handle); - - mz_stream_mem_create(&reader->mem_stream); - - if (copy) { - mz_stream_mem_set_grow_size(reader->mem_stream, len); - mz_stream_mem_open(reader->mem_stream, NULL, MZ_OPEN_MODE_CREATE); - mz_stream_mem_write(reader->mem_stream, buf, len); - mz_stream_mem_seek(reader->mem_stream, 0, MZ_SEEK_SET); - } else { - mz_stream_mem_open(reader->mem_stream, NULL, MZ_OPEN_MODE_READ); - mz_stream_mem_set_buffer(reader->mem_stream, buf, len); - } - - if (err == MZ_OK) - err = mz_zip_reader_open(handle, reader->mem_stream); - - return err; -} - -int32_t mz_zip_reader_close(void *handle) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - int32_t err = MZ_OK; - - if (reader->zip_handle) { - err = mz_zip_close(reader->zip_handle); - mz_zip_delete(&reader->zip_handle); - } - - if (reader->split_stream) { - mz_stream_split_close(reader->split_stream); - mz_stream_split_delete(&reader->split_stream); - } - - if (reader->buffered_stream) - mz_stream_buffered_delete(&reader->buffered_stream); - - if (reader->file_stream) - mz_stream_os_delete(&reader->file_stream); - - if (reader->mem_stream) { - mz_stream_close(reader->mem_stream); - mz_stream_delete(&reader->mem_stream); - } - - return err; -} - -/***************************************************************************/ - -int32_t mz_zip_reader_unzip_cd(void *handle) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - mz_zip_file *cd_info = NULL; - void *cd_mem_stream = NULL; - void *new_cd_stream = NULL; - void *file_extra_stream = NULL; - uint64_t number_entry = 0; - int32_t err = MZ_OK; - - err = mz_zip_reader_goto_first_entry(handle); - if (err != MZ_OK) - return err; - err = mz_zip_reader_entry_get_info(handle, &cd_info); - if (err != MZ_OK) - return err; - - if (strcmp(cd_info->filename, MZ_ZIP_CD_FILENAME) != 0) - return mz_zip_reader_goto_first_entry(handle); - - err = mz_zip_reader_entry_open(handle); - if (err != MZ_OK) - return err; - - mz_stream_mem_create(&file_extra_stream); - mz_stream_mem_set_buffer(file_extra_stream, (void *)cd_info->extrafield, cd_info->extrafield_size); - - err = mz_zip_extrafield_find(file_extra_stream, MZ_ZIP_EXTENSION_CDCD, INT32_MAX, NULL); - if (err == MZ_OK) - err = mz_stream_read_uint64(file_extra_stream, &number_entry); - - mz_stream_mem_delete(&file_extra_stream); - - if (err != MZ_OK) - return err; - - mz_zip_get_cd_mem_stream(reader->zip_handle, &cd_mem_stream); - if (mz_stream_mem_is_open(cd_mem_stream) != MZ_OK) - mz_stream_mem_open(cd_mem_stream, NULL, MZ_OPEN_MODE_CREATE); - - err = mz_stream_seek(cd_mem_stream, 0, MZ_SEEK_SET); - if (err == MZ_OK) - err = mz_stream_copy_stream(cd_mem_stream, NULL, handle, mz_zip_reader_entry_read, - (int32_t)cd_info->uncompressed_size); - - if (err == MZ_OK) { - reader->cd_zipped = 1; - - mz_zip_set_cd_stream(reader->zip_handle, 0, cd_mem_stream); - mz_zip_set_number_entry(reader->zip_handle, number_entry); - - err = mz_zip_reader_goto_first_entry(handle); - } - - reader->cd_verified = reader->entry_verified; - - mz_stream_mem_delete(&new_cd_stream); - return err; -} - -/***************************************************************************/ - -static int32_t mz_zip_reader_locate_entry_cb(void *handle, void *userdata, mz_zip_file *file_info) { - mz_zip_reader *reader = (mz_zip_reader *)userdata; - int32_t result = 0; - MZ_UNUSED(handle); - result = mz_path_compare_wc(file_info->filename, reader->pattern, reader->pattern_ignore_case); - return result; -} - -int32_t mz_zip_reader_goto_first_entry(void *handle) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - int32_t err = MZ_OK; - - if (mz_zip_reader_is_open(handle) != MZ_OK) - return MZ_PARAM_ERROR; - - if (mz_zip_entry_is_open(reader->zip_handle) == MZ_OK) - mz_zip_reader_entry_close(handle); - - if (!reader->pattern) - err = mz_zip_goto_first_entry(reader->zip_handle); - else - err = mz_zip_locate_first_entry(reader->zip_handle, reader, mz_zip_reader_locate_entry_cb); - - reader->file_info = NULL; - if (err == MZ_OK) - err = mz_zip_entry_get_info(reader->zip_handle, &reader->file_info); - - return err; -} - -int32_t mz_zip_reader_goto_next_entry(void *handle) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - int32_t err = MZ_OK; - - if (mz_zip_reader_is_open(handle) != MZ_OK) - return MZ_PARAM_ERROR; - - if (mz_zip_entry_is_open(reader->zip_handle) == MZ_OK) - mz_zip_reader_entry_close(handle); - - if (!reader->pattern) - err = mz_zip_goto_next_entry(reader->zip_handle); - else - err = mz_zip_locate_next_entry(reader->zip_handle, reader, mz_zip_reader_locate_entry_cb); - - reader->file_info = NULL; - if (err == MZ_OK) - err = mz_zip_entry_get_info(reader->zip_handle, &reader->file_info); - - return err; -} - -int32_t mz_zip_reader_locate_entry(void *handle, const char *filename, uint8_t ignore_case) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - int32_t err = MZ_OK; - - if (mz_zip_entry_is_open(reader->zip_handle) == MZ_OK) - mz_zip_reader_entry_close(handle); - - err = mz_zip_locate_entry(reader->zip_handle, filename, ignore_case); - - reader->file_info = NULL; - if (err == MZ_OK) - err = mz_zip_entry_get_info(reader->zip_handle, &reader->file_info); - - return err; -} - -/***************************************************************************/ - -int32_t mz_zip_reader_entry_open(void *handle) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - int32_t err = MZ_OK; - const char *password = NULL; - char password_buf[120]; - - reader->entry_verified = 0; - - if (mz_zip_reader_is_open(reader) != MZ_OK) - return MZ_PARAM_ERROR; - if (!reader->file_info) - return MZ_PARAM_ERROR; - - /* If the entry isn't open for reading, open it */ - if (mz_zip_entry_is_open(reader->zip_handle) == MZ_OK) - return MZ_OK; - - password = reader->password; - - /* Check if we need a password and ask for it if we need to */ - if (!password && reader->password_cb && (reader->file_info->flag & MZ_ZIP_FLAG_ENCRYPTED)) { - reader->password_cb(handle, reader->password_userdata, reader->file_info, - password_buf, sizeof(password_buf)); - - password = password_buf; - } - - err = mz_zip_entry_read_open(reader->zip_handle, reader->raw, password); -#ifndef MZ_ZIP_NO_CRYPTO - if (err != MZ_OK) - return err; - - if (mz_zip_reader_entry_get_first_hash(handle, &reader->hash_algorithm, &reader->hash_digest_size) == MZ_OK) { - mz_crypt_sha_create(&reader->hash); - if (reader->hash_algorithm == MZ_HASH_SHA1) - mz_crypt_sha_set_algorithm(reader->hash, MZ_HASH_SHA1); - else if (reader->hash_algorithm == MZ_HASH_SHA256) - mz_crypt_sha_set_algorithm(reader->hash, MZ_HASH_SHA256); - else - err = MZ_SUPPORT_ERROR; - - if (err == MZ_OK) - mz_crypt_sha_begin(reader->hash); -#ifdef MZ_ZIP_SIGNING - if (err == MZ_OK) { - if (mz_zip_reader_entry_has_sign(handle) == MZ_OK) { - err = mz_zip_reader_entry_sign_verify(handle); - if (err == MZ_OK) - reader->entry_verified = 1; - } else if (reader->sign_required && !reader->cd_verified) - err = MZ_SIGN_ERROR; - } -#endif - } else if (reader->sign_required && !reader->cd_verified) - err = MZ_SIGN_ERROR; -#endif - - return err; -} - -int32_t mz_zip_reader_entry_close(void *handle) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - int32_t err = MZ_OK; - int32_t err_close = MZ_OK; -#ifndef MZ_ZIP_NO_CRYPTO - int32_t err_hash = MZ_OK; - uint8_t computed_hash[MZ_HASH_MAX_SIZE]; - uint8_t expected_hash[MZ_HASH_MAX_SIZE]; - - if (reader->hash) { - mz_crypt_sha_end(reader->hash, computed_hash, sizeof(computed_hash)); - mz_crypt_sha_delete(&reader->hash); - - err_hash = mz_zip_reader_entry_get_hash(handle, reader->hash_algorithm, expected_hash, - reader->hash_digest_size); - - if (err_hash == MZ_OK) { - /* Verify expected hash against computed hash */ - if (memcmp(computed_hash, expected_hash, reader->hash_digest_size) != 0) - err = MZ_CRC_ERROR; - } - } -#endif - - err_close = mz_zip_entry_close(reader->zip_handle); - if (err == MZ_OK) - err = err_close; - return err; -} - -int32_t mz_zip_reader_entry_read(void *handle, void *buf, int32_t len) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - int32_t read = 0; - read = mz_zip_entry_read(reader->zip_handle, buf, len); -#ifndef MZ_ZIP_NO_CRYPTO - if (read > 0 && reader->hash) - mz_crypt_sha_update(reader->hash, buf, read); -#endif - return read; -} - -int32_t mz_zip_reader_entry_has_sign(void *handle) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - - if (!reader || mz_zip_entry_is_open(reader->zip_handle) != MZ_OK) - return MZ_PARAM_ERROR; - - return mz_zip_extrafield_contains(reader->file_info->extrafield, - reader->file_info->extrafield_size, MZ_ZIP_EXTENSION_SIGN, NULL); -} - -#if !defined(MZ_ZIP_NO_CRYPTO) && defined(MZ_ZIP_SIGNING) -int32_t mz_zip_reader_entry_sign_verify(void *handle) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - void *file_extra_stream = NULL; - int32_t err = MZ_OK; - uint8_t *signature = NULL; - uint16_t signature_size = 0; - uint8_t hash[MZ_HASH_MAX_SIZE]; - - if (!reader || mz_zip_entry_is_open(reader->zip_handle) != MZ_OK) - return MZ_PARAM_ERROR; - - mz_stream_mem_create(&file_extra_stream); - mz_stream_mem_set_buffer(file_extra_stream, (void *)reader->file_info->extrafield, - reader->file_info->extrafield_size); - - err = mz_zip_extrafield_find(file_extra_stream, MZ_ZIP_EXTENSION_SIGN, INT32_MAX, &signature_size); - if ((err == MZ_OK) && (signature_size > 0)) { - signature = (uint8_t *)malloc(signature_size); - if (mz_stream_read(file_extra_stream, signature, signature_size) != signature_size) - err = MZ_READ_ERROR; - } - - mz_stream_mem_delete(&file_extra_stream); - - if (err == MZ_OK) { - /* Get most secure hash to verify signature against */ - err = mz_zip_reader_entry_get_hash(handle, reader->hash_algorithm, hash, reader->hash_digest_size); - } - - if (err == MZ_OK) { - /* Verify the pkcs signature */ - err = mz_crypt_sign_verify(hash, reader->hash_digest_size, signature, signature_size); - } - - if (signature) - free(signature); - - return err; -} -#endif - -int32_t mz_zip_reader_entry_get_hash(void *handle, uint16_t algorithm, uint8_t *digest, int32_t digest_size) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - void *file_extra_stream = NULL; - int32_t err = MZ_OK; - int32_t return_err = MZ_EXIST_ERROR; - uint16_t cur_algorithm = 0; - uint16_t cur_digest_size = 0; - - mz_stream_mem_create(&file_extra_stream); - mz_stream_mem_set_buffer(file_extra_stream, (void *)reader->file_info->extrafield, - reader->file_info->extrafield_size); - - do { - err = mz_zip_extrafield_find(file_extra_stream, MZ_ZIP_EXTENSION_HASH, INT32_MAX, NULL); - if (err != MZ_OK) - break; - - err = mz_stream_read_uint16(file_extra_stream, &cur_algorithm); - if (err == MZ_OK) - err = mz_stream_read_uint16(file_extra_stream, &cur_digest_size); - if ((err == MZ_OK) && (cur_algorithm == algorithm) && (cur_digest_size <= digest_size) && - (cur_digest_size <= MZ_HASH_MAX_SIZE)) { - /* Read hash digest */ - if (mz_stream_read(file_extra_stream, digest, digest_size) == cur_digest_size) - return_err = MZ_OK; - break; - } else { - err = mz_stream_seek(file_extra_stream, cur_digest_size, MZ_SEEK_CUR); - } - } while (err == MZ_OK); - - mz_stream_mem_delete(&file_extra_stream); - - return return_err; -} - -int32_t mz_zip_reader_entry_get_first_hash(void *handle, uint16_t *algorithm, uint16_t *digest_size) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - void *file_extra_stream = NULL; - int32_t err = MZ_OK; - uint16_t cur_algorithm = 0; - uint16_t cur_digest_size = 0; - - if (!reader || !algorithm) - return MZ_PARAM_ERROR; - - mz_stream_mem_create(&file_extra_stream); - mz_stream_mem_set_buffer(file_extra_stream, (void *)reader->file_info->extrafield, - reader->file_info->extrafield_size); - - err = mz_zip_extrafield_find(file_extra_stream, MZ_ZIP_EXTENSION_HASH, INT32_MAX, NULL); - if (err == MZ_OK) - err = mz_stream_read_uint16(file_extra_stream, &cur_algorithm); - if (err == MZ_OK) - err = mz_stream_read_uint16(file_extra_stream, &cur_digest_size); - - if (algorithm) - *algorithm = cur_algorithm; - if (digest_size) - *digest_size = cur_digest_size; - - mz_stream_mem_delete(&file_extra_stream); - - return err; -} - -int32_t mz_zip_reader_entry_get_info(void *handle, mz_zip_file **file_info) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - int32_t err = MZ_OK; - if (!file_info || mz_zip_reader_is_open(handle) != MZ_OK) - return MZ_PARAM_ERROR; - *file_info = reader->file_info; - if (!*file_info) - return MZ_EXIST_ERROR; - return err; -} - -int32_t mz_zip_reader_entry_is_dir(void *handle) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - if (mz_zip_reader_is_open(handle) != MZ_OK) - return MZ_PARAM_ERROR; - return mz_zip_entry_is_dir(reader->zip_handle); -} - -int32_t mz_zip_reader_entry_save_process(void *handle, void *stream, mz_stream_write_cb write_cb) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - int32_t err = MZ_OK; - int32_t read = 0; - int32_t written = 0; - - if (mz_zip_reader_is_open(reader) != MZ_OK) - return MZ_PARAM_ERROR; - if (!reader->file_info || !write_cb) - return MZ_PARAM_ERROR; - - /* If the entry isn't open for reading, open it */ - if (mz_zip_entry_is_open(reader->zip_handle) != MZ_OK) - err = mz_zip_reader_entry_open(handle); - - if (err != MZ_OK) - return err; - - /* Unzip entry in zip file */ - read = mz_zip_reader_entry_read(handle, reader->buffer, sizeof(reader->buffer)); - - if (read == 0) { - /* If we are done close the entry */ - err = mz_zip_reader_entry_close(handle); - if (err != MZ_OK) - return err; - - return MZ_END_OF_STREAM; - } - - if (read > 0) { - /* Write the data to the specified stream */ - written = write_cb(stream, reader->buffer, read); - if (written != read) - return MZ_WRITE_ERROR; - } - - return read; -} - -int32_t mz_zip_reader_entry_save(void *handle, void *stream, mz_stream_write_cb write_cb) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - uint64_t current_time = 0; - uint64_t update_time = 0; - int64_t current_pos = 0; - int64_t update_pos = 0; - int32_t err = MZ_OK; - int32_t written = 0; - - if (mz_zip_reader_is_open(reader) != MZ_OK) - return MZ_PARAM_ERROR; - if (!reader->file_info) - return MZ_PARAM_ERROR; - - /* Update the progress at the beginning */ - if (reader->progress_cb) - reader->progress_cb(handle, reader->progress_userdata, reader->file_info, current_pos); - - /* Write data to stream until done */ - while (err == MZ_OK) { - written = mz_zip_reader_entry_save_process(handle, stream, write_cb); - if (written == MZ_END_OF_STREAM) - break; - if (written > 0) - current_pos += written; - if (written < 0) - err = written; - - /* Update progress if enough time have passed */ - current_time = mz_os_ms_time(); - if ((current_time - update_time) > reader->progress_cb_interval_ms) { - if (reader->progress_cb) - reader->progress_cb(handle, reader->progress_userdata, reader->file_info, current_pos); - - update_pos = current_pos; - update_time = current_time; - } - } - - /* Update the progress at the end */ - if (reader->progress_cb && update_pos != current_pos) - reader->progress_cb(handle, reader->progress_userdata, reader->file_info, current_pos); - - return err; -} - -int32_t mz_zip_reader_entry_save_file(void *handle, const char *path) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - void *stream = NULL; - uint32_t target_attrib = 0; - int32_t err_attrib = 0; - int32_t err = MZ_OK; - int32_t err_cb = MZ_OK; - char pathwfs[512]; - char directory[512]; - - if (mz_zip_reader_is_open(reader) != MZ_OK) - return MZ_PARAM_ERROR; - if (!reader->file_info || !path) - return MZ_PARAM_ERROR; - - /* Convert to forward slashes for unix which doesn't like backslashes */ - strncpy(pathwfs, path, sizeof(pathwfs) - 1); - pathwfs[sizeof(pathwfs) - 1] = 0; - mz_path_convert_slashes(pathwfs, MZ_PATH_SLASH_UNIX); - - if (reader->entry_cb) - reader->entry_cb(handle, reader->entry_userdata, reader->file_info, pathwfs); - - strncpy(directory, pathwfs, sizeof(directory) - 1); - directory[sizeof(directory) - 1] = 0; - mz_path_remove_filename(directory); - - /* If it is a directory entry then create a directory instead of writing file */ - if ((mz_zip_entry_is_dir(reader->zip_handle) == MZ_OK) && - (mz_zip_entry_is_symlink(reader->zip_handle) != MZ_OK)) { - err = mz_dir_make(directory); - return err; - } - - /* Check if file exists and ask if we want to overwrite */ - if (reader->overwrite_cb && mz_os_file_exists(pathwfs) == MZ_OK) { - err_cb = reader->overwrite_cb(handle, reader->overwrite_userdata, reader->file_info, pathwfs); - if (err_cb != MZ_OK) - return err; - /* We want to overwrite the file so we delete the existing one */ - mz_os_unlink(pathwfs); - } - - /* If symbolic link then properly construct destination path and link path */ - if ((mz_zip_entry_is_symlink(reader->zip_handle) == MZ_OK) && - (mz_path_has_slash(pathwfs) == MZ_OK)) { - mz_path_remove_slash(pathwfs); - mz_path_remove_filename(directory); - } - - /* Create the output directory if it doesn't already exist */ - if (mz_os_is_dir(directory) != MZ_OK) { - err = mz_dir_make(directory); - if (err != MZ_OK) - return err; - } - - /* If it is a symbolic link then create symbolic link instead of writing file */ - if (mz_zip_entry_is_symlink(reader->zip_handle) == MZ_OK) { - if (reader->file_info->linkname && *reader->file_info->linkname != 0) { - /* Create symbolic link from UNIX1 extrafield */ - err = mz_os_make_symlink(pathwfs, reader->file_info->linkname); - } else if (reader->file_info->uncompressed_size < UINT16_MAX) { - /* Create symbolic link from zip entry contents */ - mz_stream_mem_create(&stream); - err = mz_stream_mem_open(stream, NULL, MZ_OPEN_MODE_CREATE); - - if (err == MZ_OK) - err = mz_zip_reader_entry_save(handle, stream, mz_stream_write); - - if (err == MZ_OK) - err = mz_stream_write_uint8(stream, 0); - - if (err == MZ_OK) { - const char *linkname = NULL; - if (mz_stream_mem_get_buffer(stream, (const void **)&linkname) == MZ_OK) - err = mz_os_make_symlink(pathwfs, linkname); - } - - mz_stream_mem_close(stream); - mz_stream_mem_delete(&stream); - } - - /* Don't check return value because we aren't validating symbolic link target */ - return err; - } - - /* Create the file on disk so we can save to it */ - mz_stream_os_create(&stream); - err = mz_stream_os_open(stream, pathwfs, MZ_OPEN_MODE_CREATE); - - if (err == MZ_OK) - err = mz_zip_reader_entry_save(handle, stream, mz_stream_write); - - mz_stream_close(stream); - mz_stream_delete(&stream); - - if (err == MZ_OK) { - /* Set the time of the file that has been created */ - mz_os_set_file_date(pathwfs, reader->file_info->modified_date, - reader->file_info->accessed_date, reader->file_info->creation_date); - } - - if (err == MZ_OK) { - /* Set file attributes for the correct system */ - err_attrib = mz_zip_attrib_convert(MZ_HOST_SYSTEM(reader->file_info->version_madeby), - reader->file_info->external_fa, MZ_VERSION_MADEBY_HOST_SYSTEM, &target_attrib); - - if (err_attrib == MZ_OK) - mz_os_set_file_attribs(pathwfs, target_attrib); - } - - return err; -} - -int32_t mz_zip_reader_entry_save_buffer(void *handle, void *buf, int32_t len) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - void *mem_stream = NULL; - int32_t err = MZ_OK; - - if (mz_zip_reader_is_open(reader) != MZ_OK) - return MZ_PARAM_ERROR; - if (!reader->file_info || reader->file_info->uncompressed_size > INT32_MAX) - return MZ_PARAM_ERROR; - if (len != (int32_t)reader->file_info->uncompressed_size) - return MZ_BUF_ERROR; - - /* Create a memory stream backed by our buffer and save to it */ - mz_stream_mem_create(&mem_stream); - mz_stream_mem_set_buffer(mem_stream, buf, len); - - err = mz_stream_mem_open(mem_stream, NULL, MZ_OPEN_MODE_READ); - if (err == MZ_OK) - err = mz_zip_reader_entry_save(handle, mem_stream, mz_stream_mem_write); - - mz_stream_mem_delete(&mem_stream); - return err; -} - -int32_t mz_zip_reader_entry_save_buffer_length(void *handle) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - - if (mz_zip_reader_is_open(reader) != MZ_OK) - return MZ_PARAM_ERROR; - if (!reader->file_info || reader->file_info->uncompressed_size > INT32_MAX) - return MZ_PARAM_ERROR; - - /* Get the maximum size required for the save buffer */ - return (int32_t)reader->file_info->uncompressed_size; -} - -/***************************************************************************/ - -int32_t mz_zip_reader_save_all(void *handle, const char *destination_dir) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - int32_t err = MZ_OK; - uint8_t *utf8_string = NULL; - char path[512]; - char utf8_name[256]; - char resolved_name[256]; - - err = mz_zip_reader_goto_first_entry(handle); - - if (err == MZ_END_OF_LIST) - return err; - - while (err == MZ_OK) { - /* Construct output path */ - path[0] = 0; - - strncpy(utf8_name, reader->file_info->filename, sizeof(utf8_name) - 1); - utf8_name[sizeof(utf8_name) - 1] = 0; - - if ((reader->encoding > 0) && (reader->file_info->flag & MZ_ZIP_FLAG_UTF8) == 0) { - utf8_string = mz_os_utf8_string_create(reader->file_info->filename, reader->encoding); - if (utf8_string) { - strncpy(utf8_name, (char *)utf8_string, sizeof(utf8_name) - 1); - utf8_name[sizeof(utf8_name) - 1] = 0; - mz_os_utf8_string_delete(&utf8_string); - } - } - - err = mz_path_resolve(utf8_name, resolved_name, sizeof(resolved_name)); - if (err != MZ_OK) - break; - - if (destination_dir) - mz_path_combine(path, destination_dir, sizeof(path)); - - mz_path_combine(path, resolved_name, sizeof(path)); - - /* Save file to disk */ - err = mz_zip_reader_entry_save_file(handle, path); - - if (err == MZ_OK) - err = mz_zip_reader_goto_next_entry(handle); - } - - if (err == MZ_END_OF_LIST) - return MZ_OK; - - return err; -} - -/***************************************************************************/ - -void mz_zip_reader_set_pattern(void *handle, const char *pattern, uint8_t ignore_case) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - reader->pattern = pattern; - reader->pattern_ignore_case = ignore_case; -} - -void mz_zip_reader_set_password(void *handle, const char *password) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - reader->password = password; -} - -void mz_zip_reader_set_raw(void *handle, uint8_t raw) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - reader->raw = raw; -} - -int32_t mz_zip_reader_get_raw(void *handle, uint8_t *raw) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - if (!raw) - return MZ_PARAM_ERROR; - *raw = reader->raw; - return MZ_OK; -} - -int32_t mz_zip_reader_get_zip_cd(void *handle, uint8_t *zip_cd) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - if (!zip_cd) - return MZ_PARAM_ERROR; - *zip_cd = reader->cd_zipped; - return MZ_OK; -} - -int32_t mz_zip_reader_get_comment(void *handle, const char **comment) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - if (mz_zip_reader_is_open(reader) != MZ_OK) - return MZ_PARAM_ERROR; - if (!comment) - return MZ_PARAM_ERROR; - return mz_zip_get_comment(reader->zip_handle, comment); -} - -int32_t mz_zip_reader_set_recover(void *handle, uint8_t recover) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - if (!reader) - return MZ_PARAM_ERROR; - reader->recover = recover; - return MZ_OK; -} - -void mz_zip_reader_set_encoding(void *handle, int32_t encoding) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - reader->encoding = encoding; -} - -void mz_zip_reader_set_sign_required(void *handle, uint8_t sign_required) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - reader->sign_required = sign_required; -} - -void mz_zip_reader_set_overwrite_cb(void *handle, void *userdata, mz_zip_reader_overwrite_cb cb) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - reader->overwrite_cb = cb; - reader->overwrite_userdata = userdata; -} - -void mz_zip_reader_set_password_cb(void *handle, void *userdata, mz_zip_reader_password_cb cb) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - reader->password_cb = cb; - reader->password_userdata = userdata; -} - -void mz_zip_reader_set_progress_cb(void *handle, void *userdata, mz_zip_reader_progress_cb cb) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - reader->progress_cb = cb; - reader->progress_userdata = userdata; -} - -void mz_zip_reader_set_progress_interval(void *handle, uint32_t milliseconds) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - reader->progress_cb_interval_ms = milliseconds; -} - -void mz_zip_reader_set_entry_cb(void *handle, void *userdata, mz_zip_reader_entry_cb cb) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - reader->entry_cb = cb; - reader->entry_userdata = userdata; -} - -int32_t mz_zip_reader_get_zip_handle(void *handle, void **zip_handle) { - mz_zip_reader *reader = (mz_zip_reader *)handle; - if (!zip_handle) - return MZ_PARAM_ERROR; - *zip_handle = reader->zip_handle; - if (!*zip_handle) - return MZ_EXIST_ERROR; - return MZ_OK; -} - -/***************************************************************************/ - -void *mz_zip_reader_create(void **handle) { - mz_zip_reader *reader = NULL; - - reader = (mz_zip_reader *)calloc(1, sizeof(mz_zip_reader)); - if (reader) { - reader->recover = 1; - reader->progress_cb_interval_ms = MZ_DEFAULT_PROGRESS_INTERVAL; - } - if (handle) - *handle = reader; - - return reader; -} - -void mz_zip_reader_delete(void **handle) { - mz_zip_reader *reader = NULL; - if (!handle) - return; - reader = (mz_zip_reader *)*handle; - if (reader) { - mz_zip_reader_close(reader); - free(reader); - } - *handle = NULL; -} - -/***************************************************************************/ - -typedef struct mz_zip_writer_s { - void *zip_handle; - void *file_stream; - void *buffered_stream; - void *split_stream; - void *sha256; - void *mem_stream; - void *file_extra_stream; - mz_zip_file file_info; - void *overwrite_userdata; - mz_zip_writer_overwrite_cb - overwrite_cb; - void *password_userdata; - mz_zip_writer_password_cb - password_cb; - void *progress_userdata; - mz_zip_writer_progress_cb - progress_cb; - uint32_t progress_cb_interval_ms; - void *entry_userdata; - mz_zip_writer_entry_cb - entry_cb; - const char *password; - const char *comment; - uint8_t *cert_data; - int32_t cert_data_size; - const char *cert_pwd; - uint16_t compress_method; - int16_t compress_level; - uint8_t follow_links; - uint8_t store_links; - uint8_t zip_cd; - uint8_t aes; - uint8_t raw; - uint8_t buffer[UINT16_MAX]; -} mz_zip_writer; - -/***************************************************************************/ - -int32_t mz_zip_writer_zip_cd(void *handle) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - mz_zip_file cd_file; - uint64_t number_entry = 0; - int64_t cd_mem_length = 0; - int32_t err = MZ_OK; - int32_t extrafield_size = 0; - void *file_extra_stream = NULL; - void *cd_mem_stream = NULL; - - memset(&cd_file, 0, sizeof(cd_file)); - - mz_zip_get_number_entry(writer->zip_handle, &number_entry); - mz_zip_get_cd_mem_stream(writer->zip_handle, &cd_mem_stream); - mz_stream_seek(cd_mem_stream, 0, MZ_SEEK_END); - cd_mem_length = (uint32_t)mz_stream_tell(cd_mem_stream); - mz_stream_seek(cd_mem_stream, 0, MZ_SEEK_SET); - - cd_file.filename = MZ_ZIP_CD_FILENAME; - cd_file.modified_date = time(NULL); - cd_file.version_madeby = MZ_VERSION_MADEBY; - cd_file.compression_method = writer->compress_method; - cd_file.uncompressed_size = (int32_t)cd_mem_length; - cd_file.flag = MZ_ZIP_FLAG_UTF8; - - if (writer->password) - cd_file.flag |= MZ_ZIP_FLAG_ENCRYPTED; - - mz_stream_mem_create(&file_extra_stream); - mz_stream_mem_open(file_extra_stream, NULL, MZ_OPEN_MODE_CREATE); - - mz_zip_extrafield_write(file_extra_stream, MZ_ZIP_EXTENSION_CDCD, 8); - - mz_stream_write_uint64(file_extra_stream, number_entry); - - mz_stream_mem_get_buffer(file_extra_stream, (const void **)&cd_file.extrafield); - mz_stream_mem_get_buffer_length(file_extra_stream, &extrafield_size); - cd_file.extrafield_size = (uint16_t)extrafield_size; - - err = mz_zip_writer_entry_open(handle, &cd_file); - if (err == MZ_OK) { - mz_stream_copy_stream(handle, mz_zip_writer_entry_write, cd_mem_stream, - NULL, (int32_t)cd_mem_length); - - mz_stream_seek(cd_mem_stream, 0, MZ_SEEK_SET); - mz_stream_mem_set_buffer_limit(cd_mem_stream, 0); - - err = mz_zip_writer_entry_close(writer); - } - - mz_stream_mem_delete(&file_extra_stream); - - return err; -} - -/***************************************************************************/ - -int32_t mz_zip_writer_is_open(void *handle) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - if (!writer || !writer->zip_handle) - return MZ_PARAM_ERROR; - return MZ_OK; -} - -static int32_t mz_zip_writer_open_int(void *handle, void *stream, int32_t mode) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - int32_t err = MZ_OK; - - mz_zip_create(&writer->zip_handle); - err = mz_zip_open(writer->zip_handle, stream, mode); - - if (err != MZ_OK) { - mz_zip_writer_close(handle); - return err; - } - - return MZ_OK; -} - -int32_t mz_zip_writer_open(void *handle, void *stream, uint8_t append) { - int32_t mode = MZ_OPEN_MODE_WRITE; - - if (append) { - mode |= MZ_OPEN_MODE_APPEND; - } else { - mode |= MZ_OPEN_MODE_CREATE; - } - - return mz_zip_writer_open_int(handle, stream, mode); -} - -int32_t mz_zip_writer_open_file(void *handle, const char *path, int64_t disk_size, uint8_t append) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - int32_t mode = MZ_OPEN_MODE_READWRITE; - int32_t err = MZ_OK; - int32_t err_cb = 0; - char directory[320]; - - mz_zip_writer_close(handle); - - if (mz_os_file_exists(path) != MZ_OK) { - /* If the file doesn't exist, we don't append file */ - mode |= MZ_OPEN_MODE_CREATE; - - /* Create destination directory if it doesn't already exist */ - if (strchr(path, '/') || strrchr(path, '\\')) { - strncpy(directory, path, sizeof(directory) - 1); - directory[sizeof(directory) - 1] = 0; - mz_path_remove_filename(directory); - if (mz_os_file_exists(directory) != MZ_OK) - mz_dir_make(directory); - } - } else if (append) { - mode |= MZ_OPEN_MODE_APPEND; - } else { - if (writer->overwrite_cb) - err_cb = writer->overwrite_cb(handle, writer->overwrite_userdata, path); - - if (err_cb == MZ_INTERNAL_ERROR) - return err; - - if (err_cb == MZ_OK) - mode |= MZ_OPEN_MODE_CREATE; - else - mode |= MZ_OPEN_MODE_APPEND; - } - - mz_stream_os_create(&writer->file_stream); - mz_stream_buffered_create(&writer->buffered_stream); - mz_stream_split_create(&writer->split_stream); - - mz_stream_set_base(writer->buffered_stream, writer->file_stream); - mz_stream_set_base(writer->split_stream, writer->buffered_stream); - - mz_stream_split_set_prop_int64(writer->split_stream, MZ_STREAM_PROP_DISK_SIZE, disk_size); - - err = mz_stream_open(writer->split_stream, path, mode); - if (err == MZ_OK) - err = mz_zip_writer_open_int(handle, writer->split_stream, mode); - - return err; -} - -int32_t mz_zip_writer_open_file_in_memory(void *handle, const char *path) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - void *file_stream = NULL; - int64_t file_size = 0; - int32_t err = 0; - - mz_zip_writer_close(handle); - - mz_stream_os_create(&file_stream); - - err = mz_stream_os_open(file_stream, path, MZ_OPEN_MODE_READ); - - if (err != MZ_OK) { - mz_stream_os_delete(&file_stream); - mz_zip_writer_close(handle); - return err; - } - - mz_stream_os_seek(file_stream, 0, MZ_SEEK_END); - file_size = mz_stream_os_tell(file_stream); - mz_stream_os_seek(file_stream, 0, MZ_SEEK_SET); - - if ((file_size <= 0) || (file_size > UINT32_MAX)) { - /* Memory size is too large or too small */ - - mz_stream_os_close(file_stream); - mz_stream_os_delete(&file_stream); - mz_zip_writer_close(handle); - return MZ_MEM_ERROR; - } - - mz_stream_mem_create(&writer->mem_stream); - mz_stream_mem_set_grow_size(writer->mem_stream, (int32_t)file_size); - mz_stream_mem_open(writer->mem_stream, NULL, MZ_OPEN_MODE_CREATE); - - err = mz_stream_copy(writer->mem_stream, file_stream, (int32_t)file_size); - - mz_stream_os_close(file_stream); - mz_stream_os_delete(&file_stream); - - if (err == MZ_OK) - err = mz_zip_writer_open(handle, writer->mem_stream, 1); - if (err != MZ_OK) - mz_zip_writer_close(handle); - - return err; -} - -int32_t mz_zip_writer_close(void *handle) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - int32_t err = MZ_OK; - - if (writer->zip_handle) { - mz_zip_set_version_madeby(writer->zip_handle, MZ_VERSION_MADEBY); - if (writer->comment) - mz_zip_set_comment(writer->zip_handle, writer->comment); - if (writer->zip_cd) - mz_zip_writer_zip_cd(writer); - - err = mz_zip_close(writer->zip_handle); - mz_zip_delete(&writer->zip_handle); - } - - if (writer->split_stream) { - mz_stream_split_close(writer->split_stream); - mz_stream_split_delete(&writer->split_stream); - } - - if (writer->buffered_stream) - mz_stream_buffered_delete(&writer->buffered_stream); - - if (writer->file_stream) - mz_stream_os_delete(&writer->file_stream); - - if (writer->mem_stream) { - mz_stream_mem_close(writer->mem_stream); - mz_stream_mem_delete(&writer->mem_stream); - } - - return err; -} - -/***************************************************************************/ - -int32_t mz_zip_writer_entry_open(void *handle, mz_zip_file *file_info) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - int32_t err = MZ_OK; - const char *password = NULL; - char password_buf[120]; - - /* Copy file info to access data upon close */ - memcpy(&writer->file_info, file_info, sizeof(mz_zip_file)); - - if (writer->entry_cb) - writer->entry_cb(handle, writer->entry_userdata, &writer->file_info); - - password = writer->password; - - /* Check if we need a password and ask for it if we need to */ - if (!password && writer->password_cb && (writer->file_info.flag & MZ_ZIP_FLAG_ENCRYPTED)) { - writer->password_cb(handle, writer->password_userdata, &writer->file_info, - password_buf, sizeof(password_buf)); - password = password_buf; - } - -#ifndef MZ_ZIP_NO_CRYPTO - if (mz_zip_attrib_is_dir(writer->file_info.external_fa, writer->file_info.version_madeby) != MZ_OK) { - /* Start calculating sha256 */ - mz_crypt_sha_create(&writer->sha256); - mz_crypt_sha_set_algorithm(writer->sha256, MZ_HASH_SHA256); - mz_crypt_sha_begin(writer->sha256); - } -#endif - - /* Open entry in zip */ - err = mz_zip_entry_write_open(writer->zip_handle, &writer->file_info, writer->compress_level, - writer->raw, password); - - return err; -} - -#if !defined(MZ_ZIP_NO_CRYPTO) && defined(MZ_ZIP_SIGNING) -int32_t mz_zip_writer_entry_sign(void *handle, uint8_t *message, int32_t message_size, - uint8_t *cert_data, int32_t cert_data_size, const char *cert_pwd) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - int32_t err = MZ_OK; - int32_t signature_size = 0; - uint8_t *signature = NULL; - - if (!writer || !cert_data || cert_data_size <= 0) - return MZ_PARAM_ERROR; - if (mz_zip_entry_is_open(writer->zip_handle) != MZ_OK) - return MZ_PARAM_ERROR; - - /* Sign message with certificate */ - err = mz_crypt_sign(message, message_size, cert_data, cert_data_size, cert_pwd, - &signature, &signature_size); - - if (err == MZ_OK && signature) { - /* Write signature zip extra field */ - err = mz_zip_extrafield_write(writer->file_extra_stream, MZ_ZIP_EXTENSION_SIGN, - (uint16_t)signature_size); - - if (err == MZ_OK) { - if (mz_stream_write(writer->file_extra_stream, signature, signature_size) != signature_size) - err = MZ_WRITE_ERROR; - } - - free(signature); - } - - return err; -} -#endif - -int32_t mz_zip_writer_entry_close(void *handle) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - int32_t err = MZ_OK; -#ifndef MZ_ZIP_NO_CRYPTO - const uint8_t *extrafield = NULL; - int32_t extrafield_size = 0; - int16_t field_length_hash = 0; - uint8_t sha256[MZ_HASH_SHA256_SIZE]; - - if (writer->sha256) { - mz_crypt_sha_end(writer->sha256, sha256, sizeof(sha256)); - mz_crypt_sha_delete(&writer->sha256); - - /* Copy extrafield so we can append our own fields before close */ - mz_stream_mem_create(&writer->file_extra_stream); - mz_stream_mem_open(writer->file_extra_stream, NULL, MZ_OPEN_MODE_CREATE); - - /* Write sha256 hash to extrafield */ - field_length_hash = 4 + MZ_HASH_SHA256_SIZE; - err = mz_zip_extrafield_write(writer->file_extra_stream, MZ_ZIP_EXTENSION_HASH, field_length_hash); - if (err == MZ_OK) - err = mz_stream_write_uint16(writer->file_extra_stream, MZ_HASH_SHA256); - if (err == MZ_OK) - err = mz_stream_write_uint16(writer->file_extra_stream, MZ_HASH_SHA256_SIZE); - if (err == MZ_OK) { - if (mz_stream_write(writer->file_extra_stream, sha256, sizeof(sha256)) != MZ_HASH_SHA256_SIZE) - err = MZ_WRITE_ERROR; - } - -#ifdef MZ_ZIP_SIGNING - if ((err == MZ_OK) && (writer->cert_data) && (writer->cert_data_size > 0)) { - /* Sign entry if not zipping cd or if it is cd being zipped */ - if (!writer->zip_cd || strcmp(writer->file_info.filename, MZ_ZIP_CD_FILENAME) == 0) { - err = mz_zip_writer_entry_sign(handle, sha256, sizeof(sha256), - writer->cert_data, writer->cert_data_size, writer->cert_pwd); - } - } -#endif - - if ((writer->file_info.extrafield) && (writer->file_info.extrafield_size > 0)) - mz_stream_mem_write(writer->file_extra_stream, writer->file_info.extrafield, - writer->file_info.extrafield_size); - - /* Update extra field for central directory after adding extra fields */ - mz_stream_mem_get_buffer(writer->file_extra_stream, (const void **)&extrafield); - mz_stream_mem_get_buffer_length(writer->file_extra_stream, &extrafield_size); - - mz_zip_entry_set_extrafield(writer->zip_handle, extrafield, (uint16_t)extrafield_size); - } -#endif - - if (err == MZ_OK) { - if (writer->raw) - err = mz_zip_entry_close_raw(writer->zip_handle, writer->file_info.uncompressed_size, - writer->file_info.crc); - else - err = mz_zip_entry_close(writer->zip_handle); - } - - if (writer->file_extra_stream) - mz_stream_mem_delete(&writer->file_extra_stream); - - return err; -} - -int32_t mz_zip_writer_entry_write(void *handle, const void *buf, int32_t len) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - int32_t written = 0; - written = mz_zip_entry_write(writer->zip_handle, buf, len); -#ifndef MZ_ZIP_NO_CRYPTO - if (written > 0 && writer->sha256) - mz_crypt_sha_update(writer->sha256, buf, written); -#endif - return written; -} -/***************************************************************************/ - -int32_t mz_zip_writer_add_process(void *handle, void *stream, mz_stream_read_cb read_cb) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - int32_t read = 0; - int32_t written = 0; - int32_t err = MZ_OK; - - if (mz_zip_writer_is_open(writer) != MZ_OK) - return MZ_PARAM_ERROR; - /* If the entry isn't open for writing, open it */ - if (mz_zip_entry_is_open(writer->zip_handle) != MZ_OK) - return MZ_PARAM_ERROR; - if (!read_cb) - return MZ_PARAM_ERROR; - - read = read_cb(stream, writer->buffer, sizeof(writer->buffer)); - if (read == 0) - return MZ_END_OF_STREAM; - if (read < 0) { - err = read; - return err; - } - - written = mz_zip_writer_entry_write(handle, writer->buffer, read); - if (written != read) - return MZ_WRITE_ERROR; - - return written; -} - -int32_t mz_zip_writer_add(void *handle, void *stream, mz_stream_read_cb read_cb) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - uint64_t current_time = 0; - uint64_t update_time = 0; - int64_t current_pos = 0; - int64_t update_pos = 0; - int32_t err = MZ_OK; - int32_t written = 0; - - /* Update the progress at the beginning */ - if (writer->progress_cb) - writer->progress_cb(handle, writer->progress_userdata, &writer->file_info, current_pos); - - /* Write data to stream until done */ - while (err == MZ_OK) { - written = mz_zip_writer_add_process(handle, stream, read_cb); - if (written == MZ_END_OF_STREAM) - break; - if (written > 0) - current_pos += written; - if (written < 0) - err = written; - - /* Update progress if enough time have passed */ - current_time = mz_os_ms_time(); - if ((current_time - update_time) > writer->progress_cb_interval_ms) { - if (writer->progress_cb) - writer->progress_cb(handle, writer->progress_userdata, &writer->file_info, current_pos); - - update_pos = current_pos; - update_time = current_time; - } - } - - /* Update the progress at the end */ - if (writer->progress_cb && update_pos != current_pos) - writer->progress_cb(handle, writer->progress_userdata, &writer->file_info, current_pos); - - return err; -} - -int32_t mz_zip_writer_add_info(void *handle, void *stream, mz_stream_read_cb read_cb, mz_zip_file *file_info) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - int32_t err = MZ_OK; - - if (mz_zip_writer_is_open(handle) != MZ_OK) - return MZ_PARAM_ERROR; - if (!file_info) - return MZ_PARAM_ERROR; - - /* Add to zip */ - err = mz_zip_writer_entry_open(handle, file_info); - if (err != MZ_OK) - return err; - - if (stream) { - if (mz_zip_attrib_is_dir(writer->file_info.external_fa, writer->file_info.version_madeby) != MZ_OK) { - err = mz_zip_writer_add(handle, stream, read_cb); - if (err != MZ_OK) - return err; - } - } - - err = mz_zip_writer_entry_close(handle); - - return err; -} - -int32_t mz_zip_writer_add_buffer(void *handle, void *buf, int32_t len, mz_zip_file *file_info) { - void *mem_stream = NULL; - int32_t err = MZ_OK; - - if (mz_zip_writer_is_open(handle) != MZ_OK) - return MZ_PARAM_ERROR; - if (!buf) - return MZ_PARAM_ERROR; - - /* Create a memory stream backed by our buffer and add from it */ - mz_stream_mem_create(&mem_stream); - mz_stream_mem_set_buffer(mem_stream, buf, len); - - err = mz_stream_mem_open(mem_stream, NULL, MZ_OPEN_MODE_READ); - if (err == MZ_OK) - err = mz_zip_writer_add_info(handle, mem_stream, mz_stream_mem_read, file_info); - - mz_stream_mem_delete(&mem_stream); - return err; -} - -int32_t mz_zip_writer_add_file(void *handle, const char *path, const char *filename_in_zip) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - mz_zip_file file_info; - uint32_t target_attrib = 0; - uint32_t src_attrib = 0; - int32_t err = MZ_OK; - uint8_t src_sys = 0; - void *stream = NULL; - char link_path[1024]; - const char *filename = filename_in_zip; - - if (mz_zip_writer_is_open(handle) != MZ_OK) - return MZ_PARAM_ERROR; - if (!path) - return MZ_PARAM_ERROR; - - if (!filename) { - err = mz_path_get_filename(path, &filename); - if (err != MZ_OK) - return err; - } - - memset(&file_info, 0, sizeof(file_info)); - - /* The path name saved, should not include a leading slash. */ - /* If it did, windows/xp and dynazip couldn't read the zip file. */ - - while (filename[0] == '\\' || filename[0] == '/') - filename += 1; - - /* Get information about the file on disk so we can store it in zip */ - - file_info.version_madeby = MZ_VERSION_MADEBY; - file_info.compression_method = writer->compress_method; - file_info.filename = filename; - file_info.uncompressed_size = mz_os_get_file_size(path); - file_info.flag = MZ_ZIP_FLAG_UTF8; - - if (writer->zip_cd) - file_info.flag |= MZ_ZIP_FLAG_MASK_LOCAL_INFO; - if (writer->aes) - file_info.aes_version = MZ_AES_VERSION; - - mz_os_get_file_date(path, &file_info.modified_date, &file_info.accessed_date, - &file_info.creation_date); - mz_os_get_file_attribs(path, &src_attrib); - - src_sys = MZ_HOST_SYSTEM(file_info.version_madeby); - - if ((src_sys != MZ_HOST_SYSTEM_MSDOS) && (src_sys != MZ_HOST_SYSTEM_WINDOWS_NTFS)) { - /* High bytes are OS specific attributes, low byte is always DOS attributes */ - if (mz_zip_attrib_convert(src_sys, src_attrib, MZ_HOST_SYSTEM_MSDOS, &target_attrib) == MZ_OK) - file_info.external_fa = target_attrib; - file_info.external_fa |= (src_attrib << 16); - } else { - file_info.external_fa = src_attrib; - } - - if (writer->store_links && mz_os_is_symlink(path) == MZ_OK) { - err = mz_os_read_symlink(path, link_path, sizeof(link_path)); - if (err == MZ_OK) - file_info.linkname = link_path; - } else if (mz_os_is_dir(path) != MZ_OK) { - mz_stream_os_create(&stream); - err = mz_stream_os_open(stream, path, MZ_OPEN_MODE_READ); - } - - if (err == MZ_OK) - err = mz_zip_writer_add_info(handle, stream, mz_stream_read, &file_info); - - if (stream) { - mz_stream_close(stream); - mz_stream_delete(&stream); - } - - return err; -} - -int32_t mz_zip_writer_add_path(void *handle, const char *path, const char *root_path, - uint8_t include_path, uint8_t recursive) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - DIR *dir = NULL; - struct dirent *entry = NULL; - int32_t err = MZ_OK; - int16_t is_dir = 0; - const char *filename = NULL; - const char *filenameinzip = path; - char *wildcard_ptr = NULL; - char full_path[1024]; - char path_dir[1024]; - - if (strrchr(path, '*')) { - strncpy(path_dir, path, sizeof(path_dir) - 1); - path_dir[sizeof(path_dir) - 1] = 0; - mz_path_remove_filename(path_dir); - wildcard_ptr = path_dir + strlen(path_dir) + 1; - root_path = path = path_dir; - } else { - if (mz_os_is_dir(path) == MZ_OK) - is_dir = 1; - - /* Construct the filename that our file will be stored in the zip as */ - if (!root_path) - root_path = path; - - /* Should the file be stored with any path info at all? */ - if (!include_path) { - if (!is_dir && root_path == path) { - if (mz_path_get_filename(filenameinzip, &filename) == MZ_OK) - filenameinzip = filename; - } else { - filenameinzip += strlen(root_path); - } - } - - if (!writer->store_links && !writer->follow_links) { - if (mz_os_is_symlink(path) == MZ_OK) - return err; - } - - if (*filenameinzip != 0) - err = mz_zip_writer_add_file(handle, path, filenameinzip); - - if (!is_dir) - return err; - - if (writer->store_links) { - if (mz_os_is_symlink(path) == MZ_OK) - return err; - } - } - - dir = mz_os_open_dir(path); - - if (!dir) - return MZ_EXIST_ERROR; - - while ((entry = mz_os_read_dir(dir))) { - if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) - continue; - - full_path[0] = 0; - mz_path_combine(full_path, path, sizeof(full_path)); - mz_path_combine(full_path, entry->d_name, sizeof(full_path)); - - if (!recursive && mz_os_is_dir(full_path) == MZ_OK) - continue; - - if ((wildcard_ptr) && (mz_path_compare_wc(entry->d_name, wildcard_ptr, 1) != MZ_OK)) - continue; - - err = mz_zip_writer_add_path(handle, full_path, root_path, include_path, recursive); - if (err != MZ_OK) - break; - } - - mz_os_close_dir(dir); - return err; -} - -int32_t mz_zip_writer_copy_from_reader(void *handle, void *reader) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - mz_zip_file *file_info = NULL; - int64_t compressed_size = 0; - int64_t uncompressed_size = 0; - uint32_t crc32 = 0; - int32_t err = MZ_OK; - uint8_t original_raw = 0; - void *reader_zip_handle = NULL; - void *writer_zip_handle = NULL; - - if (mz_zip_reader_is_open(reader) != MZ_OK) - return MZ_PARAM_ERROR; - if (mz_zip_writer_is_open(writer) != MZ_OK) - return MZ_PARAM_ERROR; - - err = mz_zip_reader_entry_get_info(reader, &file_info); - - if (err != MZ_OK) - return err; - - mz_zip_reader_get_zip_handle(reader, &reader_zip_handle); - mz_zip_writer_get_zip_handle(writer, &writer_zip_handle); - - /* Open entry for raw reading */ - err = mz_zip_entry_read_open(reader_zip_handle, 1, NULL); - - if (err == MZ_OK) { - /* Write entry raw, save original raw value */ - original_raw = writer->raw; - writer->raw = 1; - - err = mz_zip_writer_entry_open(writer, file_info); - - if ((err == MZ_OK) && - (mz_zip_attrib_is_dir(writer->file_info.external_fa, writer->file_info.version_madeby) != MZ_OK)) { - err = mz_zip_writer_add(writer, reader_zip_handle, mz_zip_entry_read); - } - - if (err == MZ_OK) { - err = mz_zip_entry_read_close(reader_zip_handle, &crc32, &compressed_size, &uncompressed_size); - if (err == MZ_OK) - err = mz_zip_entry_write_close(writer_zip_handle, crc32, compressed_size, uncompressed_size); - } - - if (mz_zip_entry_is_open(reader_zip_handle) == MZ_OK) - mz_zip_entry_close(reader_zip_handle); - - if (mz_zip_entry_is_open(writer_zip_handle) == MZ_OK) - mz_zip_entry_close(writer_zip_handle); - - writer->raw = original_raw; - } - - return err; -} - -/***************************************************************************/ - -void mz_zip_writer_set_password(void *handle, const char *password) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - writer->password = password; -} - -void mz_zip_writer_set_comment(void *handle, const char *comment) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - writer->comment = comment; -} - -void mz_zip_writer_set_raw(void *handle, uint8_t raw) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - writer->raw = raw; -} - -int32_t mz_zip_writer_get_raw(void *handle, uint8_t *raw) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - if (!raw) - return MZ_PARAM_ERROR; - *raw = writer->raw; - return MZ_OK; -} - -void mz_zip_writer_set_aes(void *handle, uint8_t aes) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - writer->aes = aes; -} - -void mz_zip_writer_set_compress_method(void *handle, uint16_t compress_method) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - writer->compress_method = compress_method; -} - -void mz_zip_writer_set_compress_level(void *handle, int16_t compress_level) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - writer->compress_level = compress_level; -} - -void mz_zip_writer_set_follow_links(void *handle, uint8_t follow_links) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - writer->follow_links = follow_links; -} - -void mz_zip_writer_set_store_links(void *handle, uint8_t store_links) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - writer->store_links = store_links; -} - -void mz_zip_writer_set_zip_cd(void *handle, uint8_t zip_cd) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - writer->zip_cd = zip_cd; -} - -int32_t mz_zip_writer_set_certificate(void *handle, const char *cert_path, const char *cert_pwd) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - void *cert_stream = NULL; - uint8_t *cert_data = NULL; - int32_t cert_data_size = 0; - int32_t err = MZ_OK; - - if (!cert_path) - return MZ_PARAM_ERROR; - - cert_data_size = (int32_t)mz_os_get_file_size(cert_path); - - if (cert_data_size == 0) - return MZ_PARAM_ERROR; - - if (writer->cert_data) { - free(writer->cert_data); - writer->cert_data = NULL; - } - - cert_data = (uint8_t *)malloc(cert_data_size); - - /* Read pkcs12 certificate from disk */ - mz_stream_os_create(&cert_stream); - err = mz_stream_os_open(cert_stream, cert_path, MZ_OPEN_MODE_READ); - if (err == MZ_OK) { - if (mz_stream_os_read(cert_stream, cert_data, cert_data_size) != cert_data_size) - err = MZ_READ_ERROR; - mz_stream_os_close(cert_stream); - } - mz_stream_os_delete(&cert_stream); - - if (err == MZ_OK) { - writer->cert_data = cert_data; - writer->cert_data_size = cert_data_size; - writer->cert_pwd = cert_pwd; - } else { - free(cert_data); - } - - return err; -} - -void mz_zip_writer_set_overwrite_cb(void *handle, void *userdata, mz_zip_writer_overwrite_cb cb) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - writer->overwrite_cb = cb; - writer->overwrite_userdata = userdata; -} - -void mz_zip_writer_set_password_cb(void *handle, void *userdata, mz_zip_writer_password_cb cb) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - writer->password_cb = cb; - writer->password_userdata = userdata; -} - -void mz_zip_writer_set_progress_cb(void *handle, void *userdata, mz_zip_writer_progress_cb cb) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - writer->progress_cb = cb; - writer->progress_userdata = userdata; -} - -void mz_zip_writer_set_progress_interval(void *handle, uint32_t milliseconds) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - writer->progress_cb_interval_ms = milliseconds; -} - -void mz_zip_writer_set_entry_cb(void *handle, void *userdata, mz_zip_writer_entry_cb cb) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - writer->entry_cb = cb; - writer->entry_userdata = userdata; -} - -int32_t mz_zip_writer_get_zip_handle(void *handle, void **zip_handle) { - mz_zip_writer *writer = (mz_zip_writer *)handle; - if (!zip_handle) - return MZ_PARAM_ERROR; - *zip_handle = writer->zip_handle; - if (!*zip_handle) - return MZ_EXIST_ERROR; - return MZ_OK; -} - -/***************************************************************************/ - -void *mz_zip_writer_create(void **handle) { - mz_zip_writer *writer = NULL; - - writer = (mz_zip_writer *)calloc(1, sizeof(mz_zip_writer)); - if (writer) { -#if defined(HAVE_WZAES) - writer->aes = 1; -#endif -#if defined(HAVE_ZLIB) || defined(HAVE_LIBCOMP) - writer->compress_method = MZ_COMPRESS_METHOD_DEFLATE; -#elif defined(HAVE_BZIP2) - writer->compress_method = MZ_COMPRESS_METHOD_BZIP2; -#elif defined(HAVE_LZMA) - writer->compress_method = MZ_COMPRESS_METHOD_LZMA; -#else - writer->compress_method = MZ_COMPRESS_METHOD_STORE; -#endif - writer->compress_level = MZ_COMPRESS_LEVEL_BEST; - writer->progress_cb_interval_ms = MZ_DEFAULT_PROGRESS_INTERVAL; - } - if (handle) - *handle = writer; - - return writer; -} - -void mz_zip_writer_delete(void **handle) { - mz_zip_writer *writer = NULL; - if (!handle) - return; - writer = (mz_zip_writer *)*handle; - if (writer) { - mz_zip_writer_close(writer); - - if (writer->cert_data) - free(writer->cert_data); - - writer->cert_data = NULL; - writer->cert_data_size = 0; - - free(writer); - } - *handle = NULL; -} - -/***************************************************************************/ diff --git a/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h b/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h deleted file mode 100644 index 195b50780..000000000 --- a/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +++ /dev/null @@ -1,285 +0,0 @@ -/* mz_zip_rw.h -- Zip reader/writer - part of the minizip-ng project - - Copyright (C) Nathan Moinvaziri - https://github.com/zlib-ng/minizip-ng - - This program is distributed under the terms of the same license as zlib. - See the accompanying LICENSE file for the full text of the license. -*/ - -#ifndef MZ_ZIP_RW_H -#define MZ_ZIP_RW_H - -#ifdef __cplusplus -extern "C" { -#endif - -/***************************************************************************/ - -typedef int32_t (*mz_zip_reader_overwrite_cb)(void *handle, void *userdata, mz_zip_file *file_info, const char *path); -typedef int32_t (*mz_zip_reader_password_cb)(void *handle, void *userdata, mz_zip_file *file_info, char *password, int32_t max_password); -typedef int32_t (*mz_zip_reader_progress_cb)(void *handle, void *userdata, mz_zip_file *file_info, int64_t position); -typedef int32_t (*mz_zip_reader_entry_cb)(void *handle, void *userdata, mz_zip_file *file_info, const char *path); - -/***************************************************************************/ - -int32_t mz_zip_reader_is_open(void *handle); -/* Checks to see if the zip file is open */ - -int32_t mz_zip_reader_open(void *handle, void *stream); -/* Opens zip file from stream */ - -int32_t mz_zip_reader_open_file(void *handle, const char *path); -/* Opens zip file from a file path */ - -int32_t mz_zip_reader_open_file_in_memory(void *handle, const char *path); -/* Opens zip file from a file path into memory for faster access */ - -int32_t mz_zip_reader_open_buffer(void *handle, uint8_t *buf, int32_t len, uint8_t copy); -/* Opens zip file from memory buffer */ - -int32_t mz_zip_reader_close(void *handle); -/* Closes the zip file */ - -/***************************************************************************/ - -int32_t mz_zip_reader_unzip_cd(void *handle); -/* Unzip the central directory */ - -/***************************************************************************/ - -int32_t mz_zip_reader_goto_first_entry(void *handle); -/* Goto the first entry in the zip file that matches the pattern */ - -int32_t mz_zip_reader_goto_next_entry(void *handle); -/* Goto the next entry in the zip file that matches the pattern */ - -int32_t mz_zip_reader_locate_entry(void *handle, const char *filename, uint8_t ignore_case); -/* Locates an entry by filename */ - -int32_t mz_zip_reader_entry_open(void *handle); -/* Opens an entry for reading */ - -int32_t mz_zip_reader_entry_close(void *handle); -/* Closes an entry */ - -int32_t mz_zip_reader_entry_read(void *handle, void *buf, int32_t len); -/* Reads and entry after being opened */ - -int32_t mz_zip_reader_entry_has_sign(void *handle); -/* Checks to see if the entry has a signature */ - -int32_t mz_zip_reader_entry_sign_verify(void *handle); -/* Verifies a signature stored with the entry */ - -int32_t mz_zip_reader_entry_get_hash(void *handle, uint16_t algorithm, uint8_t *digest, int32_t digest_size); -/* Gets a hash algorithm from the entry's extra field */ - -int32_t mz_zip_reader_entry_get_first_hash(void *handle, uint16_t *algorithm, uint16_t *digest_size); -/* Gets the most secure hash algorithm from the entry's extra field */ - -int32_t mz_zip_reader_entry_get_info(void *handle, mz_zip_file **file_info); -/* Gets the current entry file info */ - -int32_t mz_zip_reader_entry_is_dir(void *handle); -/* Gets the current entry is a directory */ - -int32_t mz_zip_reader_entry_save(void *handle, void *stream, mz_stream_write_cb write_cb); -/* Save the current entry to a stream */ - -int32_t mz_zip_reader_entry_save_process(void *handle, void *stream, mz_stream_write_cb write_cb); -/* Saves a portion of the current entry to a stream callback */ - -int32_t mz_zip_reader_entry_save_file(void *handle, const char *path); -/* Save the current entry to a file */ - -int32_t mz_zip_reader_entry_save_buffer(void *handle, void *buf, int32_t len); -/* Save the current entry to a memory buffer */ - -int32_t mz_zip_reader_entry_save_buffer_length(void *handle); -/* Gets the length of the buffer required to save */ - -/***************************************************************************/ - -int32_t mz_zip_reader_save_all(void *handle, const char *destination_dir); -/* Save all files into a directory */ - -/***************************************************************************/ - -void mz_zip_reader_set_pattern(void *handle, const char *pattern, uint8_t ignore_case); -/* Sets the match pattern for entries in the zip file, if null all entries are matched */ - -void mz_zip_reader_set_password(void *handle, const char *password); -/* Sets the password required for extraction */ - -void mz_zip_reader_set_raw(void *handle, uint8_t raw); -/* Sets whether or not it should save the entry raw */ - -int32_t mz_zip_reader_get_raw(void *handle, uint8_t *raw); -/* Gets whether or not it should save the entry raw */ - -int32_t mz_zip_reader_get_zip_cd(void *handle, uint8_t *zip_cd); -/* Gets whether or not the archive has a zipped central directory */ - -int32_t mz_zip_reader_get_comment(void *handle, const char **comment); -/* Gets the comment for the central directory */ - -int32_t mz_zip_reader_set_recover(void *handle, uint8_t recover); -/* Sets the ability to recover the central dir by reading local file headers */ - -void mz_zip_reader_set_encoding(void *handle, int32_t encoding); -/* Sets whether or not it should support a special character encoding in zip file names. */ - -void mz_zip_reader_set_sign_required(void *handle, uint8_t sign_required); -/* Sets whether or not it a signature is required */ - -void mz_zip_reader_set_overwrite_cb(void *handle, void *userdata, mz_zip_reader_overwrite_cb cb); -/* Callback for what to do when a file is being overwritten */ - -void mz_zip_reader_set_password_cb(void *handle, void *userdata, mz_zip_reader_password_cb cb); -/* Callback for when a password is required and hasn't been set */ - -void mz_zip_reader_set_progress_cb(void *handle, void *userdata, mz_zip_reader_progress_cb cb); -/* Callback for extraction progress */ - -void mz_zip_reader_set_progress_interval(void *handle, uint32_t milliseconds); -/* Let at least milliseconds pass between calls to progress callback */ - -void mz_zip_reader_set_entry_cb(void *handle, void *userdata, mz_zip_reader_entry_cb cb); -/* Callback for zip file entries */ - -int32_t mz_zip_reader_get_zip_handle(void *handle, void **zip_handle); -/* Gets the underlying zip instance handle */ - -void* mz_zip_reader_create(void **handle); -/* Create new instance of zip reader */ - -void mz_zip_reader_delete(void **handle); -/* Delete instance of zip reader */ - -/***************************************************************************/ - -typedef int32_t (*mz_zip_writer_overwrite_cb)(void *handle, void *userdata, const char *path); -typedef int32_t (*mz_zip_writer_password_cb)(void *handle, void *userdata, mz_zip_file *file_info, char *password, int32_t max_password); -typedef int32_t (*mz_zip_writer_progress_cb)(void *handle, void *userdata, mz_zip_file *file_info, int64_t position); -typedef int32_t (*mz_zip_writer_entry_cb)(void *handle, void *userdata, mz_zip_file *file_info); - -/***************************************************************************/ - -int32_t mz_zip_writer_is_open(void *handle); -/* Checks to see if the zip file is open */ - -int32_t mz_zip_writer_open(void *handle, void *stream, uint8_t append); -/* Opens zip file from stream */ - -int32_t mz_zip_writer_open_file(void *handle, const char *path, int64_t disk_size, uint8_t append); -/* Opens zip file from a file path */ - -int32_t mz_zip_writer_open_file_in_memory(void *handle, const char *path); -/* Opens zip file from a file path into memory for faster access */ - -int32_t mz_zip_writer_close(void *handle); -/* Closes the zip file */ - -/***************************************************************************/ - -int32_t mz_zip_writer_entry_open(void *handle, mz_zip_file *file_info); -/* Opens an entry in the zip file for writing */ - -int32_t mz_zip_writer_entry_close(void *handle); -/* Closes entry in zip file */ - -int32_t mz_zip_writer_entry_write(void *handle, const void *buf, int32_t len); -/* Writes data into entry for zip */ - -/***************************************************************************/ - -int32_t mz_zip_writer_add(void *handle, void *stream, mz_stream_read_cb read_cb); -/* Writes all data to the currently open entry in the zip */ - -int32_t mz_zip_writer_add_process(void *handle, void *stream, mz_stream_read_cb read_cb); -/* Writes a portion of data to the currently open entry in the zip */ - -int32_t mz_zip_writer_add_info(void *handle, void *stream, mz_stream_read_cb read_cb, mz_zip_file *file_info); -/* Adds an entry to the zip based on the info */ - -int32_t mz_zip_writer_add_buffer(void *handle, void *buf, int32_t len, mz_zip_file *file_info); -/* Adds an entry to the zip with a memory buffer */ - -int32_t mz_zip_writer_add_file(void *handle, const char *path, const char *filename_in_zip); -/* Adds an entry to the zip from a file */ - -int32_t mz_zip_writer_add_path(void *handle, const char *path, const char *root_path, uint8_t include_path, - uint8_t recursive); -/* Enumerates a directory or pattern and adds entries to the zip */ - -int32_t mz_zip_writer_copy_from_reader(void *handle, void *reader); -/* Adds an entry from a zip reader instance */ - -/***************************************************************************/ - -void mz_zip_writer_set_password(void *handle, const char *password); -/* Password to use for encrypting files in the zip */ - -void mz_zip_writer_set_comment(void *handle, const char *comment); -/* Comment to use for the archive */ - -void mz_zip_writer_set_raw(void *handle, uint8_t raw); -/* Sets whether or not we should write the entry raw */ - -int32_t mz_zip_writer_get_raw(void *handle, uint8_t *raw); -/* Gets whether or not we should write the entry raw */ - -void mz_zip_writer_set_aes(void *handle, uint8_t aes); -/* Use aes encryption when adding files in zip */ - -void mz_zip_writer_set_compress_method(void *handle, uint16_t compress_method); -/* Sets the compression method when adding files in zip */ - -void mz_zip_writer_set_compress_level(void *handle, int16_t compress_level); -/* Sets the compression level when adding files in zip */ - -void mz_zip_writer_set_follow_links(void *handle, uint8_t follow_links); -/* Follow symbolic links when traversing directories and files to add */ - -void mz_zip_writer_set_store_links(void *handle, uint8_t store_links); -/* Store symbolic links in zip file */ - -void mz_zip_writer_set_zip_cd(void *handle, uint8_t zip_cd); -/* Sets whether or not central directory should be zipped */ - -int32_t mz_zip_writer_set_certificate(void *handle, const char *cert_path, const char *cert_pwd); -/* Sets the certificate and timestamp url to use for signing when adding files in zip */ - -void mz_zip_writer_set_overwrite_cb(void *handle, void *userdata, mz_zip_writer_overwrite_cb cb); -/* Callback for what to do when zip file already exists */ - -void mz_zip_writer_set_password_cb(void *handle, void *userdata, mz_zip_writer_password_cb cb); -/* Callback for ask if a password is required for adding */ - -void mz_zip_writer_set_progress_cb(void *handle, void *userdata, mz_zip_writer_progress_cb cb); -/* Callback for compression progress */ - -void mz_zip_writer_set_progress_interval(void *handle, uint32_t milliseconds); -/* Let at least milliseconds pass between calls to progress callback */ - -void mz_zip_writer_set_entry_cb(void *handle, void *userdata, mz_zip_writer_entry_cb cb); -/* Callback for zip file entries */ - -int32_t mz_zip_writer_get_zip_handle(void *handle, void **zip_handle); -/* Gets the underlying zip handle */ - -void* mz_zip_writer_create(void **handle); -/* Create new instance of zip writer */ - -void mz_zip_writer_delete(void **handle); -/* Delete instance of zip writer */ - -/***************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif From 1d774ba2cd8aa87ceefd3b923b56cf5008952240 Mon Sep 17 00:00:00 2001 From: Hebert Date: Mon, 27 Apr 2026 10:50:31 -0300 Subject: [PATCH 4/7] Update copyright information in LICENSE.md to reflect Source Push ownership --- LICENSE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 9871df086..60d1dee42 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ -Microsoft CodePush Plugin for React Native +Source Push React Native CodePush Plugin -Copyright (c) Microsoft Corporation +Copyright (c) Source Push All rights reserved. From c5110083f2a1646a2fef2a6076d9f41d5eda0624 Mon Sep 17 00:00:00 2001 From: Hebert Date: Mon, 27 Apr 2026 10:50:40 -0300 Subject: [PATCH 5/7] Update README.md to reflect Source Push branding and correct terminology --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 1e729b0d2..ab3a96d3e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -#### [Sign up With Source Push](https://console.srcpush.com/register) to use Source Push SDK +#### [Sign up with Source Push](https://srcpush.com/) to use the Source Push SDK # React Native SDK for Source Push (CodePush compatible service) @@ -14,7 +14,7 @@ This plugin provides client-side integration for the [Source Push service](https * [Android Setup](docs/setup-android.md) * [Plugin Usage](#plugin-usage) * [Releasing Updates](#releasing-updates) -* [Migrate from Appcenter to Source Push](#migrate-from-appcenter) +* [Migrate from App Center to Source Push](#migrate-from-appcenter) * [Continuous Integration / Delivery](#continuous-integration--delivery) * [Multi-Deployment Testing](#multi-deployment-testing) * [Android](docs/multi-deployment-testing-android.md) @@ -34,9 +34,9 @@ This plugin provides client-side integration for the [Source Push service](https A React Native app is composed of JavaScript files and any accompanying [images](https://reactnative.dev/docs/image), which are bundled together by the [metro bundler](https://github.com/facebook/metro) and distributed as part of a platform-specific binary (i.e. an `.ipa` or `.apk` file). Once the app is released, updating either the JavaScript code (e.g. making bug fixes, adding new features) or image assets, requires you to recompile and redistribute the entire binary, which of course, includes any review time associated with the store(s) you are publishing to. -The Source Push plugin helps get product improvements in front of your end users instantly, by keeping your JavaScript and images synchronized with updates you release to the Source Push server. This way, your app gets the benefits of an offline mobile experience, as well as the "web-like" agility of side-loading updates as soon as they are available. It's a win-win! +The Source Push SDK helps get product improvements in front of your end users instantly, by keeping your JavaScript and images synchronized with updates you release to the Source Push service. This way, your app gets the benefits of an offline mobile experience, as well as the "web-like" agility of side-loading updates as soon as they are available. It's a win-win! -In order to ensure that your end users always have a functioning version of your app, the Source Push plugin maintains a copy of the previous update, so that in the event that you accidentally push an update which includes a crash, it can automatically roll back. This way, you can rest assured that your newfound release agility won't result in users becoming blocked before you have a chance to roll back on the server. It's a win-win-win! +In order to ensure that your end users always have a functioning version of your app, the Source Push SDK maintains a copy of the previous update, so that in the event that you accidentally push an update which includes a crash, it can automatically roll back. This way, you can rest assured that your newfound release agility won't result in users becoming blocked before you have a chance to roll back on the server. It's a win-win-win! *Note: Any product changes which touch native code (e.g. modifying your `AppDelegate.m`/`MainActivity.java` file, adding a new plugin) cannot be distributed via Source Push, and therefore, must be updated via the appropriate store(s).* @@ -45,11 +45,11 @@ In order to ensure that your end users always have a functioning version of your * iOS (7+) * Android (4.1+) on TLS 1.2 compatible devices -We try our best to maintain backwards compatibility of our plugin with previous versions of React Native, but due to the nature of the platform, and the existence of breaking changes between releases, it is possible that you need to use a specific version of the Source Push plugin in order to support the exact version of React Native you are using. The following table outlines which Source Push plugin versions officially support the respective React Native versions: +We try our best to maintain backwards compatibility of our plugin with previous versions of React Native, but due to the nature of the platform, and the existence of breaking changes between releases, it is possible that you need to use a specific version of the Source Push SDK in order to support the exact version of React Native you are using. The following table outlines which Source Push SDK versions officially support the respective React Native versions: | React Native version(s) | Supporting Source Push version(s) | |-------------------------|---------------------------------------------------------------------------------------------| -| Reset Content and Settings..` menu item, and then re-running your app. | -| Server responds with a `404` when calling `sync` or `checkForUpdate` | Double-check that the deployment key you added to your `Info.plist` (iOS), `build.gradle` (Android) or that you're passing to `sync`/`checkForUpdate`, is in fact correct. You can run `appcenter codepush deployment list / --displayKeys` to view the correct keys for your app deployments. | +| Server responds with a `404` when calling `sync` or `checkForUpdate` | Double-check that the deployment key you added to your `Info.plist` (iOS), `build.gradle` (Android) or that you're passing to `sync`/`checkForUpdate`, is in fact correct. You can run `srcpush deployment ls / -k` to view the correct keys for your app deployments. | | Update not being discovered | Double-check that the version of your running app (like `1.0.0`) matches the version you specified when releasing the update to CodePush. Additionally, make sure that you are releasing to the same deployment that your app is configured to sync with. | | Update not being displayed after restart | If you're not calling `sync` on app start (like within `componentDidMount` of your root component), then you need to explicitly call `notifyApplicationReady` on app start, otherwise, the plugin will think your update failed and roll it back. | | I've released an update for iOS but my Android app also shows an update and it breaks it | Be sure you have different deployment keys for each platform in order to receive updates correctly | @@ -398,6 +398,6 @@ Now you'll be able to see CodePush logs in either debug or release mode, on both ### TypeScript Consumption -This module ships its `*.d.ts` file as part of its NPM package, which allows you to simply `import` it, and receive intellisense in supporting editors (like Visual Studio Code), as well as compile-time type checking if you're using TypeScript. For the most part, this behavior should just work out of the box, however, if you've specified `es6` as the value for either the `target` or `module` [compiler option](http://www.typescriptlang.org/docs/handbook/compiler-options.html) in your [`tsconfig.json`](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) file, then just make sure that you also set the `moduleResolution` option to `node`. This ensures that the TypeScript compiler will look within the `node_modules` for the type definitions of imported modules. Otherwise, you'll get an error like the following when trying to import the `react-native-code-push` module: `error TS2307: Cannot find module 'react-native-code-push'`. +This module ships its `*.d.ts` file as part of its NPM package, which allows you to simply `import` it, and receive intellisense in supporting editors (like Visual Studio Code), as well as compile-time type checking if you're using TypeScript. For the most part, this behavior should just work out of the box, however, if you've specified `es6` as the value for either the `target` or `module` [compiler option](http://www.typescriptlang.org/docs/handbook/compiler-options.html) in your [`tsconfig.json`](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html) file, then just make sure that you also set the `moduleResolution` option to `node`. This ensures that the TypeScript compiler will look within the `node_modules` for the type definitions of imported modules. Otherwise, you'll get an error like the following when trying to import the `@srcpush/react-native-code-push` module: `error TS2307: Cannot find module '@srcpush/react-native-code-push'`. --- From 6fe99df518cddfa4281c87baba2111a89f5a90ae Mon Sep 17 00:00:00 2001 From: Hebert Date: Mon, 27 Apr 2026 10:51:01 -0300 Subject: [PATCH 6/7] Update documentation to reflect Source Push branding and SDK references --- .github/ISSUE_TEMPLATE.md | 4 ++-- docs/api-android.md | 2 +- docs/api-js.md | 26 ++++++++++++------------ docs/multi-deployment-testing-android.md | 2 +- docs/multi-deployment-testing-ios.md | 6 +++--- docs/setup-ios.md | 4 ++-- docs/setup-windows.md | 4 ++-- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index aab7c89ab..05ce94a72 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -16,12 +16,12 @@ What actually happens? ### Reproducible Demo -* Download https://github.com/microsoft/react-native-code-push/archive/master.zip and unzip. From `Examples` folder run `node create-app.js appName react-native@0.71.19 react-native-code-push@9.0.1` command to generate plain CodePushified React Native app. Please see description on top of `create-app.js` file content if needed +* Download https://github.com/srcpush/react-native-code-push/archive/main.zip and unzip. From the `Examples` folder run `node create-app.js appName react-native@0.71.19 @srcpush/react-native-code-push@1.1.5` to generate a plain Source Push-enabled React Native app. See the description at the top of `create-app.js` if needed. * If you can't reproduce the bug on it, provide us as much info as possible about your project ### Environment -* react-native-code-push version: +* @srcpush/react-native-code-push version: * react-native version: * iOS/Android/Windows version: * Does this reproduce on a debug build or release build? diff --git a/docs/api-android.md b/docs/api-android.md index 406e6251a..78fe24182 100644 --- a/docs/api-android.md +++ b/docs/api-android.md @@ -1,6 +1,6 @@ ### Resource Configuration -Since `autolinking` uses `react-native.config.js` to link plugins, constructors are specified in that file. But you can override custom variables to manage the Source Push plugin by placing these values in string resources. +Since `autolinking` uses `react-native.config.js` to link plugins, constructors are specified in that file. But you can override custom variables to manage the Source Push SDK by placing these values in string resources. - **Public Key** - used for bundle verification in the Code Signing Feature. Please refer to [Code Signing](setup-android.md#code-signing-setup) section for more details about the Code Signing Feature. To set the public key, you should add the content of the public key to `strings.xml` with name `CodePushPublicKey`. Source Push automatically gets this property and enables the Code Signing feature. For example: diff --git a/docs/api-js.md b/docs/api-js.md index 0fafdccbc..0b0d26830 100644 --- a/docs/api-js.md +++ b/docs/api-js.md @@ -1,6 +1,6 @@ ## API Reference -The Source Push plugin is made up of two components: +The Source Push SDK is made up of two components: 1. A JavaScript module, which can be imported/required, and allows the app to interact with the service during runtime (for example check for updates, inspect the metadata about the currently running app update). @@ -10,7 +10,7 @@ The following sections describe the shape and behavior of these APIs in detail: ### JavaScript API Reference -When you require `react-native-code-push`, the module object provides the following top-level methods in addition to the root-level [component decorator](#codepush): +When you require `@srcpush/react-native-code-push`, the module object provides the following top-level methods in addition to the root-level [component decorator](#codepush): * [allowRestart](#codepushallowrestart): Re-allows programmatic restarts to occur as a result of an update being installed, and optionally, immediately restarts the app if a pending update had attempted to restart the app while restarts were disallowed. This is an advanced API and is only necessary if your app explicitly disallowed restarts via the `disallowRestart` method. @@ -128,7 +128,7 @@ The `codePush` decorator accepts an "options" object that allows you to customiz * __minimumBackgroundDuration__ *(Number)* - Specifies the minimum number of seconds that the app needs to have been in the background before restarting the app. This property only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME` or `InstallMode.ON_NEXT_SUSPEND`, and can be useful for getting your update in front of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying the update immediately after a resume or unless the app suspension is long enough to not matter, regardless how long it was in the background. -* __updateDialog__ *(UpdateDialogOptions)* - An "options" object used to determine whether a confirmation dialog should be displayed to the end user when an update is available, and if so, what strings to use. Defaults to `null`, which has the effect of disabling the dialog completely. Setting this to any truthy value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as overriding one or more of the default strings. Before enabling this option within an App Store-distributed app, please refer to [this note](https://github.com/microsoft/react-native-code-push#app-store). +* __updateDialog__ *(UpdateDialogOptions)* - An "options" object used to determine whether a confirmation dialog should be displayed to the end user when an update is available, and if so, what strings to use. Defaults to `null`, which has the effect of disabling the dialog completely. Setting this to any truthy value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as overriding one or more of the default strings. Before enabling this option within an App Store-distributed app, please refer to [this note](https://github.com/srcpush/react-native-code-push#app-store). The following list represents the available options and their defaults: @@ -162,7 +162,7 @@ Called when the sync process moves from one stage to another in the overall upda ##### codePushDownloadDidProgress (event hook) -Called periodically when an available update is being downloaded from the Source Push server. The method is called with a `DownloadProgress` object, which contains the following two properties: +Called periodically when an available update is being downloaded from the Source Push service. The method is called with a `DownloadProgress` object, which contains the following two properties: * __totalBytes__ *(Number)* - The total number of bytes expected to be received for this update (i.e. the size of the set of files which changed from the previous release). @@ -248,9 +248,9 @@ Temporarily disallows programmatic restarts to occur as a result of either of fo After calling this method, any calls to `sync` would still be allowed to check for an update, download it and install it, but an attempt to restart the app would be queued until `allowRestart` is called. This way, the restart request is captured and can be "flushed" whenever you want to allow it to occur. -This is an advanced API, and is primarily useful when individual components within your app (like an onboarding process) need to ensure that no end-user interruptions can occur during their lifetime, while continuing to allow the app to keep syncing with the Source Push server at its own pace and using whatever install modes are appropriate. This has the benefit of allowing the app to discover and download available updates as soon as possible, while also preventing any disruptions during key end-user experiences. +This is an advanced API, and is primarily useful when individual components within your app (like an onboarding process) need to ensure that no end-user interruptions can occur during their lifetime, while continuing to allow the app to keep syncing with the Source Push service at its own pace and using whatever install modes are appropriate. This has the benefit of allowing the app to discover and download available updates as soon as possible, while also preventing any disruptions during key end-user experiences. -As an alternative, you could also choose to simply use `InstallMode.ON_NEXT_RESTART` whenever calling `sync` (which will never attempt to programmatically restart the app), and then explicity calling `restartApp` at points in your app that you know it is "safe" to do so. `disallowRestart` provides an alternative approach to this when the code that synchronizes with the CodePush server is separate from the code/components that want to enforce a no-restart policy. +As an alternative, you could also choose to simply use `InstallMode.ON_NEXT_RESTART` whenever calling `sync` (which will never attempt to programmatically restart the app), and then explicity calling `restartApp` at points in your app that you know it is "safe" to do so. `disallowRestart` provides an alternative approach to this when the code that synchronizes with the Source Push service is separate from the code/components that want to enforce a no-restart policy. Example Usage: @@ -456,7 +456,7 @@ In addition to the options, the `sync` method also accepts several optional func * __syncStatusChangedCallback__ *((syncStatus: Number) => void)* - Called when the sync process moves from one stage to another in the overall update process. The method is called with a status code which represents the current state, and can be any of the [`SyncStatus`](#syncstatus) values. -* __downloadProgressCallback__ *((progress: DownloadProgress) => void)* - Called periodically when an available update is being downloaded from the CodePush server. The method is called with a `DownloadProgress` object, which contains the following two properties: +* __downloadProgressCallback__ *((progress: DownloadProgress) => void)* - Called periodically when an available update is being downloaded from the Source Push service. The method is called with a `DownloadProgress` object, which contains the following two properties: * __totalBytes__ *(Number)* - The total number of bytes expected to be received for this update (i.e. the size of the set of files which changed from the previous release). @@ -489,7 +489,7 @@ codePush.sync({ updateDialog: true }, This method returns a `Promise` which is resolved to a `SyncStatus` code that indicates why the `sync` call succeeded. This code can be one of the following `SyncStatus` values: -* __codePush.SyncStatus.UP_TO_DATE__ *(0)* - The app is up-to-date with the CodePush server. +* __codePush.SyncStatus.UP_TO_DATE__ *(0)* - The app is up-to-date with the Source Push service. * __codePush.SyncStatus.UPDATE_IGNORED__ *(2)* - The app had an optional update which the end user chose to ignore. (This is only applicable when the `updateDialog` is used) @@ -505,7 +505,7 @@ The `checkForUpdate` and `getUpdateMetadata` methods return `Promise` objects, t * [LocalPackage](#localpackage): Represents a downloaded update that is either already running, or has been installed and is pending an app restart. -* [RemotePackage](#remotepackage): Represents an available update on the CodePush server that hasn't been downloaded yet. +* [RemotePackage](#remotepackage): Represents an available update on the Source Push service that hasn't been downloaded yet. ##### LocalPackage @@ -519,7 +519,7 @@ Contains details about an update that has been downloaded locally or already ins - __isFirstRun__: Indicates whether this is the first time the update has been run after being installed. This is useful for determining whether you would like to show a "What's New?" UI to the end user after installing an update. *(Boolean)* - __isMandatory__: Indicates whether the update is considered mandatory. This is the value that was specified in the CLI when the update was released. *(Boolean)* - __isPending__: Indicates whether this update is in a "pending" state. When `true`, that means the update has been downloaded and installed, but the app restart needed to apply it hasn't occurred yet, and therefore, it's changes aren't currently visible to the end-user. *(Boolean)* -- __label__: The internal label automatically given to the update by the CodePush server, such as `v5`. This value uniquely identifies the update within it's deployment. *(String)* +- __label__: The internal label automatically given to the update by the Source Push service, such as `v5`. This value uniquely identifies the update within it's deployment. *(String)* - __packageHash__: The SHA hash value of the update. *(String)* - __packageSize__: The size of the code contained within the update, in bytes. *(Number)* @@ -529,7 +529,7 @@ Contains details about an update that has been downloaded locally or already ins ##### RemotePackage -Contains details about an update that is available for download from the CodePush server. You get a reference to an instance of this object by calling the `checkForUpdate` method when an update is available. If you are using the `sync` API, you don't need to worry about the `RemotePackage`, since it will handle the download and installation process automatically for you. +Contains details about an update that is available for download from the Source Push service. You get a reference to an instance of this object by calling the `checkForUpdate` method when an update is available. If you are using the `sync` API, you don't need to worry about the `RemotePackage`, since it will handle the download and installation process automatically for you. ###### Properties @@ -576,9 +576,9 @@ This enum is provided to the `syncStatusChangedCallback` function that can be pa * __codePush.SyncStatus.UPDATE_IGNORED__ *(2)* - The app has an optional update, which the end user chose to ignore. (This is only applicable when the `updateDialog` is used) * __codePush.SyncStatus.UNKNOWN_ERROR__ *(3)* - The sync operation encountered an unknown error. * __codePush.SyncStatus.SYNC_IN_PROGRESS__ *(4)* - There is an ongoing `sync` operation running which prevents the current call from being executed. -* __codePush.SyncStatus.CHECKING_FOR_UPDATE__ *(5)* - The CodePush server is being queried for an update. +* __codePush.SyncStatus.CHECKING_FOR_UPDATE__ *(5)* - The Source Push service is being queried for an update. * __codePush.SyncStatus.AWAITING_USER_ACTION__ *(6)* - An update is available, and a confirmation dialog was shown to the end user. (This is only applicable when the `updateDialog` is used) -* __codePush.SyncStatus.DOWNLOADING_PACKAGE__ *(7)* - An available update is being downloaded from the CodePush server. +* __codePush.SyncStatus.DOWNLOADING_PACKAGE__ *(7)* - An available update is being downloaded from the Source Push service. * __codePush.SyncStatus.INSTALLING_UPDATE__ *(8)* - An available update was downloaded and is about to be installed. ##### UpdateState diff --git a/docs/multi-deployment-testing-android.md b/docs/multi-deployment-testing-android.md index 1a25f24eb..30fcb23fc 100644 --- a/docs/multi-deployment-testing-android.md +++ b/docs/multi-deployment-testing-android.md @@ -2,7 +2,7 @@ > NOTE > -> Complete demo configured with "multi-deployment testing" feature is [here](https://github.com/microsoft/react-native-code-push/files/1314118/rncp1004.zip). +> Complete demo configured with "multi-deployment testing" feature is [here](https://github.com/srcpush/react-native-code-push/files/1314118/rncp1004.zip). The [Android Gradle plugin](https://google.github.io/android-gradle-dsl/current/index.html) allows you to define custom config settings for each "build type" (like debug, release). This mechanism allows you to easily configure your debug builds to use your Source Push staging deployment key and your release builds to use your Source Push production deployment key. diff --git a/docs/multi-deployment-testing-ios.md b/docs/multi-deployment-testing-ios.md index 5bcf77798..e3fd42bc5 100644 --- a/docs/multi-deployment-testing-ios.md +++ b/docs/multi-deployment-testing-ios.md @@ -4,8 +4,8 @@ > > Complete demos configured with "multi-deployment testing" feature are [here]: > -> * **without using cocoa pods**: [link](https://github.com/microsoft/react-native-code-push/files/1259957/rncp976.copy.zip) -> * **using cocoa pods**: [link](https://github.com/microsoft/react-native-code-push/files/1172217/rncp893.copy.zip) +> * **without using cocoa pods**: [link](https://github.com/srcpush/react-native-code-push/files/1259957/rncp976.copy.zip) +> * **using cocoa pods**: [link](https://github.com/srcpush/react-native-code-push/files/1172217/rncp893.copy.zip) Xcode allows you to define custom build settings for each "configuration" (like debug, release), which can then be referenced as the value of keys within the `Info.plist` file (like the `CodePushDeploymentKey` setting). This mechanism allows you to easily configure your builds to produce binaries, which are configured to synchronize with different Source Push deployments. @@ -55,6 +55,6 @@ And that's it! Now when you run or build your app, your staging builds will auto *NOTE: CocoaPods users may need to run `pod install` before building with their new release configuration.* -*Note: If you encounter the error message `ld: library not found for ...`, please consult [this issue](https://github.com/microsoft/react-native-code-push/issues/426) for a possible solution.* +*Note: If you encounter the error message `ld: library not found for ...`, please consult [this issue](https://github.com/srcpush/react-native-code-push/issues/426) for a possible solution.* Additionally, if you want to give them seperate names and/or icons, you can modify the `Product Bundle Identifier`, `Product Name` and `Asset Catalog App Icon Set Name` build settings, which will allow your staging builds to be distinguishable from release builds when installed on the same device. diff --git a/docs/setup-ios.md b/docs/setup-ios.md index 7b9329508..c5716536b 100644 --- a/docs/setup-ios.md +++ b/docs/setup-ios.md @@ -1,6 +1,6 @@ ## iOS Setup -Once you've acquired the Source Push plugin, you need to integrate it into the Xcode project of your React Native app and configure it correctly. To do this, take the following steps: +Once you've acquired the Source Push SDK, you need to integrate it into the Xcode project of your React Native app and configure it correctly. To do this, take the following steps: ### Plugin Installation and Configuration for React Native 0.76 version and above (iOS) @@ -92,7 +92,7 @@ That "friendly name" is intended only for authenticated management usage from th ### HTTP exception domains configuration (iOS) -Source Push plugin makes HTTPS requests to the following domains: +The Source Push SDK makes HTTPS requests to the following domains: - api.srcpush.com - blob.srcpush.com diff --git a/docs/setup-windows.md b/docs/setup-windows.md index edac33804..1d3c83a5e 100644 --- a/docs/setup-windows.md +++ b/docs/setup-windows.md @@ -1,6 +1,6 @@ ## Windows Setup -Once you've acquired the Source Push plugin, you need to integrate it into the Visual Studio project of your React Native app and configure it correctly. To do this, take the following steps: +Once you've acquired the Source Push SDK, you need to integrate it into the Visual Studio project of your React Native app and configure it correctly. To do this, take the following steps: ### Plugin Installation and Configuration for React Native Windows 0.63.6 version and above @@ -66,7 +66,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) ![Add Project](https://cloud.githubusercontent.com/assets/116461/14467164/ddf6312e-008e-11e6-8a10-44a8b44b5dfc.PNG) -3. Browse to the `node_modules\react-native-code-push\windows` directory, select the `CodePush.csproj` file and click `OK` +3. Browse to the `node_modules\@srcpush\react-native-code-push\windows` directory, select the `CodePush.csproj` file and click `OK` 4. Back in the `Solution Explorer`, right-click the project node that is named after your app, and select the `Add -> Reference...` menu item From 79d6a4989374245e0f7b436580c96bee0dc9f9bf Mon Sep 17 00:00:00 2001 From: Hebert Date: Mon, 27 Apr 2026 11:19:57 -0300 Subject: [PATCH 7/7] Remove deprecated testing framework scripts and typings - Deleted test.js, testBuilder.js, testConfig.js, testUtil.js, and their corresponding typings. - Cleaned up the codebase by removing unused files related to the CodePush plugin testing framework. - Ensured that all references to the removed files are eliminated to maintain code integrity. --- .../package-lock.json | 1582 ----------------- .../package.json | 35 - .../script/index.js | 17 - .../script/platform.js | 413 ----- .../script/projectManager.js | 81 - .../script/serverUtil.js | 248 --- .../script/test.js | 104 -- .../script/testBuilder.js | 88 - .../script/testConfig.js | 27 - .../script/testUtil.js | 165 -- .../code-push-plugin-testing-framework.d.ts | 488 ----- package-lock.json | 14 - test/plugin-testing-framework-compat.d.ts | 191 -- test/test.ts | 1 - 14 files changed, 3454 deletions(-) delete mode 100644 code-push-plugin-testing-framework/package-lock.json delete mode 100644 code-push-plugin-testing-framework/package.json delete mode 100644 code-push-plugin-testing-framework/script/index.js delete mode 100644 code-push-plugin-testing-framework/script/platform.js delete mode 100644 code-push-plugin-testing-framework/script/projectManager.js delete mode 100644 code-push-plugin-testing-framework/script/serverUtil.js delete mode 100644 code-push-plugin-testing-framework/script/test.js delete mode 100644 code-push-plugin-testing-framework/script/testBuilder.js delete mode 100644 code-push-plugin-testing-framework/script/testConfig.js delete mode 100644 code-push-plugin-testing-framework/script/testUtil.js delete mode 100644 code-push-plugin-testing-framework/typings/code-push-plugin-testing-framework.d.ts delete mode 100644 test/plugin-testing-framework-compat.d.ts diff --git a/code-push-plugin-testing-framework/package-lock.json b/code-push-plugin-testing-framework/package-lock.json deleted file mode 100644 index 9882091f9..000000000 --- a/code-push-plugin-testing-framework/package-lock.json +++ /dev/null @@ -1,1582 +0,0 @@ -{ - "name": "code-push-plugin-testing-framework", - "version": "0.0.1", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "code-push-plugin-testing-framework", - "version": "0.0.1", - "license": "MIT", - "dependencies": { - "@types/uuid": "^8.3.1", - "base-64": "^1.0.0", - "mocha": "^11.1.0", - "mocha-junit-reporter": "latest", - "q": "^1.5.1", - "replace": "latest", - "uuid": "^8.3.2" - } - }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "license": "ISC", - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "license": "MIT", - "optional": true, - "engines": { - "node": ">=14" - } - }, - "node_modules/@types/uuid": { - "version": "8.3.4", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", - "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==", - "license": "MIT" - }, - "node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "license": "Python-2.0" - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "license": "MIT" - }, - "node_modules/base-64": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", - "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==", - "license": "MIT" - }, - "node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "license": "ISC" - }, - "node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/chalk/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/charenc": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", - "license": "BSD-3-Clause", - "engines": { - "node": "*" - } - }, - "node_modules/chokidar": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", - "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", - "license": "MIT", - "dependencies": { - "readdirp": "^4.0.1" - }, - "engines": { - "node": ">= 14.16.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "license": "ISC", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/cliui/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/cliui/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "license": "MIT" - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "license": "MIT" - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/crypt": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", - "license": "BSD-3-Clause", - "engines": { - "node": "*" - } - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/diff": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", - "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "license": "MIT" - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "license": "MIT" - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "license": "MIT", - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "license": "BSD-3-Clause", - "bin": { - "flat": "cli.js" - } - }, - "node_modules/foreground-child": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", - "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", - "license": "ISC", - "dependencies": { - "cross-spawn": "^7.0.6", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/glob": { - "version": "10.5.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", - "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", - "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", - "license": "ISC", - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "license": "MIT", - "bin": { - "he": "bin/he" - } - }, - "node_modules/is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "license": "MIT" - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "license": "ISC" - }, - "node_modules/jackspeak": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", - "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, - "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "license": "MIT", - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "license": "MIT", - "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "license": "ISC" - }, - "node_modules/md5": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", - "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", - "license": "BSD-3-Clause", - "dependencies": { - "charenc": "0.0.2", - "crypt": "0.0.2", - "is-buffer": "~1.1.6" - } - }, - "node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "license": "ISC", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/mkdirp": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", - "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==", - "license": "MIT", - "bin": { - "mkdirp": "dist/cjs/src/bin.js" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/mocha": { - "version": "11.7.5", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.7.5.tgz", - "integrity": "sha512-mTT6RgopEYABzXWFx+GcJ+ZQ32kp4fMf0xvpZIIfSq9Z8lC/++MtcCnQ9t5FP2veYEP95FIYSvW+U9fV4xrlig==", - "license": "MIT", - "peer": true, - "dependencies": { - "browser-stdout": "^1.3.1", - "chokidar": "^4.0.1", - "debug": "^4.3.5", - "diff": "^7.0.0", - "escape-string-regexp": "^4.0.0", - "find-up": "^5.0.0", - "glob": "^10.4.5", - "he": "^1.2.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", - "log-symbols": "^4.1.0", - "minimatch": "^9.0.5", - "ms": "^2.1.3", - "picocolors": "^1.1.1", - "serialize-javascript": "^6.0.2", - "strip-json-comments": "^3.1.1", - "supports-color": "^8.1.1", - "workerpool": "^9.2.0", - "yargs": "^17.7.2", - "yargs-parser": "^21.1.1", - "yargs-unparser": "^2.0.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha.js" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/mocha-junit-reporter": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/mocha-junit-reporter/-/mocha-junit-reporter-2.2.1.tgz", - "integrity": "sha512-iDn2tlKHn8Vh8o4nCzcUVW4q7iXp7cC4EB78N0cDHIobLymyHNwe0XG8HEHHjc3hJlXm0Vy6zcrxaIhnI2fWmw==", - "license": "MIT", - "dependencies": { - "debug": "^4.3.4", - "md5": "^2.3.0", - "mkdirp": "^3.0.0", - "strip-ansi": "^6.0.1", - "xml": "^1.0.1" - }, - "peerDependencies": { - "mocha": ">=2.2.5" - } - }, - "node_modules/mocha-junit-reporter/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/mocha-junit-reporter/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "license": "MIT", - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "license": "MIT", - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json-from-dist": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", - "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", - "license": "BlueOak-1.0.0" - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "license": "ISC" - }, - "node_modules/q": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", - "integrity": "sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==", - "deprecated": "You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other.\n\n(For a CapTP with native promises, see @endo/eventual-send and @endo/captp)", - "license": "MIT", - "engines": { - "node": ">=0.6.0", - "teleport": ">=0.2.0" - } - }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "license": "MIT", - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/readdirp": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", - "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", - "license": "MIT", - "engines": { - "node": ">= 14.18.0" - }, - "funding": { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/replace": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/replace/-/replace-1.2.2.tgz", - "integrity": "sha512-C4EDifm22XZM2b2JOYe6Mhn+lBsLBAvLbK8drfUQLTfD1KYl/n3VaW/CDju0Ny4w3xTtegBpg8YNSpFJPUDSjA==", - "license": "MIT", - "dependencies": { - "chalk": "2.4.2", - "minimatch": "3.0.5", - "yargs": "^15.3.1" - }, - "bin": { - "replace": "bin/replace.js", - "search": "bin/search.js" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/replace/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/replace/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/replace/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/replace/node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/replace/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/replace/node_modules/cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "license": "ISC", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "node_modules/replace/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/replace/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "license": "MIT" - }, - "node_modules/replace/node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/replace/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/replace/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/replace/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/replace/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/replace/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/replace/node_modules/minimatch": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.5.tgz", - "integrity": "sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==", - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/replace/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/replace/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/replace/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/replace/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/replace/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/replace/node_modules/wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/replace/node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/replace/node_modules/wrap-ansi/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/replace/node_modules/wrap-ansi/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "license": "MIT" - }, - "node_modules/replace/node_modules/y18n": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", - "license": "ISC" - }, - "node_modules/replace/node_modules/yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", - "license": "MIT", - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/replace/node_modules/yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "license": "ISC", - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "license": "ISC" - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/serialize-javascript": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", - "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", - "license": "BSD-3-Clause", - "dependencies": { - "randombytes": "^2.1.0" - } - }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", - "license": "ISC" - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "license": "ISC", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/string-width-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", - "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/which-module": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", - "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", - "license": "ISC" - }, - "node_modules/workerpool": { - "version": "9.3.4", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.3.4.tgz", - "integrity": "sha512-TmPRQYYSAnnDiEB0P/Ytip7bFGvqnSU6I2BcuSw7Hx+JSg/DsUi5ebYfc8GYaSdpuvOcEs6dXxPurOYpe9QFwg==", - "license": "Apache-2.0" - }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/wrap-ansi-cjs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", - "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/xml": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", - "integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==", - "license": "MIT" - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "license": "MIT", - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "license": "ISC", - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "license": "MIT", - "dependencies": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" - }, - "node_modules/yargs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - } -} diff --git a/code-push-plugin-testing-framework/package.json b/code-push-plugin-testing-framework/package.json deleted file mode 100644 index 314571ee2..000000000 --- a/code-push-plugin-testing-framework/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "code-push-plugin-testing-framework", - "version": "0.0.1", - "description": "Plugin Testing Framework for CodePush Plugins", - "main": "script/index.js", - "scripts": { - "test": "gulp" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/microsoft/code-push.git" - }, - "author": { - "name": "Microsoft Corporation" - }, - "license": "MIT", - "homepage": "https://microsoft.github.io/code-push", - "dependencies": { - "@types/uuid": "^8.3.1", - "base-64": "^1.0.0", - "mocha": "^11.1.0", - "mocha-junit-reporter": "latest", - "q": "^1.5.1", - "replace": "latest", - "uuid": "^8.3.2" - }, - "bugs": { - "url": "https://github.com/microsoft/code-push/issues" - }, - "readme": "ERROR: No README data found!", - "_id": "code-push-plugin-testing-framework@0.0.1", - "_shasum": "6ea33a661710628af266d714949fe95f88d71f0d", - "_from": "../code-push/plugin-testing-framework/bin", - "_resolved": "file:../code-push/plugin-testing-framework/bin" -} diff --git a/code-push-plugin-testing-framework/script/index.js b/code-push-plugin-testing-framework/script/index.js deleted file mode 100644 index 0dc995d00..000000000 --- a/code-push-plugin-testing-framework/script/index.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -var Platform = require("./platform"); -exports.Platform = Platform; -var PluginTestingFramework = require("./test"); -exports.PluginTestingFramework = PluginTestingFramework; -var projectManager_1 = require("./projectManager"); -exports.ProjectManager = projectManager_1.ProjectManager; -exports.setupTestRunScenario = projectManager_1.setupTestRunScenario; -exports.setupUpdateScenario = projectManager_1.setupUpdateScenario; -var ServerUtil = require("./serverUtil"); -exports.ServerUtil = ServerUtil; -var testBuilder_1 = require("./testBuilder"); -exports.TestBuilder = testBuilder_1.TestBuilder; -var TestConfig = require("./testConfig"); -exports.TestConfig = TestConfig; -var testUtil_1 = require("./testUtil"); -exports.TestUtil = testUtil_1.TestUtil; diff --git a/code-push-plugin-testing-framework/script/platform.js b/code-push-plugin-testing-framework/script/platform.js deleted file mode 100644 index 351cbceb3..000000000 --- a/code-push-plugin-testing-framework/script/platform.js +++ /dev/null @@ -1,413 +0,0 @@ -"use strict"; -var Q = require("q"); -var testUtil_1 = require("./testUtil"); -////////////////////////////////////////////////////////////////////////////////////////// -// PLATFORMS -/** - * Android implementations of IPlatform. - */ -var Android = (function () { - function Android(emulatorManager) { - this.emulatorManager = emulatorManager; - } - /** - * Gets the platform name. (e.g. "android" for the Android platform). - */ - Android.prototype.getName = function () { - return "android"; - }; - /** - * The command line flag used to determine whether or not this platform should run. - * Runs when the flag is present, doesn't run otherwise. - */ - Android.prototype.getCommandLineFlagName = function () { - return "--android"; - }; - /** - * Gets the server url used for testing. - */ - Android.prototype.getServerUrl = function () { - if (!this.serverUrl) - this.serverUrl = process.env.ANDROID_SERVER ? process.env.ANDROID_SERVER : Android.DEFAULT_ANDROID_SERVER_URL; - return this.serverUrl; - }; - /** - * Gets an IEmulatorManager that is used to control the emulator during the tests. - */ - Android.prototype.getEmulatorManager = function () { - return this.emulatorManager; - }; - /** - * Gets the default deployment key. - */ - Android.prototype.getDefaultDeploymentKey = function () { - return "mock-android-deployment-key"; - }; - Android.DEFAULT_ANDROID_SERVER_URL = "http://10.0.2.2:3001"; - return Android; -}()); -exports.Android = Android; -/** - * IOS implementation of IPlatform. - */ -var IOS = (function () { - function IOS(emulatorManager) { - this.emulatorManager = emulatorManager; - } - /** - * Gets the platform name. (e.g. "android" for the Android platform). - */ - IOS.prototype.getName = function () { - return "ios"; - }; - /** - * The command line flag used to determine whether or not this platform should run. - * Runs when the flag is present, doesn't run otherwise. - */ - IOS.prototype.getCommandLineFlagName = function () { - return "--ios"; - }; - /** - * Gets the server url used for testing. - */ - IOS.prototype.getServerUrl = function () { - if (!this.serverUrl) - this.serverUrl = process.env.IOS_SERVER ? process.env.IOS_SERVER : IOS.DEFAULT_IOS_SERVER_URL; - - return this.serverUrl; - }; - /** - * Gets an IEmulatorManager that is used to control the emulator during the tests. - */ - IOS.prototype.getEmulatorManager = function () { - return this.emulatorManager; - }; - /** - * Gets the default deployment key. - */ - IOS.prototype.getDefaultDeploymentKey = function () { - return "mock-ios-deployment-key"; - }; - IOS.DEFAULT_IOS_SERVER_URL = "http://127.0.0.1:3000"; - return IOS; -}()); -exports.IOS = IOS; -////////////////////////////////////////////////////////////////////////////////////////// -// EMULATOR MANAGERS -// bootEmulatorInternal constants -var emulatorMaxReadyAttempts = 50; -var emulatorReadyCheckDelayMs = 5 * 1000; -/** - * Helper function for EmulatorManager implementations to use to boot an emulator with a given platformName and check, start, and kill methods. - */ -function bootEmulatorInternal(platformName, restartEmulators, targetEmulator, checkEmulator, startEmulator, killEmulator) { - var deferred = Q.defer(); - console.log("Setting up " + platformName + " emulator."); - function onEmulatorReady() { - console.log(platformName + " emulator is ready!"); - deferred.resolve(undefined); - return deferred.promise; - } - // Called to check if the emulator for the platform is initialized. - function checkEmulatorReady() { - var checkDeferred = Q.defer(); - console.log("Checking if " + platformName + " emulator is ready yet..."); - // Dummy command that succeeds if emulator is ready and fails otherwise. - checkEmulator(targetEmulator) - .then(function () { - checkDeferred.resolve(undefined); - }, function (error) { - console.info(error); - console.log(platformName + " emulator is not ready yet!"); - checkDeferred.reject(error); - }); - return checkDeferred.promise; - } - var emulatorReadyAttempts = 0; - // Loops checks to see if the emulator is ready and eventually fails after surpassing emulatorMaxReadyAttempts. - function checkEmulatorReadyLooper() { - var looperDeferred = Q.defer(); - emulatorReadyAttempts++; - if (emulatorReadyAttempts > emulatorMaxReadyAttempts) { - console.log(platformName + " emulator is not ready after " + emulatorMaxReadyAttempts + " attempts, abort."); - deferred.reject(platformName + " emulator failed to boot."); - looperDeferred.resolve(undefined); - } - setTimeout(function () { - checkEmulatorReady() - .then(function () { - looperDeferred.resolve(undefined); - onEmulatorReady(); - }, function () { - return checkEmulatorReadyLooper().then(function () { looperDeferred.resolve(undefined); }, function () { looperDeferred.reject(undefined); }); - }); - }, emulatorReadyCheckDelayMs); - return looperDeferred.promise; - } - // Starts and loops the emulator. - function startEmulatorAndLoop() { - console.log("Booting " + platformName + " emulator named " + targetEmulator + "."); - startEmulator(targetEmulator).catch(function (error) { console.log(error); deferred.reject(error); }); - return checkEmulatorReadyLooper(); - } - var promise; - if (restartEmulators) { - console.log("Killing " + platformName + " emulator."); - promise = killEmulator().catch(function () { return null; }).then(startEmulatorAndLoop); - } - else { - promise = checkEmulatorReady().then(onEmulatorReady, startEmulatorAndLoop); - } - return deferred.promise; -} -var AndroidEmulatorManager = (function () { - function AndroidEmulatorManager() { - } - /** - * Returns the target emulator, which is specified through the command line. - */ - AndroidEmulatorManager.prototype.getTargetEmulator = function () { - let _this = this; - if (this.targetEmulator) - return Q(this.targetEmulator); - else { - const deferred = Q.defer(); - const targetAndroidEmulator = process.env.ANDROID_EMU; - if (!targetAndroidEmulator) { - // If no Android simulator is specified, get the most recent Android simulator to run tests on. - testUtil_1.TestUtil.getProcessOutput("emulator -list-avds", { noLogCommand: true, noLogStdOut: true, noLogStdErr: true }) - .then((Devices) => { - const listOfDevices = Devices.trim().split("\n"); - deferred.resolve(listOfDevices[listOfDevices.length - 1]); - }, (error) => { - deferred.reject(error); - }); - } - else { - // Use the simulator specified on the command line. - deferred.resolve(targetAndroidEmulator); - } - return deferred.promise - .then((targetEmulator) => { - _this.targetEmulator = targetEmulator; - console.log("Using Android simulator named " + _this.targetEmulator); - return _this.targetEmulator; - }); - } - }; - /** - * Boots the target emulator. - */ - AndroidEmulatorManager.prototype.bootEmulator = function (restartEmulators) { - function checkAndroidEmulator(androidEmulatorName) { - // A command that does nothing but only succeeds if the emulator is running. - // List all of the packages on the device. - return testUtil_1.TestUtil.getProcessOutput("adb shell pm list packages", { noLogCommand: true, noLogStdOut: true, noLogStdErr: true }).then(function () { return null; }); - } - function startAndroidEmulator(androidEmulatorName) { - const androidEmulatorCommand = `emulator @${androidEmulatorName}`; - let osSpecificCommand = ""; - if (process.platform === "darwin") { - osSpecificCommand = `${androidEmulatorCommand} &`; - } else { - osSpecificCommand = `START /B ${androidEmulatorCommand}`; - } - return testUtil_1.TestUtil.getProcessOutput(osSpecificCommand, { noLogStdErr: true, timeout: 5000 }); - } - function killAndroidEmulator() { - return testUtil_1.TestUtil.getProcessOutput("adb emu kill").then(function () { return null; }); - } - return this.getTargetEmulator() - .then(function (targetEmulator) { - return bootEmulatorInternal("Android", restartEmulators, targetEmulator, checkAndroidEmulator, startAndroidEmulator, killAndroidEmulator); - }); - }; - /** - * Launches an already installed application by app id. - */ - AndroidEmulatorManager.prototype.launchInstalledApplication = function (appId) { - return testUtil_1.TestUtil.getProcessOutput("adb shell monkey -p " + appId + " -c android.intent.category.LAUNCHER 1").then(function () { return null; }); - }; - /** - * Ends a running application given its app id. - */ - AndroidEmulatorManager.prototype.endRunningApplication = function (appId) { - return testUtil_1.TestUtil.getProcessOutput("adb shell am force-stop " + appId).then(function () { return Q.delay(10000); }); - }; - /** - * Restarts an already installed application by app id. - */ - AndroidEmulatorManager.prototype.restartApplication = function (appId) { - var _this = this; - return this.endRunningApplication(appId) - .then(function () { - // Wait for a 1 second before restarting. - return Q.delay(1000); - }) - .then(function () { - return _this.launchInstalledApplication(appId); - }); - }; - /** - * Navigates away from the current app, waits for a delay (defaults to 1 second), then navigates to the specified app. - */ - AndroidEmulatorManager.prototype.resumeApplication = function (appId, delayBeforeResumingMs) { - var _this = this; - if (delayBeforeResumingMs === void 0) { delayBeforeResumingMs = 1000; } - // Open a default Android app (for example, settings). - return this.launchInstalledApplication("com.android.settings") - .then(function () { - console.log("Waiting for " + delayBeforeResumingMs + "ms before resuming the test application."); - return Q.delay(delayBeforeResumingMs); - }) - .then(function () { - // Reopen the app. - return _this.launchInstalledApplication(appId); - }); - }; - /** - * Prepares the emulator for a test. - */ - AndroidEmulatorManager.prototype.prepareEmulatorForTest = function (appId) { - return this.endRunningApplication(appId) - .then(function () { - return commandWithCheckAppExistence("adb shell pm clear", appId); - }); - }; - /** - * Uninstalls the app from the emulator. - */ - AndroidEmulatorManager.prototype.uninstallApplication = function (appId) { - return commandWithCheckAppExistence("adb uninstall", appId); - }; - return AndroidEmulatorManager; -}()); -exports.AndroidEmulatorManager = AndroidEmulatorManager; -var IOSEmulatorManager = (function () { - function IOSEmulatorManager() { - } - /** - * Returns the target emulator, which is specified through the command line. - */ - IOSEmulatorManager.prototype.getTargetEmulator = function () { - let _this = this; - if (this.targetEmulator) - return Q(this.targetEmulator); - else { - let deferred = Q.defer(); - let targetIOSEmulator = process.env.IOS_EMU; - if (!targetIOSEmulator) { - // If no iOS simulator is specified, get the most recent iOS simulator to run tests on. - testUtil_1.TestUtil.getProcessOutput("xcrun simctl list", { noLogCommand: true, noLogStdOut: true, noLogStdErr: true }) - .then((listOfDevicesWithDevicePairs) => { - let listOfDevices = listOfDevicesWithDevicePairs.slice(listOfDevicesWithDevicePairs.indexOf("-- iOS"), listOfDevicesWithDevicePairs.indexOf("-- tvOS")); - let phoneDevice = /iPhone\ \S*\ ?.*?\(([0-9A-Z-]*)\)/g; - let match = phoneDevice.exec(listOfDevices); - deferred.resolve(match[1]); - }, (error) => { - deferred.reject(error); - }); - } - else { - // Use the simulator specified on the command line. - deferred.resolve(targetIOSEmulator); - } - return deferred.promise - .then((targetEmulator) => { - _this.targetEmulator = targetEmulator; - console.log("Using iOS simulator named " + _this.targetEmulator); - return _this.targetEmulator; - }); - } - }; - /** - * Boots the target emulator. - */ - IOSEmulatorManager.prototype.bootEmulator = function (restartEmulators) { - function checkIOSEmulator(iOSEmulatorId) { - // A command that does nothing but only succeeds if the emulator is running. - return testUtil_1.TestUtil.getProcessOutput("xcrun simctl getenv booted SIMULATOR_UDID", { noLogCommand: true, noLogStdOut: true, noLogStdErr: true }).then(function (simUdid) { - return simUdid.trim() == iOSEmulatorId.trim() ? true : Promise.reject(new Error('Waiting for device to boot')); - }); - } - function startIOSEmulator(iOSEmulatorId) { - return testUtil_1.TestUtil.getProcessOutput("xcrun simctl boot " + iOSEmulatorId, { noLogStdErr: true }) - .catch(function (error) { return undefined; /* Always fails because we do not specify a template, which is not necessary to just start the emulator */ }).then(function () { return null; }); - } - function killIOSEmulator() { - return testUtil_1.TestUtil.getProcessOutput("xcrun simctl shutdown all").then(function () { return null; }); - } - return this.getTargetEmulator() - .then(function (targetEmulator) { - return bootEmulatorInternal("iOS", restartEmulators, targetEmulator, checkIOSEmulator, startIOSEmulator, killIOSEmulator); - }); - }; - /** - * Launches an already installed application by app id. - */ - IOSEmulatorManager.prototype.launchInstalledApplication = function (appId) { - return testUtil_1.TestUtil.getProcessOutput("xcrun simctl launch booted " + appId, undefined).then(function () { return null; }); - }; - /** - * Ends a running application given its app id. - */ - IOSEmulatorManager.prototype.endRunningApplication = function (appId) { - return testUtil_1.TestUtil.getProcessOutput("xcrun simctl terminate booted " + appId, undefined).then(function () { return null; }) - }; - /** - * Restarts an already installed application by app id. - */ - IOSEmulatorManager.prototype.restartApplication = function (appId) { - var _this = this; - return this.endRunningApplication(appId) - .then(function () { - // Wait for a second before restarting. - return Q.delay(1000); - }) - .then(function () { return _this.launchInstalledApplication(appId); }); - }; - /** - * Navigates away from the current app, waits for a delay (defaults to 1 second), then navigates to the specified app. - */ - IOSEmulatorManager.prototype.resumeApplication = function (appId, delayBeforeResumingMs) { - var _this = this; - if (delayBeforeResumingMs === void 0) { delayBeforeResumingMs = 1000; } - // Open a default iOS app (for example, settings). - return this.launchInstalledApplication("com.apple.Preferences") - .then(function () { - console.log("Waiting for " + delayBeforeResumingMs + "ms before resuming the test application."); - return Q.delay(delayBeforeResumingMs); - }) - .then(function () { - // Reopen the app. - return _this.launchInstalledApplication(appId); - }); - }; - /** - * Prepares the emulator for a test. - */ - IOSEmulatorManager.prototype.prepareEmulatorForTest = function (appId) { - return this.endRunningApplication(appId); - }; - /** - * Uninstalls the app from the emulator. - */ - IOSEmulatorManager.prototype.uninstallApplication = function (appId) { - return testUtil_1.TestUtil.getProcessOutput("xcrun simctl uninstall booted " + appId).then(function () { return null; }); - }; - return IOSEmulatorManager; -}()); -exports.IOSEmulatorManager = IOSEmulatorManager; - -function commandWithCheckAppExistence(command, appId) { - return testUtil_1.TestUtil.getProcessOutput("adb shell pm list packages", { noLogCommand: true, noLogStdOut: true, noLogStdErr: true }) - .then((output) => { - return output.includes(appId); - }).then((isAppExist) => { - if (isAppExist) { - return testUtil_1.TestUtil.getProcessOutput(`${command} ${appId}`).then(function () { return null; }); - } - console.log(`Command "${command}" is skipped because the application has not yet been installed`) - return null; - }); -} diff --git a/code-push-plugin-testing-framework/script/projectManager.js b/code-push-plugin-testing-framework/script/projectManager.js deleted file mode 100644 index 3c4a5b96f..000000000 --- a/code-push-plugin-testing-framework/script/projectManager.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; -var TestConfig = require("./testConfig"); -/** - * In charge of project related operations. - */ -var ProjectManager = (function () { - function ProjectManager() { - } - //// ABSTRACT METHODS - // (not actually abstract because there are some issues with our dts generator that causes it to incorrectly generate abstract classes) - /** - * Returns the name of the plugin being tested, for example Cordova or React-Native. - * - * Overwrite this in your implementation! - */ - ProjectManager.prototype.getPluginName = function () { throw ProjectManager.NOT_IMPLEMENTED_ERROR_MSG; }; - /** - * Creates a new test application at the specified path, and configures it - * with the given server URL, android and ios deployment keys. - * - * Overwrite this in your implementation! - */ - ProjectManager.prototype.setupProject = function (projectDirectory, templatePath, appName, appNamespace, version) { - if (version === void 0) { version = ProjectManager.DEFAULT_APP_VERSION; } - throw ProjectManager.NOT_IMPLEMENTED_ERROR_MSG; - }; - /** - * Sets up the scenario for a test in an already existing project. - * - * Overwrite this in your implementation! - */ - ProjectManager.prototype.setupScenario = function (projectDirectory, appId, templatePath, jsPath, targetPlatform, version) { - if (version === void 0) { version = ProjectManager.DEFAULT_APP_VERSION; } - throw ProjectManager.NOT_IMPLEMENTED_ERROR_MSG; - }; - /** - * Creates a CodePush update package zip for a project. - * - * Overwrite this in your implementation! - */ - ProjectManager.prototype.createUpdateArchive = function (projectDirectory, targetPlatform, isDiff) { throw ProjectManager.NOT_IMPLEMENTED_ERROR_MSG; }; - /** - * Prepares a specific platform for tests. - * - * Overwrite this in your implementation! - */ - ProjectManager.prototype.preparePlatform = function (projectDirectory, targetPlatform) { throw ProjectManager.NOT_IMPLEMENTED_ERROR_MSG; }; - /** - * Cleans up a specific platform after tests. - * - * Overwrite this in your implementation! - */ - ProjectManager.prototype.cleanupAfterPlatform = function (projectDirectory, targetPlatform) { throw ProjectManager.NOT_IMPLEMENTED_ERROR_MSG; }; - /** - * Runs the test app on the given target / platform. - * - * Overwrite this in your implementation! - */ - ProjectManager.prototype.runApplication = function (projectDirectory, targetPlatform) { throw ProjectManager.NOT_IMPLEMENTED_ERROR_MSG; }; - ProjectManager.DEFAULT_APP_VERSION = "Store version"; - ProjectManager.NOT_IMPLEMENTED_ERROR_MSG = "This method is unimplemented! Please extend ProjectManager and overwrite it!"; - return ProjectManager; -}()); -exports.ProjectManager = ProjectManager; -////////////////////////////////////////////////////////////////////////////////////////// -// Wrapper functions for simpler code in test cases. -/** - * Wrapper for ProjectManager.setupScenario in the TestRun directory. - */ -function setupTestRunScenario(projectManager, targetPlatform, scenarioJsPath, version) { - return projectManager.setupScenario(TestConfig.testRunDirectory, TestConfig.TestNamespace, TestConfig.templatePath, scenarioJsPath, targetPlatform, version); -} -exports.setupTestRunScenario = setupTestRunScenario; -/** - * Creates an update and zip for the test app using the specified scenario and version. - */ -function setupUpdateScenario(projectManager, targetPlatform, scenarioJsPath, version) { - return projectManager.setupScenario(TestConfig.updatesDirectory, TestConfig.TestNamespace, TestConfig.templatePath, scenarioJsPath, targetPlatform, version) - .then(projectManager.createUpdateArchive.bind(projectManager, TestConfig.updatesDirectory, targetPlatform)); -} -exports.setupUpdateScenario = setupUpdateScenario; diff --git a/code-push-plugin-testing-framework/script/serverUtil.js b/code-push-plugin-testing-framework/script/serverUtil.js deleted file mode 100644 index 80503628d..000000000 --- a/code-push-plugin-testing-framework/script/serverUtil.js +++ /dev/null @@ -1,248 +0,0 @@ -"use strict"; -// IMPORTS -var assert = require("assert"); -var bodyParser = require("body-parser"); -var express = require("express"); -var Q = require("q"); -////////////////////////////////////////////////////////////////////////////////////////// -// Use these functions to set up and shut down the server. -/** - * Sets up the server that the test app uses to send test messages and check for and download updates. - */ -function setupServer(targetPlatform) { - console.log("Setting up server at " + targetPlatform.getServerUrl()); - var app = express(); - app.use(bodyParser.json()); - app.use(bodyParser.urlencoded({ extended: true })); - app.use(function (req, res, next) { - res.setHeader("Access-Control-Allow-Origin", "*"); - res.setHeader("Access-Control-Allow-Methods", "*"); - res.setHeader("Access-Control-Allow-Headers", "origin, content-type, accept, X-CodePush-SDK-Version"); - next(); - }); - app.get("/v0.1/public/codepush/update_check", function (req, res) { - exports.updateCheckCallback && exports.updateCheckCallback(req); - res.send(exports.updateResponse); - console.log("Update check called from the app."); - console.log("Request: " + JSON.stringify(req.query)); - console.log("Response: " + JSON.stringify(exports.updateResponse)); - }); - app.get("/v0.1/public/codepush/report_status/download", function (req, res) { - console.log("Application downloading the package."); - res.download(exports.updatePackagePath); - }); - app.post("/reportTestMessage", function (req, res) { - console.log("Application reported a test message."); - console.log("Body: " + JSON.stringify(req.body)); - if (!exports.testMessageResponse) { - console.log("Sending OK"); - res.sendStatus(200); - } - else { - console.log("Sending body: " + exports.testMessageResponse); - res.status(200).send(exports.testMessageResponse); - } - exports.testMessageCallback && exports.testMessageCallback(req.body); - }); - var serverPortRegEx = /:([0-9]+)/; - exports.server = app.listen(+targetPlatform.getServerUrl().match(serverPortRegEx)[1]); -} -exports.setupServer = setupServer; -/** - * Closes the server. - */ -function cleanupServer() { - if (exports.server) { - exports.server.close(); - exports.server = undefined; - } -} -exports.cleanupServer = cleanupServer; -////////////////////////////////////////////////////////////////////////////////////////// -// Classes and methods used for sending mock responses to the app. -/** - * Class used to mock the codePush.checkForUpdate() response from the server. - */ -var CheckForUpdateResponseMock = (function () { - function CheckForUpdateResponseMock() { - } - return CheckForUpdateResponseMock; -}()); -exports.CheckForUpdateResponseMock = CheckForUpdateResponseMock; -/** - * The model class of the codePush.checkForUpdate() request to the server. - */ -var UpdateCheckRequestMock = (function () { - function UpdateCheckRequestMock() { - } - return UpdateCheckRequestMock; -}()); -exports.UpdateCheckRequestMock = UpdateCheckRequestMock; -/** - * Returns a default empty response to give to the app in a checkForUpdate request - */ -function createDefaultResponse() { - var defaultResponse = new CheckForUpdateResponseMock(); - defaultResponse.download_url = ""; - defaultResponse.is_disabled = false; - defaultResponse.description = ""; - defaultResponse.is_available = false; - defaultResponse.is_mandatory = false; - defaultResponse.target_binary_range = ""; - defaultResponse.package_hash = ""; - defaultResponse.label = ""; - defaultResponse.package_size = 0; - defaultResponse.should_run_binary_version = false; - defaultResponse.update_app_version = false; - return defaultResponse; -} -exports.createDefaultResponse = createDefaultResponse; -/** - * Returns a default update response to give to the app in a checkForUpdate request - */ -function createUpdateResponse(mandatory, targetPlatform, randomHash) { - if (mandatory === void 0) { mandatory = false; } - if (randomHash === void 0) { randomHash = true; } - var updateResponse = new CheckForUpdateResponseMock(); - updateResponse.is_available = true; - updateResponse.is_disabled = false; - updateResponse.target_binary_range = "1.0.0"; - updateResponse.download_url = "mock.url/v0.1/public/codepush/report_status/download"; - updateResponse.is_mandatory = mandatory; - updateResponse.label = "mock-update"; - updateResponse.package_hash = "12345-67890"; - updateResponse.package_size = 12345; - updateResponse.should_run_binary_version = false; - updateResponse.update_app_version = false; - if (!!targetPlatform) - updateResponse.download_url = targetPlatform.getServerUrl() + "/v0.1/public/codepush/report_status/download"; - // We need unique hashes to avoid conflicts. - if (randomHash) { - updateResponse.package_hash = "randomHash-" + Math.floor(Math.random() * 10000); - } - return updateResponse; -} -exports.createUpdateResponse = createUpdateResponse; -/** - * Returns a promise that waits for the next set of test messages sent by the app and resolves if that they are equal to the expected messages or rejects if they are not. - */ -function expectTestMessages(expectedMessages) { - var deferred = Q.defer(); - var messageIndex = 0; - var lastRequestBody = null; - exports.testMessageCallback = function (requestBody) { - try { - console.log("Message index: " + messageIndex); - // We should ignore duplicated requests. It is only CI issue. - if (lastRequestBody === null || !areEqual(requestBody, lastRequestBody)) { - if (typeof expectedMessages[messageIndex] === "string") { - assert.equal(requestBody.message, expectedMessages[messageIndex]); - } - else { - assert(areEqual(requestBody, expectedMessages[messageIndex])); - } - - lastRequestBody = requestBody; - - /* end of message array */ - if (++messageIndex === expectedMessages.length) { - deferred.resolve(undefined); - } - } - } - catch (e) { - deferred.reject(e); - } - }; - return deferred.promise; -} -exports.expectTestMessages = expectTestMessages; -; -////////////////////////////////////////////////////////////////////////////////////////// -// Test messages used by the test app to send state information to the server. -/** - * Contains all the messages sent from the application to the mock server during tests. - */ -var TestMessage = (function () { - function TestMessage() { - } - TestMessage.CHECK_UP_TO_DATE = "CHECK_UP_TO_DATE"; - TestMessage.CHECK_UPDATE_AVAILABLE = "CHECK_UPDATE_AVAILABLE"; - TestMessage.CHECK_ERROR = "CHECK_ERROR"; - TestMessage.DOWNLOAD_SUCCEEDED = "DOWNLOAD_SUCCEEDED"; - TestMessage.DOWNLOAD_ERROR = "DOWNLOAD_ERROR"; - TestMessage.UPDATE_INSTALLED = "UPDATE_INSTALLED"; - TestMessage.INSTALL_ERROR = "INSTALL_ERROR"; - TestMessage.DEVICE_READY_AFTER_UPDATE = "DEVICE_READY_AFTER_UPDATE"; - TestMessage.UPDATE_FAILED_PREVIOUSLY = "UPDATE_FAILED_PREVIOUSLY"; - TestMessage.NOTIFY_APP_READY_SUCCESS = "NOTIFY_APP_READY_SUCCESS"; - TestMessage.NOTIFY_APP_READY_FAILURE = "NOTIFY_APP_READY_FAILURE"; - TestMessage.SKIPPED_NOTIFY_APPLICATION_READY = "SKIPPED_NOTIFY_APPLICATION_READY"; - TestMessage.SYNC_STATUS = "SYNC_STATUS"; - TestMessage.RESTART_SUCCEEDED = "RESTART_SUCCEEDED"; - TestMessage.RESTART_FAILED = "RESTART_FAILED"; - TestMessage.PENDING_PACKAGE = "PENDING_PACKAGE"; - TestMessage.CURRENT_PACKAGE = "CURRENT_PACKAGE"; - TestMessage.SYNC_UP_TO_DATE = 0; - TestMessage.SYNC_UPDATE_INSTALLED = 1; - TestMessage.SYNC_UPDATE_IGNORED = 2; - TestMessage.SYNC_ERROR = 3; - TestMessage.SYNC_IN_PROGRESS = 4; - TestMessage.SYNC_CHECKING_FOR_UPDATE = 5; - TestMessage.SYNC_AWAITING_USER_ACTION = 6; - TestMessage.SYNC_DOWNLOADING_PACKAGE = 7; - TestMessage.SYNC_INSTALLING_UPDATE = 8; - return TestMessage; -}()); -exports.TestMessage = TestMessage; -/** - * Contains all the messages sent from the mock server back to the application during tests. - */ -var TestMessageResponse = (function () { - function TestMessageResponse() { - } - TestMessageResponse.SKIP_NOTIFY_APPLICATION_READY = "SKIP_NOTIFY_APPLICATION_READY"; - return TestMessageResponse; -}()); -exports.TestMessageResponse = TestMessageResponse; -/** - * Defines the messages sent from the application to the mock server during tests. - */ -var AppMessage = (function () { - function AppMessage(message, args) { - this.message = message; - this.args = args; - } - AppMessage.fromString = function (message) { - return new AppMessage(message, undefined); - }; - return AppMessage; -}()); -exports.AppMessage = AppMessage; -/** - * Checks if two messages are equal. - */ -function areEqual(m1, m2) { - /* compare objects */ - if (m1 === m2) { - return true; - } - /* compare messages */ - if (!m1 || !m2 || m1.message !== m2.message) { - return false; - } - /* compare arguments */ - if (m1.args === m2.args) { - return true; - } - if (!m1.args || !m2.args || m1.args.length !== m2.args.length) { - return false; - } - for (var i = 0; i < m1.args.length; i++) { - if (m1.args[i] !== m2.args[i]) { - return false; - } - } - return true; -} -exports.areEqual = areEqual; diff --git a/code-push-plugin-testing-framework/script/test.js b/code-push-plugin-testing-framework/script/test.js deleted file mode 100644 index 2a209edc9..000000000 --- a/code-push-plugin-testing-framework/script/test.js +++ /dev/null @@ -1,104 +0,0 @@ -"use strict"; -var Q = require("q"); -var ServerUtil = require("./serverUtil"); -var testBuilder_1 = require("./testBuilder"); -var TestConfig = require("./testConfig"); -var testUtil_1 = require("./testUtil"); -////////////////////////////////////////////////////////////////////////////////////////// -/** - * Call this function to initialize the automated tests. - */ -function initializeTests(projectManager, supportedTargetPlatforms, describeTests) { - // DETERMINE PLATFORMS TO TEST // - /** The platforms to test on. */ - var targetPlatforms = []; - supportedTargetPlatforms.forEach(function (supportedPlatform) { - if (testUtil_1.TestUtil.readMochaCommandLineFlag(supportedPlatform.getCommandLineFlagName())) - targetPlatforms.push(supportedPlatform); - }); - // Log current configuration - console.log("Initializing tests for " + testUtil_1.TestUtil.getPluginName()); - console.log(TestConfig.TestAppName + "\n" + TestConfig.TestNamespace); - console.log("Testing " + TestConfig.thisPluginPath + "."); - targetPlatforms.forEach(function (platform) { - console.log("On " + platform.getName()); - }); - console.log("test run directory = " + TestConfig.testRunDirectory); - console.log("updates directory = " + TestConfig.updatesDirectory); - if (TestConfig.onlyRunCoreTests) - console.log("--only running core tests--"); - if (TestConfig.shouldSetup) - console.log("--setting up--"); - if (TestConfig.restartEmulators) - console.log("--restarting emulators--"); - // FUNCTIONS // - function cleanupTest() { - console.log("Cleaning up!"); - ServerUtil.updateResponse = undefined; - ServerUtil.testMessageCallback = undefined; - ServerUtil.updateCheckCallback = undefined; - ServerUtil.testMessageResponse = undefined; - } - /** - * Sets up tests for each platform. - * Creates the test project directory and the test update directory. - * Starts required emulators. - */ - function setupTests() { - it("sets up tests correctly", function (done) { - var promises = []; - targetPlatforms.forEach(function (platform) { - promises.push(platform.getEmulatorManager().bootEmulator(TestConfig.restartEmulators)); - }); - console.log("Building test project."); - // create the test project - promises.push(createTestProject(TestConfig.testRunDirectory) - .then(function () { - console.log("Building update project."); - // create the update project - return createTestProject(TestConfig.updatesDirectory); - }).then(function () { return null; })); - Q.all(promises).then(function () { done(); }, function (error) { done(error); }); - }); - } - /** - * Creates a test project directory at the given path. - */ - function createTestProject(directory) { - return projectManager.setupProject(directory, TestConfig.templatePath, TestConfig.TestAppName, TestConfig.TestNamespace); - } - /** - * Creates and runs the tests from the projectManager and TestBuilderDescribe objects passed to initializeTests. - */ - function createAndRunTests(targetPlatform) { - describe("CodePush", function () { - before(function () { - ServerUtil.setupServer(targetPlatform); - return targetPlatform.getEmulatorManager().uninstallApplication(TestConfig.TestNamespace) - .then(projectManager.preparePlatform.bind(projectManager, TestConfig.testRunDirectory, targetPlatform)) - .then(projectManager.preparePlatform.bind(projectManager, TestConfig.updatesDirectory, targetPlatform)); - }); - after(function () { - ServerUtil.cleanupServer(); - return projectManager.cleanupAfterPlatform(TestConfig.testRunDirectory, targetPlatform).then(projectManager.cleanupAfterPlatform.bind(projectManager, TestConfig.updatesDirectory, targetPlatform)); - }); - testBuilder_1.TestContext.projectManager = projectManager; - testBuilder_1.TestContext.targetPlatform = targetPlatform; - // Build the tests. - describeTests(projectManager, targetPlatform); - }); - } - // BEGIN TESTING // - describe("CodePush " + projectManager.getPluginName() + " Plugin", function () { - this.timeout(100 * 60 * 1000); - if (TestConfig.shouldSetup) - describe("Setting Up For Tests", function () { return setupTests(); }); - else { - targetPlatforms.forEach(function (platform) { - var prefix = (TestConfig.onlyRunCoreTests ? "Core Tests " : "Tests ") + TestConfig.thisPluginPath + " on "; - describe(prefix + platform.getName(), function () { return createAndRunTests(platform); }); - }); - } - }); -} -exports.initializeTests = initializeTests; diff --git a/code-push-plugin-testing-framework/script/testBuilder.js b/code-push-plugin-testing-framework/script/testBuilder.js deleted file mode 100644 index 34a202952..000000000 --- a/code-push-plugin-testing-framework/script/testBuilder.js +++ /dev/null @@ -1,88 +0,0 @@ -"use strict"; -var ServerUtil = require("./serverUtil"); -var TestConfig = require("./testConfig"); -////////////////////////////////////////////////////////////////////////////////////////// -// Use this class to create and structure the tests. -// Usage is almost identical to Mocha, but with the addition of the optional "scenarioPath" in describe() and the required "isCoreTest" in it(). -var TestBuilder = (function () { - function TestBuilder() { - } - TestBuilder.describe = getDescribe(); - TestBuilder.it = getIt(); - return TestBuilder; -}()); -exports.TestBuilder = TestBuilder; -////////////////////////////////////////////////////////////////////////////////////////// -// Mocha mimicry -/** Singleton class for TestBuilder.describe to use internally to define the context. */ -var TestContext = (function () { - function TestContext() { - } - return TestContext; -}()); -exports.TestContext = TestContext; -function describeInternal(func, description, spec, scenarioPath) { - if (!TestContext.projectManager || !TestContext.targetPlatform) { - throw new Error("TestContext.projectManager or TestContext.targetPlatform are not defined! Did you call TestBuilder.describe outside of a function you passed to PluginTestingFramework.initializeTests?"); - } - return func(description, function () { - afterEach(function () { - console.log("Cleaning up!"); - ServerUtil.updateResponse = undefined; - ServerUtil.testMessageCallback = undefined; - ServerUtil.updateCheckCallback = undefined; - ServerUtil.testMessageResponse = undefined; - }); - beforeEach(function () { - return TestContext.targetPlatform.getEmulatorManager().prepareEmulatorForTest(TestConfig.TestNamespace) - .catch(function () { }); - }); - if (scenarioPath) { - before(function () { - return TestContext.projectManager.setupScenario(TestConfig.testRunDirectory, TestConfig.TestNamespace, TestConfig.templatePath, scenarioPath, TestContext.targetPlatform); - }); - } - spec(); - }); -} -/** - * Returns a hybrid type that mimics mocha's describe object. - */ -function getDescribe() { - var describer = function (description, spec, scenarioPath) { - describeInternal(describe, description, spec, scenarioPath); - }; - describer.only = function (description, spec, scenarioPath) { - describeInternal(describe.only, description, spec, scenarioPath); - }; - describer.skip = function (description, spec, scenarioPath) { - describeInternal(describe.skip, description, spec, scenarioPath); - }; - return describer; -} -function itInternal(func, expectation, isCoreTest, assertion) { - if ((!TestConfig.onlyRunCoreTests || isCoreTest)) { - // Create a wrapper around the assertion to set the timeout on the test to 10 minutes. - var assertionWithTimeout = function (done) { - this.timeout(10 * 2 * 60 * 1000); - assertion(done); - }; - return it(expectation, assertionWithTimeout); - } - return null; -} -/** - * Returns a hybrid type that mimics mocha's it object. - */ -function getIt() { - var itr = function (expectation, isCoreTest, assertion) { - itInternal(it, expectation, isCoreTest, assertion); - }; - itr.only = function (expectation, isCoreTest, assertion) { - itInternal(it.only, expectation, isCoreTest, assertion); - }; - itr.skip = function (expectation, isCoreTest, assertion) { - itInternal(it.skip, expectation, isCoreTest, assertion); - }; - return itr; -} diff --git a/code-push-plugin-testing-framework/script/testConfig.js b/code-push-plugin-testing-framework/script/testConfig.js deleted file mode 100644 index 0ebd708aa..000000000 --- a/code-push-plugin-testing-framework/script/testConfig.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; -// IMPORTS // -var os = require("os"); -var path = require("path"); -var TestUtil_1 = require("./testUtil"); -////////////////////////////////////////////////////////////////////////////////////////// -// Configuration variables. -// What plugin to use, what project directories to use, etc. -// COMMAND LINE OPTION NAMES, FLAGS, AND DEFAULTS -var DEFAULT_TEST_RUN_DIRECTORY = path.join(os.tmpdir(), TestUtil_1.TestUtil.getPluginName(), "test-run"); -var DEFAULT_UPDATES_DIRECTORY = path.join(os.tmpdir(), TestUtil_1.TestUtil.getPluginName(), "updates"); -var DEFAULT_PLUGIN_PATH = path.join(__dirname, "../.."); -var NPM_PLUGIN_PATH = TestUtil_1.TestUtil.getPluginName(); -var SETUP_FLAG_NAME = "--setup"; -var DEFAULT_PLUGIN_TGZ_NAME = TestUtil_1.TestUtil.getPluginName().replace("@", "").replace("/", "-") + "-" + TestUtil_1.TestUtil.getPluginVersion() + ".tgz"; -// CONST VARIABLES -exports.TestAppName = "TestCodePush"; -exports.TestNamespace = "com.testcodepush"; -exports.AcquisitionSDKPluginName = "code-push"; -exports.templatePath = path.join(__dirname, "../../test/template"); -exports.thisPluginInstallString = TestUtil_1.TestUtil.resolveBooleanVariables(process.env.NPM) ? `npm install ${NPM_PLUGIN_PATH}` : `npm pack ${DEFAULT_PLUGIN_PATH} && npm install ${DEFAULT_PLUGIN_TGZ_NAME} && npm link`; -exports.testRunDirectory = process.env.RUN_DIR ? process.env.RUN_DIR: DEFAULT_TEST_RUN_DIRECTORY; -exports.updatesDirectory = process.env.UPDATE_DIR ? process.env.UPDATE_DIR : DEFAULT_UPDATES_DIRECTORY; -exports.onlyRunCoreTests = TestUtil_1.TestUtil.resolveBooleanVariables(process.env.CORE); -exports.shouldSetup = TestUtil_1.TestUtil.readMochaCommandLineFlag(SETUP_FLAG_NAME); -exports.restartEmulators = TestUtil_1.TestUtil.resolveBooleanVariables(process.env.CLEAN); -exports.isOldArchitecture = TestUtil_1.TestUtil.resolveBooleanVariables(process.env.IS_OLD_ARCHITECTURE); diff --git a/code-push-plugin-testing-framework/script/testUtil.js b/code-push-plugin-testing-framework/script/testUtil.js deleted file mode 100644 index 5d39f503f..000000000 --- a/code-push-plugin-testing-framework/script/testUtil.js +++ /dev/null @@ -1,165 +0,0 @@ -"use strict"; -var archiver = require("archiver"); -var child_process = require("child_process"); -var fs = require("fs"); -var replace = require("replace"); -var Q = require("q"); -var TestUtil = (function () { - function TestUtil() { - } - //// Command Line Input Functions - /** - * Reads a command line option passed to mocha and returns a default if unspecified. - */ - TestUtil.readMochaCommandLineOption = function (optionName, defaultValue) { - var optionValue = undefined; - for (var i = 0; i < process.argv.length; i++) { - if (process.argv[i] === optionName) { - if (i + 1 < process.argv.length) { - optionValue = process.argv[i + 1]; - } - break; - } - } - if (!optionValue) - optionValue = defaultValue; - return optionValue; - }; - /** - * Reads command line options passed to mocha. - */ - TestUtil.readMochaCommandLineFlag = function (optionName) { - for (var i = 0; i < process.argv.length; i++) { - if (process.argv[i] === optionName) { - return true; - } - } - return false; - }; - //// Utility Functions - /** - * Executes a child process and returns a promise that resolves with its output or rejects with its error. - */ - TestUtil.getProcessOutput = function (command, options) { - var deferred = Q.defer(); - options = options || {}; - // set default options - if (options.maxBuffer === undefined) - options.maxBuffer = 1024 * 1024 * 500; - if (options.timeout === undefined) - options.timeout = 10 * 60 * 1000; - if (!options.noLogCommand) - console.log("Running command: " + command); - var execProcess = child_process.exec(command, options, function (error, stdout, stderr) { - if (error) { - if (!options.noLogStdErr) - console.error("" + error); - deferred.reject(error); - } - else { - deferred.resolve(stdout.toString()); - } - }); - if (!options.noLogStdOut) - execProcess.stdout.pipe(process.stdout); - if (!options.noLogStdErr) - execProcess.stderr.pipe(process.stderr); - execProcess.on('error', function (error) { - if (!options.noLogStdErr) - console.error("" + error); - deferred.reject(error); - }); - return deferred.promise; - }; - /** - * Returns the name of the plugin that is being tested. - */ - TestUtil.getPluginName = function () { - var packageFile = JSON.parse(fs.readFileSync("./package.json", "utf8")); - return packageFile.name; - }; - - TestUtil.getPluginVersion = function () { - var packageFile = JSON.parse(fs.readFileSync("./package.json", "utf8")); - return packageFile.version; - }; - /** - * Replaces a regex in a file with a given string. - */ - TestUtil.replaceString = function (filePath, regex, replacement) { - console.log("replacing \"" + regex + "\" with \"" + replacement + "\" in " + filePath); - replace({ regex: regex, replacement: replacement, recursive: false, silent: true, paths: [filePath] }); - }; - /** - * Copies a file from a given location to another. - */ - TestUtil.copyFile = function (source, destination, overwrite) { - var deferred = Q.defer(); - try { - var errorHandler = function (error) { - deferred.reject(error); - }; - if (overwrite && fs.existsSync(destination)) { - fs.unlinkSync(destination); - } - var readStream = fs.createReadStream(source); - readStream.on("error", errorHandler); - var writeStream = fs.createWriteStream(destination); - writeStream.on("error", errorHandler); - writeStream.on("close", deferred.resolve.bind(undefined, undefined)); - readStream.pipe(writeStream); - } - catch (e) { - deferred.reject(e); - } - return deferred.promise; - }; - /** - * Archives the contents of sourceFolder and puts it in an archive at archivePath in targetFolder. - */ - TestUtil.archiveFolder = function (sourceFolder, targetFolder, archivePath, isDiff) { - var deferred = Q.defer(); - var archive = archiver.create("zip", {}); - console.log("Creating an update archive at: " + archivePath); - if (fs.existsSync(archivePath)) { - fs.unlinkSync(archivePath); - } - var writeStream = fs.createWriteStream(archivePath); - writeStream.on("close", function () { - deferred.resolve(archivePath); - }); - archive.on("error", function (e) { - deferred.reject(e); - }); - if (isDiff) { - archive.append("{\"deletedFiles\":[]}", { name: "hotcodepush.json" }); - } - archive.directory(sourceFolder, targetFolder); - archive.pipe(writeStream); - archive.finalize(); - return deferred.promise; - }; - - /** - * Check that boolean environment variable string is 'true. - */ - TestUtil.resolveBooleanVariables = function(variable) { - if (variable) { - return variable.toLowerCase() === 'true'; - } - - return false; - } - //// Placeholders - // Used in the template to represent data that needs to be added by the testing framework at runtime. - TestUtil.ANDROID_KEY_PLACEHOLDER = "CODE_PUSH_ANDROID_DEPLOYMENT_KEY"; - TestUtil.IOS_KEY_PLACEHOLDER = "CODE_PUSH_IOS_DEPLOYMENT_KEY"; - TestUtil.SERVER_URL_PLACEHOLDER = "CODE_PUSH_SERVER_URL"; - TestUtil.INDEX_JS_PLACEHOLDER = "CODE_PUSH_INDEX_JS_PATH"; - TestUtil.CODE_PUSH_APP_VERSION_PLACEHOLDER = "CODE_PUSH_APP_VERSION"; - TestUtil.CODE_PUSH_TEST_APP_NAME_PLACEHOLDER = "CODE_PUSH_TEST_APP_NAME"; - TestUtil.CODE_PUSH_APP_ID_PLACEHOLDER = "CODE_PUSH_TEST_APPLICATION_ID"; - TestUtil.PLUGIN_VERSION_PLACEHOLDER = "CODE_PUSH_PLUGIN_VERSION"; - return TestUtil; -}()); -exports.TestUtil = TestUtil; diff --git a/code-push-plugin-testing-framework/typings/code-push-plugin-testing-framework.d.ts b/code-push-plugin-testing-framework/typings/code-push-plugin-testing-framework.d.ts deleted file mode 100644 index 2a614ffab..000000000 --- a/code-push-plugin-testing-framework/typings/code-push-plugin-testing-framework.d.ts +++ /dev/null @@ -1,488 +0,0 @@ -declare module 'code-push-plugin-testing-framework/script/platform' { - import Q = require("q"); - /** - * Defines a platform supported by CodePush. - */ - export interface IPlatform { - /** - * Gets the platform name. (e.g. "android" for the Android platform). - */ - getName(): string; - /** - * The command line flag used to determine whether or not this platform should run. - * Runs when the flag is present, doesn't run otherwise. - */ - getCommandLineFlagName(): string; - /** - * Gets the server url used for testing. - */ - getServerUrl(): string; - /** - * Gets an IEmulatorManager that is used to control the emulator during the tests. - */ - getEmulatorManager(): IEmulatorManager; - /** - * Gets the default deployment key. - */ - getDefaultDeploymentKey(): string; - } - /** - * Manages the interaction with the emulator. - */ - export interface IEmulatorManager { - /** - * Returns the target emulator, which is specified through the command line. - */ - getTargetEmulator(): Q.Promise; - /** - * Boots the target emulator. - */ - bootEmulator(restartEmulators: boolean): Q.Promise; - /** - * Launches an already installed application by app id. - */ - launchInstalledApplication(appId: string): Q.Promise; - /** - * Ends a running application given its app id. - */ - endRunningApplication(appId: string): Q.Promise; - /** - * Restarts an already installed application by app id. - */ - restartApplication(appId: string): Q.Promise; - /** - * Navigates away from the current app, waits for a delay (defaults to 1 second), then navigates to the specified app. - */ - resumeApplication(appId: string, delayBeforeResumingMs?: number): Q.Promise; - /** - * Prepares the emulator for a test. - */ - prepareEmulatorForTest(appId: string): Q.Promise; - /** - * Uninstalls the app from the emulator. - */ - uninstallApplication(appId: string): Q.Promise; - } - /** - * Android implementations of IPlatform. - */ - export class Android implements IPlatform { - private emulatorManager; - private serverUrl; - constructor(emulatorManager: IEmulatorManager); - /** - * Gets the platform name. (e.g. "android" for the Android platform). - */ - getName(): string; - /** - * The command line flag used to determine whether or not this platform should run. - * Runs when the flag is present, doesn't run otherwise. - */ - getCommandLineFlagName(): string; - private static DEFAULT_ANDROID_SERVER_URL; - /** - * Gets the server url used for testing. - */ - getServerUrl(): string; - /** - * Gets an IEmulatorManager that is used to control the emulator during the tests. - */ - getEmulatorManager(): IEmulatorManager; - /** - * Gets the default deployment key. - */ - getDefaultDeploymentKey(): string; - } - /** - * IOS implementation of IPlatform. - */ - export class IOS implements IPlatform { - private emulatorManager; - private serverUrl; - constructor(emulatorManager: IEmulatorManager); - /** - * Gets the platform name. (e.g. "android" for the Android platform). - */ - getName(): string; - /** - * The command line flag used to determine whether or not this platform should run. - * Runs when the flag is present, doesn't run otherwise. - */ - getCommandLineFlagName(): string; - private static DEFAULT_IOS_SERVER_URL; - /** - * Gets the server url used for testing. - */ - getServerUrl(): string; - /** - * Gets an IEmulatorManager that is used to control the emulator during the tests. - */ - getEmulatorManager(): IEmulatorManager; - /** - * Gets the default deployment key. - */ - getDefaultDeploymentKey(): string; - } - export class AndroidEmulatorManager implements IEmulatorManager { - private targetEmulator; - /** - * Returns the target emulator, which is specified through the command line. - */ - getTargetEmulator(): Q.Promise; - /** - * Boots the target emulator. - */ - bootEmulator(restartEmulators: boolean): Q.Promise; - /** - * Launches an already installed application by app id. - */ - launchInstalledApplication(appId: string): Q.Promise; - /** - * Ends a running application given its app id. - */ - endRunningApplication(appId: string): Q.Promise; - /** - * Restarts an already installed application by app id. - */ - restartApplication(appId: string): Q.Promise; - /** - * Navigates away from the current app, waits for a delay (defaults to 1 second), then navigates to the specified app. - */ - resumeApplication(appId: string, delayBeforeResumingMs?: number): Q.Promise; - /** - * Prepares the emulator for a test. - */ - prepareEmulatorForTest(appId: string): Q.Promise; - /** - * Uninstalls the app from the emulator. - */ - uninstallApplication(appId: string): Q.Promise; - } - export class IOSEmulatorManager implements IEmulatorManager { - private targetEmulator; - /** - * Returns the target emulator, which is specified through the command line. - */ - getTargetEmulator(): Q.Promise; - /** - * Boots the target emulator. - */ - bootEmulator(restartEmulators: boolean): Q.Promise; - /** - * Launches an already installed application by app id. - */ - launchInstalledApplication(appId: string): Q.Promise; - /** - * Ends a running application given its app id. - */ - endRunningApplication(appId: string): Q.Promise; - /** - * Restarts an already installed application by app id. - */ - restartApplication(appId: string): Q.Promise; - /** - * Navigates away from the current app, waits for a delay (defaults to 1 second), then navigates to the specified app. - */ - resumeApplication(appId: string, delayBeforeResumingMs?: number): Q.Promise; - /** - * Prepares the emulator for a test. - */ - prepareEmulatorForTest(appId: string): Q.Promise; - /** - * Uninstalls the app from the emulator. - */ - uninstallApplication(appId: string): Q.Promise; - } - -} -declare module 'code-push-plugin-testing-framework/script/projectManager' { - import Q = require("q"); - import platform = require('code-push-plugin-testing-framework/script/platform'); - /** - * In charge of project related operations. - */ - export class ProjectManager { - static DEFAULT_APP_VERSION: string; - private static NOT_IMPLEMENTED_ERROR_MSG; - /** - * Returns the name of the plugin being tested, for example Cordova or React-Native. - * - * Overwrite this in your implementation! - */ - getPluginName(): string; - /** - * Creates a new test application at the specified path, and configures it - * with the given server URL, android and ios deployment keys. - * - * Overwrite this in your implementation! - */ - setupProject(projectDirectory: string, templatePath: string, appName: string, appNamespace: string, version?: string): Q.Promise; - /** - * Sets up the scenario for a test in an already existing project. - * - * Overwrite this in your implementation! - */ - setupScenario(projectDirectory: string, appId: string, templatePath: string, jsPath: string, targetPlatform: platform.IPlatform, version?: string): Q.Promise; - /** - * Creates a CodePush update package zip for a project. - * - * Overwrite this in your implementation! - */ - createUpdateArchive(projectDirectory: string, targetPlatform: platform.IPlatform, isDiff?: boolean): Q.Promise; - /** - * Prepares a specific platform for tests. - * - * Overwrite this in your implementation! - */ - preparePlatform(projectDirectory: string, targetPlatform: platform.IPlatform): Q.Promise; - /** - * Cleans up a specific platform after tests. - * - * Overwrite this in your implementation! - */ - cleanupAfterPlatform(projectDirectory: string, targetPlatform: platform.IPlatform): Q.Promise; - /** - * Runs the test app on the given target / platform. - * - * Overwrite this in your implementation! - */ - runApplication(projectDirectory: string, targetPlatform: platform.IPlatform): Q.Promise; - } - /** - * Wrapper for ProjectManager.setupScenario in the TestRun directory. - */ - export function setupTestRunScenario(projectManager: ProjectManager, targetPlatform: platform.IPlatform, scenarioJsPath: string, version?: string): Q.Promise; - /** - * Creates an update and zip for the test app using the specified scenario and version. - */ - export function setupUpdateScenario(projectManager: ProjectManager, targetPlatform: platform.IPlatform, scenarioJsPath: string, version: string): Q.Promise; - -} -declare module 'code-push-plugin-testing-framework/script/test' { - import Platform = require('code-push-plugin-testing-framework/script/platform'); - import { ProjectManager } from 'code-push-plugin-testing-framework/script/projectManager'; - /** - * Call this function to initialize the automated tests. - */ - export function initializeTests(projectManager: ProjectManager, supportedTargetPlatforms: Platform.IPlatform[], describeTests: (projectManager: ProjectManager, targetPlatform: Platform.IPlatform) => void): void; - -} -declare module 'code-push-plugin-testing-framework/script/serverUtil' { - import platform = require('code-push-plugin-testing-framework/script/platform'); - import Q = require("q"); - /** The server to respond to requests from the app. */ - export var server: any; - /** Response the server gives the next update check request */ - export var updateResponse: any; - /** Response the server gives the next test message request */ - export var testMessageResponse: any; - /** Called after the next test message request */ - export var testMessageCallback: (requestBody: any) => void; - /** Called after the next update check request */ - export var updateCheckCallback: (requestBody: any) => void; - /** Location of the update package given in the update check response */ - export var updatePackagePath: string; - /** - * Sets up the server that the test app uses to send test messages and check for and download updates. - */ - export function setupServer(targetPlatform: platform.IPlatform): void; - /** - * Closes the server. - */ - export function cleanupServer(): void; - /** - * Class used to mock the codePush.checkForUpdate() response from the server. - */ - export class CheckForUpdateResponseMock { - download_url: string; - is_available: boolean; - should_run_binary_version: boolean; - package_size: number; - update_app_version: boolean; - target_binary_range: string; - is_disabled: boolean; - description: string; - label: string; - package_hash: string; - is_mandatory: boolean; - } - /** - * The model class of the codePush.checkForUpdate() request to the server. - */ - export class UpdateCheckRequestMock { - deploymentKey: string; - appVersion: string; - packageHash: string; - isCompanion: boolean; - } - /** - * Returns a default empty response to give to the app in a checkForUpdate request - */ - export function createDefaultResponse(): CheckForUpdateResponseMock; - /** - * Returns a default update response to give to the app in a checkForUpdate request - */ - export function createUpdateResponse(mandatory?: boolean, targetPlatform?: platform.IPlatform, randomHash?: boolean): CheckForUpdateResponseMock; - /** - * Returns a promise that waits for the next set of test messages sent by the app and resolves if that they are equal to the expected messages or rejects if they are not. - */ - export function expectTestMessages(expectedMessages: (string | AppMessage)[]): Q.Promise; - /** - * Contains all the messages sent from the application to the mock server during tests. - */ - export class TestMessage { - static CHECK_UP_TO_DATE: string; - static CHECK_UPDATE_AVAILABLE: string; - static CHECK_ERROR: string; - static DOWNLOAD_SUCCEEDED: string; - static DOWNLOAD_ERROR: string; - static UPDATE_INSTALLED: string; - static INSTALL_ERROR: string; - static DEVICE_READY_AFTER_UPDATE: string; - static UPDATE_FAILED_PREVIOUSLY: string; - static NOTIFY_APP_READY_SUCCESS: string; - static NOTIFY_APP_READY_FAILURE: string; - static SKIPPED_NOTIFY_APPLICATION_READY: string; - static SYNC_STATUS: string; - static RESTART_SUCCEEDED: string; - static RESTART_FAILED: string; - static PENDING_PACKAGE: string; - static CURRENT_PACKAGE: string; - static SYNC_UP_TO_DATE: number; - static SYNC_UPDATE_INSTALLED: number; - static SYNC_UPDATE_IGNORED: number; - static SYNC_ERROR: number; - static SYNC_IN_PROGRESS: number; - static SYNC_CHECKING_FOR_UPDATE: number; - static SYNC_AWAITING_USER_ACTION: number; - static SYNC_DOWNLOADING_PACKAGE: number; - static SYNC_INSTALLING_UPDATE: number; - } - /** - * Contains all the messages sent from the mock server back to the application during tests. - */ - export class TestMessageResponse { - static SKIP_NOTIFY_APPLICATION_READY: string; - } - /** - * Defines the messages sent from the application to the mock server during tests. - */ - export class AppMessage { - message: string; - args: any[]; - constructor(message: string, args: any[]); - static fromString(message: string): AppMessage; - } - /** - * Checks if two messages are equal. - */ - export function areEqual(m1: AppMessage, m2: AppMessage): boolean; - -} -declare module 'code-push-plugin-testing-framework/script/testBuilder' { - import Platform = require('code-push-plugin-testing-framework/script/platform'); - import { ProjectManager } from 'code-push-plugin-testing-framework/script/projectManager'; - export class TestBuilder { - static describe: ITestBuilderContextDefintion; - static it: ITestBuilderTestDefinition; - } - /** Singleton class for TestBuilder.describe to use internally to define the context. */ - export class TestContext { - static projectManager: ProjectManager; - static targetPlatform: Platform.IPlatform; - } - export interface ITestBuilderContextDefintion { - (description: string, spec: () => void, scenarioPath?: string): void; - only(description: string, spec: () => void, scenarioPath?: string): void; - skip(description: string, spec: () => void, scenarioPath?: string): void; - } - export interface ITestBuilderTestDefinition { - (expectation: string, isCoreTest: boolean, assertion: (done: Mocha.Done) => void): void; - only(expectation: string, isCoreTest: boolean, assertion: (done: Mocha.Done) => void): void; - skip(expectation: string, isCoreTest: boolean, assertion: (done: Mocha.Done) => void): void; - } - -} -declare module 'code-push-plugin-testing-framework/script/testConfig' { - export const TestAppName: string; - export const TestNamespace: string; - export const AcquisitionSDKPluginName: string; - export const templatePath: string; - export const thisPluginInstallString: string; - export const testRunDirectory: string; - export const updatesDirectory: string; - export const onlyRunCoreTests: boolean; - export const shouldSetup: boolean; - export const restartEmulators: boolean; - export const isOldArchitecture: boolean; - -} -declare module 'code-push-plugin-testing-framework/script/testUtil' { - import Q = require("q"); - export class TestUtil { - static ANDROID_KEY_PLACEHOLDER: string; - static IOS_KEY_PLACEHOLDER: string; - static SERVER_URL_PLACEHOLDER: string; - static INDEX_JS_PLACEHOLDER: string; - static CODE_PUSH_APP_VERSION_PLACEHOLDER: string; - static CODE_PUSH_TEST_APP_NAME_PLACEHOLDER: string; - static CODE_PUSH_APP_ID_PLACEHOLDER: string; - static PLUGIN_VERSION_PLACEHOLDER: string; - /** - * Reads a command line option passed to mocha and returns a default if unspecified. - */ - static readMochaCommandLineOption(optionName: string, defaultValue?: string): string; - /** - * Reads command line options passed to mocha. - */ - static readMochaCommandLineFlag(optionName: string): boolean; - /** - * Executes a child process and returns a promise that resolves with its output or rejects with its error. - */ - static getProcessOutput(command: string, options?: { - cwd?: string; - stdio?: any; - customFds?: any; - env?: any; - encoding?: string; - timeout?: number; - maxBuffer?: number; - killSignal?: string; - noLogCommand?: boolean; - noLogStdOut?: boolean; - noLogStdErr?: boolean; - }): Q.Promise; - /** - * Returns the name of the plugin that is being tested. - */ - static getPluginName(): string; - /** - * Replaces a regex in a file with a given string. - */ - static replaceString(filePath: string, regex: string, replacement: string): void; - /** - * Copies a file from a given location to another. - */ - static copyFile(source: string, destination: string, overwrite: boolean): Q.Promise; - /** - * Archives the contents of sourceFolder and puts it in an archive at archivePath in targetFolder. - */ - static archiveFolder(sourceFolder: string, targetFolder: string, archivePath: string, isDiff: boolean): Q.Promise; - } - -} -declare module 'code-push-plugin-testing-framework/script/index' { - import * as Platform from 'code-push-plugin-testing-framework/script/platform'; - import * as PluginTestingFramework from 'code-push-plugin-testing-framework/script/test'; - import { ProjectManager, setupTestRunScenario, setupUpdateScenario } from 'code-push-plugin-testing-framework/script/projectManager'; - import * as ServerUtil from 'code-push-plugin-testing-framework/script/serverUtil'; - import { TestBuilder } from 'code-push-plugin-testing-framework/script/testBuilder'; - import * as TestConfig from 'code-push-plugin-testing-framework/script/testConfig'; - import { TestUtil } from 'code-push-plugin-testing-framework/script/testUtil'; - export { Platform, PluginTestingFramework, ProjectManager, setupTestRunScenario, setupUpdateScenario, ServerUtil, TestBuilder, TestConfig, TestUtil }; - -} -declare module 'code-push-plugin-testing-framework' { - import main = require('code-push-plugin-testing-framework/script/index'); - export = main; -} diff --git a/package-lock.json b/package-lock.json index 69442ef39..48d6e7d2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,20 +37,6 @@ "typescript": "^4.4.3" } }, - "code-push-plugin-testing-framework": { - "version": "0.0.1", - "extraneous": true, - "license": "MIT", - "dependencies": { - "@types/uuid": "^8.3.1", - "base-64": "^1.0.0", - "mocha": "^11.1.0", - "mocha-junit-reporter": "latest", - "q": "^1.5.1", - "replace": "latest", - "uuid": "^8.3.2" - } - }, "node_modules/@babel/code-frame": { "version": "7.24.7", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", diff --git a/test/plugin-testing-framework-compat.d.ts b/test/plugin-testing-framework-compat.d.ts deleted file mode 100644 index 55dcc7781..000000000 --- a/test/plugin-testing-framework-compat.d.ts +++ /dev/null @@ -1,191 +0,0 @@ -declare module "@srcpush/plugin-testing-framework" { - import Q = require("q"); - - namespace Platform { - interface IPlatform { - getName(): string; - getCommandLineFlagName(): string; - getServerUrl(): string; - getEmulatorManager(): IEmulatorManager; - getDefaultDeploymentKey(): string; - } - - interface IEmulatorManager { - getTargetEmulator(): Q.Promise; - bootEmulator(restartEmulators: boolean): Q.Promise; - launchInstalledApplication(appId: string): Q.Promise; - endRunningApplication(appId: string): Q.Promise; - restartApplication(appId: string): Q.Promise; - resumeApplication(appId: string, delayBeforeResumingMs?: number): Q.Promise; - prepareEmulatorForTest(appId: string): Q.Promise; - uninstallApplication(appId: string): Q.Promise; - } - - class Android implements IPlatform { - constructor(emulatorManager: IEmulatorManager); - getName(): string; - getCommandLineFlagName(): string; - getServerUrl(): string; - getEmulatorManager(): IEmulatorManager; - getDefaultDeploymentKey(): string; - } - - class IOS implements IPlatform { - constructor(emulatorManager: IEmulatorManager); - getName(): string; - getCommandLineFlagName(): string; - getServerUrl(): string; - getEmulatorManager(): IEmulatorManager; - getDefaultDeploymentKey(): string; - } - - class AndroidEmulatorManager implements IEmulatorManager { - getTargetEmulator(): Q.Promise; - bootEmulator(restartEmulators: boolean): Q.Promise; - launchInstalledApplication(appId: string): Q.Promise; - endRunningApplication(appId: string): Q.Promise; - restartApplication(appId: string): Q.Promise; - resumeApplication(appId: string, delayBeforeResumingMs?: number): Q.Promise; - prepareEmulatorForTest(appId: string): Q.Promise; - uninstallApplication(appId: string): Q.Promise; - } - - class IOSEmulatorManager implements IEmulatorManager { - getTargetEmulator(): Q.Promise; - bootEmulator(restartEmulators: boolean): Q.Promise; - launchInstalledApplication(appId: string): Q.Promise; - endRunningApplication(appId: string): Q.Promise; - restartApplication(appId: string): Q.Promise; - resumeApplication(appId: string, delayBeforeResumingMs?: number): Q.Promise; - prepareEmulatorForTest(appId: string): Q.Promise; - uninstallApplication(appId: string): Q.Promise; - } - } - - namespace PluginTestingFramework { - function initializeTests( - projectManager: ProjectManager, - supportedTargetPlatforms: Platform.IPlatform[], - describeTests: (projectManager: ProjectManager, targetPlatform: Platform.IPlatform) => void - ): void; - } - - class ProjectManager { - static DEFAULT_APP_VERSION: string; - getPluginName(): string; - setupProject(projectDirectory: string, templatePath: string, appName: string, appNamespace: string, version?: string): Q.Promise; - setupScenario(projectDirectory: string, appId: string, templatePath: string, jsPath: string, targetPlatform: Platform.IPlatform, version?: string): Q.Promise; - createUpdateArchive(projectDirectory: string, targetPlatform: Platform.IPlatform, isDiff?: boolean): Q.Promise; - preparePlatform(projectDirectory: string, targetPlatform: Platform.IPlatform): Q.Promise; - cleanupAfterPlatform(projectDirectory: string, targetPlatform: Platform.IPlatform): Q.Promise; - runApplication(projectDirectory: string, targetPlatform: Platform.IPlatform): Q.Promise; - } - - function setupTestRunScenario(projectManager: ProjectManager, targetPlatform: Platform.IPlatform, scenarioJsPath: string, version?: string): Q.Promise; - function setupUpdateScenario(projectManager: ProjectManager, targetPlatform: Platform.IPlatform, scenarioJsPath: string, version: string): Q.Promise; - - namespace ServerUtil { - let server: any; - let updateResponse: any; - let testMessageResponse: any; - let testMessageCallback: (requestBody: any) => void; - let updateCheckCallback: (requestBody: any) => void; - let updatePackagePath: string; - - function setupServer(targetPlatform: Platform.IPlatform): void; - function cleanupServer(): void; - function createDefaultResponse(): any; - function createUpdateResponse(mandatory?: boolean, targetPlatform?: Platform.IPlatform, randomHash?: boolean): any; - function expectTestMessages(expectedMessages: any[]): Q.Promise; - - class TestMessage { - static CHECK_UP_TO_DATE: string; - static CHECK_UPDATE_AVAILABLE: string; - static CHECK_ERROR: string; - static DOWNLOAD_SUCCEEDED: string; - static DOWNLOAD_ERROR: string; - static UPDATE_INSTALLED: string; - static INSTALL_ERROR: string; - static DEVICE_READY_AFTER_UPDATE: string; - static UPDATE_FAILED_PREVIOUSLY: string; - static NOTIFY_APP_READY_SUCCESS: string; - static NOTIFY_APP_READY_FAILURE: string; - static SKIPPED_NOTIFY_APPLICATION_READY: string; - static SYNC_STATUS: string; - static RESTART_SUCCEEDED: string; - static RESTART_FAILED: string; - static PENDING_PACKAGE: string; - static CURRENT_PACKAGE: string; - static SYNC_UP_TO_DATE: number; - static SYNC_UPDATE_INSTALLED: number; - static SYNC_UPDATE_IGNORED: number; - static SYNC_ERROR: number; - static SYNC_IN_PROGRESS: number; - static SYNC_CHECKING_FOR_UPDATE: number; - static SYNC_AWAITING_USER_ACTION: number; - static SYNC_DOWNLOADING_PACKAGE: number; - static SYNC_INSTALLING_UPDATE: number; - } - - class TestMessageResponse { - static SKIP_NOTIFY_APPLICATION_READY: string; - } - - class AppMessage { - message: string; - args: any[]; - constructor(message: string, args: any[]); - static fromString(message: string): AppMessage; - } - } - - class TestBuilder { - static describe: { - (description: string, spec: () => void, scenarioPath?: string): void; - only(description: string, spec: () => void, scenarioPath?: string): void; - skip(description: string, spec: () => void, scenarioPath?: string): void; - }; - static it: { - (expectation: string, isCoreTest: boolean, assertion: (done: Mocha.Done) => void): void; - only(expectation: string, isCoreTest: boolean, assertion: (done: Mocha.Done) => void): void; - skip(expectation: string, isCoreTest: boolean, assertion: (done: Mocha.Done) => void): void; - }; - } - - namespace TestConfig { - const TestAppName: string; - const TestNamespace: string; - const AcquisitionSDKPluginName: string; - const templatePath: string; - const thisPluginInstallString: string; - const testRunDirectory: string; - const updatesDirectory: string; - const onlyRunCoreTests: boolean; - const shouldSetup: boolean; - const restartEmulators: boolean; - const isOldArchitecture: boolean; - } - - class TestUtil { - static ANDROID_KEY_PLACEHOLDER: string; - static IOS_KEY_PLACEHOLDER: string; - static SERVER_URL_PLACEHOLDER: string; - static INDEX_JS_PLACEHOLDER: string; - static CODE_PUSH_APP_VERSION_PLACEHOLDER: string; - static CODE_PUSH_TEST_APP_NAME_PLACEHOLDER: string; - static CODE_PUSH_APP_ID_PLACEHOLDER: string; - static PLUGIN_VERSION_PLACEHOLDER: string; - - static readMochaCommandLineOption(optionName: string, defaultValue?: string): string; - static readMochaCommandLineFlag(optionName: string): boolean; - static getProcessOutput(command: string, options?: any): Q.Promise; - static getPluginName(): string; - static getPluginVersion(): string; - static replaceString(filePath: string, regex: string, replacement: string): void; - static copyFile(source: string, destination: string, overwrite: boolean): Q.Promise; - static archiveFolder(sourceFolder: string, targetFolder: string, archivePath: string, isDiff: boolean): Q.Promise; - static resolveBooleanVariables(variable: string | undefined): boolean; - } - - export { Platform, PluginTestingFramework, ProjectManager, setupTestRunScenario, setupUpdateScenario, ServerUtil, TestBuilder, TestConfig, TestUtil }; -} diff --git a/test/test.ts b/test/test.ts index e7bdd75e3..6b92a2296 100644 --- a/test/test.ts +++ b/test/test.ts @@ -8,7 +8,6 @@ import slash = require("slash"); import { Platform, PluginTestingFramework, ProjectManager, setupTestRunScenario, setupUpdateScenario, ServerUtil, TestBuilder, TestConfig, TestUtil } from "@srcpush/plugin-testing-framework"; -import Q = require("q"); ////////////////////////////////////////////////////////////////////////////////////////// // Create the platforms to run the tests on.