UNPKG

613 BJavaScriptView Raw
1/*!
2 * Copyright (c) 2012-2018 Digital Bazaar, Inc. All rights reserved.
3 */
4const bedrock = require('bedrock');
5
6const schema = {
7 title: 'Private Key PEM',
8 description: 'A cryptographic Private Key in PEM format.',
9 type: 'string',
10 pattern: '^\\s*-----BEGIN RSA PRIVATE KEY-----[a-zA-Z0-9/+=\\s]*-----END RSA PRIVATE KEY-----\\s*$',
11 errors: {
12 invalid: 'The private key is not formatted correctly.',
13 missing: 'The private key is missing.'
14 }
15};
16
17module.exports = function(extend) {
18 if(extend) {
19 return bedrock.util.extend(true, bedrock.util.clone(schema), extend);
20 }
21 return schema;
22};