-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1364 from WalletConnect/jack/rejection-tags
chore(rejection tags): Session rejection tags
- Loading branch information
Showing
12 changed files
with
130 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 39 additions & 9 deletions
48
Sources/WalletConnectSign/Auth/SessionAuthenticatedProtocolMethod.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,47 @@ | ||
import Foundation | ||
|
||
struct SessionAuthenticatedProtocolMethod: ProtocolMethod { | ||
|
||
enum Tag: Int { | ||
case sessionAuthenticate = 1116 | ||
case sessionAuthenticateResponseApprove = 1117 | ||
case sessionAuthenticateResponseReject = 1118 | ||
case sessionAuthenticateResponseAutoReject = 1119 | ||
} | ||
|
||
let method: String = "wc_sessionAuthenticate" | ||
|
||
let requestConfig = RelayConfig(tag: 1116, prompt: true, ttl: 3600) | ||
|
||
let responseConfig = RelayConfig(tag: 1117, prompt: false, ttl: 3600) | ||
|
||
|
||
static let defaultTtl: TimeInterval = 3600 | ||
private let ttl: Int | ||
let requestConfig: RelayConfig | ||
|
||
let responseConfig: RelayConfig | ||
|
||
init(ttl: TimeInterval = Self.defaultTtl) { | ||
self.ttl = Int(ttl) | ||
static let defaultTtl: TimeInterval = 300 | ||
|
||
private init( | ||
ttl: TimeInterval, | ||
responseTag: Tag | ||
) { | ||
self.requestConfig = RelayConfig( | ||
tag: Tag.sessionAuthenticate.rawValue, | ||
prompt: true, | ||
ttl: Int(ttl) | ||
) | ||
self.responseConfig = RelayConfig( | ||
tag: responseTag.rawValue, | ||
prompt: false, | ||
ttl: Int(ttl) | ||
) | ||
} | ||
|
||
static func responseApprove(ttl: TimeInterval = Self.defaultTtl) -> Self { | ||
Self(ttl: ttl, responseTag: .sessionAuthenticateResponseApprove) | ||
} | ||
|
||
static func responseReject(ttl: TimeInterval = Self.defaultTtl) -> Self { | ||
Self(ttl: ttl, responseTag: .sessionAuthenticateResponseReject) | ||
} | ||
|
||
static func responseAutoReject(ttl: TimeInterval = Self.defaultTtl) -> Self { | ||
Self(ttl: ttl, responseTag: .sessionAuthenticateResponseAutoReject) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters