archethic_lib_dart library

SPDX-License-Identifier: AGPL-3.0-or-later Package archEthic aims to provide a easy way to create Archethic transaction and to send them over the network.

This implementation is based on Official Archethic Javascript library for Node and Browser.

Mixins

ArchethicTransactionParser
Handles conversion from Archethic DTOs to Models
NotificationUtil
TransactionMixin

Constants

cVersion → const int
kAddressLength → const int
kCurveType → const List<int>
keychainOriginId → const int
kHashType → const List<int>
kOriginPrivateKey → const String
Return the Initial Origin Private Key
softwareId → const int
txTypes → const Map<String, int>

Functions

addressFromJson(String json) Address
addressToJson(Address? address) String?
aesAuthDecrypt(Uint8List encrypted, Uint8List aesKey, Uint8List iv, Uint8List tag) Uint8List
aesAuthEncrypt(Uint8List data, Uint8List aesKey, Uint8List iv) AesAuthEncryptInfos
aesDecrypt(dynamic cipherText, dynamic key, {bool isCipherTextHexa = true, bool isKeyHexa = true}) Uint8List
aesEncrypt(dynamic data, dynamic key, {bool isDataHexa = true, bool isKeyHexa = true}) Uint8List
Encrypt a data for a given public key using AES algorithm @param {String | Uint8List} data Data to encrypt @param {String | Uint8List} key Symmetric key
concatUint8List(Iterable<Uint8List> list) Uint8List
Concat a list of Uint8List @param {Array} arrays Uint8List
curveToID(String curve) int
Get the ID of a given Elliptic curve @params {String} curve Elliptic curve
decodeKeychain(Uint8List binary) Keychain
deriveAddress(String seed, int index, {String curve = 'ed25519', String hashAlgo = 'sha256', bool isSeedHexa = true}) String
Create a hash digest from the data with an hash algorithm identification prepending the digest @param {String} seed Keypair derivation seed @param {int} index Number to identify the order of keys to generate @param {String} curve Elliptic curve to use ("ed25519", "P256", "secp256k1") @param {String} hashAlgo Hash algorithm ("sha256", "sha512", "sha3-256", "sha3-512", "blake2b")
deriveArchethicKeypair(dynamic seed, String derivationPath, int index, {String curve = 'ed25519', String pathSuffix = ''}) KeyPair
deriveKeyPair(String seed, int index, {String curve = 'ed25519', bool isSeedHexa = true, int originId = softwareId}) KeyPair
Generate a keypair using a derivation function with a seed and an index. Each keys is prepending with a curve identification. @param {String} seed Keypair derivation seed @param {int} index Number to identify the order of keys to generate @param {String} curve Elliptic curve to use ("P256", "secp256k1", "ed25519") @param {int} originId Origin id of the public key (0, 1, 2) = ("on chain wallet", "software", "tpm")
derivePrivateKey(dynamic seed, int index, {bool isSeedHexa = true}) Uint8List
deriveSecret(dynamic sharedKey, {bool isSharedKey = true}) Secret
deriveServiceSeed(dynamic seed, String derivationPath, int index, {String pathSuffix = ''}) Uint8List
ecDecrypt(dynamic cipherText, dynamic privateKey, {bool isCipherTextHexa = true, bool isPrivateKeyHexa = true}) Uint8List
Decrypt a ciphertext for a given private key using ECIES algorithm @param {String | Uint8List} ciphertext Ciphertext to decrypt @param {String | Uint8List} privateKey Private key for the shared secret encryption
ecEncrypt(dynamic data, dynamic publicKey, {bool isDataHexa = true, bool isPublicKeyHexa = true}) Uint8List
Encrypt a data for a given public key using ECIES algorithm @param {String | Uint8List} data Data to encrypt @param {String | Uint8List} publicKey Public key for the shared secret encryption
fromBigInt(int? number) num
Convert big int of 10^8 decimals to any number @param {int} Number to convert
generateDeterministicKeyPair(Uint8List pvKey, String curve, int originID) KeyPair
Generate a new keypair deterministically with a given private key, curve and origin id @params {Uint8List} privateKey Private key @params {String} curve Elliptic curve @params {int} originID Origin identification
generateRandomAESKey({int length = 32}) String
Generate a random AESKey
generateRandomSeed() String
Generate a random seed
getHashDigest(dynamic content, dynamic algo) Uint8List
getKeypair(Uint8List pvKey, String curve) KeyPair
hash(dynamic content, {String algo = 'sha256', bool isContentHexa = true}) Uint8List
Create a hash digest from the data with an hash algorithm identification prepending the digest @param {String | Uint8List} content Data to hash (string or buffer) @param {String} algo Hash algorithm ("sha256", "sha512", "sha3-256", "sha3-512", "blake2b")
hashAlgoToID(String hashAlgo) int
Get the ID of a given hash algorithm @params {String} hashAlgo Hash algorithm
hexToUint8List(String hexString) Uint8List
Encode an hexadecimal string into a Uint8List @param {Uint8List} hexString Hexadecimal string
idToCurve(int id) String
Get the curve name from the curve ID @param {int} ID Curve's ID
idToHashAlgo(int id) String
Get the hash algo name from the hash algorithm ID @param {int} ID Hash algorithm's ID
isHex(String inputString) bool
Determines if a string is an hexadecimal @param {String} inputString Potential hexadecimal string
isPathWithIndex(String path) bool
keyToJWK(Uint8List publicKey, String keyId) → Jwk
nextUint8(Iterator<MapEntry<int, int>> iterator) int
Return the next Uint8 from an iterator of Uint8Array There is an assumption on success @param iter @returns
oracleUcoPriceFromJson(String str) OracleUcoPrice
oracleUcoPriceToJson(OracleUcoPrice data) String
originKeyResponseFromJson(String str) OriginKeyResponse
originKeyResponseToJson(OriginKeyResponse data) String
removeAliasPrefix<T>(Map<String, T?>? map) Map<String, T>?
Remove alias prefix (underscore) used in graphQL requests
replaceDerivationPathIndex(String path, String suffix, int index) String
sign(dynamic data, dynamic privateKey, {bool isDataHexa = true, bool isPrivateKeyHexa = true}) Uint8List
Sign the data @param {String | Uint8List} data Data to sign @param {String | Uint8List} privateKey Private key to use to sign the data
sortObjectKeysAsc(dynamic term) → dynamic
toBigInt(num? number) int
Convert any number into a big int for 10^8 decimals @param {num} Number to convert
toByteArray(int value, {int length = 0}) Uint8List
Convert any number into a byte array
transactionStatusFromJson(String str) TransactionStatus
uint8ListToHex(Uint8List bytes) String
Encode an Uint8List into an hexadecimal string @param {Uint8List} bytes Uint8List
uint8ListToInt(Uint8List bytes) int
Decode byte array (4 bytes) into a integer @param {Uint8List} bytes Bytes array to decode
verify(dynamic sig, dynamic data, dynamic publicKey, {bool isSigHexa = true, bool isDataHexa = true, bool isPublicKeyHexa = true}) bool
walletEncoder(String originPublicKey) OnChainWalletData
Archethic Onchain Wallet Generator and Encoder, using V1 specifications https://archethic-foundation.github.io/archethic-docs/build/clients/wallet-spec

Typedefs

TransactionConfirmationHandler = Future<void> Function(TransactionConfirmation confirmation)
TransactionErrorHandler = Future<void> Function(TransactionError error)