Skip to content

Commit

Permalink
Merge pull request #6 from VirgilSecurity/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
SanjoDeundiak authored Jan 17, 2019
2 parents 29713fa + 074f772 commit 1982b09
Show file tree
Hide file tree
Showing 49 changed files with 504 additions and 1,182 deletions.
95 changes: 92 additions & 3 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
disabled_rules:
- redundant_optional_initialization
- statement_position
- void_return
- nesting
- explicit_enum_raw_value
- compiler_protocol_init
- sorted_imports
- discouraged_optional_collection
- attributes
- multiline_arguments_brackets
- explicit_type_interface
- multiline_parameters_brackets
- multiline_parameters
- closure_body_length
- no_grouping_extension
- function_body_length

opt_in_rules:
- array_init
Expand Down Expand Up @@ -36,6 +45,86 @@ opt_in_rules:
- unneeded_parentheses_in_closure_argument
- vertical_parameter_alignment_on_call
- yoda_condition
- closing_brace
- closure_parameter_position
- collection_alignment
- colon
- comma
- control_statement
- convenience_type
- cyclomatic_complexity
- discouraged_direct_init
- discouraged_optional_boolean
- empty_enum_arguments
- empty_parameters
- empty_parentheses_with_trailing_closure
- empty_string
- empty_xctest_method
- explicit_self
- fallthrough
- file_length
- for_where
- force_cast
- force_try
- function_body_length
- function_parameter_count
- identical_operands
- identifier_name
- implicit_getter
- implicit_return
- inert_defer
- is_disjoint
- large_tuple
- leading_whitespace
- legacy_constant
- legacy_constructor
- legacy_random
- let_var_whitespace
- line_length
- lower_acl_than_parent
- mark
- missing_docs
- modifier_order
- multiline_arguments
- multiline_function_chains
- multiline_literal_brackets
- multiple_closures_with_trailing_closure
- number_separator
- opening_brace
- operator_whitespace
- pattern_matching_keywords
- private_over_fileprivate
- protocol_property_accessors_order
- redundant_discardable_let
- redundant_string_enum_value
- redundant_type_annotation
- redundant_void_return
- return_arrow_whitespace
- shorthand_operator
- single_test_class
- static_operator
- switch_case_alignment
- switch_case_on_newline
- syntactic_sugar
- todo
- trailing_closure
- trailing_comma
- trailing_newline
- trailing_semicolon
- trailing_whitespace
- type_body_length
- type_name
- unavailable_function
- unneeded_break_in_switch
- unused_closure_parameter
- unused_enumerated
- unused_import
- unused_optional_binding
- unused_private_declaration
- vertical_parameter_alignment
- vertical_whitespace
- void_return
- weak_delegate

excluded:
- Carthage
Expand All @@ -48,7 +137,7 @@ warning_threshold: 15
file_header:
required_pattern: |
\/\/
\/\/ Copyright \(C\) 2015-2018 Virgil Security Inc.
\/\/ Copyright \(C\) 2015-2019 Virgil Security Inc.
\/\/
\/\/ All rights reserved.
\/\/
Expand Down
25 changes: 12 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: swift
osx_image: xcode10
osx_image: xcode10.1

env:
global:
Expand All @@ -11,17 +11,17 @@ env:
- WATCHOS_FRAMEWORK_SCHEME="VirgilSDKKeyknox watchOS"
- IOS_TEST_SCHEME="KeyknoxTestApp iOS"
- TVOS_TEST_SCHEME="KeyknoxTestApp tvOS"
- IOS_SDK=iphonesimulator12.0
- IOS_SDK=iphonesimulator12.1
- MACOS_SDK=macosx10.14
- TVOS_SDK=appletvsimulator12.0
- WATCHOS_SDK=watchsimulator5.0
- TVOS_SDK=appletvsimulator12.1
- WATCHOS_SDK=watchsimulator5.1
- FRAMEWORK_NAME=VirgilSDKKeyknox

matrix:
- DESTINATION="OS=12.0,name=iPhone SE" ENABLE_BUILD="YES" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" TWO_STEP_BUILD_ENABLED="YES" RUN_TESTS="YES" ADDITIONAL_TESTS_SCHEME="$IOS_TEST_SCHEME" PUBLISH_DOCS="NO" PUBLISH_CARTHAGE="NO" POD_LIB_LINT="NO" SWIFT_LINT="NO"
- DESTINATION="OS=12.1,name=iPhone SE" ENABLE_BUILD="YES" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" TWO_STEP_BUILD_ENABLED="YES" RUN_TESTS="YES" ADDITIONAL_TESTS_SCHEME="$IOS_TEST_SCHEME" PUBLISH_DOCS="NO" PUBLISH_CARTHAGE="NO" POD_LIB_LINT="NO" SWIFT_LINT="NO"
- DESTINATION="arch=x86_64" ENABLE_BUILD="YES" SCHEME="$MACOS_FRAMEWORK_SCHEME" SDK="$MACOS_SDK" TWO_STEP_BUILD_ENABLED="YES" RUN_TESTS="YES" ADDITIONAL_TESTS_SCHEME="" PUBLISH_DOCS="NO" PUBLISH_CARTHAGE="NO" POD_LIB_LINT="NO" SWIFT_LINT="NO"
- DESTINATION="OS=12.0,name=Apple TV 4K" ENABLE_BUILD="YES" SCHEME="$TVOS_FRAMEWORK_SCHEME" SDK="$TVOS_SDK" TWO_STEP_BUILD_ENABLED="YES" RUN_TESTS="YES" ADDITIONAL_TESTS_SCHEME="$TVOS_TEST_SCHEME" PUBLISH_DOCS="NO" PUBLISH_CARTHAGE="NO" POD_LIB_LINT="NO" SWIFT_LINT="NO"
- DESTINATION="OS=5.0,name=Apple Watch Series 4 - 44mm" ENABLE_BUILD="YES" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" SDK="$WATCHOS_SDK" TWO_STEP_BUILD_ENABLED="NO" RUN_TESTS="NO" ADDITIONAL_TESTS_SCHEME="" PUBLISH_DOCS="NO" PUBLISH_CARTHAGE="NO" POD_LIB_LINT="NO" SWIFT_LINT="NO"
- DESTINATION="OS=12.1,name=Apple TV 4K" ENABLE_BUILD="YES" SCHEME="$TVOS_FRAMEWORK_SCHEME" SDK="$TVOS_SDK" TWO_STEP_BUILD_ENABLED="YES" RUN_TESTS="YES" ADDITIONAL_TESTS_SCHEME="$TVOS_TEST_SCHEME" PUBLISH_DOCS="NO" PUBLISH_CARTHAGE="NO" POD_LIB_LINT="NO" SWIFT_LINT="NO"
- DESTINATION="OS=5.1,name=Apple Watch Series 4 - 44mm" ENABLE_BUILD="YES" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" SDK="$WATCHOS_SDK" TWO_STEP_BUILD_ENABLED="NO" RUN_TESTS="NO" ADDITIONAL_TESTS_SCHEME="" PUBLISH_DOCS="NO" PUBLISH_CARTHAGE="NO" POD_LIB_LINT="NO" SWIFT_LINT="NO"
- DESTINATION="" ENABLE_BUILD="NO" SCHEME="" SDK="" TWO_STEP_BUILD_ENABLED="" RUN_TESTS="YES" ADDITIONAL_TESTS_SCHEME="" PUBLISH_DOCS="YES" PUBLISH_CARTHAGE="YES" POD_LIB_LINT="YES" SWIFT_LINT="YES"

before_install:
Expand All @@ -45,7 +45,7 @@ script:
- carthage version
- carthage bootstrap --no-build
- carthage bootstrap

- |
if [ $SWIFT_LINT == "YES" ]; then
Expand Down Expand Up @@ -74,11 +74,11 @@ script:
# Build with carthage
- if [ $PUBLISH_CARTHAGE == "YES" ]; then
carthage build --no-skip-current --no-use-binaries;
carthage build --no-skip-current;
fi

# Check pod lib
- if [ $POD_LIB_LINT == "YES" ]; then
- if [ -n "$TRAVIS_TAG" ] && [ $POD_LIB_LINT == "YES" ]; then
gem install cocoapods --pre;
pod repo update;
pod lib lint;
Expand All @@ -89,8 +89,7 @@ before_deploy:

after_success:
# Generate and publish docs
# - if [ -n "${TRAVIS_TAG}" ] && [ $PUBLISH_DOCS == "YES" ]; then
- if [ $PUBLISH_DOCS == "YES" ]; then
- if [ -n "${TRAVIS_TAG}" ] && [ $PUBLISH_DOCS == "YES" ]; then
./CI/publish-docs.sh;
fi

Expand All @@ -102,7 +101,7 @@ deploy:
file: $FRAMEWORK_NAME.framework.zip
skip_cleanup: true
on:
repo: VirgilSecurity/keyknox-x
repo: VirgilSecurity/virgil-keyknox-x
tags: true
condition: $PUBLISH_CARTHAGE = "YES"

Expand Down
2 changes: 1 addition & 1 deletion CI/publish-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#

# Settings
REPO_PATH=https://github.com/VirgilSecurity/keyknox-x.git
REPO_PATH=https://github.com/VirgilSecurity/virgil-keyknox-x.git
HTML_PATH_DST="${TRAVIS_BUILD_DIR}/docs"
CHANGESET=$(git rev-parse --verify HEAD)

Expand Down
4 changes: 2 additions & 2 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "VirgilSecurity/sdk-x" ~> 5.4.0
github "VirgilSecurity/crypto-x" ~> 3.2.0
github "VirgilSecurity/virgil-sdk-x" ~> 5.7
github "VirgilSecurity/virgil-crypto-x" ~> 3.2
6 changes: 3 additions & 3 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "VirgilSecurity/crypto-x" "3.2.0"
github "VirgilSecurity/cryptoapi-x" "1.0.3"
github "VirgilSecurity/sdk-x" "5.4.1"
github "VirgilSecurity/virgil-crypto-x" "3.2.2"
github "VirgilSecurity/virgil-cryptoapi-x" "1.0.4"
github "VirgilSecurity/virgil-sdk-x" "5.7.0"
2 changes: 1 addition & 1 deletion KeyknoxTestApp iOS/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Virgil Security Inc.
// Copyright (C) 2015-2019 Virgil Security Inc.
//
// All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion KeyknoxTestApp iOS/ViewController.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Virgil Security Inc.
// Copyright (C) 2015-2019 Virgil Security Inc.
//
// All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion KeyknoxTestApp tvOS/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Virgil Security Inc.
// Copyright (C) 2015-2019 Virgil Security Inc.
//
// All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion KeyknoxTestApp tvOS/ViewController.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Virgil Security Inc.
// Copyright (C) 2015-2019 Virgil Security Inc.
//
// All rights reserved.
//
Expand Down
25 changes: 3 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Virgil KeyKnox Objective-C/Swift SDK

[![Build Status](https://api.travis-ci.org/VirgilSecurity/keyknox-x.svg?branch=master)](https://travis-ci.org/VirgilSecurity/keyknox-x)
[![Build Status](https://api.travis-ci.com/VirgilSecurity/virgil-keyknox-x.svg?branch=master)](https://travis-ci.com/VirgilSecurity/virgil-keyknox-x)
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/VirgilSDKKeyknox.svg)](https://img.shields.io/cocoapods/v/VirgilSDKKeyknox.svg)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Platform](https://img.shields.io/cocoapods/p/VirgilSDKKeyknox.svg?style=flat)](http://cocoadocs.org/docsets/VirgilSDKKeyknox)
Expand Down Expand Up @@ -47,7 +47,7 @@ To integrate Virgil Keyknox into your Xcode project using CocoaPods, specify it
target '<Your Target Name>' do
use_frameworks!

pod 'VirgilSDKKeyknox', '~> 0.2.1'
pod 'VirgilSDKKeyknox', '~> 0.3'
end
```

Expand All @@ -71,7 +71,7 @@ $ brew install carthage
To integrate Virgil Keyknox into your Xcode project using Carthage, create an empty file with name *Cartfile* in your project's root folder and add following lines to your *Cartfile*

```
github "VirgilSecurity/keyknox-x" ~> 0.2.1
github "VirgilSecurity/virgil-keyknox-x" ~> 0.3
```

#### Linking against prebuilt binaries
Expand Down Expand Up @@ -126,25 +126,6 @@ Additionally, you'll need to copy debug symbols for debugging and crash reportin
On your application target’s “Build Phases” settings tab, click the “+” icon and choose “New Copy Files Phase”.
Click the “Destination” drop-down menu and select “Products Directory”. For each framework, drag and drop corresponding dSYM file.

#### Integrating as subproject

It is possible to use carthage just for fetching the right sources for further integration into your project.
Run following command:

```bash
$ carthage update --no-build
```

This will fetch dependencies into a *Carthage/Checkouts* folder inside your project's folder. Then, drag and drop VirgilCrypto.xcodeproj, VirgilCryptoAPI.xcodeproj, VirgilSDK.xcodeproj and VirgilSDKKeyknox.xcodeproj from corresponding folders inside Carthage/Checkouts folder to your Xcode Project Navigator sidebar.

Next, on your application target's “General” settings tab, in the “Embedded Binaries” section add the following frameworks from subprojects:
- VirgilSDKKeyknox
- VirgilSDK
- VirgilCryptoAPI
- VirgilCryptoApiImpl
- VirgilCrypto
- VSCCrypto

### Configure SDK

To begin using Virgil Keyknox SDK you'll need to initialize `SyncKeyStorage` class. This class is responsible for synchronization between Keychain and Keyknox Cloud.
Expand Down
14 changes: 9 additions & 5 deletions Source/Client/KeyknoxClient.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Virgil Security Inc.
// Copyright (C) 2015-2019 Virgil Security Inc.
//
// All rights reserved.
//
Expand Down Expand Up @@ -58,20 +58,24 @@ import VirgilSDK
/// - Parameters:
/// - serviceUrl: URL of service client will use
/// - connection: custom HTTPConnection
public override init(serviceUrl: URL = KeyknoxClient.defaultURL, connection: HttpConnectionProtocol) {
override public init(serviceUrl: URL = KeyknoxClient.defaultURL, connection: HttpConnectionProtocol) {
super.init(serviceUrl: serviceUrl, connection: connection)
}

/// Initializes a new `KeyknoxClient` instance
@objc convenience public init() {
@objc public convenience init() {
self.init(serviceUrl: KeyknoxClient.defaultURL)
}

/// Initializes a new `KeyknoxClient` instance
///
/// - Parameter serviceUrl: URL of service client will use
@objc convenience public init(serviceUrl: URL) {
self.init(serviceUrl: serviceUrl, connection: HttpConnection())
@objc public convenience init(serviceUrl: URL) {
let version = VersionUtils.getVersion(bundleIdentitifer: "com.virgilsecurity.VirgilSDKKeyknox")

let connection = HttpConnection(adapters: [VirgilAgentAdapter(product: "keyknox", version: version)])

self.init(serviceUrl: serviceUrl, connection: connection)
}

/// Handles error from Keyknox Service
Expand Down
2 changes: 1 addition & 1 deletion Source/Client/KeyknoxClientProtocol.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Virgil Security Inc.
// Copyright (C) 2015-2019 Virgil Security Inc.
//
// All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion Source/Client/KeynoxClient+Queries.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Virgil Security Inc.
// Copyright (C) 2015-2019 Virgil Security Inc.
//
// All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion Source/Client/Models/KeyknoxData.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Virgil Security Inc.
// Copyright (C) 2015-2019 Virgil Security Inc.
//
// All rights reserved.
//
Expand Down
8 changes: 5 additions & 3 deletions Source/Client/Models/KeyknoxValue.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Virgil Security Inc.
// Copyright (C) 2015-2019 Virgil Security Inc.
//
// All rights reserved.
//
Expand Down Expand Up @@ -51,8 +51,10 @@ import Foundation
@objc public let keyknoxHash: Data

internal convenience init(keyknoxData: KeyknoxData, keyknoxHash: Data) {
self.init(meta: keyknoxData.meta, value: keyknoxData.value,
version: keyknoxData.version, keyknoxHash: keyknoxHash)
self.init(meta: keyknoxData.meta,
value: keyknoxData.value,
version: keyknoxData.version,
keyknoxHash: keyknoxHash)
}

internal init(meta: Data, value: Data, version: String, keyknoxHash: Data) {
Expand Down
7 changes: 6 additions & 1 deletion Source/CloudKeyStorage/CloudEntry.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (C) 2015-2018 Virgil Security Inc.
// Copyright (C) 2015-2019 Virgil Security Inc.
//
// All rights reserved.
//
Expand Down Expand Up @@ -71,6 +71,8 @@ import Foundation
super.init()
}

// swiftlint:disable explicit_enum_raw_value

/// CodingKeys
///
/// - name: name
Expand All @@ -85,8 +87,11 @@ import Foundation
case modificationDate = "modification_date"
case meta
}

// swiftlint:enable explicit_enum_raw_value
}

// swiftlint:disable missing_docs
// MARK: - Equatable implementation
public extension CloudEntry {
static func == (lhs: CloudEntry, rhs: CloudEntry) -> Bool {
Expand Down
Loading

0 comments on commit 1982b09

Please sign in to comment.