mirror of
https://github.com/aljazceru/react-native-pubky.git
synced 2025-12-17 22:54:29 +01:00
Add base project
Implement auth method
This commit is contained in:
16
ios/Pubky.swift
Normal file
16
ios/Pubky.swift
Normal file
@@ -0,0 +1,16 @@
|
||||
import Foundation
|
||||
|
||||
@objc(Pubky)
|
||||
class Pubky: NSObject {
|
||||
@objc(auth:secretKey:withResolver:withRejecter:)
|
||||
func auth(_ url: String, secretKey: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
||||
Task {
|
||||
do {
|
||||
let result = try await react_native_pubky.auth(url: url, secretKey: secretKey)
|
||||
resolve(result)
|
||||
} catch {
|
||||
reject("auth Error", "Failed to auth", error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user