File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 1
1
# jsonld-signatures ChangeLog
2
2
3
+ ## 11.4.0 - 2024-12-dd
4
+
5
+ ### Added
6
+ - Add support for validating proof with ` domain ` expressed as an array.
7
+
3
8
## 11.3.2 - 2024-11-06
4
9
5
10
### Fixed
Original file line number Diff line number Diff line change @@ -25,14 +25,23 @@ module.exports = class AuthenticationProofPurpose extends
25
25
try {
26
26
// check challenge
27
27
if ( proof . challenge !== this . challenge ) {
28
- throw new Error ( 'The challenge is not as expected; ' +
28
+ throw new Error (
29
+ 'The challenge is not as expected; ' +
29
30
`challenge="${ proof . challenge } ", expected="${ this . challenge } "` ) ;
30
31
}
31
32
32
33
// check domain
33
- if ( this . domain !== undefined && proof . domain !== this . domain ) {
34
- throw new Error ( 'The domain is not as expected; ' +
35
- `domain="${ proof . domain } ", expected="${ this . domain } "` ) ;
34
+ if ( this . domain !== undefined ) {
35
+ // `proof.domain` must equal `this.domain` OR if `proof.domain` is
36
+ // an array, the array must include `this.domain` as an element
37
+ const { domain} = proof ;
38
+ if ( ! ( domain === this . domain ||
39
+ ( Array . isArray ( domain ) && domain . includes ( this . domain ) ) ) ) {
40
+ throw new Error (
41
+ 'The domain is not as expected; ' +
42
+ `domain=${ JSON . stringify ( domain ) } , ` +
43
+ `expected=${ JSON . stringify ( this . domain ) } ` ) ;
44
+ }
36
45
}
37
46
38
47
return super . validate (
You can’t perform that action at this time.
0 commit comments