Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions bindings/go/examples/address_from_mnemonic/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright (c) 2025 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

package main

import (
"fmt"
"log"

sdk "bindings/iota_sdk_ffi"
)

const MNEMONIC = "round attack kitchen wink winter music trip tiny nephew hire orange what"

func main() {
privateKeyEd25519, err := sdk.Ed25519PrivateKeyFromMnemonic(MNEMONIC, nil, nil)
if err != nil {
log.Fatalf("Failed to get key from mnemonic: %v", err)
}
privateKeyEd25519Bech32, err := privateKeyEd25519.ToBech32()
if err != nil {
log.Fatalf("Failed to convert to bech32: %v", err)
}
publicKeyEd25519 := privateKeyEd25519.PublicKey()
flaggedPublicKeyEd25519 := publicKeyEd25519.ToFlaggedBytes()
addressEd25519 := publicKeyEd25519.DeriveAddress()

fmt.Println("Ed25519\n---:")
fmt.Println("Private Key:", privateKeyEd25519Bech32)
fmt.Println("Public Key:", sdk.Base64Encode(publicKeyEd25519.ToBytes()))
fmt.Println("Public Key With Flag:", sdk.Base64Encode(flaggedPublicKeyEd25519))
fmt.Println("Address:", addressEd25519.ToHex())

privateKeySecp256k1, err := sdk.Secp256k1PrivateKeyFromMnemonic(MNEMONIC, nil, nil)
if err != nil {
log.Fatalf("Failed to get key from mnemonic: %v", err)
}
privateKeySecp256k1Bech32, err := privateKeySecp256k1.ToBech32()
if err != nil {
log.Fatalf("Failed to convert to bech32: %v", err)
}
publicKeySecp256k1 := privateKeySecp256k1.PublicKey()
flaggedPublicKeySecp256k1 := publicKeySecp256k1.ToFlaggedBytes()
addressSecp256k1 := publicKeySecp256k1.DeriveAddress()

fmt.Println("\nSecp256k1\n---:")
fmt.Println("Private Key:", privateKeySecp256k1Bech32)
fmt.Println("Public Key:", sdk.Base64Encode(publicKeySecp256k1.ToBytes()))
fmt.Println("Public Key With Flag:", sdk.Base64Encode(flaggedPublicKeySecp256k1))
fmt.Println("Address:", addressSecp256k1.ToHex())

privateKeySecp256r1, err := sdk.Secp256r1PrivateKeyFromMnemonic(MNEMONIC, nil, nil)
if err != nil {
log.Fatalf("Failed to get key from mnemonic: %v", err)
}
privateKeySecp256r1Bech32, err := privateKeySecp256r1.ToBech32()
if err != nil {
log.Fatalf("Failed to convert to bech32: %v", err)
}
publicKeySecp256r1 := privateKeySecp256r1.PublicKey()
flaggedPublicKeySecp256r1 := publicKeySecp256r1.ToFlaggedBytes()
addressSecp256r1 := publicKeySecp256r1.DeriveAddress()

fmt.Println("\nSecp256r1\n---:")
fmt.Println("Private Key:", privateKeySecp256r1Bech32)
fmt.Println("Public Key:", sdk.Base64Encode(publicKeySecp256r1.ToBytes()))
fmt.Println("Public Key With Flag:", sdk.Base64Encode(flaggedPublicKeySecp256r1))
fmt.Println("Address:", addressSecp256r1.ToHex())

}
89 changes: 89 additions & 0 deletions bindings/go/iota_sdk_ffi/iota_sdk_ffi.go
Original file line number Diff line number Diff line change
Expand Up @@ -7109,6 +7109,15 @@ func uniffiCheckChecksums() {
}
}
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_iota_sdk_ffi_checksum_constructor_ed25519privatekey_from_mnemonic()
})
if checksum != 52060 {
// If this happens try cleaning and rebuilding your project
panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_constructor_ed25519privatekey_from_mnemonic: UniFFI API checksum mismatch")
}
}
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_iota_sdk_ffi_checksum_constructor_ed25519privatekey_from_pem()
})
Expand Down Expand Up @@ -8351,6 +8360,15 @@ func uniffiCheckChecksums() {
}
}
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_iota_sdk_ffi_checksum_constructor_secp256k1privatekey_from_mnemonic()
})
if checksum != 27698 {
// If this happens try cleaning and rebuilding your project
panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_constructor_secp256k1privatekey_from_mnemonic: UniFFI API checksum mismatch")
}
}
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_iota_sdk_ffi_checksum_constructor_secp256k1privatekey_from_pem()
})
Expand Down Expand Up @@ -8486,6 +8504,15 @@ func uniffiCheckChecksums() {
}
}
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_iota_sdk_ffi_checksum_constructor_secp256r1privatekey_from_mnemonic()
})
if checksum != 62413 {
// If this happens try cleaning and rebuilding your project
panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_constructor_secp256r1privatekey_from_mnemonic: UniFFI API checksum mismatch")
}
}
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_iota_sdk_ffi_checksum_constructor_secp256r1privatekey_from_pem()
})
Expand Down Expand Up @@ -8639,6 +8666,15 @@ func uniffiCheckChecksums() {
}
}
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_iota_sdk_ffi_checksum_constructor_simplekeypair_from_mnemonic()
})
if checksum != 10406 {
// If this happens try cleaning and rebuilding your project
panic("iota_sdk_ffi: uniffi_iota_sdk_ffi_checksum_constructor_simplekeypair_from_mnemonic: UniFFI API checksum mismatch")
}
}
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_iota_sdk_ffi_checksum_constructor_simplekeypair_from_pem()
})
Expand Down Expand Up @@ -12685,6 +12721,19 @@ func Ed25519PrivateKeyFromDer(bytes []byte) (*Ed25519PrivateKey, error) {
}
}

// Construct the private key from a mnemonic phrase
func Ed25519PrivateKeyFromMnemonic(phrase string, password *string, path *string) (*Ed25519PrivateKey, error) {
_uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer {
return C.uniffi_iota_sdk_ffi_fn_constructor_ed25519privatekey_from_mnemonic(FfiConverterStringINSTANCE.Lower(phrase), FfiConverterOptionalStringINSTANCE.Lower(password), FfiConverterOptionalStringINSTANCE.Lower(path),_uniffiStatus)
})
if _uniffiErr != nil {
var _uniffiDefaultValue *Ed25519PrivateKey
return _uniffiDefaultValue, _uniffiErr
} else {
return FfiConverterEd25519PrivateKeyINSTANCE.Lift(_uniffiRV), nil
}
}

// Deserialize PKCS#8-encoded private key from PEM.
func Ed25519PrivateKeyFromPem(s string) (*Ed25519PrivateKey, error) {
_uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer {
Expand Down Expand Up @@ -21203,6 +21252,19 @@ func Secp256k1PrivateKeyFromDer(bytes []byte) (*Secp256k1PrivateKey, error) {
}
}

// Construct the private key from a mnemonic phrase
func Secp256k1PrivateKeyFromMnemonic(phrase string, password *string, path *string) (*Secp256k1PrivateKey, error) {
_uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer {
return C.uniffi_iota_sdk_ffi_fn_constructor_secp256k1privatekey_from_mnemonic(FfiConverterStringINSTANCE.Lower(phrase), FfiConverterOptionalStringINSTANCE.Lower(password), FfiConverterOptionalStringINSTANCE.Lower(path),_uniffiStatus)
})
if _uniffiErr != nil {
var _uniffiDefaultValue *Secp256k1PrivateKey
return _uniffiDefaultValue, _uniffiErr
} else {
return FfiConverterSecp256k1PrivateKeyINSTANCE.Lift(_uniffiRV), nil
}
}

// Deserialize PKCS#8-encoded private key from PEM.
func Secp256k1PrivateKeyFromPem(s string) (*Secp256k1PrivateKey, error) {
_uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer {
Expand Down Expand Up @@ -22045,6 +22107,19 @@ func Secp256r1PrivateKeyFromDer(bytes []byte) (*Secp256r1PrivateKey, error) {
}
}

// Construct the private key from a mnemonic phrase
func Secp256r1PrivateKeyFromMnemonic(phrase string, password *string, path *string) (*Secp256r1PrivateKey, error) {
_uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer {
return C.uniffi_iota_sdk_ffi_fn_constructor_secp256r1privatekey_from_mnemonic(FfiConverterStringINSTANCE.Lower(phrase), FfiConverterOptionalStringINSTANCE.Lower(password), FfiConverterOptionalStringINSTANCE.Lower(path),_uniffiStatus)
})
if _uniffiErr != nil {
var _uniffiDefaultValue *Secp256r1PrivateKey
return _uniffiDefaultValue, _uniffiErr
} else {
return FfiConverterSecp256r1PrivateKeyINSTANCE.Lift(_uniffiRV), nil
}
}

// Deserialize PKCS#8-encoded private key from PEM.
func Secp256r1PrivateKeyFromPem(s string) (*Secp256r1PrivateKey, error) {
_uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer {
Expand Down Expand Up @@ -22895,6 +22970,20 @@ func SimpleKeypairFromEd25519(keypair *Ed25519PrivateKey) *SimpleKeypair {
}))
}

// Construct the private key from a mnemonic phrase and the signature
// scheme
func SimpleKeypairFromMnemonic(scheme SignatureScheme, phrase string, password *string, path *string) (*SimpleKeypair, error) {
_uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer {
return C.uniffi_iota_sdk_ffi_fn_constructor_simplekeypair_from_mnemonic(FfiConverterSignatureSchemeINSTANCE.Lower(scheme), FfiConverterStringINSTANCE.Lower(phrase), FfiConverterOptionalStringINSTANCE.Lower(password), FfiConverterOptionalStringINSTANCE.Lower(path),_uniffiStatus)
})
if _uniffiErr != nil {
var _uniffiDefaultValue *SimpleKeypair
return _uniffiDefaultValue, _uniffiErr
} else {
return FfiConverterSimpleKeypairINSTANCE.Lift(_uniffiRV), nil
}
}

// Deserialize PKCS#8-encoded private key from PEM.
func SimpleKeypairFromPem(s string) (*SimpleKeypair, error) {
_uniffiRV, _uniffiErr := rustCallWithError[SdkFfiError](FfiConverterSdkFfiError{},func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer {
Expand Down
44 changes: 44 additions & 0 deletions bindings/go/iota_sdk_ffi/iota_sdk_ffi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,11 @@ void* uniffi_iota_sdk_ffi_fn_constructor_ed25519privatekey_from_bech32(RustBuffe
void* uniffi_iota_sdk_ffi_fn_constructor_ed25519privatekey_from_der(RustBuffer bytes, RustCallStatus *out_status
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_ED25519PRIVATEKEY_FROM_MNEMONIC
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_ED25519PRIVATEKEY_FROM_MNEMONIC
void* uniffi_iota_sdk_ffi_fn_constructor_ed25519privatekey_from_mnemonic(RustBuffer phrase, RustBuffer password, RustBuffer path, RustCallStatus *out_status
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_ED25519PRIVATEKEY_FROM_PEM
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_ED25519PRIVATEKEY_FROM_PEM
void* uniffi_iota_sdk_ffi_fn_constructor_ed25519privatekey_from_pem(RustBuffer s, RustCallStatus *out_status
Expand Down Expand Up @@ -3383,6 +3388,11 @@ void* uniffi_iota_sdk_ffi_fn_constructor_secp256k1privatekey_from_bech32(RustBuf
void* uniffi_iota_sdk_ffi_fn_constructor_secp256k1privatekey_from_der(RustBuffer bytes, RustCallStatus *out_status
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_SECP256K1PRIVATEKEY_FROM_MNEMONIC
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_SECP256K1PRIVATEKEY_FROM_MNEMONIC
void* uniffi_iota_sdk_ffi_fn_constructor_secp256k1privatekey_from_mnemonic(RustBuffer phrase, RustBuffer password, RustBuffer path, RustCallStatus *out_status
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_SECP256K1PRIVATEKEY_FROM_PEM
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_SECP256K1PRIVATEKEY_FROM_PEM
void* uniffi_iota_sdk_ffi_fn_constructor_secp256k1privatekey_from_pem(RustBuffer s, RustCallStatus *out_status
Expand Down Expand Up @@ -3627,6 +3637,11 @@ void* uniffi_iota_sdk_ffi_fn_constructor_secp256r1privatekey_from_bech32(RustBuf
void* uniffi_iota_sdk_ffi_fn_constructor_secp256r1privatekey_from_der(RustBuffer bytes, RustCallStatus *out_status
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_SECP256R1PRIVATEKEY_FROM_MNEMONIC
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_SECP256R1PRIVATEKEY_FROM_MNEMONIC
void* uniffi_iota_sdk_ffi_fn_constructor_secp256r1privatekey_from_mnemonic(RustBuffer phrase, RustBuffer password, RustBuffer path, RustCallStatus *out_status
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_SECP256R1PRIVATEKEY_FROM_PEM
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_SECP256R1PRIVATEKEY_FROM_PEM
void* uniffi_iota_sdk_ffi_fn_constructor_secp256r1privatekey_from_pem(RustBuffer s, RustCallStatus *out_status
Expand Down Expand Up @@ -3881,6 +3896,11 @@ void* uniffi_iota_sdk_ffi_fn_constructor_simplekeypair_from_der(RustBuffer bytes
void* uniffi_iota_sdk_ffi_fn_constructor_simplekeypair_from_ed25519(void* keypair, RustCallStatus *out_status
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_SIMPLEKEYPAIR_FROM_MNEMONIC
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_SIMPLEKEYPAIR_FROM_MNEMONIC
void* uniffi_iota_sdk_ffi_fn_constructor_simplekeypair_from_mnemonic(RustBuffer scheme, RustBuffer phrase, RustBuffer password, RustBuffer path, RustCallStatus *out_status
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_SIMPLEKEYPAIR_FROM_PEM
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_FN_CONSTRUCTOR_SIMPLEKEYPAIR_FROM_PEM
void* uniffi_iota_sdk_ffi_fn_constructor_simplekeypair_from_pem(RustBuffer s, RustCallStatus *out_status
Expand Down Expand Up @@ -11232,6 +11252,12 @@ uint16_t uniffi_iota_sdk_ffi_checksum_constructor_ed25519privatekey_from_bech32(
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_ED25519PRIVATEKEY_FROM_DER
uint16_t uniffi_iota_sdk_ffi_checksum_constructor_ed25519privatekey_from_der(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_ED25519PRIVATEKEY_FROM_MNEMONIC
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_ED25519PRIVATEKEY_FROM_MNEMONIC
uint16_t uniffi_iota_sdk_ffi_checksum_constructor_ed25519privatekey_from_mnemonic(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_ED25519PRIVATEKEY_FROM_PEM
Expand Down Expand Up @@ -12060,6 +12086,12 @@ uint16_t uniffi_iota_sdk_ffi_checksum_constructor_secp256k1privatekey_from_bech3
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_SECP256K1PRIVATEKEY_FROM_DER
uint16_t uniffi_iota_sdk_ffi_checksum_constructor_secp256k1privatekey_from_der(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_SECP256K1PRIVATEKEY_FROM_MNEMONIC
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_SECP256K1PRIVATEKEY_FROM_MNEMONIC
uint16_t uniffi_iota_sdk_ffi_checksum_constructor_secp256k1privatekey_from_mnemonic(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_SECP256K1PRIVATEKEY_FROM_PEM
Expand Down Expand Up @@ -12150,6 +12182,12 @@ uint16_t uniffi_iota_sdk_ffi_checksum_constructor_secp256r1privatekey_from_bech3
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_SECP256R1PRIVATEKEY_FROM_DER
uint16_t uniffi_iota_sdk_ffi_checksum_constructor_secp256r1privatekey_from_der(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_SECP256R1PRIVATEKEY_FROM_MNEMONIC
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_SECP256R1PRIVATEKEY_FROM_MNEMONIC
uint16_t uniffi_iota_sdk_ffi_checksum_constructor_secp256r1privatekey_from_mnemonic(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_SECP256R1PRIVATEKEY_FROM_PEM
Expand Down Expand Up @@ -12252,6 +12290,12 @@ uint16_t uniffi_iota_sdk_ffi_checksum_constructor_simplekeypair_from_der(void
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_SIMPLEKEYPAIR_FROM_ED25519
uint16_t uniffi_iota_sdk_ffi_checksum_constructor_simplekeypair_from_ed25519(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_SIMPLEKEYPAIR_FROM_MNEMONIC
#define UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_SIMPLEKEYPAIR_FROM_MNEMONIC
uint16_t uniffi_iota_sdk_ffi_checksum_constructor_simplekeypair_from_mnemonic(void

);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_IOTA_SDK_FFI_CHECKSUM_CONSTRUCTOR_SIMPLEKEYPAIR_FROM_PEM
Expand Down
48 changes: 48 additions & 0 deletions bindings/kotlin/examples/AddressFromMnemonic.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright (c) 2025 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import iota_sdk.Ed25519PrivateKey
import iota_sdk.Secp256k1PrivateKey
import iota_sdk.Secp256r1PrivateKey
import iota_sdk.base64Encode
import kotlin.io.println

const val MNEMONIC = "round attack kitchen wink winter music trip tiny nephew hire orange what"

fun main() {
val privateKeyEd25519 = Ed25519PrivateKey.fromMnemonic(MNEMONIC)
val privateKeyEd25519Bech32 = privateKeyEd25519.toBech32()
val publicKeyEd25519 = privateKeyEd25519.publicKey()
val flaggedPublicKeyEd25519 = publicKeyEd25519.toFlaggedBytes()
val addressEd25519 = publicKeyEd25519.deriveAddress()

println("Ed25519\n---")
println("Private Key: ${privateKeyEd25519Bech32}")
println("Public Key: ${base64Encode(publicKeyEd25519.toBytes())}")
println("Public Key With Flag: ${base64Encode(flaggedPublicKeyEd25519)}")
println("Address: ${addressEd25519.toHex()}")

val privateKeySecp256k1 = Secp256k1PrivateKey.fromMnemonic(MNEMONIC)
val privateKeySecp256k1Bech32 = privateKeySecp256k1.toBech32()
val publicKeySecp256k1 = privateKeySecp256k1.publicKey()
val flaggedPublicKeySecp256k1 = publicKeySecp256k1.toFlaggedBytes()
val addressSecp256k1 = publicKeySecp256k1.deriveAddress()

println("\nSecp256k1\n---")
println("Private Key: ${privateKeySecp256k1Bech32}")
println("Public Key: ${base64Encode(publicKeySecp256k1.toBytes())}")
println("Public Key With Flag: ${base64Encode(flaggedPublicKeySecp256k1)}")
println("Address: ${addressSecp256k1.toHex()}")

val privateKeySecp256r1 = Secp256r1PrivateKey.fromMnemonic(MNEMONIC)
val privateKeySecp256r1Bech32 = privateKeySecp256r1.toBech32()
val publicKeySecp256r1 = privateKeySecp256r1.publicKey()
val flaggedPublicKeySecp256r1 = publicKeySecp256r1.toFlaggedBytes()
val addressSecp256r1 = publicKeySecp256r1.deriveAddress()

println("\nSecp256r1\n---")
println("Private Key: ${privateKeySecp256r1Bech32}")
println("Public Key: ${base64Encode(publicKeySecp256r1.toBytes())}")
println("Public Key With Flag: ${base64Encode(flaggedPublicKeySecp256r1)}")
println("Address: ${addressSecp256r1.toHex()}")
}
Loading