@sphereon/oid4vci-common
Version:
OpenID 4 Verifiable Credential Issuance Common Types
78 lines • 3.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthzFlowType = exports.CreateRequestObjectMode = exports.PARMode = exports.CodeChallengeMethod = exports.ResponseType = exports.Encoding = exports.GrantTypes = exports.AuthorizationChallengeError = void 0;
const Generic_types_1 = require("./Generic.types");
// https://www.ietf.org/archive/id/draft-parecki-oauth-first-party-apps-02.html#name-error-response
var AuthorizationChallengeError;
(function (AuthorizationChallengeError) {
AuthorizationChallengeError["invalid_request"] = "invalid_request";
AuthorizationChallengeError["invalid_client"] = "invalid_client";
AuthorizationChallengeError["unauthorized_client"] = "unauthorized_client";
AuthorizationChallengeError["invalid_session"] = "invalid_session";
AuthorizationChallengeError["invalid_scope"] = "invalid_scope";
AuthorizationChallengeError["insufficient_authorization"] = "insufficient_authorization";
AuthorizationChallengeError["redirect_to_web"] = "redirect_to_web";
})(AuthorizationChallengeError || (exports.AuthorizationChallengeError = AuthorizationChallengeError = {}));
var GrantTypes;
(function (GrantTypes) {
GrantTypes["AUTHORIZATION_CODE"] = "authorization_code";
GrantTypes["PRE_AUTHORIZED_CODE"] = "urn:ietf:params:oauth:grant-type:pre-authorized_code";
GrantTypes["PASSWORD"] = "password";
})(GrantTypes || (exports.GrantTypes = GrantTypes = {}));
var Encoding;
(function (Encoding) {
Encoding["FORM_URL_ENCODED"] = "application/x-www-form-urlencoded";
Encoding["UTF_8"] = "UTF-8";
})(Encoding || (exports.Encoding = Encoding = {}));
var ResponseType;
(function (ResponseType) {
ResponseType["AUTH_CODE"] = "code";
})(ResponseType || (exports.ResponseType = ResponseType = {}));
var CodeChallengeMethod;
(function (CodeChallengeMethod) {
CodeChallengeMethod["plain"] = "plain";
CodeChallengeMethod["S256"] = "S256";
})(CodeChallengeMethod || (exports.CodeChallengeMethod = CodeChallengeMethod = {}));
/*export interface AuthorizationRequestOpts {
clientId: string;
codeChallenge: string;
codeChallengeMethod: CodeChallengeMethod;
authorizationDetails?: AuthorizationDetails[];
redirectUri: string;
scope?: string;
}*/
/**
* Determinse whether PAR should be used when supported
*
* REQUIRE: Require PAR, if AS does not support it throw an error
* AUTO: Use PAR is the AS supports it, otherwise construct a reqular URI,
* NEVER: Do not use PAR even if the AS supports it (not recommended)
*/
var PARMode;
(function (PARMode) {
PARMode[PARMode["REQUIRE"] = 0] = "REQUIRE";
PARMode[PARMode["AUTO"] = 1] = "AUTO";
PARMode[PARMode["NEVER"] = 2] = "NEVER";
})(PARMode || (exports.PARMode = PARMode = {}));
var CreateRequestObjectMode;
(function (CreateRequestObjectMode) {
CreateRequestObjectMode[CreateRequestObjectMode["NONE"] = 0] = "NONE";
CreateRequestObjectMode[CreateRequestObjectMode["REQUEST_OBJECT"] = 1] = "REQUEST_OBJECT";
CreateRequestObjectMode[CreateRequestObjectMode["REQUEST_URI"] = 2] = "REQUEST_URI";
})(CreateRequestObjectMode || (exports.CreateRequestObjectMode = CreateRequestObjectMode = {}));
var AuthzFlowType;
(function (AuthzFlowType) {
AuthzFlowType["AUTHORIZATION_CODE_FLOW"] = "Authorization Code Flow";
AuthzFlowType["PRE_AUTHORIZED_CODE_FLOW"] = "Pre-Authorized Code Flow";
})(AuthzFlowType || (exports.AuthzFlowType = AuthzFlowType = {}));
// eslint-disable-next-line @typescript-eslint/no-namespace
(function (AuthzFlowType) {
function valueOf(request) {
if (Generic_types_1.PRE_AUTH_CODE_LITERAL in request) {
return AuthzFlowType.PRE_AUTHORIZED_CODE_FLOW;
}
return AuthzFlowType.AUTHORIZATION_CODE_FLOW;
}
AuthzFlowType.valueOf = valueOf;
})(AuthzFlowType || (exports.AuthzFlowType = AuthzFlowType = {}));
//# sourceMappingURL=Authorization.types.js.map