-
Notifications
You must be signed in to change notification settings - Fork 29
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 #73 from WalletConnect/1click-auth
1click auth and link mode integration
- Loading branch information
Showing
17 changed files
with
276 additions
and
111 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Foundation | ||
import Web3 | ||
import CryptoSwift | ||
import WalletConnectSigner | ||
|
||
struct DefaultCryptoProvider: CryptoProvider { | ||
|
||
public func recoverPubKey(signature: EthereumSignature, message: Data) throws -> Data { | ||
let publicKey = try EthereumPublicKey( | ||
message: message.bytes, | ||
v: EthereumQuantity(quantity: BigUInt(signature.v)), | ||
r: EthereumQuantity(signature.r), | ||
s: EthereumQuantity(signature.s) | ||
) | ||
return Data(publicKey.rawPublicKey) | ||
} | ||
|
||
public func keccak256(_ data: Data) -> Data { | ||
let digest = SHA3(variant: .keccak256) | ||
let hash = digest.calculate(for: [UInt8](data)) | ||
return Data(hash) | ||
} | ||
|
||
} |
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
Oops, something went wrong.