gecko/packages/dubp_rs
librelois 2492465d46 ref(dubp): bind an array of string directly and use it in signSeveral 2021-01-04 17:36:30 +01:00
..
android chore: add package dubp 2021-01-04 17:11:57 +01:00
ios ref(dubp): bind an array of string directly and use it in signSeveral 2021-01-04 17:36:30 +01:00
lib ref(dubp): bind an array of string directly and use it in signSeveral 2021-01-04 17:36:30 +01:00
.metadata chore: add package dubp 2021-01-04 17:11:57 +01:00
LICENSE chore: add package dubp 2021-01-04 17:11:57 +01:00
README.md chore: add package dubp 2021-01-04 17:11:57 +01:00
analysis_options.yaml chore: add package dubp 2021-01-04 17:11:57 +01:00
pubspec.lock chore: add package dubp 2021-01-04 17:11:57 +01:00
pubspec.yaml chore: add package dubp 2021-01-04 17:11:57 +01:00

README.md

dubp

Flutter package that bind dubp-rs-libs Rust crates.

Use

You must execute this instruction at startup of your application:

DubpRust.setup();

Generate a random Mnemonic

Function signature

static Future<String> DubpRust.genMnemonic({Language language = Language.English});

Usage example

String mnemonic = await DubpRust.genMnemonic();

You can choose a language (English by default):

String mnemonic = await DubpRust.genMnemonic(language: Language.French);

Generate a wallet

Function signature

static Future<NewWallet> genWalletFromMnemonic({
    String currency = "g1",
    Language language = Language.English,
    String mnemonic,
    PinLength pinLength = PinLength.Six
});

If the mnemonic is not in English, you must indicate the language of the mnemonic (necessary for the verification of its validity). If the wallet to be generated is not dedicated to the Ğ1 currency, you must indicate the currency for which this wallet will be used.

Usage example

NewWallet new_wallet = await DubpRust.genWalletFromMnemonic(
    language: Language.English,
    mnemonic: "tongue cute mail fossil great frozen same social weasel impact brush kind"
);

You can choose a different length for the pin code (6 by default):

NewWallet new_wallet = await DubpRust.genWalletFromMnemonic(
    language: Language.English,
    mnemonic: "tongue cute mail fossil great frozen same social weasel impact brush kind",
    pinLength: PinLength.Eight
);

Sign a message

Function signature

static Future<String> sign({
    String currency = "g1",
    String dewif,
    String pin,
    String message
});

If the wallet is not dedicated to the Ğ1 currency, you must indicate the currency.

Usage example

String signature = await DubpRust.sign(
    dewif: "AAAAARAAAAGfFDAs+jVZYkfhBlHZZ2fEQIvBqnG16g5+02cY18wSOjW0cUg2JV3SUTJYN2CrbQeRDwGazWnzSFBphchMmiL0",
    pin: "CDJ4UB",
    message: "toto"
);

Change pin code

You can change the pin code that encrypts the DEWIF.

Function signature

static Future<NewWallet> changeDewifPin({
    String currency = "g1",
    String dewif,
    String oldPin,
    PinLength newPinLength = PinLength.Six
});

If the wallet is not dedicated to the Ğ1 currency, you must indicate the currency.

Usage example

NewWallet new_wallet = await DubpRust.changeDewifPin(
    dewif: "AAAAARAAAAGfFDAs+jVZYkfhBlHZZ2fEQIvBqnG16g5+02cY18wSOjW0cUg2JV3SUTJYN2CrbQeRDwGazWnzSFBphchMmiL0",
    oldPin: "CDJ4UB",
);