Skip to content

Commit

Permalink
Merge pull request #371 from Concordium/fail-on-invalid-date
Browse files Browse the repository at this point in the history
Throw error in replacer if date is invalid
  • Loading branch information
orhoj authored Aug 31, 2023
2 parents 9bc7afb + 859381e commit fa590bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/browser-wallet-api/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ function replacer(this: any, k: string, value: any) {
}
const rawValue = this[k];
if (rawValue instanceof Date) {
if (Number.isNaN(rawValue.getTime())) {
throw new Error(`Received a Date instance that was an invalid Date. Raw value was: [${rawValue}]`);
}
return { '@type': serializationTypes.Date, value };
}
if (Buffer.isBuffer(rawValue)) {
Expand Down
1 change: 1 addition & 0 deletions packages/browser-wallet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Fixed

- An issue where changing the credential metadata URL to an invalid URL, or a URL that does not contain a credential metadata file, would result in an empty screen.
- An issue where an invalid Date would result in the epoch timestamp instead of returning an error.
- Enabled ID statement checks for Web3 ID proof requests containing account credential statements.

## 1.1.3
Expand Down

0 comments on commit fa590bc

Please sign in to comment.