bls-eth-swift

1.0.1

MyEtherWallet/bls-eth-swift

What's New

Release 1.0.1

2021-10-30T22:14:52Z
  • bls_framework.xcframework is now safe for extensions
  • Cleaned unused exclude sources from Package.swift
  • Fix symlinks in bls_framework.xcframework.zip

GitHub Platform Swift support Swift Package Manager compatible

Note: this framework doesn't provide a way to derive Eth2 secret key (eip-2333). Please use your own implementation

bls-eth-swift

bls-eth-swift provides convenient way to integrate https://github.com/herumi/bls-eth-go-binary

Requirements

Good mood

Features

  • Easy to use
  • Precompiled sources

Installation

Swift Package Manager

You can use Swift Package Manager and specify dependency in Package.swift by adding this:

.package(url: "https://github.com/MyEtherWallet/bls-eth-swift.git", .upToNextMajor(from: "1.0.0"))

XCFramework

XCFrameworks require Xcode 11 or later and they can be integrated similarly to how we’re used to integrating the .framework format. Please use a script bls_framework/build.sh to generate binary bls_framework.xcframework archive that you can use as a dependency in Xcode or you can use precompiled one.

bls_framework.xcframework is a Release (Optimized) binary that offer best available Swift code performance.

How to

import bls_framework
blsSecretKey
try BLSInterface.blsInit()

let serializedSecretKey = Data(hex: "455c0dc9fccb3395825d92a60d2672d69416be1c2578a87a7a3d3ced11ebb88d").bytes // [UInt8]

var secretKey = blsSecretKey.init()
blsSecretKeyDeserialize(&secretKey, &serializedSecretKey, numericCast(serializedSecretKey.count))
blsPublicKey
var publicKey = blsPublicKey.init()
blsGetPublicKey(&publicKey, &secretKey)
Eth2 Public Key
let PUBLIC_KEY_SIZE = 48
var publicKeyBytes = Data(count: PUBLIC_KEY_SIZE).bytes // [UInt8]
blsPublicKeySerialize(&publicKeyBytes, PUBLIC_KEY_SIZE, &publicKey)

return Data(publicKeyBytes)

Swift versions support

  • Swift 5.0 and newer, branch master

License

MIT

Description

  • Swift Tools 5.4.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sat Nov 02 2024 17:29:13 GMT-0900 (Hawaii-Aleutian Daylight Time)