sui_keys::keypair_file

Function read_key

Source
pub fn read_key(
    path: &PathBuf,
    require_secp256k1: bool,
) -> Result<SuiKeyPair, Error>
Expand description

Read a SuiKeyPair from a file. The content could be any of the following:

  • Base64 encoded flag || privkey for ECDSA key
  • Base64 encoded privkey for Raw key
  • Bech32 encoded private key prefixed with suiprivkey
  • Hex encoded privkey for Raw key

If require_secp256k1 is true, it will return an error if the key is not Secp256k1.