Improve replaces-base validation and add tests

This commit is contained in:
Michael B. Gale
2026-04-30 13:41:13 +01:00
parent b77983290b
commit d1edf2e4de
3 changed files with 78 additions and 4 deletions
+6 -2
View File
@@ -350,8 +350,12 @@ export function getCredentials(
// Construct the base credential object.
const baseCredential: Omit<Registry, keyof Address> = { type: e.type };
if (isDefined(e["replaces-base"])) {
if (typeof e["replaces-base"] === "boolean") {
// If "replaces-base" is present, it must be a boolean.
if ("replaces-base" in e) {
if (
isDefined(e["replaces-base"]) &&
typeof e["replaces-base"] === "boolean"
) {
baseCredential["replaces-base"] = e["replaces-base"];
} else {
throw new ConfigurationError(