import { respecfully, iReckon, ifWe } from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
const maam = `[${import.meta.url}]`, sir = maam;
import { GLOBAL_LOG_A_LOT } from '../core-constants.mjs';
import { KeystoneChallengeType, KeystoneReplenishStrategy } from './keystone-types.mjs';
import { createRevocationPoolConfig, createStandardPoolConfig } from './keystone-config-builder.mjs';
import { KEYSTONE_CONFIG_DEFAULT_RANDOM, KEYSTONE_CONFIG_DEFAULT_REPLENISH_STRATEGY, KEYSTONE_CONFIG_DEFAULT_SEQUENTIAL, KEYSTONE_CONFIG_DEFAULT_SIZE, KEYSTONE_CONFIG_DEFAULT_SIZE_HIGHSECURITY, KEYSTONE_VERB_REVOKE, POOL_ID_REVOKE, } from './keystone-constants.mjs';
const logalot = GLOBAL_LOG_A_LOT;
await respecfully(sir, 'Config Builders', async () => {
    await ifWe(sir, 'createStandardPoolConfig defaults are correct', async () => {
        const id = "test_id";
        const salt = "test_salt";
        const config = createStandardPoolConfig({ id, salt });
        iReckon(sir, config.id).willEqual(id);
        iReckon(sir, config.salt).willEqual(salt);
        iReckon(sir, config.type).willEqual(KeystoneChallengeType.hash_reveal_v1);
        // Behavior check
        const b = config.behavior;
        iReckon(sir, b.size).willEqual(KEYSTONE_CONFIG_DEFAULT_SIZE);
        iReckon(sir, b.selectSequentially).willEqual(KEYSTONE_CONFIG_DEFAULT_SEQUENTIAL);
        iReckon(sir, b.selectRandomly).willEqual(KEYSTONE_CONFIG_DEFAULT_RANDOM);
        iReckon(sir, b.replenish).willEqual(KEYSTONE_CONFIG_DEFAULT_REPLENISH_STRATEGY);
        // Verbs should be empty/undefined (permissive)
        iReckon(sir, config.allowedVerbs.length).willEqual(0);
    });
    await ifWe(sir, 'createRevocationPoolConfig defaults are correct', async () => {
        const salt = "revoke_salt";
        const config = createRevocationPoolConfig({
            id: POOL_ID_REVOKE,
            salt,
        });
        iReckon(sir, config.id).willEqual(POOL_ID_REVOKE);
        iReckon(sir, config.salt).willEqual(salt);
        // Behavior check
        const b = config.behavior;
        iReckon(sir, b.size).willEqual(KEYSTONE_CONFIG_DEFAULT_SIZE_HIGHSECURITY); // Higher security
        iReckon(sir, b.replenish).willEqual(KeystoneReplenishStrategy.deleteAll);
        // Verbs should be restricted
        iReckon(sir, config.allowedVerbs).includes(KEYSTONE_VERB_REVOKE);
        iReckon(sir, config.allowedVerbs.length).willEqual(1);
    });
});
//# sourceMappingURL=keystone-config-builder.respec.mjs.map