Skip to content

Commit

Permalink
fix: parse scheme with number
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <timo@animo.id>
  • Loading branch information
TimoGlastra committed Sep 28, 2023
1 parent ca508e3 commit 20b91a5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
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

0 comments on commit 20b91a5

Please sign in to comment.