1 // Copyright 2015-present 650 Industries. All rights reserved. 2 3 #import <Foundation/Foundation.h> 4 #import <EXManifests/EXManifestsManifest.h> 5 6 NS_ASSUME_NONNULL_BEGIN 7 8 typedef void (^EXVerifySignatureSuccessBlock)(BOOL isValid); 9 typedef void (^EXVerifySignatureErrorBlock)(NSError *error); 10 11 @interface EXApiUtil : NSObject 12 13 /** 14 * Verify data using a RSA+SHA256 base64 signature string and the public key at #{publicKeyUrl}. 15 * The public key must be in `pem` format and will be downloaded and cached. 16 * 17 * @param publicKeyUrl Url of the public key 18 * @param data The data string to verify 19 * @param signature The signature string to verify with 20 * @param successBlock Called when the verification is finished with the result 21 * @param errorBlock Called if an error occured, eg. a network error downloading the key 22 */ 23 + (void)verifySignatureWithPublicKeyUrl:(NSURL *)publicKeyUrl 24 data:(NSString *)data 25 signature:(NSString *)signature 26 successBlock:(EXVerifySignatureSuccessBlock)successBlock 27 errorBlock:(EXVerifySignatureErrorBlock)errorBlock; 28 29 + (NSURL *)bundleUrlFromManifest:(EXManifestsManifest *)manifest; 30 + (NSURL *)encodedUrlFromString:(NSString *)urlString; 31 32 @end 33 34 NS_ASSUME_NONNULL_END 35