(hmacKey, algorithm, encoding)
| 14 | const crypto = require('crypto'); |
| 15 | |
| 16 | function generateKey(hmacKey, algorithm, encoding) { |
| 17 | hmacKey = hmacKey || 'loopback'; |
| 18 | algorithm = algorithm || 'sha1'; |
| 19 | encoding = encoding || 'hex'; |
| 20 | const hmac = crypto.createHmac(algorithm, hmacKey); |
| 21 | const buf = crypto.randomBytes(32); |
| 22 | hmac.update(buf); |
| 23 | const key = hmac.digest(encoding); |
| 24 | return key; |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Manage client applications and organize their users. |
no outgoing calls
no test coverage detected
searching dependent graphs…