-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create wallet from the seed #262
Conversation
Переименовал все на IsImported / keysImport |
@@ -44,7 +44,8 @@ class WalletDeserializer { | |||
|
|||
func deserializeWallet(from decoder: TlvDecoder) throws -> Card.Wallet { | |||
let status: Card.Wallet.Status = try decoder.decode(.status) | |||
guard status == .loaded || status == .backuped else { //We need only loaded wallets |
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.
loaded надо переименовать на generated видимо. Непонятно вообще. Не читается.
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.
Типа Imported, Generated
GeneratedAndBackedup
ImportedAndBackedup
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.
Ну пока ок, тогда, на надо и в документации поправить просто.
@@ -44,7 +44,8 @@ class WalletDeserializer { | |||
|
|||
func deserializeWallet(from decoder: TlvDecoder) throws -> Card.Wallet { | |||
let status: Card.Wallet.Status = try decoder.decode(.status) | |||
guard status == .loaded || status == .backuped else { //We need only loaded wallets | |||
|
|||
if !status.isLoaded { //We need only loaded wallets |
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.
сделал isAvailable
private let signingMethod = SigningMethod.signHash | ||
|
||
/// Default initializer | ||
/// - Parameter curve: Elliptic curve of the wallet. `Card.supportedCurves` contains all curves supported by the card | ||
init(curve: EllipticCurve) { | ||
/// - Parameter seed: An optional BIP39 seed to create wallet from. COS v6.10+. | ||
init(curve: EllipticCurve, seed: Data?) throws { |
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.
Имхо так понятнее. Сид есть - будет использоваться, Сида нет - не будет.
if let seed { | ||
self.keyToImport = try BIP32().makeMasterKey(from: seed, curve: curve) | ||
} else { | ||
self.keyToImport = nil |
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.
А он изначально не nil?
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.
нет, это же константа и ее надо проинициализировать явно в конструкторе
TangemSdk/TangemSdk/Operations/Wallet/CreateWalletCommand.swift
Outdated
Show resolved
Hide resolved
TangemSdk/TangemSdk/Operations/Wallet/CreateWalletCommand.swift
Outdated
Show resolved
Hide resolved
private var derivationTask: DeriveWalletPublicKeysTask? = nil | ||
/// Default initializer | ||
/// - Parameter curve: Elliptic curve of the wallet. `Card.supportedCurves` contains all curves supported by the card | ||
public init(curve: EllipticCurve) { | ||
/// - Parameter seed: An optional BIP39 seed to create wallet from. COS v6.10+. Nil by default. | ||
public init(curve: EllipticCurve, seed: Data? = nil) { |
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 description provided.