UNPKG

623 BJavaScriptView Raw
1/*!
2 * Copyright (c) 2012-2018 Digital Bazaar, Inc. All rights reserved.
3 */
4const bedrock = require('bedrock');
5
6const schema = {
7 title: 'Nonce',
8 description: 'A single use secure unique string.',
9 type: 'string',
10 pattern: '^[-a-zA-Z0-9~!$%^&*\\(\\)_=+\\. ]*$',
11 minLength: 8,
12 maxLength: 64,
13 errors: {
14 invalid: 'The nonce contains invalid characters or is not between ' +
15 '8 and 64 characters in length.',
16 missing: 'Please enter a nonce.'
17 }
18};
19
20module.exports = function(extend) {
21 if(extend) {
22 return bedrock.util.extend(true, bedrock.util.clone(schema), extend);
23 }
24 return schema;
25};