Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
[iOS Wrapper] Fixed Archive issuer for Indy-demo project.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anastasia Tarasova committed Jun 12, 2019
1 parent 0e7ea04 commit 07d0770
Show file tree
Hide file tree
Showing 11 changed files with 219 additions and 139 deletions.
190 changes: 111 additions & 79 deletions wrappers/ios/libindy-pod/Indy-demo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
version = "1.7">
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand Down Expand Up @@ -40,7 +40,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -90,7 +89,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down Expand Up @@ -139,23 +137,5 @@
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
<PostActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "${SRCROOT}/universal_framework.sh ">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3E2A7F841EC36186006194EC"
BuildableName = "Indy-demo.app"
BlueprintName = "Indy-demo"
ReferencedContainer = "container:Indy-demo.xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PostActions>
</ArchiveAction>
</Scheme>
Expand Up @@ -14,38 +14,40 @@ public enum Base58Alphabet {
public static let flickr = [UInt8]("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ".utf8)
}

@objc
@objc(Base58)
public class Base58: NSObject {

@objc
static func encode(_ bytes: Data) -> String? {
public static func encode(_ bytes: Data) -> String?
{
let alphabet: [UInt8] = Base58Alphabet.btc
var x = BigUInt(bytes)
let radix = BigUInt(alphabet.count)

var answer = [UInt8]()
answer.reserveCapacity(bytes.count)

while x > 0 {
let (quotient, modulus) = x.quotientAndRemainder(dividingBy: radix)
answer.append(alphabet[Int(modulus)])
x = quotient
}

let prefix = Array(bytes.prefix(while: {$0 == 0})).map { _ in alphabet[0] }
answer.append(contentsOf: prefix)
answer.reverse()

return String(bytes: answer, encoding: .utf8)
}

@objc
static func decode(_ string: String) -> Data? {
public static func decode(_ string: String) -> Data? {
let alphabet: [UInt8] = Base58Alphabet.btc
var answer = BigUInt(0)
var j = BigUInt(1)
let radix = BigUInt(alphabet.count)
let byteString = [UInt8](string.utf8)

for ch in byteString.reversed() {
if let index = alphabet.firstIndex(of: ch) {
answer = answer + (j * BigUInt(index))
Expand All @@ -54,7 +56,7 @@ public class Base58: NSObject {
return nil
}
}

let bytes = answer.serialize()
return byteString.prefix(while: { i in i == alphabet[0]}) + bytes
}
Expand Down
19 changes: 19 additions & 0 deletions wrappers/ios/libindy-pod/Indy-demo/Base58Utils.h
@@ -0,0 +1,19 @@
//
// Base58Utils.h
// Indy-demo
//
// Created by Anastasia Tarasova on 12/06/2019.
// Copyright © 2019 Hyperledger. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Indy_demo-Swift.h>

@class Base58;

@interface Base58Utils : NSObject

+ (NSData *) decode:(NSString *) str;
+ (NSString *) encodeData:(NSData *) data;

@end
25 changes: 25 additions & 0 deletions wrappers/ios/libindy-pod/Indy-demo/Base58Utils.m
@@ -0,0 +1,25 @@
//
// Base58Utils.m
// Indy-demoTests
//
// Created by Anastasia Tarasova on 12/06/2019.
// Copyright © 2019 Hyperledger. All rights reserved.
//

#import "Base58Utils.h"

@interface Base58Utils ()
@end

@implementation Base58Utils

+ (NSData *)decode:(NSString *) str
{
return [[Base58 class] decode: str];
}

+ (NSString *)encodeData:(NSData *) data
{
return [[Base58 class] encode: data];
}
@end
8 changes: 4 additions & 4 deletions wrappers/ios/libindy-pod/Indy-demoTests/Base58Test.m
Expand Up @@ -14,7 +14,7 @@
#import "WalletUtils.h"
#import <Indy/Indy.h>
#import "NSDictionary+JSON.h"
#import "Indy_demoTests-Swift.h"
#import "Base58Utils.h"

@interface Base58Test : XCTestCase

Expand All @@ -24,9 +24,9 @@ @implementation Base58Test

- (void)testDecode
{
XCTAssertTrue([[Base58 decode:@""] isEqualToData:[@"" dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:false]], @"");
XCTAssertTrue([[Base58 decode:@"3mJr7AoUXx2Wqd"] isEqualToData:[@"1234598760" dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:false]], @"");
XCTAssertTrue([[Base58 decode:@"3yxU3u1igY8WkgtjK92fbJQCd4BZiiT1v25f"] isEqualToData:[@"abcdefghijklmnopqrstuvwxyz" dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:false]], @"");
XCTAssertTrue([[Base58Utils decode:@""] isEqualToData:[@"" dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:false]], @"");
XCTAssertTrue([[Base58Utils decode:@"3mJr7AoUXx2Wqd"] isEqualToData:[@"1234598760" dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:false]], @"");
XCTAssertTrue([[Base58Utils decode:@"3yxU3u1igY8WkgtjK92fbJQCd4BZiiT1v25f"] isEqualToData:[@"abcdefghijklmnopqrstuvwxyz" dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:false]], @"");
}

@end
Expand Up @@ -2,7 +2,7 @@
#import <XCTest/XCTest.h>
#import "PoolUtils.h"
#import "TestUtils.h"
#import "Indy_demoTests-Swift.h"
#import "Base58Utils.h"

@interface DidHignCases : XCTestCase

Expand Down Expand Up @@ -43,8 +43,8 @@ - (void)testCreateMyDidWorksForEmptyJson {
outMyDid:&myDid
outMyVerkey:&myVerKey];
XCTAssertEqual(ret.code, Success, @"DidUtils::createMyDidWithWalletHandle() failed");
XCTAssertEqual([[Base58 decode:myDid] length], 16, @"length of myDid != 16");
XCTAssertEqual([[Base58 decode:myVerKey] length], 32, @"length of myVerKey != 32");
XCTAssertEqual([[Base58Utils decode:myDid] length], 16, @"length of myDid != 16");
XCTAssertEqual([[Base58Utils decode:myVerKey] length], 32, @"length of myVerKey != 32");
}

- (void)testCreateMyDidWorksWithSeed {
Expand Down
@@ -0,0 +1,17 @@
//
// IndyDemoTests-PrefixHeader.pch
// Indy-demoTests
//
// Created by Anastasia Tarasova on 12/06/2019.
// Copyright © 2019 Hyperledger. All rights reserved.
//

#ifndef IndyDemoTests_PrefixHeader_pch
#define IndyDemoTests_PrefixHeader_pch

// Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.

#import <Indy_demo-Swift.h>

#endif /* IndyDemoTests_PrefixHeader_pch */
Expand Up @@ -3,7 +3,6 @@
// Indy-demo
//


#import <XCTest/XCTest.h>

@interface NSDictionary (JSON)
Expand Down
45 changes: 25 additions & 20 deletions wrappers/ios/libindy-pod/Indy.xcodeproj/project.pbxproj
Expand Up @@ -39,6 +39,7 @@
5DB57A611F711EE600EB4C90 /* IndyWallet.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5DB57A391F711EE600EB4C90 /* IndyWallet.mm */; };
78E844EB229306030069FF36 /* IndyCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 78E844E9229306030069FF36 /* IndyCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
78E844EC229306030069FF36 /* IndyCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 78E844EA229306030069FF36 /* IndyCache.mm */; };
A50B8C1F51DC52A17CE8D1B2 /* libPods-Indy.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3308B1FDB55716E0F56BADB3 /* libPods-Indy.a */; };
ADF5F09002A987F55A08F493 /* IndyNonSecrets.h in Headers */ = {isa = PBXBuildFile; fileRef = ADF5F1B3292A4FAEE6C9B4BB /* IndyNonSecrets.h */; settings = {ATTRIBUTES = (Public, ); }; };
ADF5F180774B3F07CF685B00 /* IndyNonSecrets.mm in Sources */ = {isa = PBXBuildFile; fileRef = ADF5FD56969EAF15313B3399 /* IndyNonSecrets.mm */; };
ADF5F3B8EFC4D2816713001C /* IndyBlobStorage.mm in Sources */ = {isa = PBXBuildFile; fileRef = ADF5F28481E59F87D3680FB0 /* IndyBlobStorage.mm */; };
Expand All @@ -49,15 +50,15 @@
ADF5FFAD8BF145CFC7C57C28 /* IndyBlobStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = ADF5F0289053914846F15C3E /* IndyBlobStorage.h */; settings = {ATTRIBUTES = (Public, ); }; };
DDEE2A6421C14062009BDDA8 /* IndyLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = DDEE2A6321C14062009BDDA8 /* IndyLogger.m */; };
DDEE2A6521C144E3009BDDA8 /* IndyLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = DDEE2A6221C1404A009BDDA8 /* IndyLogger.h */; settings = {ATTRIBUTES = (Public, ); }; };
E32B103AE817115C80F0142F /* libPods-Indy.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 788BE98286C5622244B9A7F5 /* libPods-Indy.a */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
053FA7E61FB32097006CEC35 /* IndyCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndyCrypto.h; sourceTree = "<group>"; };
053FA7E71FB32097006CEC35 /* IndyCrypto.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IndyCrypto.mm; sourceTree = "<group>"; };
3308B1FDB55716E0F56BADB3 /* libPods-Indy.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Indy.a"; sourceTree = BUILT_PRODUCTS_DIR; };
3E08C01B1EB3336A000A73BA /* Indy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Indy.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3E7A1C4BE17271AC1BB4E256 /* Pods-Indy.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Indy.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Indy/Pods-Indy.debug.xcconfig"; sourceTree = "<group>"; };
3E8809E41EB88AED00E0AA5F /* libsqlite3.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.0.tbd; path = usr/lib/libsqlite3.0.tbd; sourceTree = SDKROOT; };
55A3677CB10DE78CA6871B28 /* Pods-Indy.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Indy.release.xcconfig"; path = "Target Support Files/Pods-Indy/Pods-Indy.release.xcconfig"; sourceTree = "<group>"; };
5D27970022A9419A00305B3A /* libboringssl.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libboringssl.tbd; path = usr/lib/libboringssl.tbd; sourceTree = SDKROOT; };
5D57DEC21F853A9600CD63FE /* DictionaryExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DictionaryExtension.swift; sourceTree = "<group>"; };
5D57DEC31F853A9600CD63FE /* NSDictionary+JSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+JSON.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -87,9 +88,9 @@
5DB57A371F711EE600EB4C90 /* IndyTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndyTypes.h; sourceTree = "<group>"; };
5DB57A381F711EE600EB4C90 /* IndyWallet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndyWallet.h; sourceTree = "<group>"; };
5DB57A391F711EE600EB4C90 /* IndyWallet.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IndyWallet.mm; sourceTree = "<group>"; };
788BE98286C5622244B9A7F5 /* libPods-Indy.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Indy.a"; sourceTree = BUILT_PRODUCTS_DIR; };
78E844E9229306030069FF36 /* IndyCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndyCache.h; sourceTree = "<group>"; };
78E844EA229306030069FF36 /* IndyCache.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IndyCache.mm; sourceTree = "<group>"; };
88A7D3856ABA7BAE34B97FB1 /* Pods-Indy.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Indy.debug.xcconfig"; path = "Target Support Files/Pods-Indy/Pods-Indy.debug.xcconfig"; sourceTree = "<group>"; };
ADF5F0289053914846F15C3E /* IndyBlobStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndyBlobStorage.h; sourceTree = "<group>"; };
ADF5F1B3292A4FAEE6C9B4BB /* IndyNonSecrets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndyNonSecrets.h; sourceTree = "<group>"; };
ADF5F28481E59F87D3680FB0 /* IndyBlobStorage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IndyBlobStorage.mm; sourceTree = "<group>"; };
Expand All @@ -98,7 +99,6 @@
ADF5FAE758484DA836DF08D1 /* IndyPayment.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IndyPayment.mm; sourceTree = "<group>"; };
ADF5FBF2E10538C7610F30CC /* IndyUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndyUtils.h; sourceTree = "<group>"; };
ADF5FD56969EAF15313B3399 /* IndyNonSecrets.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IndyNonSecrets.mm; sourceTree = "<group>"; };
CB6A56DBDD1F10585C90ECA8 /* Pods-Indy.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Indy.release.xcconfig"; path = "Pods/Target Support Files/Pods-Indy/Pods-Indy.release.xcconfig"; sourceTree = "<group>"; };
DDEE2A6221C1404A009BDDA8 /* IndyLogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndyLogger.h; sourceTree = "<group>"; };
DDEE2A6321C14062009BDDA8 /* IndyLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IndyLogger.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand All @@ -109,7 +109,7 @@
buildActionMask = 2147483647;
files = (
3E8809E51EB88AED00E0AA5F /* libsqlite3.0.tbd in Frameworks */,
E32B103AE817115C80F0142F /* libPods-Indy.a in Frameworks */,
A50B8C1F51DC52A17CE8D1B2 /* libPods-Indy.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -121,18 +121,28 @@
children = (
5D27970022A9419A00305B3A /* libboringssl.tbd */,
3E8809E41EB88AED00E0AA5F /* libsqlite3.0.tbd */,
788BE98286C5622244B9A7F5 /* libPods-Indy.a */,
3308B1FDB55716E0F56BADB3 /* libPods-Indy.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
2F909A83D9AA00B62DF21D7E /* Pods */ = {
isa = PBXGroup;
children = (
88A7D3856ABA7BAE34B97FB1 /* Pods-Indy.debug.xcconfig */,
55A3677CB10DE78CA6871B28 /* Pods-Indy.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
3E08C0111EB3336A000A73BA = {
isa = PBXGroup;
children = (
5DB57A0E1F711EE600EB4C90 /* Indy */,
3E08C01C1EB3336A000A73BA /* Products */,
7AA078817B8C2B22C808AE50 /* Pods */,
2C11A2035B94F34DF5CCDB2A /* Frameworks */,
2F909A83D9AA00B62DF21D7E /* Pods */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -217,15 +227,6 @@
path = Wrapper;
sourceTree = "<group>";
};
7AA078817B8C2B22C808AE50 /* Pods */ = {
isa = PBXGroup;
children = (
3E7A1C4BE17271AC1BB4E256 /* Pods-Indy.debug.xcconfig */,
CB6A56DBDD1F10585C90ECA8 /* Pods-Indy.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -264,7 +265,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 3E08C0231EB3336A000A73BA /* Build configuration list for PBXNativeTarget "Indy" */;
buildPhases = (
D6BFF417833531D0F48BA45D /* [CP] Check Pods Manifest.lock */,
57F1231A71A042F651F06330 /* [CP] Check Pods Manifest.lock */,
3E08C0161EB3336A000A73BA /* Sources */,
3E08C0171EB3336A000A73BA /* Frameworks */,
3E08C0181EB3336A000A73BA /* Headers */,
Expand Down Expand Up @@ -325,16 +326,20 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
D6BFF417833531D0F48BA45D /* [CP] Check Pods Manifest.lock */ = {
57F1231A71A042F651F06330 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Indy-checkManifestLockResult.txt",
);
Expand Down Expand Up @@ -493,7 +498,7 @@
};
3E08C0241EB3336A000A73BA /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 3E7A1C4BE17271AC1BB4E256 /* Pods-Indy.debug.xcconfig */;
baseConfigurationReference = 88A7D3856ABA7BAE34B97FB1 /* Pods-Indy.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
ALWAYS_SEARCH_USER_PATHS = NO;
Expand Down Expand Up @@ -551,7 +556,7 @@
};
3E08C0251EB3336A000A73BA /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = CB6A56DBDD1F10585C90ECA8 /* Pods-Indy.release.xcconfig */;
baseConfigurationReference = 55A3677CB10DE78CA6871B28 /* Pods-Indy.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
ALWAYS_SEARCH_USER_PATHS = NO;
Expand Down
3 changes: 2 additions & 1 deletion wrappers/ios/libindy-pod/Podfile
Expand Up @@ -12,8 +12,9 @@ def appPods
end

target 'Indy-demo' do
use_frameworks!
project 'Indy-demo'
pod 'BigInt', '~> 4.0'
pod 'BigInt'

target 'Indy-demoTests' do
inherit! :search_paths
Expand Down

0 comments on commit 07d0770

Please sign in to comment.