Skip to content

Commit

Permalink
Fix ComonCrypto dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
colbylwilliams committed Jan 22, 2018
1 parent 958d3a1 commit 9fd303c
Show file tree
Hide file tree
Showing 15 changed files with 219 additions and 326 deletions.
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0
53 changes: 53 additions & 0 deletions AzureData.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#
# Be sure to run `pod lib lint AzureData.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
s.name = 'AzureData'
s.version = '0.5.6'
s.summary = 'iOS client for Microsoft\'s Azure Cosmos DB DocumentDB written in Swift'

# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!

s.description = <<-DESC
AzureData is an iOS, watchOS, macOS, tvOS client for Microsoft\'s Azure Cosmos DB DocumentDB written in Swift
It originally created as part of **[Azure.Mobile](https://aka.ms/mobile)** — a framework for rapidly creating iOS and android apps with modern, highly-scalable backends on Azure — built with two simple objectives:
1. Enable developers to create, configure, deploy all necessary backend services fast — ideally under 10 minutes with only a few clicks
2. Provide native iOS and android SDKs with delightful APIs to interact with the services
DESC

s.homepage = 'https://aka.ms/azureios'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = 'Colby Williams'
# s.author = { 'Colby Williams' => 'colbylwilliams@gmail.com' }
s.source = { :git => 'https://github.com/colbylwilliams/Azure.iOS.git', :tag => "v#{s.version}" }
# s.social_media_url = 'https://twitter.com/colbylwilliams'
# s.social_media_url = 'https://www.instagram.com/colbylwilliams'

s.ios.deployment_target = '11.1'
# s.osx.deployment_target = '10.13'
# s.tvos.deployment_target = '11.1'
# s.watchos.deployment_target = '4.0'

s.source_files = 'AzureData/Source/*.swift', 'AzureData/Source/Resources/*.swift', 'AzureData/Source/*.h', 'AzureData/Source/*.m'

# s.resource_bundles = {
# 'AzureData' => ['AzureData/Assets/*.png']
# }

# s.public_header_files = 'Pod/Classes/**/*.h'
s.ios.frameworks = 'Foundation', 'CommonCrypto'
# s.osx.frameworks = 'Foundation', 'CommonCrypto'
# s.dependency 'AFNetworking', '~> 2.3'
end
153 changes: 33 additions & 120 deletions AzureData/AzureData.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

This file was deleted.

2 changes: 2 additions & 0 deletions AzureData/Source/AzureData.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

@import Foundation;

#import <AzureData/NSData+CCHmac.h>

FOUNDATION_EXPORT double AzureDataVersionNumber;

FOUNDATION_EXPORT const unsigned char AzureDataVersionString[];
7 changes: 7 additions & 0 deletions AzureData/Source/AzureData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ public func query (documentsIn collection: DocumentCollection, with query: Query
return DocumentClient.default.query (documentsIn: collection, with: query, callback: callback)
}

public func query (documentsIn collectionId: String, inDatabase databaseId: String, with query: Query, callback: @escaping (ListResponse<DictionaryDocument>) -> ()) {
return DocumentClient.default.query (documentsIn: collectionId, inDatabase: databaseId, with: query, callback: callback)
}

public func query (documentsIn collection: DocumentCollection, with query: Query, callback: @escaping (ListResponse<DictionaryDocument>) -> ()) {
return DocumentClient.default.query (documentsIn: collection, with: query, callback: callback)
}



Expand Down
6 changes: 5 additions & 1 deletion AzureData/Source/AzureDataExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ public extension DocumentCollection {
public func query (documentsWith query: Query, callback: @escaping (ListResponse<Document>) -> ()) {
return DocumentClient.default.query(documentsIn: self, with: query, callback: callback)
}


public func query (documentsWith query: Query, callback: @escaping (ListResponse<DictionaryDocument>) -> ()) {
return DocumentClient.default.query(documentsIn: self, with: query, callback: callback)
}



// MARK: Stored Procedures
Expand Down
18 changes: 16 additions & 2 deletions AzureData/Source/DocumentClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,20 @@ public class DocumentClient {
}


public func query (documentsIn collectionId: String, inDatabase databaseId: String, with query: Query, callback: @escaping (ListResponse<DictionaryDocument>) -> ()) {

let resourceUri = baseUri?.document(inDatabase: databaseId, inCollection: collectionId)

return self.query(query, at: resourceUri, callback: callback)
}

public func query (documentsIn collection: DocumentCollection, with query: Query, callback: @escaping (ListResponse<DictionaryDocument>) -> ()) {

let resourceUri = baseUri?.document(atLink: collection.selfLink!)

return self.query(query, at: resourceUri, callback: callback)
}




Expand Down Expand Up @@ -953,7 +967,7 @@ public class DocumentClient {

} catch let decodeError as DecodingError {

if self.verboseLogging { decodeError.printLog() }
if self.verboseLogging { decodeError.printLog(); print(String(data: data, encoding: .utf8) ?? "nil") }

let docError = DocumentClientError(withData: data, response: httpResponse, error: decodeError)

Expand Down Expand Up @@ -1012,7 +1026,7 @@ public class DocumentClient {

} catch let decodeError as DecodingError {

if self.verboseLogging { decodeError.printLog() }
if self.verboseLogging { decodeError.printLog(); print(String(data: data, encoding: .utf8) ?? "nil") }

let docError = DocumentClientError(withData: data, response: httpResponse, error: decodeError)

Expand Down
1 change: 0 additions & 1 deletion AzureData/Source/DocumentClientExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import Foundation


extension DocumentClient {

fileprivate static let timestamp = "_ts"
Expand Down
15 changes: 15 additions & 0 deletions AzureData/Source/NSData+CCHmac.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// NSData+CCHmac.h
// AzureData
//
// Created by Colby L Williams on 1/8/18.
// Copyright © 2018 Colby Williams. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSData (CCHmac)

- (NSData *)CCHmacWithBytes:(const unsigned char *) bytes;

@end
25 changes: 25 additions & 0 deletions AzureData/Source/NSData+CCHmac.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// NSString+CCHmac.m
// AzureData
//
// Created by Colby L Williams on 1/8/18.
// Copyright © 2018 Colby Williams. All rights reserved.
//

#import "NSData+CCHmac.h"
#import <CommonCrypto/CommonHMAC.h>

@implementation NSData (CCHmac)

- (NSData *)CCHmacWithBytes:(const unsigned char *) bytes {

unsigned char hashResult[CC_SHA256_DIGEST_LENGTH];

CCHmac(kCCHmacAlgSHA256, self.bytes, self.length, bytes, strlen((char*)bytes), hashResult);

NSData *hash = [[NSData alloc] initWithBytes:hashResult length:sizeof(hashResult)];

return hash;
}

@end
1 change: 0 additions & 1 deletion AzureData/Source/Resources/DocumentCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import Foundation


/// Represents a document collection in the Azure Cosmos DB service.
/// A collection is a named logical container for documents.
///
Expand Down

0 comments on commit 9fd303c

Please sign in to comment.