Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: parse scheme with number #60

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/authorization-request/URI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class URI implements AuthorizationRequestURI {
throw Error(SIOPErrors.BAD_PARAMS);
}
// We strip the uri scheme before passing it to the decode function
const scheme: string = uri.match(/^([a-zA-Z-_]+:\/\/)/g)[0];
const scheme: string = uri.match(/^([a-zA-Z][a-zA-Z0-9-_]*:\/\/)/g)[0];
const authorizationRequestPayload = decodeUriAsJson(uri) as AuthorizationRequestPayload;
return { scheme, authorizationRequestPayload };
}
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/Encodings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function decodeUriAsJson(uri: string) {
if (!uri) {
throw new Error(SIOPErrors.BAD_PARAMS);
}
const queryString = uri.replace(/^([a-zA-Z-_]+:\/\/[?]?)/g, '');
const queryString = uri.replace(/^([a-zA-Z][a-zA-Z0-9-_]*:\/\/[?]?)/g, '');
if (!queryString) {
throw new Error(SIOPErrors.BAD_PARAMS);
}
Expand Down
Loading