multiversx-bls 0.1.0

BLS signature library for MultiversX
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::sync::Once;

use crate::bls_api::blsInit;
use crate::constants::MCLBN_COMPILED_TIME_VAR;

enum CurveType {
    BLS12_381 = 5,
}

// Used to call blsInit only once.
pub static INIT: Once = Once::new();
pub fn init_library() {
    init(CurveType::BLS12_381);
}

fn init(curve_type: CurveType) -> bool {
    unsafe { blsInit(curve_type as usize, MCLBN_COMPILED_TIME_VAR) == 0 }
}