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

Commit

Permalink
Merge pull request #85 from mytiki/feat/Import-AppAuth
Browse files Browse the repository at this point in the history
feat/Import AppAuth
  • Loading branch information
ricardobrg authored Apr 25, 2024
2 parents 702f35c + 9a004ab commit 5d3e66d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
13 changes: 11 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
PODS:
- AppAuth (1.6.2):
- AppAuth/Core (= 1.6.2)
- AppAuth/ExternalUserAgent (= 1.6.2)
- AppAuth/Core (1.6.2)
- AppAuth/ExternalUserAgent (1.6.2):
- AppAuth/Core
- CryptoSwift (1.8.1)
- TikiClient (0.0.4):
- TikiClient (0.1.0):
- AppAuth
- CryptoSwift

DEPENDENCIES:
- TikiClient (from `../`)

SPEC REPOS:
trunk:
- AppAuth
- CryptoSwift

EXTERNAL SOURCES:
TikiClient:
:path: "../"

SPEC CHECKSUMS:
AppAuth: 3bb1d1cd9340bd09f5ed189fb00b1cc28e1e8570
CryptoSwift: b9c701d6f5011df23794dbf7f2e480a77835d83d
TikiClient: b8d731fc3aa47a8262a49cde6ee77592f3438445
TikiClient: 1b3e207b2308574e665a9f5c6d06b37ac4d7e3c0

PODFILE CHECKSUM: 96d93e7c36e6d9cd116be19ddc3938e717dc0264

Expand Down
6 changes: 4 additions & 2 deletions Example/TikiClient.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@
8CBDD72C2BD26AD400549A74 /* Recovered References */ = {
isa = PBXGroup;
children = (
99997F9EA2E68CC22E9BC31D /* Pods_TikiClient_Example.framework */,
FFF57A86C217F3BB10B27DE9 /* Pods_TikiClientExampleTests.framework */,
);
name = "Recovered References";
sourceTree = "<group>";
Expand Down Expand Up @@ -273,11 +271,13 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-TikiClientExampleTests/Pods-TikiClientExampleTests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/AppAuth/AppAuth.framework",
"${BUILT_PRODUCTS_DIR}/CryptoSwift/CryptoSwift.framework",
"${BUILT_PRODUCTS_DIR}/TikiClient/TikiClient.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppAuth.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CryptoSwift.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TikiClient.framework",
);
Expand Down Expand Up @@ -315,11 +315,13 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-TikiClient_Example/Pods-TikiClient_Example-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/AppAuth/AppAuth.framework",
"${BUILT_PRODUCTS_DIR}/CryptoSwift/CryptoSwift.framework",
"${BUILT_PRODUCTS_DIR}/TikiClient/TikiClient.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppAuth.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CryptoSwift.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TikiClient.framework",
);
Expand Down
3 changes: 2 additions & 1 deletion TikiClient.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Pod::Spec.new do |s|
s.source_files = 'TikiClient/Classes/**/*'

s.dependency 'CryptoSwift'

s.dependency 'AppAuth'

s.resource_bundles = {
'TikiClientAssets' => [
'TikiClient/Assets'
Expand Down
8 changes: 8 additions & 0 deletions TikiClient/Classes/TikiClient.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

import Foundation
import SwiftUI
import AppAuth

/// Tiki Client Library
///
Expand All @@ -24,6 +25,8 @@ public class TikiClient {
public static let location = LocationDataManager()
public static var config: Config? = nil
public static var userId: String? = nil
private static var authState: OIDAuthState?


/// Initializes the `TikiClient` with the application context and sets its parameters.
/// - Parameters:
Expand All @@ -38,6 +41,11 @@ public class TikiClient {
}

let key = KeyService.get(providerId: TikiClient.config!.providerId, userId: userId, isPrivate: true)

let authorizationEndpoint = URL(string: "https://accounts.google.com/o/oauth2/v2/auth")!
let tokenEdpoint = URL(string: "https://www.googleapis.com/oauth2/v4/token")!
let configuration = OIDServiceConfiguration(authorizationEndpoint: authorizationEndpoint,
tokenEndpoint: tokenEdpoint)

if(key == nil){
auth.registerAddress(userId: userId, providerId: TikiClient.config!.providerId, pubKey: TikiClient.config!.publicKey, completion: {address, error in
Expand Down

0 comments on commit 5d3e66d

Please sign in to comment.