1 |
|
2 |
|
3 |
|
4 | const bedrock = require('bedrock');
|
5 |
|
6 | const w3cDateTime = require('./w3cDateTime');
|
7 | const identifier = require('./identifier');
|
8 |
|
9 | const signature = {
|
10 | title: 'Linked Data Signature',
|
11 | description: 'A Linked Data digital signature.',
|
12 | type: 'object',
|
13 | properties: {
|
14 | id: identifier(),
|
15 | type: {
|
16 | title: 'Linked Data Signature Type',
|
17 | type: 'string',
|
18 | enum: ['LinkedDataSignature2015', 'LinkedDataSignature2016']
|
19 | },
|
20 | creator: identifier(),
|
21 | created: w3cDateTime(),
|
22 | signatureValue: {
|
23 | title: 'Digital Signature Value',
|
24 | description: 'The Base64 encoding of the result of the signature ' +
|
25 | 'algorithm.',
|
26 | type: 'string'
|
27 | },
|
28 | },
|
29 |
|
30 | required: ['type', 'creator', 'created', 'signatureValue']
|
31 | };
|
32 |
|
33 | const schema = {
|
34 | title: 'Linked Data Signatures',
|
35 | anyOf: [{
|
36 | type: 'array',
|
37 | items: signature,
|
38 | minItems: 1,
|
39 | }, signature]
|
40 | };
|
41 |
|
42 | module.exports = extend => {
|
43 | if(extend) {
|
44 | return bedrock.util.extend(true, bedrock.util.clone(schema), extend);
|
45 | }
|
46 | return schema;
|
47 | };
|