This repository has been archived by the owner on Oct 28, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- FrameHandler#register accepts all capabilities at once and overwrites current packetTypesMap - RLP.decode throws exceptions - RLPElement(#listValue, #intValue, #bIntValue, #stringValue) throw exceptions - Factory, CryptoUtils and RandomHelper are now singletons
- Loading branch information
Showing
49 changed files
with
363 additions
and
346 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 was deleted.
Oops, something went wrong.
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
68 changes: 45 additions & 23 deletions
68
HSEthereumKit/HSEthereumKit/EthereumKit/Helper/RLPElement.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
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,34 @@ | ||
import Foundation | ||
import HSCryptoKit | ||
|
||
class Factory: IFactory { | ||
|
||
static let shared = Factory() | ||
|
||
func authMessage(signature: Data, publicKeyPoint: ECPoint, nonce: Data) -> AuthMessage { | ||
return AuthMessage(signature: signature, publicKeyPoint: publicKeyPoint, nonce: nonce) | ||
} | ||
|
||
func authAckMessage(data: Data) throws -> AuthAckMessage { | ||
return try AuthAckMessage(data: data) | ||
} | ||
|
||
func keccakDigest() -> KeccakDigest { | ||
return KeccakDigest() | ||
} | ||
|
||
func frameCodec(secrets: Secrets) -> FrameCodec { | ||
return FrameCodec( | ||
secrets: secrets, helper: FrameCodecHelper(crypto: CryptoUtils.shared), | ||
encryptor: AESCipher(keySize: 256, key: secrets.aes), decryptor: AESCipher(keySize: 256, key: secrets.aes) | ||
) | ||
} | ||
|
||
func encryptionHandshake(myKey: ECKey, publicKey: Data) -> EncryptionHandshake { | ||
return EncryptionHandshake( | ||
myKey: myKey, publicKeyPoint: ECPoint(nodeId: publicKey), | ||
crypto: CryptoUtils.shared, randomHelper: RandomHelper.shared, factory: self | ||
) | ||
} | ||
|
||
} |
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.