1 |
|
2 |
|
3 |
|
4 | const bedrock = require('bedrock');
|
5 |
|
6 | const schema = {
|
7 | title: 'Public Key PEM',
|
8 | description: 'A cryptographic Public Key in PEM format.',
|
9 | type: 'string',
|
10 | pattern: '^\\s*-----BEGIN (RSA\\s)?PUBLIC KEY-----[a-zA-Z0-9/+=\\s]*-----END (RSA\\s)?PUBLIC KEY-----\\s*$',
|
11 | errors: {
|
12 | invalid: 'The public key is not formatted correctly.',
|
13 | missing: 'The public key is missing.'
|
14 | }
|
15 | };
|
16 |
|
17 | module.exports = function(extend) {
|
18 | if(extend) {
|
19 | return bedrock.util.extend(true, bedrock.util.clone(schema), extend);
|
20 | }
|
21 | return schema;
|
22 | };
|