@bedrock/validation 7.1.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/main.yml +12 -11
- package/CHANGELOG.md +26 -0
- package/README.md +2 -2
- package/eslint.config.js +23 -0
- package/lib/index.js +33 -8
- package/package.json +6 -9
- package/schemas/comment.js +2 -3
- package/schemas/credential.js +3 -4
- package/schemas/description.js +2 -3
- package/schemas/email.js +6 -7
- package/schemas/helpers/idOrObjectWithId.js +2 -3
- package/schemas/identifier.js +2 -3
- package/schemas/jsonPatch.js +4 -5
- package/schemas/jsonldContext.js +3 -4
- package/schemas/label.js +2 -3
- package/schemas/linkedDataSignature.js +4 -5
- package/schemas/linkedDataSignature2018.js +6 -6
- package/schemas/linkedDataSignature2020.js +4 -4
- package/schemas/nonce.js +2 -3
- package/schemas/personName.js +2 -3
- package/schemas/privateKeyPem.js +3 -4
- package/schemas/proof.js +2 -3
- package/schemas/publicKeyPem.js +3 -4
- package/schemas/sequencedPatch.js +3 -4
- package/schemas/slug.js +2 -3
- package/schemas/title.js +2 -3
- package/schemas/url.js +2 -3
- package/schemas/verifiableCredential.js +4 -5
- package/schemas/verifiablePresentation.js +5 -6
- package/schemas/w3cDateTime.js +4 -5
- package/test/mocha/001-schemas.js +14 -15
- package/.eslintrc.cjs +0 -12
- package/lib/Cache.js +0 -24
- package/test/mocha/.eslintrc +0 -9
|
@@ -8,11 +8,11 @@ jobs:
|
|
|
8
8
|
timeout-minutes: 10
|
|
9
9
|
strategy:
|
|
10
10
|
matrix:
|
|
11
|
-
node-version: [
|
|
11
|
+
node-version: [24.x]
|
|
12
12
|
steps:
|
|
13
|
-
- uses: actions/checkout@
|
|
13
|
+
- uses: actions/checkout@v6
|
|
14
14
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
15
|
-
uses: actions/setup-node@
|
|
15
|
+
uses: actions/setup-node@v6
|
|
16
16
|
with:
|
|
17
17
|
node-version: ${{ matrix.node-version }}
|
|
18
18
|
- run: npm install
|
|
@@ -24,11 +24,11 @@ jobs:
|
|
|
24
24
|
timeout-minutes: 10
|
|
25
25
|
strategy:
|
|
26
26
|
matrix:
|
|
27
|
-
node-version: [
|
|
27
|
+
node-version: [22.x, 24.x, 26.x]
|
|
28
28
|
steps:
|
|
29
|
-
- uses: actions/checkout@
|
|
29
|
+
- uses: actions/checkout@v6
|
|
30
30
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
31
|
-
uses: actions/setup-node@
|
|
31
|
+
uses: actions/setup-node@v6
|
|
32
32
|
with:
|
|
33
33
|
node-version: ${{ matrix.node-version }}
|
|
34
34
|
- run: |
|
|
@@ -45,11 +45,11 @@ jobs:
|
|
|
45
45
|
timeout-minutes: 10
|
|
46
46
|
strategy:
|
|
47
47
|
matrix:
|
|
48
|
-
node-version: [
|
|
48
|
+
node-version: [24.x]
|
|
49
49
|
steps:
|
|
50
|
-
- uses: actions/checkout@
|
|
50
|
+
- uses: actions/checkout@v6
|
|
51
51
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
52
|
-
uses: actions/setup-node@
|
|
52
|
+
uses: actions/setup-node@v6
|
|
53
53
|
with:
|
|
54
54
|
node-version: ${{ matrix.node-version }}
|
|
55
55
|
- run: |
|
|
@@ -61,7 +61,8 @@ jobs:
|
|
|
61
61
|
cd test
|
|
62
62
|
npm run coverage-ci
|
|
63
63
|
- name: Upload coverage to Codecov
|
|
64
|
-
uses: codecov/codecov-action@
|
|
64
|
+
uses: codecov/codecov-action@v6
|
|
65
65
|
with:
|
|
66
|
-
|
|
66
|
+
files: ./test/coverage/lcov.info
|
|
67
67
|
fail_ci_if_error: true
|
|
68
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
# bedrock-validation ChangeLog
|
|
2
2
|
|
|
3
|
+
## 7.2.0 - 2026-06-04
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- Update dependencies:
|
|
7
|
+
- `ajv@8`
|
|
8
|
+
- remove `klona` dependency.
|
|
9
|
+
|
|
10
|
+
## 7.1.1 - 2024-11-14
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- Test and support Node.js 18, 20, 22.
|
|
14
|
+
- Update dependencies:
|
|
15
|
+
- `ajv@6.12.6`
|
|
16
|
+
- `klona@2.0.6`
|
|
17
|
+
- Update dev dependencies.
|
|
18
|
+
- Fix lint issues.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- Errors now use the spelling `occurred` vs the typo `occured`.
|
|
22
|
+
- **NOTE**: This typo is known to be present in many tests of error message
|
|
23
|
+
and will require similar typo fixes.
|
|
24
|
+
|
|
3
25
|
## 7.1.0 - 2022-10-16
|
|
4
26
|
|
|
5
27
|
### Added
|
|
6
28
|
- Added a validator for `VerifiablePresentation`
|
|
7
29
|
- Added a validator for `VerifiableCredential`.
|
|
8
30
|
|
|
31
|
+
### Changed
|
|
32
|
+
- The `credential` and `presentation` schemas are now deprecated and
|
|
33
|
+
will be removed in a future major release.
|
|
34
|
+
|
|
9
35
|
## 7.0.0 - 2022-04-28
|
|
10
36
|
|
|
11
37
|
### Changed
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ bedrock.events.on('bedrock-express.configure.routes', function(app) {
|
|
|
29
29
|
app.post('/bar',
|
|
30
30
|
// validate the query using the 'postBarQueryValidator'
|
|
31
31
|
// validate the response body using the 'postBarValidator'
|
|
32
|
-
validate({
|
|
32
|
+
validate({querySchema: postBarQueryValidator, bodySchema: postBarValidator}),
|
|
33
33
|
function(req, res) {
|
|
34
34
|
// do something
|
|
35
35
|
});
|
|
@@ -51,7 +51,7 @@ For more documentation on configuration, see [config.js](./lib/config.js).
|
|
|
51
51
|
|
|
52
52
|
## API
|
|
53
53
|
|
|
54
|
-
### createValidateMiddleware({
|
|
54
|
+
### createValidateMiddleware({querySchema: schema, bodySchema: schema})
|
|
55
55
|
|
|
56
56
|
This method may be called with either `query` or `body` defined.
|
|
57
57
|
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 - 2026 Digital Bazaar, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import config from '@digitalbazaar/eslint-config/node-recommended';
|
|
20
|
+
|
|
21
|
+
export default [
|
|
22
|
+
...config
|
|
23
|
+
];
|
package/lib/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import * as bedrock from '@bedrock/core';
|
|
5
5
|
import Ajv from 'ajv';
|
|
6
|
-
import {Cache} from './Cache.js';
|
|
7
6
|
import {promises as fs} from 'node:fs';
|
|
8
7
|
import {logger} from './logger.js';
|
|
9
8
|
import PATH from 'node:path';
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
// strict=false for backwards compatibility with ajv v6
|
|
11
|
+
const ajv = new Ajv({strict: false, verbose: true});
|
|
12
12
|
const {util: {BedrockError}} = bedrock;
|
|
13
13
|
|
|
14
14
|
// load config defaults
|
|
@@ -203,9 +203,10 @@ function _createError({schema, instance}) {
|
|
|
203
203
|
const details = {
|
|
204
204
|
instance,
|
|
205
205
|
params: error.params,
|
|
206
|
-
|
|
206
|
+
instancePath: error.instancePath,
|
|
207
|
+
path: _jsonPointerToJsPath(error.instancePath),
|
|
207
208
|
public: true,
|
|
208
|
-
schemaPath: error.schemaPath
|
|
209
|
+
schemaPath: error.schemaPath
|
|
209
210
|
};
|
|
210
211
|
let title;
|
|
211
212
|
if(Array.isArray(error.schema)) {
|
|
@@ -214,7 +215,7 @@ function _createError({schema, instance}) {
|
|
|
214
215
|
title = title || error.parentSchema.title || '',
|
|
215
216
|
details.schema = {
|
|
216
217
|
description: error.parentSchema.description || '',
|
|
217
|
-
title
|
|
218
|
+
title
|
|
218
219
|
};
|
|
219
220
|
// include custom errors or use default
|
|
220
221
|
// FIXME: enable if ajv supports this parentSchema.errors property
|
|
@@ -241,10 +242,34 @@ function _createError({schema, instance}) {
|
|
|
241
242
|
}
|
|
242
243
|
|
|
243
244
|
const msg = schema.title ?
|
|
244
|
-
'A validation error
|
|
245
|
-
'A validation error
|
|
245
|
+
'A validation error occurred in the \'' + schema.title + '\' validator.' :
|
|
246
|
+
'A validation error occurred in an unnamed validator.';
|
|
246
247
|
const error = new BedrockError(
|
|
247
248
|
msg, 'ValidationError', {public: true, errors, httpStatusCode: 400});
|
|
248
249
|
|
|
249
250
|
return error;
|
|
250
251
|
}
|
|
252
|
+
|
|
253
|
+
function _jsonPointerToJsPath(pointer) {
|
|
254
|
+
let path = '';
|
|
255
|
+
const [, ...segments] = pointer.split('/');
|
|
256
|
+
for(const segment of segments) {
|
|
257
|
+
// decode JSON pointer escape chars
|
|
258
|
+
const decoded = segment.replace(/~1/g, '/').replace(/~0/g, '~');
|
|
259
|
+
|
|
260
|
+
// handle integer index
|
|
261
|
+
if(/^\d+$/.test(decoded)) {
|
|
262
|
+
path += `[${decoded}]`;
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// use dot notation for valid keys and bracket notation otherwise
|
|
267
|
+
if(/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(decoded)) {
|
|
268
|
+
path += `.${decoded}`;
|
|
269
|
+
} else {
|
|
270
|
+
path += `["${decoded}"]`;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return path;
|
|
275
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrock/validation",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Bedrock validation",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"lint": "eslint
|
|
8
|
+
"lint": "eslint"
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -24,19 +24,16 @@
|
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://github.com/digitalbazaar/bedrock-validation",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"ajv": "^
|
|
28
|
-
"klona": "^2.0.5"
|
|
27
|
+
"ajv": "^8.20.0"
|
|
29
28
|
},
|
|
30
29
|
"peerDependencies": {
|
|
31
|
-
"@bedrock/core": "^6.
|
|
30
|
+
"@bedrock/core": "^6.2.0"
|
|
32
31
|
},
|
|
33
32
|
"directories": {
|
|
34
33
|
"lib": "./lib"
|
|
35
34
|
},
|
|
36
35
|
"devDependencies": {
|
|
37
|
-
"eslint": "^
|
|
38
|
-
"eslint
|
|
39
|
-
"eslint-plugin-jsdoc": "^37.9.7",
|
|
40
|
-
"jsdoc-to-markdown": "^7.1.1"
|
|
36
|
+
"@digitalbazaar/eslint-config": "^8.0.1",
|
|
37
|
+
"eslint": "^9.39.4"
|
|
41
38
|
}
|
|
42
39
|
}
|
package/schemas/comment.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
const schema = {
|
|
8
7
|
title: 'Comment',
|
|
@@ -19,7 +18,7 @@ const schema = {
|
|
|
19
18
|
|
|
20
19
|
export default function(extend) {
|
|
21
20
|
if(extend) {
|
|
22
|
-
return _extend(true,
|
|
21
|
+
return _extend(true, structuredClone(schema), extend);
|
|
23
22
|
}
|
|
24
23
|
return schema;
|
|
25
24
|
}
|
package/schemas/credential.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
5
|
import identifier from './identifier.js';
|
|
6
6
|
import jsonldContext from './jsonldContext.js';
|
|
7
|
-
import {klona} from 'klona';
|
|
8
7
|
import w3cDateTime from './w3cDateTime.js';
|
|
9
8
|
|
|
10
9
|
// TODO: Improve this schema
|
|
@@ -24,7 +23,7 @@ const schema = {
|
|
|
24
23
|
required: ['id'],
|
|
25
24
|
properties: {
|
|
26
25
|
id: identifier()
|
|
27
|
-
}
|
|
26
|
+
}
|
|
28
27
|
}
|
|
29
28
|
},
|
|
30
29
|
required: ['issuer', 'issued', 'claim']
|
|
@@ -32,7 +31,7 @@ const schema = {
|
|
|
32
31
|
|
|
33
32
|
export default function(extend) {
|
|
34
33
|
if(extend) {
|
|
35
|
-
return _extend(true,
|
|
34
|
+
return _extend(true, structuredClone(schema), extend);
|
|
36
35
|
}
|
|
37
36
|
return schema;
|
|
38
37
|
}
|
package/schemas/description.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
const schema = {
|
|
8
7
|
title: 'Description',
|
|
@@ -19,7 +18,7 @@ const schema = {
|
|
|
19
18
|
|
|
20
19
|
export default function(extend) {
|
|
21
20
|
if(extend) {
|
|
22
|
-
return _extend(true,
|
|
21
|
+
return _extend(true, structuredClone(schema), extend);
|
|
23
22
|
}
|
|
24
23
|
return schema;
|
|
25
24
|
}
|
package/schemas/email.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
// RFC 1034 - All labels have a max length of 63 octets.
|
|
8
7
|
// https://tools.ietf.org/html/rfc1034#section-3.1
|
|
@@ -10,8 +9,8 @@ const schema = {
|
|
|
10
9
|
title: 'Email',
|
|
11
10
|
description: 'An email address.',
|
|
12
11
|
type: 'string',
|
|
13
|
-
// eslint-disable-next-line max-len
|
|
14
|
-
pattern:
|
|
12
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
13
|
+
pattern: `^[-a-z0-9~!$%^&*_=+}{'?]+(\\.[-a-z0-9~!$%^&*_=+}{'?]+)*@(((([a-z0-9]{1}[a-z0-9\\-]{0,63}[a-z0-9]{1})|[a-z])\\.)+[a-z]{2,63})$`,
|
|
15
14
|
minLength: 1,
|
|
16
15
|
maxLength: 100,
|
|
17
16
|
errors: {
|
|
@@ -24,12 +23,12 @@ export default function(extend, options) {
|
|
|
24
23
|
if(options && options.lowerCaseOnly) {
|
|
25
24
|
extend = extend || {};
|
|
26
25
|
if(!('pattern' in extend)) {
|
|
27
|
-
// eslint-disable-next-line max-len
|
|
28
|
-
extend.pattern =
|
|
26
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
27
|
+
extend.pattern = `^[-a-z0-9~!$%^&*_=+}{'?]+(\\.[-a-z0-9~!$%^&*_=+}{'?]+)*@(((([a-z0-9]{1}[a-z0-9\\-]{0,63}[a-z0-9]{1})|[a-z])\\.)+[a-z]{2,63})$`;
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
if(extend) {
|
|
32
|
-
return _extend(true,
|
|
31
|
+
return _extend(true, structuredClone(schema), extend);
|
|
33
32
|
}
|
|
34
33
|
return schema;
|
|
35
34
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
import identifier from '../identifier.js';
|
|
7
6
|
|
|
8
7
|
const schema = {
|
|
@@ -20,7 +19,7 @@ const schema = {
|
|
|
20
19
|
|
|
21
20
|
export default function(extend) {
|
|
22
21
|
if(extend) {
|
|
23
|
-
return _extend(true,
|
|
22
|
+
return _extend(true, structuredClone(schema), extend);
|
|
24
23
|
}
|
|
25
24
|
return schema;
|
|
26
25
|
}
|
package/schemas/identifier.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
const schema = {
|
|
8
7
|
title: 'ID',
|
|
@@ -17,7 +16,7 @@ const schema = {
|
|
|
17
16
|
|
|
18
17
|
export default function(extend) {
|
|
19
18
|
if(extend) {
|
|
20
|
-
return _extend(true,
|
|
19
|
+
return _extend(true, structuredClone(schema), extend);
|
|
21
20
|
}
|
|
22
21
|
return schema;
|
|
23
22
|
}
|
package/schemas/jsonPatch.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
const schema = {
|
|
8
7
|
title: 'JSON Patch',
|
|
@@ -18,10 +17,10 @@ const schema = {
|
|
|
18
17
|
enum: ['add', 'copy', 'move', 'remove', 'replace', 'test']
|
|
19
18
|
},
|
|
20
19
|
from: {
|
|
21
|
-
type: 'string'
|
|
20
|
+
type: 'string'
|
|
22
21
|
},
|
|
23
22
|
path: {
|
|
24
|
-
type: 'string'
|
|
23
|
+
type: 'string'
|
|
25
24
|
},
|
|
26
25
|
value: {
|
|
27
26
|
//type: ['number', 'string', 'boolean', 'object', 'array'],
|
|
@@ -33,7 +32,7 @@ const schema = {
|
|
|
33
32
|
|
|
34
33
|
export default function(extend) {
|
|
35
34
|
if(extend) {
|
|
36
|
-
return _extend(true,
|
|
35
|
+
return _extend(true, structuredClone(schema), extend);
|
|
37
36
|
}
|
|
38
37
|
return schema;
|
|
39
38
|
}
|
package/schemas/jsonldContext.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
export default function(context, extend) {
|
|
8
7
|
const schema = {
|
|
@@ -17,7 +16,7 @@ export default function(context, extend) {
|
|
|
17
16
|
type: 'object'
|
|
18
17
|
// FIXME: improve context object validator
|
|
19
18
|
}, {
|
|
20
|
-
type: 'array'
|
|
19
|
+
type: 'array'
|
|
21
20
|
// items added below if context param truthy
|
|
22
21
|
}];
|
|
23
22
|
if(context) {
|
|
@@ -49,7 +48,7 @@ export default function(context, extend) {
|
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
if(extend) {
|
|
52
|
-
return _extend(true,
|
|
51
|
+
return _extend(true, structuredClone(schema), extend);
|
|
53
52
|
}
|
|
54
53
|
return schema;
|
|
55
54
|
}
|
package/schemas/label.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
const schema = {
|
|
8
7
|
title: 'Label',
|
|
@@ -20,7 +19,7 @@ const schema = {
|
|
|
20
19
|
|
|
21
20
|
export default function(extend) {
|
|
22
21
|
if(extend) {
|
|
23
|
-
return _extend(true,
|
|
22
|
+
return _extend(true, structuredClone(schema), extend);
|
|
24
23
|
}
|
|
25
24
|
return schema;
|
|
26
25
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
5
|
import identifier from './identifier.js';
|
|
6
|
-
import {klona} from 'klona';
|
|
7
6
|
import w3cDateTime from './w3cDateTime.js';
|
|
8
7
|
|
|
9
8
|
const signature = {
|
|
@@ -24,7 +23,7 @@ const signature = {
|
|
|
24
23
|
description: 'The Base64 encoding of the result of the signature ' +
|
|
25
24
|
'algorithm.',
|
|
26
25
|
type: 'string'
|
|
27
|
-
}
|
|
26
|
+
}
|
|
28
27
|
},
|
|
29
28
|
// NOTE: id is not required
|
|
30
29
|
required: ['type', 'creator', 'created', 'signatureValue']
|
|
@@ -35,13 +34,13 @@ const schema = {
|
|
|
35
34
|
anyOf: [{
|
|
36
35
|
type: 'array',
|
|
37
36
|
items: signature,
|
|
38
|
-
minItems: 1
|
|
37
|
+
minItems: 1
|
|
39
38
|
}, signature]
|
|
40
39
|
};
|
|
41
40
|
|
|
42
41
|
export default function(extend) {
|
|
43
42
|
if(extend) {
|
|
44
|
-
return _extend(true,
|
|
43
|
+
return _extend(true, structuredClone(schema), extend);
|
|
45
44
|
}
|
|
46
45
|
return schema;
|
|
47
46
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import identifier from './identifier.js';
|
|
5
5
|
import w3cDateTime from './w3cDateTime.js';
|
|
@@ -25,8 +25,8 @@ const baseSignature = {
|
|
|
25
25
|
'algorithm.',
|
|
26
26
|
type: 'string'
|
|
27
27
|
},
|
|
28
|
-
verificationMethod: identifier()
|
|
29
|
-
}
|
|
28
|
+
verificationMethod: identifier()
|
|
29
|
+
}
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const signature = {
|
|
@@ -35,10 +35,10 @@ const signature = {
|
|
|
35
35
|
// only one of `creator` or `verificationMethod`
|
|
36
36
|
anyOf: [{
|
|
37
37
|
required: ['creator'],
|
|
38
|
-
not: {required: ['verificationMethod']}
|
|
38
|
+
not: {required: ['verificationMethod']}
|
|
39
39
|
}, {
|
|
40
40
|
required: ['verificationMethod'],
|
|
41
|
-
not: {required: ['creator']}
|
|
41
|
+
not: {required: ['creator']}
|
|
42
42
|
}]
|
|
43
43
|
}
|
|
44
44
|
]
|
|
@@ -49,7 +49,7 @@ const schema = {
|
|
|
49
49
|
oneOf: [{
|
|
50
50
|
type: 'array',
|
|
51
51
|
items: signature,
|
|
52
|
-
minItems: 1
|
|
52
|
+
minItems: 1
|
|
53
53
|
}, signature]
|
|
54
54
|
};
|
|
55
55
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2021-
|
|
2
|
+
* Copyright (c) 2021-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import identifier from './identifier.js';
|
|
5
5
|
import w3cDateTime from './w3cDateTime.js';
|
|
@@ -24,8 +24,8 @@ const signature = {
|
|
|
24
24
|
'the signature algorithm.',
|
|
25
25
|
type: 'string'
|
|
26
26
|
},
|
|
27
|
-
verificationMethod: identifier()
|
|
28
|
-
}
|
|
27
|
+
verificationMethod: identifier()
|
|
28
|
+
}
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const schema = {
|
|
@@ -33,7 +33,7 @@ const schema = {
|
|
|
33
33
|
oneOf: [{
|
|
34
34
|
type: 'array',
|
|
35
35
|
items: signature,
|
|
36
|
-
minItems: 1
|
|
36
|
+
minItems: 1
|
|
37
37
|
}, signature]
|
|
38
38
|
};
|
|
39
39
|
|
package/schemas/nonce.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
const schema = {
|
|
8
7
|
title: 'Nonce',
|
|
@@ -20,7 +19,7 @@ const schema = {
|
|
|
20
19
|
|
|
21
20
|
export default function(extend) {
|
|
22
21
|
if(extend) {
|
|
23
|
-
return _extend(true,
|
|
22
|
+
return _extend(true, structuredClone(schema), extend);
|
|
24
23
|
}
|
|
25
24
|
return schema;
|
|
26
25
|
}
|
package/schemas/personName.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
const schema = {
|
|
8
7
|
title: 'Person Name',
|
|
@@ -20,7 +19,7 @@ const schema = {
|
|
|
20
19
|
|
|
21
20
|
export default function(extend) {
|
|
22
21
|
if(extend) {
|
|
23
|
-
return _extend(true,
|
|
22
|
+
return _extend(true, structuredClone(schema), extend);
|
|
24
23
|
}
|
|
25
24
|
return schema;
|
|
26
25
|
}
|
package/schemas/privateKeyPem.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
const schema = {
|
|
8
7
|
title: 'Private Key PEM',
|
|
9
8
|
description: 'A cryptographic Private Key in PEM format.',
|
|
10
9
|
type: 'string',
|
|
11
|
-
// eslint-disable-next-line max-len
|
|
10
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
12
11
|
pattern: '^\\s*-----BEGIN RSA PRIVATE KEY-----[a-zA-Z0-9/+=\\s]*-----END RSA PRIVATE KEY-----\\s*$',
|
|
13
12
|
errors: {
|
|
14
13
|
invalid: 'The private key is not formatted correctly.',
|
|
@@ -18,7 +17,7 @@ const schema = {
|
|
|
18
17
|
|
|
19
18
|
export default function(extend) {
|
|
20
19
|
if(extend) {
|
|
21
|
-
return _extend(true,
|
|
20
|
+
return _extend(true, structuredClone(schema), extend);
|
|
22
21
|
}
|
|
23
22
|
return schema;
|
|
24
23
|
}
|
package/schemas/proof.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
// schema for a proof on a VerifiableCredential or Presentation
|
|
8
7
|
const schema = {
|
|
@@ -15,7 +14,7 @@ const schema = {
|
|
|
15
14
|
|
|
16
15
|
export default function(extend) {
|
|
17
16
|
if(extend) {
|
|
18
|
-
return _extend(true,
|
|
17
|
+
return _extend(true, structuredClone(schema), extend);
|
|
19
18
|
}
|
|
20
19
|
return schema;
|
|
21
20
|
}
|
package/schemas/publicKeyPem.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
const schema = {
|
|
8
7
|
title: 'Public Key PEM',
|
|
9
8
|
description: 'A cryptographic Public Key in PEM format.',
|
|
10
9
|
type: 'string',
|
|
11
|
-
// eslint-disable-next-line max-len
|
|
10
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
12
11
|
pattern: '^\\s*-----BEGIN (RSA\\s)?PUBLIC KEY-----[a-zA-Z0-9/+=\\s]*-----END (RSA\\s)?PUBLIC KEY-----\\s*$',
|
|
13
12
|
errors: {
|
|
14
13
|
invalid: 'The public key is not formatted correctly.',
|
|
@@ -18,7 +17,7 @@ const schema = {
|
|
|
18
17
|
|
|
19
18
|
export default function(extend) {
|
|
20
19
|
if(extend) {
|
|
21
|
-
return _extend(true,
|
|
20
|
+
return _extend(true, structuredClone(schema), extend);
|
|
22
21
|
}
|
|
23
22
|
return schema;
|
|
24
23
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
5
|
import jsonPatch from './jsonPatch.js';
|
|
6
|
-
import {klona} from 'klona';
|
|
7
6
|
|
|
8
7
|
const schema = {
|
|
9
8
|
required: ['patch', 'sequence', 'target'],
|
|
@@ -11,7 +10,7 @@ const schema = {
|
|
|
11
10
|
type: 'object',
|
|
12
11
|
properties: {
|
|
13
12
|
target: {
|
|
14
|
-
type: 'string'
|
|
13
|
+
type: 'string'
|
|
15
14
|
},
|
|
16
15
|
// FIXME: also support `frame` property later
|
|
17
16
|
patch: jsonPatch(),
|
|
@@ -26,7 +25,7 @@ const schema = {
|
|
|
26
25
|
|
|
27
26
|
export default function(extend) {
|
|
28
27
|
if(extend) {
|
|
29
|
-
return _extend(true,
|
|
28
|
+
return _extend(true, structuredClone(schema), extend);
|
|
30
29
|
}
|
|
31
30
|
return schema;
|
|
32
31
|
}
|
package/schemas/slug.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
const schema = {
|
|
8
7
|
title: 'Slug',
|
|
@@ -22,7 +21,7 @@ const schema = {
|
|
|
22
21
|
|
|
23
22
|
export default function(extend) {
|
|
24
23
|
if(extend) {
|
|
25
|
-
return _extend(true,
|
|
24
|
+
return _extend(true, structuredClone(schema), extend);
|
|
26
25
|
}
|
|
27
26
|
return schema;
|
|
28
27
|
}
|
package/schemas/title.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
const schema = {
|
|
8
7
|
title: 'Title',
|
|
@@ -20,7 +19,7 @@ const schema = {
|
|
|
20
19
|
|
|
21
20
|
export default function(extend) {
|
|
22
21
|
if(extend) {
|
|
23
|
-
return _extend(true,
|
|
22
|
+
return _extend(true, structuredClone(schema), extend);
|
|
24
23
|
}
|
|
25
24
|
return schema;
|
|
26
25
|
}
|
package/schemas/url.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
const schema = {
|
|
8
7
|
title: 'URL',
|
|
@@ -17,7 +16,7 @@ const schema = {
|
|
|
17
16
|
|
|
18
17
|
export default function(extend) {
|
|
19
18
|
if(extend) {
|
|
20
|
-
return _extend(true,
|
|
19
|
+
return _extend(true, structuredClone(schema), extend);
|
|
21
20
|
}
|
|
22
21
|
return schema;
|
|
23
22
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import proof from './proof.js';
|
|
6
5
|
import idOrObjectWithId from './helpers/idOrObjectWithId.js';
|
|
7
|
-
import
|
|
6
|
+
import proof from './proof.js';
|
|
8
7
|
import w3cDateTime from './w3cDateTime.js';
|
|
9
8
|
|
|
10
9
|
// https://www.w3.org/TR/vc-data-model/
|
|
@@ -42,7 +41,7 @@ const schema = {
|
|
|
42
41
|
minItems: 1,
|
|
43
42
|
// this first type must be VerifiableCredential
|
|
44
43
|
items: [
|
|
45
|
-
{type: 'string', const: 'VerifiableCredential'}
|
|
44
|
+
{type: 'string', const: 'VerifiableCredential'}
|
|
46
45
|
],
|
|
47
46
|
// additional types must be strings
|
|
48
47
|
additionalItems: {
|
|
@@ -61,7 +60,7 @@ const schema = {
|
|
|
61
60
|
|
|
62
61
|
export default function(extend) {
|
|
63
62
|
if(extend) {
|
|
64
|
-
return _extend(true,
|
|
63
|
+
return _extend(true, structuredClone(schema), extend);
|
|
65
64
|
}
|
|
66
65
|
return schema;
|
|
67
66
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
|
-
import verifiableCredential from './verifiableCredential.js';
|
|
5
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
6
|
-
import proof from './proof.js';
|
|
7
5
|
import idOrObjectWithId from './helpers/idOrObjectWithId.js';
|
|
8
|
-
import
|
|
6
|
+
import proof from './proof.js';
|
|
7
|
+
import verifiableCredential from './verifiableCredential.js';
|
|
9
8
|
|
|
10
9
|
const schema = {
|
|
11
10
|
title: 'Verifiable Presentation',
|
|
@@ -31,7 +30,7 @@ const schema = {
|
|
|
31
30
|
minItems: 1,
|
|
32
31
|
// this first type must be VerifiablePresentation
|
|
33
32
|
items: [
|
|
34
|
-
{type: 'string', const: 'VerifiablePresentation'}
|
|
33
|
+
{type: 'string', const: 'VerifiablePresentation'}
|
|
35
34
|
],
|
|
36
35
|
// additional types must be strings
|
|
37
36
|
additionalItems: {
|
|
@@ -52,7 +51,7 @@ const schema = {
|
|
|
52
51
|
|
|
53
52
|
export default function(extend) {
|
|
54
53
|
if(extend) {
|
|
55
|
-
return _extend(true,
|
|
54
|
+
return _extend(true, structuredClone(schema), extend);
|
|
56
55
|
}
|
|
57
56
|
return schema;
|
|
58
57
|
}
|
package/schemas/w3cDateTime.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
|
|
7
6
|
const schema = {
|
|
8
7
|
title: 'W3C Date/Time',
|
|
9
8
|
description: 'A W3C-formatted date and time combination.',
|
|
10
9
|
type: 'string',
|
|
11
|
-
// eslint-disable-next-line max-len
|
|
10
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
12
11
|
pattern: '^[1-9][0-9]{3}-(0[1-9]|1[0-2])-([0-2][0-9]|3[0-1])T([0-1][0-9]|2[0-3]):([0-5][0-9]):(([0-5][0-9])|60)(\\.[0-9]+)?(Z|((\\+|-)([0-1][0-9]|2[0-3]):([0-5][0-9])))?$',
|
|
13
12
|
errors: {
|
|
14
|
-
// eslint-disable-next-line max-len
|
|
13
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
15
14
|
invalid: 'The date/time must be of the W3C date/time format "YYYY-MM-DD( |T)HH:MM:SS.s(Z|(+|-)TZOFFSET)".',
|
|
16
15
|
missing: 'Please enter a date/time.'
|
|
17
16
|
}
|
|
@@ -19,7 +18,7 @@ const schema = {
|
|
|
19
18
|
|
|
20
19
|
export default function(extend) {
|
|
21
20
|
if(extend) {
|
|
22
|
-
return _extend(true,
|
|
21
|
+
return _extend(true, structuredClone(schema), extend);
|
|
23
22
|
}
|
|
24
23
|
return schema;
|
|
25
24
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c) 2012-
|
|
2
|
+
* Copyright (c) 2012-2026 Digital Bazaar, Inc.
|
|
3
3
|
*/
|
|
4
4
|
import * as validation from '@bedrock/validation';
|
|
5
5
|
import {mock} from './mock.data.js';
|
|
@@ -822,7 +822,7 @@ describe('bedrock-validation', function() {
|
|
|
822
822
|
type: 'LinkedDataSignature2015',
|
|
823
823
|
created: '2016-01-01T01:00:00Z',
|
|
824
824
|
creator: 'urn:5dd6a7e2-4c32-4a21-60b3-2385e5b6bcd4/keys/1',
|
|
825
|
-
// eslint-disable-next-line max-len
|
|
825
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
826
826
|
signatureValue: 'Lc6l7gxEPV1lKTj4KADaER52CiMBpvsHg7eZZJXzRK3U8N/eUYxITlenu3svj4KPrdnaBfMXGo3U/vAVaQNF5Er0g/SXC2KpUmRN4uyMYgQ5NwWklS2JqjJ/0Y3hio4GOgdMDiqrlZJvfQdtRaJjKoskc7F3bZtDVsX6Sr95erfOeobHOIMcbNIC0a96oYOaQlOeOC45BqQaUaczYKPayGEeQN2lfD+qR6b1MR4xtWNrx5pzzPpAPkjj3I91wiVQER43s/nq5XZKkDk8V8eD7xEURoDUcu3rA1qHLfrpRHJGCErXNc784O4R4Oqm5zQlkyB1mWJxnz3qSqzgqVG0sQ=='
|
|
827
827
|
};
|
|
828
828
|
const result = validateInstance({instance: signature, schema});
|
|
@@ -834,7 +834,7 @@ describe('bedrock-validation', function() {
|
|
|
834
834
|
type: 'LinkedDataSignature2016',
|
|
835
835
|
created: '2016-01-01T01:00:00Z',
|
|
836
836
|
creator: 'urn:5dd6a7e2-4c32-4a21-60b3-2385e5b6bcd4/keys/1',
|
|
837
|
-
// eslint-disable-next-line max-len
|
|
837
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
838
838
|
signatureValue: 'Lc6l7gxEPV1lKTj4KADaER52CiMBpvsHg7eZZJXzRK3U8N/eUYxITlenu3svj4KPrdnaBfMXGo3U/vAVaQNF5Er0g/SXC2KpUmRN4uyMYgQ5NwWklS2JqjJ/0Y3hio4GOgdMDiqrlZJvfQdtRaJjKoskc7F3bZtDVsX6Sr95erfOeobHOIMcbNIC0a96oYOaQlOeOC45BqQaUaczYKPayGEeQN2lfD+qR6b1MR4xtWNrx5pzzPpAPkjj3I91wiVQER43s/nq5XZKkDk8V8eD7xEURoDUcu3rA1qHLfrpRHJGCErXNc784O4R4Oqm5zQlkyB1mWJxnz3qSqzgqVG0sQ=='
|
|
839
839
|
};
|
|
840
840
|
const result = validateInstance({instance: signature, schema});
|
|
@@ -846,7 +846,7 @@ describe('bedrock-validation', function() {
|
|
|
846
846
|
type: 'LinkedDataSignature2015',
|
|
847
847
|
created: '2016-01-01T01:00:00Z',
|
|
848
848
|
creator: 'urn:5dd6a7e2-4c32-4a21-60b3-2385e5b6bcd4/keys/1',
|
|
849
|
-
// eslint-disable-next-line max-len
|
|
849
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
850
850
|
signatureValue: 'Lc6l7gxEPV1lKTj4KADaER52CiMBpvsHg7eZZJXzRK3U8N/eUYxITlenu3svj4KPrdnaBfMXGo3U/vAVaQNF5Er0g/SXC2KpUmRN4uyMYgQ5NwWklS2JqjJ/0Y3hio4GOgdMDiqrlZJvfQdtRaJjKoskc7F3bZtDVsX6Sr95erfOeobHOIMcbNIC0a96oYOaQlOeOC45BqQaUaczYKPayGEeQN2lfD+qR6b1MR4xtWNrx5pzzPpAPkjj3I91wiVQER43s/nq5XZKkDk8V8eD7xEURoDUcu3rA1qHLfrpRHJGCErXNc784O4R4Oqm5zQlkyB1mWJxnz3qSqzgqVG0sQ=='
|
|
851
851
|
};
|
|
852
852
|
const extend = {name: 'test'};
|
|
@@ -861,7 +861,7 @@ describe('bedrock-validation', function() {
|
|
|
861
861
|
type: 'GraphSignature2012',
|
|
862
862
|
created: '2016-01-01T01:00:00Z',
|
|
863
863
|
creator: 'urn:5dd6a7e2-4c32-4a21-60b3-2385e5b6bcd4/keys/1',
|
|
864
|
-
// eslint-disable-next-line max-len
|
|
864
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
865
865
|
signatureValue: 'Lc6l7gxEPV1lKTj4KADaER52CiMBpvsHg7eZZJXzRK3U8N/eUYxITlenu3svj4KPrdnaBfMXGo3U/vAVaQNF5Er0g/SXC2KpUmRN4uyMYgQ5NwWklS2JqjJ/0Y3hio4GOgdMDiqrlZJvfQdtRaJjKoskc7F3bZtDVsX6Sr95erfOeobHOIMcbNIC0a96oYOaQlOeOC45BqQaUaczYKPayGEeQN2lfD+qR6b1MR4xtWNrx5pzzPpAPkjj3I91wiVQER43s/nq5XZKkDk8V8eD7xEURoDUcu3rA1qHLfrpRHJGCErXNc784O4R4Oqm5zQlkyB1mWJxnz3qSqzgqVG0sQ=='
|
|
866
866
|
};
|
|
867
867
|
const result = validateInstance({instance: signature, schema});
|
|
@@ -872,38 +872,38 @@ describe('bedrock-validation', function() {
|
|
|
872
872
|
const signature = {
|
|
873
873
|
created: '2016-01-01T01:00:00Z',
|
|
874
874
|
creator: 'urn:5dd6a7e2-4c32-4a21-60b3-2385e5b6bcd4/keys/1',
|
|
875
|
-
// eslint-disable-next-line max-len
|
|
875
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
876
876
|
signatureValue: 'Lc6l7gxEPV1lKTj4KADaER52CiMBpvsHg7eZZJXzRK3U8N/eUYxITlenu3svj4KPrdnaBfMXGo3U/vAVaQNF5Er0g/SXC2KpUmRN4uyMYgQ5NwWklS2JqjJ/0Y3hio4GOgdMDiqrlZJvfQdtRaJjKoskc7F3bZtDVsX6Sr95erfOeobHOIMcbNIC0a96oYOaQlOeOC45BqQaUaczYKPayGEeQN2lfD+qR6b1MR4xtWNrx5pzzPpAPkjj3I91wiVQER43s/nq5XZKkDk8V8eD7xEURoDUcu3rA1qHLfrpRHJGCErXNc784O4R4Oqm5zQlkyB1mWJxnz3qSqzgqVG0sQ=='
|
|
877
877
|
};
|
|
878
878
|
const result = validateInstance({instance: signature, schema});
|
|
879
879
|
result.valid.should.be.false;
|
|
880
880
|
});
|
|
881
881
|
|
|
882
|
-
// eslint-disable-next-line max-len
|
|
882
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
883
883
|
it('should NOT validate a LinkedDataSignature2015 signature w/missing created', function() {
|
|
884
884
|
const signature = {
|
|
885
885
|
type: 'LinkedDataSignature2015',
|
|
886
886
|
creator: 'urn:5dd6a7e2-4c32-4a21-60b3-2385e5b6bcd4/keys/1',
|
|
887
|
-
// eslint-disable-next-line max-len
|
|
887
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
888
888
|
signatureValue: 'Lc6l7gxEPV1lKTj4KADaER52CiMBpvsHg7eZZJXzRK3U8N/eUYxITlenu3svj4KPrdnaBfMXGo3U/vAVaQNF5Er0g/SXC2KpUmRN4uyMYgQ5NwWklS2JqjJ/0Y3hio4GOgdMDiqrlZJvfQdtRaJjKoskc7F3bZtDVsX6Sr95erfOeobHOIMcbNIC0a96oYOaQlOeOC45BqQaUaczYKPayGEeQN2lfD+qR6b1MR4xtWNrx5pzzPpAPkjj3I91wiVQER43s/nq5XZKkDk8V8eD7xEURoDUcu3rA1qHLfrpRHJGCErXNc784O4R4Oqm5zQlkyB1mWJxnz3qSqzgqVG0sQ=='
|
|
889
889
|
};
|
|
890
890
|
const result = validateInstance({instance: signature, schema});
|
|
891
891
|
result.valid.should.be.false;
|
|
892
892
|
});
|
|
893
893
|
|
|
894
|
-
// eslint-disable-next-line max-len
|
|
894
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
895
895
|
it('should NOT validate a LinkedDataSignature2015 signature w/missing creator', function() {
|
|
896
896
|
const signature = {
|
|
897
897
|
type: 'LinkedDataSignature2015',
|
|
898
898
|
created: '2016-01-01T01:00:00Z',
|
|
899
|
-
// eslint-disable-next-line max-len
|
|
899
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
900
900
|
signatureValue: 'Lc6l7gxEPV1lKTj4KADaER52CiMBpvsHg7eZZJXzRK3U8N/eUYxITlenu3svj4KPrdnaBfMXGo3U/vAVaQNF5Er0g/SXC2KpUmRN4uyMYgQ5NwWklS2JqjJ/0Y3hio4GOgdMDiqrlZJvfQdtRaJjKoskc7F3bZtDVsX6Sr95erfOeobHOIMcbNIC0a96oYOaQlOeOC45BqQaUaczYKPayGEeQN2lfD+qR6b1MR4xtWNrx5pzzPpAPkjj3I91wiVQER43s/nq5XZKkDk8V8eD7xEURoDUcu3rA1qHLfrpRHJGCErXNc784O4R4Oqm5zQlkyB1mWJxnz3qSqzgqVG0sQ=='
|
|
901
901
|
};
|
|
902
902
|
const result = validateInstance({instance: signature, schema});
|
|
903
903
|
result.valid.should.be.false;
|
|
904
904
|
});
|
|
905
905
|
|
|
906
|
-
// eslint-disable-next-line max-len
|
|
906
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
907
907
|
it('should NOT validate a LinkedDataSignature2015 signature w/missing signature', function() {
|
|
908
908
|
const signature = {
|
|
909
909
|
type: 'LinkedDataSignature2015',
|
|
@@ -973,7 +973,6 @@ describe('bedrock-validation', function() {
|
|
|
973
973
|
result.valid.should.be.false;
|
|
974
974
|
});
|
|
975
975
|
|
|
976
|
-
// eslint-disable-next-line max-len
|
|
977
976
|
it('should NOT validate a signature w/missing proofValue', function() {
|
|
978
977
|
const signature = {
|
|
979
978
|
type: 'Ed25519Signature2020',
|
|
@@ -1098,7 +1097,7 @@ describe('bedrock-validation', function() {
|
|
|
1098
1097
|
result.valid.should.be.true;
|
|
1099
1098
|
});
|
|
1100
1099
|
|
|
1101
|
-
// eslint-disable-next-line max-len
|
|
1100
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
1102
1101
|
it('should NOT validate a sequenced JSON patch without a sequence', function() {
|
|
1103
1102
|
const doc = {
|
|
1104
1103
|
target: 'some-identifier',
|
|
@@ -1110,7 +1109,7 @@ describe('bedrock-validation', function() {
|
|
|
1110
1109
|
result.valid.should.be.false;
|
|
1111
1110
|
});
|
|
1112
1111
|
|
|
1113
|
-
// eslint-disable-next-line max-len
|
|
1112
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
1114
1113
|
it('should NOT validate a sequenced JSON patch without a target', function() {
|
|
1115
1114
|
const doc = {
|
|
1116
1115
|
patch: [
|
|
@@ -1122,7 +1121,7 @@ describe('bedrock-validation', function() {
|
|
|
1122
1121
|
result.valid.should.be.false;
|
|
1123
1122
|
});
|
|
1124
1123
|
|
|
1125
|
-
// eslint-disable-next-line max-len
|
|
1124
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
1126
1125
|
it('should NOT validate a sequenced JSON patch with a negative sequence', function() {
|
|
1127
1126
|
const doc = {
|
|
1128
1127
|
target: 'some-identifier',
|
package/.eslintrc.cjs
DELETED
package/lib/Cache.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2012-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
export class Cache {
|
|
5
|
-
constructor() {
|
|
6
|
-
this._cache = new Map();
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
put(key, value) {
|
|
10
|
-
this._cache.set(key, value);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
get(key) {
|
|
14
|
-
return this._cache.get(key);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
del(key) {
|
|
18
|
-
this._cache.delete(key);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
clear() {
|
|
22
|
-
this._cache.clear();
|
|
23
|
-
}
|
|
24
|
-
}
|