@sign-speak/react-sdk
Version:
Unlock Sign Language Recognition, Avatar, and Speech Recognition.
27 lines (26 loc) • 767 B
JavaScript
;
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getKey = exports.setKey = void 0;
var key = typeof process !== "undefined" && ((_a = process.env) === null || _a === void 0 ? void 0 : _a.SIGN_SPEAK_API_KEY)
? process.env.SIGN_SPEAK_API_KEY
: null;
/**
* Sets the API key manually. This will override any environment variable.
* @param k - The API key to set.
*/
function setKey(k) {
key = k;
}
exports.setKey = setKey;
/**
* Retrieves the API key.
* @returns The API key if set, otherwise throws an error.
*/
function getKey() {
if (!key) {
throw new Error("API key is not set. Use setKey() or define SIGN_SPEAK_API_KEY in your environment.");
}
return key;
}
exports.getKey = getKey;