@metamask/keyring-api
Version:
MetaMask Keyring API
53 lines • 1.84 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExportPrivateKeyFormatStruct = exports.ImportPrivateKeyFormatStruct = exports.PrivateKeyEncodingStruct = exports.PrivateKeyEncoding = void 0;
const superstruct_1 = require("@metamask/superstruct");
const account_1 = require("../account.cjs");
/**
* Supported encoding formats for private keys.
*/
var PrivateKeyEncoding;
(function (PrivateKeyEncoding) {
/**
* Hexadecimal encoding format.
*/
PrivateKeyEncoding["Hexadecimal"] = "hexadecimal";
/**
* Base58 encoding format.
*/
PrivateKeyEncoding["Base58"] = "base58";
})(PrivateKeyEncoding || (exports.PrivateKeyEncoding = PrivateKeyEncoding = {}));
/**
* Struct for {@link PrivateKeyEncoding}.
*/
exports.PrivateKeyEncodingStruct = (0, superstruct_1.enums)([
`${PrivateKeyEncoding.Hexadecimal}`,
`${PrivateKeyEncoding.Base58}`,
]);
/**
* Struct for {@link ImportPrivateKeyFormat}.
*/
exports.ImportPrivateKeyFormatStruct = (0, superstruct_1.object)({
/**
* Format used to encode the private key as a string.
*/
encoding: exports.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: (0, superstruct_1.exactOptional)(account_1.KeyringAccountTypeStruct),
});
/**
* Struct for {@link ExportPrivateKeyFormat}.
*/
exports.ExportPrivateKeyFormatStruct = (0, superstruct_1.object)({
/**
* Format used to encode the private key as a string.
*/
encoding: exports.PrivateKeyEncodingStruct,
});
//# sourceMappingURL=private-key.cjs.map