Merge NSData categories.
This commit is contained in:
parent
2c9c028504
commit
db3df249bf
2
Pods
2
Pods
|
@ -1 +1 @@
|
|||
Subproject commit f62516a6d38a44a322bd115f913e83e2941e404f
|
||||
Subproject commit d16f91410fa1d9859a910b6f2b6e2369fb6d0377
|
|
@ -1,7 +1,9 @@
|
|||
// Copyright © 2016 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSDeviceProvisioningURLParser.h"
|
||||
#import "NSData+Base64.h"
|
||||
#import "NSData+OWS.h"
|
||||
#import <AxolotlKit/NSData+keyVersionByte.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
|
|
@ -72,8 +72,8 @@
|
|||
#import <SignalServiceKit/Cryptography.h>
|
||||
#import <SignalServiceKit/DataSource.h>
|
||||
#import <SignalServiceKit/MIMETypeUtil.h>
|
||||
#import <SignalServiceKit/NSData+Base64.h>
|
||||
#import <SignalServiceKit/NSData+Image.h>
|
||||
#import <SignalServiceKit/NSData+OWS.h>
|
||||
#import <SignalServiceKit/NSDate+OWS.h>
|
||||
#import <SignalServiceKit/NSNotificationCenter+OWS.h>
|
||||
#import <SignalServiceKit/NSString+SSK.h>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#import "OWSBackupIO.h"
|
||||
#import "OWSDatabaseMigration.h"
|
||||
#import "Signal-Swift.h"
|
||||
#import <SignalServiceKit/NSData+Base64.h>
|
||||
#import <SignalServiceKit/NSData+OWS.h>
|
||||
#import <SignalServiceKit/NSDate+OWS.h>
|
||||
#import <SignalServiceKit/OWSBackgroundTask.h>
|
||||
#import <SignalServiceKit/OWSError.h>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#import "OWSDatabaseMigration.h"
|
||||
#import "OWSDatabaseMigrationRunner.h"
|
||||
#import "Signal-Swift.h"
|
||||
#import <SignalServiceKit/NSData+Base64.h>
|
||||
#import <SignalServiceKit/NSData+OWS.h>
|
||||
#import <SignalServiceKit/OWSBackgroundTask.h>
|
||||
#import <SignalServiceKit/OWSFileSystem.h>
|
||||
#import <SignalServiceKit/TSAttachment.h>
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
// Copyright © 2016 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSDeviceProvisioningURLParser.h"
|
||||
#import <SignalServiceKit/NSData+Base64.h>
|
||||
#import <SignalServiceKit/NSData+OWS.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
@interface OWSDeviceProvisioningURLParserTest : XCTestCase
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
//
|
||||
|
||||
#import <SignalServiceKit/CDSSigningCertificate.h>
|
||||
#import <SignalServiceKit/NSData+Base64.h>
|
||||
#import <SignalServiceKit/NSData+OWS.h>
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
#import "TSAccountManager.h"
|
||||
#import "AppContext.h"
|
||||
#import "Cryptography.h"
|
||||
#import "NSData+Base64.h"
|
||||
#import "NSData+OWS.h"
|
||||
#import "NSNotificationCenter+OWS.h"
|
||||
#import "NSURLSessionDataTask+StatusCode.h"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#import "CDSSigningCertificate.h"
|
||||
#import "Cryptography.h"
|
||||
#import "NSData+Base64.h"
|
||||
#import "NSData+OWS.h"
|
||||
#import <CommonCrypto/CommonCrypto.h>
|
||||
#import <openssl/x509.h>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
|
||||
#import "TSGroupThread.h"
|
||||
#import "NSData+Base64.h"
|
||||
#import "NSData+OWS.h"
|
||||
#import "TSAttachmentStream.h"
|
||||
#import <SignalServiceKit/TSAccountManager.h>
|
||||
#import <YapDatabase/YapDatabaseConnection.h>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSMessageServiceParams.h"
|
||||
#import "NSData+Base64.h"
|
||||
#import "NSData+OWS.h"
|
||||
#import "TSConstants.h"
|
||||
|
||||
@implementation OWSMessageServiceParams
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSData+OWS.h"
|
||||
#import "PreKeyBundle+jsonDict.h"
|
||||
#import "NSData+Base64.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSRequestBuilder.h"
|
||||
#import "TSRequest.h"
|
||||
#import "NSData+OWS.h"
|
||||
#import "TSConstants.h"
|
||||
#import "NSData+Base64.h"
|
||||
#import "TSRequest.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
|
||||
#import "OWSRequestFactory.h"
|
||||
#import "NSData+Base64.h"
|
||||
#import "NSData+OWS.h"
|
||||
#import "OWS2FAManager.h"
|
||||
#import "OWSDevice.h"
|
||||
#import "TSAttributes.h"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
|
||||
#import "OWSFingerprint.h"
|
||||
#import "NSData+Base64.h"
|
||||
#import "NSData+OWS.h"
|
||||
#import "OWSError.h"
|
||||
#import <AxolotlKit/NSData+keyVersionByte.h>
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#import "OWSStorage.h"
|
||||
#import "AppContext.h"
|
||||
#import "NSData+Base64.h"
|
||||
#import "NSData+OWS.h"
|
||||
#import "NSNotificationCenter+OWS.h"
|
||||
#import "NSUserDefaults+OWS.h"
|
||||
#import "OWSBackgroundTask.h"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
//
|
||||
|
||||
#import "Cryptography.h"
|
||||
#import "NSData+Base64.h"
|
||||
#import "NSData+OWS.h"
|
||||
#import "OWSError.h"
|
||||
#import <CommonCrypto/CommonCryptor.h>
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
@interface NSData (Base64)
|
||||
|
||||
+ (NSData *)dataFromBase64StringNoPadding:(NSString *)aString;
|
||||
+ (NSData *)dataFromBase64String:(NSString *)aString;
|
||||
|
||||
- (NSString *)base64EncodedString;
|
||||
|
||||
@end
|
|
@ -1,49 +0,0 @@
|
|||
|
||||
#import "NSData+Base64.h"
|
||||
|
||||
|
||||
@implementation NSData (Base64)
|
||||
|
||||
+ (NSData *)dataFromBase64StringNoPadding:(NSString *)aString {
|
||||
int padding = aString.length % 4;
|
||||
|
||||
NSMutableString *strResult = [aString mutableCopy];
|
||||
if (padding != 0) {
|
||||
int charsToAdd = 4 - padding;
|
||||
for (int i = 0; i < charsToAdd; i++) {
|
||||
[strResult appendString:@"="];
|
||||
}
|
||||
}
|
||||
return [self dataFromBase64String:strResult];
|
||||
}
|
||||
|
||||
//
|
||||
// dataFromBase64String:
|
||||
//
|
||||
// Creates an NSData object containing the base64 decoded representation of
|
||||
// the base64 string 'aString'
|
||||
//
|
||||
// Parameters:
|
||||
// aString - the base64 string to decode
|
||||
//
|
||||
// returns the NSData representation of the base64 string
|
||||
//
|
||||
|
||||
+ (NSData *)dataFromBase64String:(NSString *)aString {
|
||||
return [[NSData alloc] initWithBase64EncodedString:aString options:NSDataBase64DecodingIgnoreUnknownCharacters];
|
||||
}
|
||||
|
||||
//
|
||||
// base64EncodedString
|
||||
//
|
||||
// Creates an NSString object that contains the base 64 encoding of the
|
||||
// receiver's data. Lines are broken at 64 characters long.
|
||||
//
|
||||
// returns an NSString being the base 64 representation of the
|
||||
// receiver.
|
||||
//
|
||||
- (NSString *)base64EncodedString {
|
||||
return [self base64EncodedStringWithOptions:0];
|
||||
}
|
||||
|
||||
@end
|
|
@ -15,6 +15,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
- (NSString *)hexadecimalString;
|
||||
|
||||
#pragma mark - Base64
|
||||
|
||||
+ (NSData *)dataFromBase64StringNoPadding:(NSString *)aString;
|
||||
+ (NSData *)dataFromBase64String:(NSString *)aString;
|
||||
|
||||
- (NSString *)base64EncodedString;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -51,6 +51,53 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return [hexString copy];
|
||||
}
|
||||
|
||||
#pragma mark - Base64
|
||||
|
||||
+ (NSData *)dataFromBase64StringNoPadding:(NSString *)aString
|
||||
{
|
||||
int padding = aString.length % 4;
|
||||
|
||||
NSMutableString *strResult = [aString mutableCopy];
|
||||
if (padding != 0) {
|
||||
int charsToAdd = 4 - padding;
|
||||
for (int i = 0; i < charsToAdd; i++) {
|
||||
[strResult appendString:@"="];
|
||||
}
|
||||
}
|
||||
return [self dataFromBase64String:strResult];
|
||||
}
|
||||
|
||||
//
|
||||
// dataFromBase64String:
|
||||
//
|
||||
// Creates an NSData object containing the base64 decoded representation of
|
||||
// the base64 string 'aString'
|
||||
//
|
||||
// Parameters:
|
||||
// aString - the base64 string to decode
|
||||
//
|
||||
// returns the NSData representation of the base64 string
|
||||
//
|
||||
|
||||
+ (NSData *)dataFromBase64String:(NSString *)aString
|
||||
{
|
||||
return [[NSData alloc] initWithBase64EncodedString:aString options:NSDataBase64DecodingIgnoreUnknownCharacters];
|
||||
}
|
||||
|
||||
//
|
||||
// base64EncodedString
|
||||
//
|
||||
// Creates an NSString object that contains the base 64 encoding of the
|
||||
// receiver's data. Lines are broken at 64 characters long.
|
||||
//
|
||||
// returns an NSString being the base 64 representation of the
|
||||
// receiver.
|
||||
//
|
||||
- (NSString *)base64EncodedString
|
||||
{
|
||||
return [self base64EncodedStringWithOptions:0];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
Loading…
Reference in New Issue