@metamask/keyring-api
Version:
MetaMask Keyring API
50 lines • 1.53 kB
JavaScript
import { enums, exactOptional, object } from "@metamask/superstruct";
import { KeyringAccountTypeStruct } from "../account.mjs";
/**
* Supported encoding formats for private keys.
*/
export var PrivateKeyEncoding;
(function (PrivateKeyEncoding) {
/**
* Hexadecimal encoding format.
*/
PrivateKeyEncoding["Hexadecimal"] = "hexadecimal";
/**
* Base58 encoding format.
*/
PrivateKeyEncoding["Base58"] = "base58";
})(PrivateKeyEncoding || (PrivateKeyEncoding = {}));
/**
* Struct for {@link PrivateKeyEncoding}.
*/
export const PrivateKeyEncodingStruct = enums([
`${PrivateKeyEncoding.Hexadecimal}`,
`${PrivateKeyEncoding.Base58}`,
]);
/**
* Struct for {@link ImportPrivateKeyFormat}.
*/
export const ImportPrivateKeyFormatStruct = object({
/**
* Format used to encode the private key as a string.
*/
encoding: PrivateKeyEncodingStruct,
/**
* Type of the account to be created.
*
* This field is necessary when there is ambiguity about the type of account
* to be created from the private key. For example, in Bitcoin, a private key
* can be used to create multiple types of accounts, such as P2WPKH, or P2TR.
*/
type: exactOptional(KeyringAccountTypeStruct),
});
/**
* Struct for {@link ExportPrivateKeyFormat}.
*/
export const ExportPrivateKeyFormatStruct = object({
/**
* Format used to encode the private key as a string.
*/
encoding: PrivateKeyEncodingStruct,
});
//# sourceMappingURL=private-key.mjs.map