Skip to content
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

feature: implementation of HDKey #73

Closed
wants to merge 5 commits into from
Closed

Conversation

cristianIOHK
Copy link
Contributor

Implementation of HDKey

@atala-dev
Copy link
Contributor

atala-dev commented Jul 4, 2023

🦙 MegaLinter status: ⚠️ WARNING

Descriptor Linter Files Fixed Errors Elapsed time
✅ ACTION actionlint 1 0 0.03s
✅ EDITORCONFIG editorconfig-checker 5 0 0.04s
✅ KOTLIN ktlint 4 0 14.66s
⚠️ REPOSITORY devskim yes 6 1.39s
✅ REPOSITORY dustilock yes no 0.03s
✅ REPOSITORY gitleaks yes no 1.9s
✅ REPOSITORY git_diff yes no 0.03s
✅ REPOSITORY secretlint yes no 5.41s
✅ REPOSITORY syft yes no 0.45s
✅ REPOSITORY trivy yes no 6.98s
⚠️ YAML prettier 1 1 0.64s
✅ YAML v8r 1 0 2.81s
✅ YAML yamllint 1 0 0.39s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@goncalo-frade-iohk
Copy link
Contributor

We need to add this tests as well but adapted for KMM Apollo code ;)

final class BIP32Tests: XCTestCase {

    let mnemonics = ["blade", "multiply", "coil", "rare", "fox", "doll", "tongue", "please", "icon", "mind", "gesture", "moral", "old", "laugh", "symptom", "assume", "burden", "appear", "always", "oil", "ticket", "vault", "return", "height"]

    func testBip32RootKeyGeneration() throws {
        let seed = try CreateSeedOperation(words: mnemonics).compute()
        let operation = CreateSec256k1KeyPairOperation(seed: seed, keyPath: .init(index: 0))
        let privateKey = try operation.compute()
        XCTAssertEqual(
            privateKey.raw.base64UrlEncodedString(),
            "xURclKhT6as1Tb9vg4AJRRLPAMWb9dYTTthDvXEKjMc"
        )
    }

    func testBip32KeyPathGeneration() throws {
        let seed = try CreateSeedOperation(words: mnemonics).compute()
        let operation = CreateSec256k1KeyPairOperation(seed: seed, keyPath: .init(index: 3))
        let privateKey = try operation.compute()
        XCTAssertEqual(
            privateKey.raw.base64UrlEncodedString(),
            "N_JFgvYaReyRXwassz5FHg33A4I6dczzdXrjdHGksmg"
        )
    }

    func testBip32KeyPathGenerationPublicKey() throws {
        let seed = try CreateSeedOperation(words: mnemonics).compute()
        let operation = CreateSec256k1KeyPairOperation(seed: seed, keyPath: .init(index: 3))
        let privateKey = try operation.compute()
        XCTAssertEqual(
            privateKey.publicKey().raw.base64UrlEncodedString(),
            "BD-l4lrQ6Go-oN5XtdpY6o5dyf2V2v5EbMAvRjVGJpE1gYVURJfxKMpNPnKlLr4MOLNVaYvBNOoy9L50E8jVx8Q"
        )
    }
}

@@ -55,8 +55,8 @@ jobs:
include:
- os: ubuntu-latest
os-type: linux
- os: macos-latest
os-type: macos
# - os: macos-latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We mustn't disable the macOS tests.

@cristianIOHK cristianIOHK deleted the feature/ATL-5165 branch July 13, 2023 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants