@lit-protocol/auth-helpers
Version:
Advanced authentication utilities for managing blockchain resource permissions and capabilities within the Lit Protocol ecosystem. Built on top of SIWE (Sign-In with Ethereum) and SIWE-RECAP for robust authentication flows.
44 lines • 1.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRecapNamespaceAndAbility = getRecapNamespaceAndAbility;
const constants_1 = require("@lit-protocol/constants");
/**
* Map from a LitAbility to the Recap namespace and ability.
* @throws Error if the LitAbility is unknown
*/
function getRecapNamespaceAndAbility(litAbility) {
switch (litAbility) {
case constants_1.LIT_ABILITY.AccessControlConditionDecryption:
return {
recapNamespace: constants_1.LIT_NAMESPACE.Threshold,
recapAbility: constants_1.LIT_RECAP_ABILITY.Decryption,
};
case constants_1.LIT_ABILITY.AccessControlConditionSigning:
return {
recapNamespace: constants_1.LIT_NAMESPACE.Threshold,
recapAbility: constants_1.LIT_RECAP_ABILITY.Signing,
};
case constants_1.LIT_ABILITY.PKPSigning:
return {
recapNamespace: constants_1.LIT_NAMESPACE.Threshold,
recapAbility: constants_1.LIT_RECAP_ABILITY.Signing,
};
case constants_1.LIT_ABILITY.RateLimitIncreaseAuth:
return {
recapNamespace: constants_1.LIT_NAMESPACE.Auth,
recapAbility: constants_1.LIT_RECAP_ABILITY.Auth,
};
case constants_1.LIT_ABILITY.LitActionExecution:
return {
recapNamespace: constants_1.LIT_NAMESPACE.Threshold,
recapAbility: constants_1.LIT_RECAP_ABILITY.Execution,
};
default:
throw new constants_1.InvalidArgumentException({
info: {
litAbility,
},
}, `Unknown LitAbility`);
}
}
//# sourceMappingURL=utils.js.map