Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

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