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

Commit

Permalink
* Create OIDC extension
Browse files Browse the repository at this point in the history
* Bump extension package to 1.1.0
  • Loading branch information
Ethella committed Oct 19, 2022
1 parent 027e969 commit a6566c4
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 9 deletions.
2 changes: 1 addition & 1 deletion MagicExt-OAuth.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Pod::Spec.new do |s|
s.name = 'MagicExt-OAuth'
s.version = '1.0.0'
s.version = '1.1.0'
s.summary = 'Magic IOS Extension - OAuth'

s.description = <<-DESC
Expand Down
2 changes: 1 addition & 1 deletion MagicExt-OIDC.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Pod::Spec.new do |s|
s.name = 'MagicExt-OIDC'
s.version = '0.1.0'
s.version = '1.1.0'
s.summary = 'Magic IOS Extension - OIDC'

s.description = <<-DESC
Expand Down
6 changes: 4 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ let package = Package(
targets: ["MagicExt-OAuth"]),
.library(
name: "MagicExt-OIDC",
targets: ["MagicExt-OIDC"]
),
targets: ["MagicExt-OIDC"]),
],
dependencies: [
.package(url: "https://github.com/magiclabs/magic-ios.git", from:"4.0.0"),
Expand All @@ -38,5 +37,8 @@ let package = Package(
.testTarget(
name: "MagicExt-OAuthTests",
dependencies: ["MagicExt-OAuth"]),
.testTarget(
name: "MagicExt-OIDCTests",
dependencies: ["MagicExt-OIDC"]),
]
)
11 changes: 6 additions & 5 deletions Sources/MagicExt-OIDC/Core/OIDCExtension.swift
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
//
// OauthModule.swift
// OIDCExtension.swift
// MagicSDK
//
// Created by Wentao Liu on 9/16/20.
// Created by Jerry Liu on 10/16/22.
//

import Foundation
import AuthenticationServices
import SafariServices
import MagicSDK_Web3
import MagicSDK
import PromiseKit

public class OIDCExtension: BaseModule {

public func loginWithOIDC (_ configuration: OpenIdConfiguration, response: @escaping Web3ResponseCompletion<String> ) {
let request = RPCRequest<[OpenIdConfiguration]>(method: OIDCMethod.magic_auth_login_with_oidc.rawValue, params: [configuration])
self.provider.send(request: request, response: response)
}
}

extension Magic {
Expand Down
11 changes: 11 additions & 0 deletions Sources/MagicExt-OIDC/Types/OIDCMethod.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// OIDCMethod.swift
//
//
// Created by Jerry Liu on 10/17/22.
//

import Foundation
internal enum OIDCMethod: String, CaseIterable {
case magic_auth_login_with_oidc
}
19 changes: 19 additions & 0 deletions Sources/MagicExt-OIDC/Types/OpenIdConfiguration.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// OpenIdConfiguration.swift
//
//
// Created by Jerry Liu on 10/17/22.
//

import Foundation
import MagicSDK

public struct OpenIdConfiguration: BaseConfiguration {
public var jwt: String
public var providerId: String

public init(jwt: String, providerId: String) {
self.jwt = jwt
self.providerId = providerId
}
}
7 changes: 7 additions & 0 deletions Tests/MagicExt-OIDCTests/MagicExt_OIDCTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import XCTest
@testable import MagicExt_OIDC

final class MagicExt_OIDCTests: XCTestCase {
func testExample() throws {
}
}

0 comments on commit a6566c4

Please sign in to comment.