-
Notifications
You must be signed in to change notification settings - Fork 67
Conversation
6944f01
to
5265531
Compare
Codecov Report
@@ Coverage Diff @@
## master #13 +/- ##
=========================================
- Coverage 85.57% 85.5% -0.08%
=========================================
Files 28 38 +10
Lines 1241 1552 +311
=========================================
+ Hits 1062 1327 +265
- Misses 179 225 +46
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
|
||
import Foundation | ||
|
||
public struct BitcoinAddress: Address, Hashable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since both BitcoinAddress
and EthereumAddress
conform to Hashable
, should we make Address
conform to Hashable
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No because that will make Address
a PAT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is PAT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more relevant link: https://appventure.me/2017/12/10/patterns-for-working-with-associated-types/
public init() { | ||
data = Data(count: Bitcoin.privateKeySize) | ||
repeat { | ||
let result = data.withUnsafeMutableBytes { SecRandomCopyBytes(kSecRandomDefault, Bitcoin.privateKeySize, $0) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it remove private key from the memory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, will fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do this quite often, maybe having a helper function that will do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did add a helper function to Data
: clear()
No description provided.