@appzung/react-native-code-push 5.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AlertAdapter.js +24 -0
- package/CONTRIBUTING.md +136 -0
- package/CodePush.js +666 -0
- package/CodePush.podspec +27 -0
- package/LICENSE.md +13 -0
- package/README.md +386 -0
- package/RestartManager.js +59 -0
- package/android/app/build.gradle +31 -0
- package/android/app/proguard-rules.pro +25 -0
- package/android/app/src/main/AndroidManifest.xml +10 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +395 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +37 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +34 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushDialog.java +102 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInstallMode.java +16 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +12 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidUpdateException.java +7 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushMalformedDataException.java +12 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +641 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNotInitializedException.java +12 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushTelemetryManager.java +175 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUnknownException.java +12 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +369 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateState.java +15 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +267 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUtils.java +236 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/DownloadProgress.java +30 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/DownloadProgressCallback.java +5 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java +190 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +17 -0
- package/android/app/src/main/java/com/microsoft/codepush/react/SettingsManager.java +173 -0
- package/android/build.gradle +20 -0
- package/android/codepush.gradle +113 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +20 -0
- package/android/gradlew +164 -0
- package/android/gradlew.bat +90 -0
- package/android/settings.gradle +1 -0
- package/docs/api-android.md +65 -0
- package/docs/api-ios.md +31 -0
- package/docs/api-js.md +592 -0
- package/docs/multi-deployment-testing-android.md +107 -0
- package/docs/multi-deployment-testing-ios.md +53 -0
- package/docs/setup-android.md +406 -0
- package/docs/setup-ios.md +229 -0
- package/docs/setup-windows.md +65 -0
- package/gulpfile.js +302 -0
- package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +34 -0
- package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +252 -0
- package/ios/CodePush/Base64/README.md +47 -0
- package/ios/CodePush/CodePush.h +235 -0
- package/ios/CodePush/CodePush.m +1041 -0
- package/ios/CodePush/CodePushConfig.m +116 -0
- package/ios/CodePush/CodePushDownloadHandler.m +130 -0
- package/ios/CodePush/CodePushErrorUtils.m +20 -0
- package/ios/CodePush/CodePushPackage.m +598 -0
- package/ios/CodePush/CodePushTelemetryManager.m +175 -0
- package/ios/CodePush/CodePushUpdateUtils.m +376 -0
- package/ios/CodePush/CodePushUtils.m +9 -0
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +69 -0
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +16 -0
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +51 -0
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +15 -0
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +55 -0
- package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +24 -0
- package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +41 -0
- package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +28 -0
- package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +205 -0
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +103 -0
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +322 -0
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +37 -0
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +145 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +35 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +551 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +23 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +43 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +230 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +31 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +113 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +38 -0
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +500 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +18 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +214 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +23 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +29 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +19 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +68 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +18 -0
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +72 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +67 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +111 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +119 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +307 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +94 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +619 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +164 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +514 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +24 -0
- package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +11 -0
- package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +52 -0
- package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +5 -0
- package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +28 -0
- package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +70 -0
- package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +22 -0
- package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +34 -0
- package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +73 -0
- package/ios/CodePush/JWT/LICENSE +19 -0
- package/ios/CodePush/JWT/README.md +489 -0
- package/ios/CodePush/RCTConvert+CodePushInstallMode.m +20 -0
- package/ios/CodePush/RCTConvert+CodePushUpdateState.m +20 -0
- package/ios/CodePush/SSZipArchive/Common.h +81 -0
- package/ios/CodePush/SSZipArchive/README.md +1 -0
- package/ios/CodePush/SSZipArchive/SSZipArchive.h +76 -0
- package/ios/CodePush/SSZipArchive/SSZipArchive.m +691 -0
- package/ios/CodePush/SSZipArchive/aes/aes.h +198 -0
- package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +541 -0
- package/ios/CodePush/SSZipArchive/aes/aescrypt.c +294 -0
- package/ios/CodePush/SSZipArchive/aes/aeskey.c +548 -0
- package/ios/CodePush/SSZipArchive/aes/aesopt.h +739 -0
- package/ios/CodePush/SSZipArchive/aes/aestab.c +391 -0
- package/ios/CodePush/SSZipArchive/aes/aestab.h +173 -0
- package/ios/CodePush/SSZipArchive/aes/brg_endian.h +126 -0
- package/ios/CodePush/SSZipArchive/aes/brg_types.h +219 -0
- package/ios/CodePush/SSZipArchive/aes/entropy.c +54 -0
- package/ios/CodePush/SSZipArchive/aes/entropy.h +16 -0
- package/ios/CodePush/SSZipArchive/aes/fileenc.c +144 -0
- package/ios/CodePush/SSZipArchive/aes/fileenc.h +121 -0
- package/ios/CodePush/SSZipArchive/aes/hmac.c +145 -0
- package/ios/CodePush/SSZipArchive/aes/hmac.h +103 -0
- package/ios/CodePush/SSZipArchive/aes/prng.c +155 -0
- package/ios/CodePush/SSZipArchive/aes/prng.h +82 -0
- package/ios/CodePush/SSZipArchive/aes/pwd2key.c +103 -0
- package/ios/CodePush/SSZipArchive/aes/pwd2key.h +57 -0
- package/ios/CodePush/SSZipArchive/aes/sha1.c +258 -0
- package/ios/CodePush/SSZipArchive/aes/sha1.h +73 -0
- package/ios/CodePush/SSZipArchive/minizip/crypt.h +130 -0
- package/ios/CodePush/SSZipArchive/minizip/ioapi.c +369 -0
- package/ios/CodePush/SSZipArchive/minizip/ioapi.h +175 -0
- package/ios/CodePush/SSZipArchive/minizip/mztools.c +284 -0
- package/ios/CodePush/SSZipArchive/minizip/mztools.h +31 -0
- package/ios/CodePush/SSZipArchive/minizip/unzip.c +1839 -0
- package/ios/CodePush/SSZipArchive/minizip/unzip.h +248 -0
- package/ios/CodePush/SSZipArchive/minizip/zip.c +1910 -0
- package/ios/CodePush/SSZipArchive/minizip/zip.h +202 -0
- package/ios/CodePush.xcodeproj/project.pbxproj +937 -0
- package/ios/CodePush.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/CodePush.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/logging.js +6 -0
- package/package-mixins.js +69 -0
- package/package.json +47 -0
- package/request-fetch-adapter.js +52 -0
- package/scripts/generateBundledResourcesHash.js +125 -0
- package/scripts/getFilesInFolder.js +19 -0
- package/scripts/postlink/android/postlink.js +87 -0
- package/scripts/postlink/ios/postlink.js +116 -0
- package/scripts/postlink/run.js +11 -0
- package/scripts/postunlink/android/postunlink.js +74 -0
- package/scripts/postunlink/ios/postunlink.js +87 -0
- package/scripts/postunlink/run.js +11 -0
- package/scripts/recordFilesBeforeBundleCommand.js +41 -0
- package/scripts/tools/linkToolsAndroid.js +57 -0
- package/scripts/tools/linkToolsIos.js +130 -0
- package/typings/react-native-code-push.d.ts +446 -0
- package/windows/CodePush/CodePush.csproj +128 -0
- package/windows/CodePush/CodePushUtils.cs +47 -0
- package/windows/CodePush/FileUtils.cs +40 -0
- package/windows/CodePush/Properties/AssemblyInfo.cs +29 -0
- package/windows/CodePush/Properties/CodePush.rd.xml +33 -0
- package/windows/CodePush/UpdateManager.cs +305 -0
- package/windows/CodePush/UpdateUtils.cs +46 -0
- package/windows/CodePush.Net46/Adapters/Http/HttpProgress.cs +28 -0
- package/windows/CodePush.Net46/Adapters/Storage/ApplicationDataContainer.cs +106 -0
- package/windows/CodePush.Net46/CodePush.Net46.csproj +103 -0
- package/windows/CodePush.Net46/CodePushUtils.cs +158 -0
- package/windows/CodePush.Net46/FileUtils.cs +55 -0
- package/windows/CodePush.Net46/Properties/AssemblyInfo.cs +36 -0
- package/windows/CodePush.Net46/UpdateManager.cs +330 -0
- package/windows/CodePush.Net46/UpdateUtils.cs +70 -0
- package/windows/CodePush.Net46/packages.config +5 -0
- package/windows/CodePush.Shared/CodePush.Shared.projitems +22 -0
- package/windows/CodePush.Shared/CodePush.Shared.shproj +13 -0
- package/windows/CodePush.Shared/CodePushConstants.cs +35 -0
- package/windows/CodePush.Shared/CodePushNativeModule.cs +329 -0
- package/windows/CodePush.Shared/CodePushReactPackage.cs +235 -0
- package/windows/CodePush.Shared/CodePushUtils.cs +70 -0
- package/windows/CodePush.Shared/InstallMode.cs +9 -0
- package/windows/CodePush.Shared/MinimumBackgroundListener.cs +44 -0
- package/windows/CodePush.Shared/SettingsManager.cs +148 -0
- package/windows/CodePush.Shared/TelemetryManager.cs +250 -0
- package/windows/CodePush.Shared/UpdateState.cs +9 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
//
|
|
2
|
+
// JWTCoding+VersionOne.h
|
|
3
|
+
// JWT
|
|
4
|
+
//
|
|
5
|
+
// Created by Lobanov Dmitry on 27.11.16.
|
|
6
|
+
// Copyright © 2016 JWTIO. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <JWTCoding.h>
|
|
10
|
+
|
|
11
|
+
@protocol JWTAlgorithm;
|
|
12
|
+
@class JWTClaimsSet;
|
|
13
|
+
|
|
14
|
+
@interface JWT (VersionOne)
|
|
15
|
+
#pragma mark - Encode
|
|
16
|
+
+ (NSString *)encodeClaimsSet:(JWTClaimsSet *)theClaimsSet withSecret:(NSString *)theSecret;
|
|
17
|
+
+ (NSString *)encodeClaimsSet:(JWTClaimsSet *)theClaimsSet withSecret:(NSString *)theSecret algorithm:(id<JWTAlgorithm>)theAlgorithm;
|
|
18
|
+
|
|
19
|
+
+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret;
|
|
20
|
+
+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret algorithm:(id<JWTAlgorithm>)theAlgorithm;
|
|
21
|
+
|
|
22
|
+
+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret withHeaders:(NSDictionary *)theHeaders algorithm:(id<JWTAlgorithm>)theAlgorithm;
|
|
23
|
+
|
|
24
|
+
+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret withHeaders:(NSDictionary *)theHeaders algorithm:(id<JWTAlgorithm>)theAlgorithm withError:(NSError * __autoreleasing *)theError;
|
|
25
|
+
|
|
26
|
+
//Will be deprecated in later releases
|
|
27
|
+
#pragma mark - Decode
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
Decodes a JWT and returns the decoded Header and Payload
|
|
31
|
+
@param theMessage The encoded JWT
|
|
32
|
+
@param theSecret The verification key to use for validating the JWT signature
|
|
33
|
+
@param theTrustedClaimsSet The JWTClaimsSet to use for verifying the JWT values
|
|
34
|
+
@param theError Error pointer, if there is an error decoding the message, upon return contains an NSError object that describes the problem.
|
|
35
|
+
@param theAlgorithmName The name of the algorithm to use for verifying the signature. Required, unless skipping verification
|
|
36
|
+
@param theForcedOption BOOL indicating if verifying the JWT signature should be skipped. Should only be used for debugging
|
|
37
|
+
@return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs.
|
|
38
|
+
*/
|
|
39
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withTrustedClaimsSet:(JWTClaimsSet *)theTrustedClaimsSet withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName withForcedOption:(BOOL)theForcedOption;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
Decodes a JWT and returns the decoded Header and Payload
|
|
43
|
+
@param theMessage The encoded JWT
|
|
44
|
+
@param theSecret The verification key to use for validating the JWT signature
|
|
45
|
+
@param theTrustedClaimsSet The JWTClaimsSet to use for verifying the JWT values
|
|
46
|
+
@param theError Error pointer, if there is an error decoding the message, upon return contains an NSError object that describes the problem.
|
|
47
|
+
@param theAlgorithmName The name of the algorithm to use for verifying the signature. Required.
|
|
48
|
+
@return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs.
|
|
49
|
+
*/
|
|
50
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withTrustedClaimsSet:(JWTClaimsSet *)theTrustedClaimsSet withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
Decodes a JWT and returns the decoded Header and Payload.
|
|
54
|
+
|
|
55
|
+
Uses the JWTAlgorithmHS512 for decoding
|
|
56
|
+
|
|
57
|
+
@param theMessage The encoded JWT
|
|
58
|
+
@param theSecret The verification key to use for validating the JWT signature
|
|
59
|
+
@param theTrustedClaimsSet The JWTClaimsSet to use for verifying the JWT values
|
|
60
|
+
@param theError Error pointer, if there is an error decoding the message, upon return contains an NSError object that describes the problem.
|
|
61
|
+
@param theForcedOption BOOL indicating if verifying the JWT signature should be skipped. Should only be used for debugging
|
|
62
|
+
@return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs.
|
|
63
|
+
*/
|
|
64
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withTrustedClaimsSet:(JWTClaimsSet *)theTrustedClaimsSet withError:(NSError *__autoreleasing *)theError withForcedOption:(BOOL)theForcedOption;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
Decodes a JWT and returns the decoded Header and Payload
|
|
68
|
+
@param theMessage The encoded JWT
|
|
69
|
+
@param theSecret The verification key to use for validating the JWT signature
|
|
70
|
+
@param theError Error pointer, if there is an error decoding the message, upon return contains an NSError object that describes the problem.
|
|
71
|
+
@param theAlgorithmName The name of the algorithm to use for verifying the signature. Required, unless skipping verification
|
|
72
|
+
@param skipVerification BOOL indicating if verifying the JWT signature should be skipped. Should only be used for debugging
|
|
73
|
+
@return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs.
|
|
74
|
+
*/
|
|
75
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName skipVerification:(BOOL)skipVerification;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
Decodes a JWT and returns the decoded Header and Payload
|
|
79
|
+
@param theMessage The encoded JWT
|
|
80
|
+
@param theSecret The verification key to use for validating the JWT signature
|
|
81
|
+
@param theError Error pointer, if there is an error decoding the message, upon return contains an NSError object that describes the problem.
|
|
82
|
+
@param theAlgorithmName The name of the algorithm to use for verifying the signature. Required.
|
|
83
|
+
@return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs.
|
|
84
|
+
*/
|
|
85
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
Decodes a JWT and returns the decoded Header and Payload
|
|
89
|
+
|
|
90
|
+
Uses the JWTAlgorithmHS512 for decoding
|
|
91
|
+
|
|
92
|
+
@param theMessage The encoded JWT
|
|
93
|
+
@param theSecret The verification key to use for validating the JWT signature
|
|
94
|
+
@param theError Error pointer, if there is an error decoding the message, upon return contains an NSError object that describes the problem.
|
|
95
|
+
@param theForcedOption BOOL indicating if verifying the JWT signature should be skipped.
|
|
96
|
+
@return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs.
|
|
97
|
+
*/
|
|
98
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError *__autoreleasing *)theError withForcedOption:(BOOL)theForcedOption;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
Decodes a JWT and returns the decoded Header and Payload.
|
|
102
|
+
Uses the JWTAlgorithmHS512 for decoding
|
|
103
|
+
@param theMessage The encoded JWT
|
|
104
|
+
@param theSecret The verification key to use for validating the JWT signature
|
|
105
|
+
@param theError Error pointer, if there is an error decoding the message, upon return contains an NSError object that describes the problem.
|
|
106
|
+
@return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs.
|
|
107
|
+
*/
|
|
108
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError * __autoreleasing *)theError;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
Decodes a JWT and returns the decoded Header and Payload.
|
|
112
|
+
Uses the JWTAlgorithmHS512 for decoding
|
|
113
|
+
@param theMessage The encoded JWT
|
|
114
|
+
@param theSecret The verification key to use for validating the JWT signature
|
|
115
|
+
@return A dictionary containing the header and payload dictionaries. Keyed to "header" and "payload", respectively. Or nil if an error occurs.
|
|
116
|
+
*/
|
|
117
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret;
|
|
118
|
+
|
|
119
|
+
@end
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
//
|
|
2
|
+
// JWTCoding+VersionOne.m
|
|
3
|
+
// JWT
|
|
4
|
+
//
|
|
5
|
+
// Created by Lobanov Dmitry on 27.11.16.
|
|
6
|
+
// Copyright © 2016 JWTIO. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import "JWTCoding+VersionOne.h"
|
|
10
|
+
#import "JWTBase64Coder.h"
|
|
11
|
+
|
|
12
|
+
#import "JWTRSAlgorithm.h"
|
|
13
|
+
|
|
14
|
+
#import "JWTAlgorithmFactory.h"
|
|
15
|
+
#import "JWTAlgorithmHSBase.h"
|
|
16
|
+
|
|
17
|
+
#import "JWTAlgorithmDataHolder.h"
|
|
18
|
+
|
|
19
|
+
#import "JWTClaimsSetSerializer.h"
|
|
20
|
+
#import "JWTClaimsSetVerifier.h"
|
|
21
|
+
|
|
22
|
+
#import "JWTErrorDescription.h"
|
|
23
|
+
|
|
24
|
+
@implementation JWT (VersionOne)
|
|
25
|
+
#pragma mark - Private Methods
|
|
26
|
+
+ (NSString *)encodeSegment:(id)theSegment withError:(NSError **)error
|
|
27
|
+
{
|
|
28
|
+
NSData *encodedSegmentData = nil;
|
|
29
|
+
|
|
30
|
+
if (theSegment) {
|
|
31
|
+
encodedSegmentData = [NSJSONSerialization dataWithJSONObject:theSegment options:0 error:error];
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
// error!
|
|
35
|
+
NSError *generatedError = [JWTErrorDescription errorWithCode:JWTInvalidSegmentSerializationError];
|
|
36
|
+
if (error) {
|
|
37
|
+
*error = generatedError;
|
|
38
|
+
}
|
|
39
|
+
NSLog(@"%@ Could not encode segment: %@", self.class, generatedError.localizedDescription);
|
|
40
|
+
return nil;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
NSString *encodedSegment = nil;
|
|
44
|
+
|
|
45
|
+
if (encodedSegmentData) {
|
|
46
|
+
encodedSegment = [JWTBase64Coder base64UrlEncodedStringWithData:encodedSegmentData];//[encodedSegmentData base64UrlEncodedString];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return encodedSegment;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
+ (NSString *)encodeSegment:(id)theSegment;
|
|
53
|
+
{
|
|
54
|
+
NSError *error;
|
|
55
|
+
return [self encodeSegment:theSegment withError:&error];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#pragma mark - Public Methods
|
|
59
|
+
|
|
60
|
+
+ (NSString *)encodeClaimsSet:(JWTClaimsSet *)theClaimsSet withSecret:(NSString *)theSecret;
|
|
61
|
+
{
|
|
62
|
+
return [self encodeClaimsSet:theClaimsSet withSecret:theSecret algorithm:[JWTAlgorithmFactory algorithmByName:JWTAlgorithmNameHS512]];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
+ (NSString *)encodeClaimsSet:(JWTClaimsSet *)theClaimsSet withSecret:(NSString *)theSecret algorithm:(id<JWTAlgorithm>)theAlgorithm;
|
|
66
|
+
{
|
|
67
|
+
NSDictionary *payload = [JWTClaimsSetSerializer dictionaryWithClaimsSet:theClaimsSet];
|
|
68
|
+
return [self encodePayload:payload withSecret:theSecret algorithm:theAlgorithm];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret;
|
|
72
|
+
{
|
|
73
|
+
return [self encodePayload:thePayload withSecret:theSecret algorithm:[JWTAlgorithmFactory algorithmByName:JWTAlgorithmNameHS512]];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret algorithm:(id<JWTAlgorithm>)theAlgorithm;
|
|
77
|
+
{
|
|
78
|
+
return [self encodePayload:thePayload withSecret:theSecret withHeaders:nil algorithm:theAlgorithm];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret withHeaders:(NSDictionary *)theHeaders algorithm:(id<JWTAlgorithm>)theAlgorithm;
|
|
82
|
+
{
|
|
83
|
+
|
|
84
|
+
NSError *error = nil;
|
|
85
|
+
NSString *encodedString = [self encodePayload:thePayload withSecret:theSecret withHeaders:theHeaders algorithm:theAlgorithm withError:&error];
|
|
86
|
+
|
|
87
|
+
if (error) {
|
|
88
|
+
// do something
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return encodedString;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
+ (NSString *)encodePayload:(NSDictionary *)thePayload withSecret:(NSString *)theSecret withHeaders:(NSDictionary *)theHeaders algorithm:(id<JWTAlgorithm>)theAlgorithm withError:(NSError * __autoreleasing *)theError;
|
|
95
|
+
{
|
|
96
|
+
|
|
97
|
+
NSDictionary *header = @{@"typ": @"JWT", @"alg": theAlgorithm.name};
|
|
98
|
+
NSMutableDictionary *allHeaders = [header mutableCopy];
|
|
99
|
+
|
|
100
|
+
if (theHeaders.allKeys.count) {
|
|
101
|
+
[allHeaders addEntriesFromDictionary:theHeaders];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
NSString *headerSegment = [self encodeSegment:[allHeaders copy] withError:theError];
|
|
105
|
+
|
|
106
|
+
if (!headerSegment) {
|
|
107
|
+
// encode header segment error
|
|
108
|
+
if (theError) {
|
|
109
|
+
*theError = [JWTErrorDescription errorWithCode:JWTEncodingHeaderError];
|
|
110
|
+
}
|
|
111
|
+
return nil;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
NSString *payloadSegment = [self encodeSegment:thePayload withError:theError];
|
|
115
|
+
|
|
116
|
+
if (!payloadSegment) {
|
|
117
|
+
// encode payment segment error
|
|
118
|
+
if (theError) {
|
|
119
|
+
*theError = [JWTErrorDescription errorWithCode:JWTEncodingPayloadError];
|
|
120
|
+
}
|
|
121
|
+
return nil;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (!theAlgorithm) {
|
|
125
|
+
// error
|
|
126
|
+
*theError = [JWTErrorDescription errorWithCode:JWTUnsupportedAlgorithmError];
|
|
127
|
+
return nil;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
NSString *signingInput = [@[headerSegment, payloadSegment] componentsJoinedByString:@"."];
|
|
131
|
+
NSData *signedOutputData = [theAlgorithm encodePayload:signingInput withSecret:theSecret];
|
|
132
|
+
NSString *signedOutput = [JWTBase64Coder base64UrlEncodedStringWithData:signedOutputData];
|
|
133
|
+
|
|
134
|
+
return [@[headerSegment, payloadSegment, signedOutput] componentsJoinedByString:@"."];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
#pragma mark - Decode
|
|
138
|
+
|
|
139
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withTrustedClaimsSet:(JWTClaimsSet *)theTrustedClaimsSet withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName
|
|
140
|
+
{
|
|
141
|
+
return [self decodeMessage:theMessage withSecret:theSecret withTrustedClaimsSet:theTrustedClaimsSet withError:theError withForcedAlgorithmByName:theAlgorithmName withForcedOption:NO];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withTrustedClaimsSet:(JWTClaimsSet *)theTrustedClaimsSet withError:(NSError *__autoreleasing *)theError withForcedOption:(BOOL)theForcedOption
|
|
145
|
+
{
|
|
146
|
+
return [self decodeMessage:theMessage withSecret:theSecret withTrustedClaimsSet:theTrustedClaimsSet withError:theError withForcedAlgorithmByName:JWTAlgorithmNameHS512 withForcedOption:theForcedOption];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withTrustedClaimsSet:(JWTClaimsSet *)theTrustedClaimsSet withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName withForcedOption:(BOOL)theForcedOption
|
|
150
|
+
{
|
|
151
|
+
return [self decodeMessage:theMessage withSecret:theSecret withTrustedClaimsSet:theTrustedClaimsSet withError:theError withForcedAlgorithmByName:theAlgorithmName withForcedOption:theForcedOption withAlgorithmWhiteList:nil];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withTrustedClaimsSet:(JWTClaimsSet *)theTrustedClaimsSet withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName withForcedOption:(BOOL)theForcedOption withAlgorithmWhiteList:(NSSet *)theWhitelist
|
|
155
|
+
{
|
|
156
|
+
NSDictionary *dictionary = [self decodeMessage:theMessage withSecret:theSecret withError:theError withForcedAlgorithmByName:theAlgorithmName skipVerification:theForcedOption whitelist:theWhitelist];
|
|
157
|
+
|
|
158
|
+
if (*theError) {
|
|
159
|
+
// do something
|
|
160
|
+
return dictionary;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (theTrustedClaimsSet) {
|
|
164
|
+
BOOL claimVerified = [JWTClaimsSetVerifier verifyClaimsSet:[JWTClaimsSetSerializer claimsSetWithDictionary:dictionary[@"payload"]] withTrustedClaimsSet:theTrustedClaimsSet];
|
|
165
|
+
if (claimVerified) {
|
|
166
|
+
return dictionary;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
*theError = [JWTErrorDescription errorWithCode:JWTClaimsSetVerificationFailed];
|
|
170
|
+
return nil;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return dictionary;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError *__autoreleasing *)theError withForcedOption:(BOOL)theForcedOption;
|
|
178
|
+
{
|
|
179
|
+
return [self decodeMessage:theMessage withSecret:theSecret withError:theError withForcedAlgorithmByName:JWTAlgorithmNameHS512 skipVerification:theForcedOption];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName;
|
|
183
|
+
{
|
|
184
|
+
return [self decodeMessage:theMessage withSecret:theSecret withError:theError withForcedAlgorithmByName:theAlgorithmName skipVerification:NO];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName skipVerification:(BOOL)skipVerification
|
|
188
|
+
{
|
|
189
|
+
return [self decodeMessage:theMessage withSecret:theSecret withError:theError withForcedAlgorithmByName:theAlgorithmName skipVerification:skipVerification whitelist:nil];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError *__autoreleasing *)theError withForcedAlgorithmByName:(NSString *)theAlgorithmName skipVerification:(BOOL)skipVerification whitelist:(NSSet *)theWhitelist
|
|
193
|
+
{
|
|
194
|
+
NSArray *parts = [theMessage componentsSeparatedByString:@"."];
|
|
195
|
+
|
|
196
|
+
if (parts.count < 3) {
|
|
197
|
+
// generate error?
|
|
198
|
+
if (theError) {
|
|
199
|
+
*theError = [JWTErrorDescription errorWithCode:JWTInvalidFormatError];
|
|
200
|
+
}
|
|
201
|
+
return nil;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
NSString *headerPart = parts[0];
|
|
205
|
+
NSString *payloadPart = parts[1];
|
|
206
|
+
NSString *signedPart = parts[2];
|
|
207
|
+
|
|
208
|
+
// decode headerPart
|
|
209
|
+
NSError *jsonError = nil;
|
|
210
|
+
NSData *headerData = [JWTBase64Coder dataWithBase64UrlEncodedString:headerPart];
|
|
211
|
+
id headerJSON = [NSJSONSerialization JSONObjectWithData:headerData
|
|
212
|
+
options:0
|
|
213
|
+
error:&jsonError];
|
|
214
|
+
if (jsonError) {
|
|
215
|
+
*theError = [JWTErrorDescription errorWithCode:JWTDecodingHeaderError];
|
|
216
|
+
return nil;
|
|
217
|
+
}
|
|
218
|
+
NSDictionary *header = (NSDictionary *)headerJSON;
|
|
219
|
+
if (!header) {
|
|
220
|
+
*theError = [JWTErrorDescription errorWithCode:JWTNoHeaderError];
|
|
221
|
+
return nil;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (!skipVerification) {
|
|
225
|
+
// find algorithm
|
|
226
|
+
|
|
227
|
+
//It is insecure to trust the header's value for the algorithm, since
|
|
228
|
+
//the signature hasn't been verified yet, so an algorithm must be provided
|
|
229
|
+
if (!theAlgorithmName) {
|
|
230
|
+
*theError = [JWTErrorDescription errorWithCode:JWTUnspecifiedAlgorithmError];
|
|
231
|
+
return nil;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
NSString *headerAlgorithmName = header[@"alg"];
|
|
235
|
+
|
|
236
|
+
//If the algorithm in the header doesn't match what's expected, verification fails
|
|
237
|
+
if (![theAlgorithmName isEqualToString:headerAlgorithmName]) {
|
|
238
|
+
*theError = [JWTErrorDescription errorWithCode:JWTUnsupportedAlgorithmError];
|
|
239
|
+
return nil;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
//If a whitelist is passed in, ensure the chosen algorithm is allowed
|
|
243
|
+
if (theWhitelist) {
|
|
244
|
+
if (![theWhitelist containsObject:theAlgorithmName]) {
|
|
245
|
+
*theError = [JWTErrorDescription errorWithCode:JWTUnsupportedAlgorithmError];
|
|
246
|
+
return nil;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
id<JWTAlgorithm> algorithm = [JWTAlgorithmFactory algorithmByName:theAlgorithmName];
|
|
251
|
+
|
|
252
|
+
if (!algorithm) {
|
|
253
|
+
*theError = [JWTErrorDescription errorWithCode:JWTUnsupportedAlgorithmError];
|
|
254
|
+
return nil;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Verify the signed part
|
|
258
|
+
NSString *signingInput = [@[headerPart, payloadPart] componentsJoinedByString:@"."];
|
|
259
|
+
BOOL signatureValid = [algorithm verifySignedInput:signingInput withSignature:signedPart verificationKey:theSecret];
|
|
260
|
+
|
|
261
|
+
if (!signatureValid) {
|
|
262
|
+
*theError = [JWTErrorDescription errorWithCode:JWTInvalidSignatureError];
|
|
263
|
+
return nil;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// and decode payload
|
|
268
|
+
jsonError = nil;
|
|
269
|
+
NSData *payloadData = [JWTBase64Coder dataWithBase64UrlEncodedString:payloadPart];
|
|
270
|
+
id payloadJSON = [NSJSONSerialization JSONObjectWithData:payloadData
|
|
271
|
+
options:0
|
|
272
|
+
error:&jsonError];
|
|
273
|
+
if (jsonError) {
|
|
274
|
+
*theError = [JWTErrorDescription errorWithCode:JWTDecodingPayloadError];
|
|
275
|
+
return nil;
|
|
276
|
+
}
|
|
277
|
+
NSDictionary *payload = (NSDictionary *)payloadJSON;
|
|
278
|
+
|
|
279
|
+
if (!payload) {
|
|
280
|
+
*theError = [JWTErrorDescription errorWithCode:JWTNoPayloadError];
|
|
281
|
+
return nil;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
NSDictionary *result = @{
|
|
285
|
+
@"header" : header,
|
|
286
|
+
@"payload" : payload
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
return result;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret withError:(NSError * __autoreleasing *)theError;
|
|
293
|
+
{
|
|
294
|
+
return [self decodeMessage:theMessage withSecret:theSecret withError:theError withForcedAlgorithmByName:JWTAlgorithmNameHS512];
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
+ (NSDictionary *)decodeMessage:(NSString *)theMessage withSecret:(NSString *)theSecret;
|
|
298
|
+
{
|
|
299
|
+
NSError *error = nil;
|
|
300
|
+
NSDictionary *dictionary = [self decodeMessage:theMessage withSecret:theSecret withError:&error];
|
|
301
|
+
if (error) {
|
|
302
|
+
// do something
|
|
303
|
+
}
|
|
304
|
+
return dictionary;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
@end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
//
|
|
2
|
+
// JWTCoding+VersionThree.h
|
|
3
|
+
// JWT
|
|
4
|
+
//
|
|
5
|
+
// Created by Lobanov Dmitry on 27.11.16.
|
|
6
|
+
// Copyright © 2016 JWTIO. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <JWTCoding.h>
|
|
10
|
+
|
|
11
|
+
// encode and decode options
|
|
12
|
+
@protocol JWTAlgorithm;
|
|
13
|
+
@class JWTClaimsSet;
|
|
14
|
+
@class JWTCodingBuilder;
|
|
15
|
+
@class JWTEncodingBuilder;
|
|
16
|
+
@class JWTDecodingBuilder;
|
|
17
|
+
@class JWTAlgorithmDataHolderChain;
|
|
18
|
+
@protocol JWTAlgorithmDataHolderProtocol;
|
|
19
|
+
@class JWTCodingResultType;
|
|
20
|
+
|
|
21
|
+
@interface JWT (VersionThree)
|
|
22
|
+
+ (JWTEncodingBuilder *)encodeWithHolders:(NSArray *)holders;
|
|
23
|
+
+ (JWTEncodingBuilder *)encodeWithChain:(JWTAlgorithmDataHolderChain *)chain;
|
|
24
|
+
+ (JWTDecodingBuilder *)decodeWithHolders:(NSArray *)holders;
|
|
25
|
+
+ (JWTDecodingBuilder *)decodeWithChain:(JWTAlgorithmDataHolderChain *)chain;
|
|
26
|
+
@end
|
|
27
|
+
|
|
28
|
+
@interface JWTCodingBuilder : NSObject
|
|
29
|
+
#pragma mark - Create
|
|
30
|
+
// each element should conform to JWTAlgorithmDataHolderProtocol
|
|
31
|
+
+ (instancetype)createWithHolders:(NSArray *)holders;
|
|
32
|
+
+ (instancetype)createWithChain:(JWTAlgorithmDataHolderChain *)chain;
|
|
33
|
+
+ (instancetype)createWithEmptyChain;
|
|
34
|
+
|
|
35
|
+
#pragma mark - Internal
|
|
36
|
+
@property (nonatomic, readonly) JWTAlgorithmDataHolderChain *internalChain;
|
|
37
|
+
@property (copy, nonatomic, readonly) NSNumber *internalOptions;
|
|
38
|
+
|
|
39
|
+
#pragma mark - Fluent
|
|
40
|
+
@property (copy, nonatomic, readonly) JWTCodingBuilder *(^chain)(JWTAlgorithmDataHolderChain *chain);
|
|
41
|
+
@property (copy, nonatomic, readonly) JWTCodingBuilder *(^constructChain)(JWTAlgorithmDataHolderChain *(^block)());
|
|
42
|
+
@property (copy, nonatomic, readonly) JWTCodingBuilder *(^modifyChain)(JWTAlgorithmDataHolderChain *(^block)(JWTAlgorithmDataHolderChain * chain));
|
|
43
|
+
@property (copy, nonatomic, readonly) JWTCodingBuilder *(^options)(NSNumber *options);
|
|
44
|
+
@property (copy, nonatomic, readonly) JWTCodingBuilder *(^addHolder)(id<JWTAlgorithmDataHolderProtocol> holder);
|
|
45
|
+
//@property (copy, nonatomic, readonly) JWTCodingBuilder *(^constructHolder)(id<JWTAlgorithmDataHolderProtocol>(^block)(id<JWTAlgorithmDataHolderProtocol> holder));
|
|
46
|
+
@end
|
|
47
|
+
|
|
48
|
+
@interface JWTCodingBuilder (Sugar)
|
|
49
|
+
- (instancetype)and;
|
|
50
|
+
- (instancetype)with;
|
|
51
|
+
@end
|
|
52
|
+
|
|
53
|
+
@interface JWTCodingBuilder (Coding)
|
|
54
|
+
@property (nonatomic, readonly) JWTCodingResultType *result;
|
|
55
|
+
@end
|
|
56
|
+
|
|
57
|
+
@interface JWTEncodingBuilder : JWTCodingBuilder
|
|
58
|
+
#pragma mark - Create
|
|
59
|
+
+ (instancetype)encodePayload:(NSDictionary *)payload;
|
|
60
|
+
+ (instancetype)encodeClaimsSet:(JWTClaimsSet *)claimsSet;
|
|
61
|
+
|
|
62
|
+
#pragma mark - Internal
|
|
63
|
+
@property (copy, nonatomic, readonly) NSDictionary *internalPayload;
|
|
64
|
+
@property (copy, nonatomic, readonly) NSDictionary *internalHeaders;
|
|
65
|
+
@property (nonatomic, readonly) JWTClaimsSet *internalClaimsSet;
|
|
66
|
+
|
|
67
|
+
#pragma mark - Fluent
|
|
68
|
+
@property (copy, nonatomic, readonly) JWTEncodingBuilder *(^payload)(NSDictionary *payload);
|
|
69
|
+
@property (copy, nonatomic, readonly) JWTEncodingBuilder *(^headers)(NSDictionary *headers);
|
|
70
|
+
@property (copy, nonatomic, readonly) JWTEncodingBuilder *(^claimsSet)(JWTClaimsSet *claimsSet);
|
|
71
|
+
|
|
72
|
+
@end
|
|
73
|
+
|
|
74
|
+
@interface JWTEncodingBuilder (Coding)
|
|
75
|
+
@property (nonatomic, readonly) JWTCodingResultType *encode;
|
|
76
|
+
@end
|
|
77
|
+
|
|
78
|
+
@interface JWTDecodingBuilder : JWTCodingBuilder
|
|
79
|
+
#pragma mark - Create
|
|
80
|
+
+ (instancetype)decodeMessage:(NSString *)message;
|
|
81
|
+
|
|
82
|
+
#pragma mark - Internal
|
|
83
|
+
@property (copy, nonatomic, readonly) NSString *internalMessage;
|
|
84
|
+
@property (nonatomic, readonly) JWTClaimsSet *internalClaimsSet;
|
|
85
|
+
|
|
86
|
+
#pragma mark - Fluent
|
|
87
|
+
@property (copy, nonatomic, readonly) JWTDecodingBuilder *(^message)(NSString *message);
|
|
88
|
+
@property (copy, nonatomic, readonly) JWTDecodingBuilder *(^claimsSet)(JWTClaimsSet *claimsSet);
|
|
89
|
+
|
|
90
|
+
@end
|
|
91
|
+
|
|
92
|
+
@interface JWTDecodingBuilder (Coding)
|
|
93
|
+
@property (nonatomic, readonly) JWTCodingResultType *decode;
|
|
94
|
+
@end
|