decodeSuiSecretKey static method
Decodes a Sui Bech32 secret key into its corresponding private key.
Implementation
static (SuiKeyAlgorithm, List<int>) decodeSuiSecretKey(String secretKey) {
try {
final decode =
Bech32Decoder.decode(SuiKeypairConst.suiPrivateKeyPrefix, secretKey);
final algorithm = SuiKeyAlgorithm.fromFlag(decode[0]);
return (algorithm, decode.sublist(1).asImmutableBytes);
} on DartSuiPluginException {
rethrow;
} catch (e) {
throw DartSuiPluginException("Invalid sui bech32 secret key.",
details: {"error": e.toString()});
}
}