(buf, secret)
| 50 | return Buffer.concat([salt, cipher.getAuthTag(), iv, enc]); |
| 51 | } |
| 52 | function decrypt(buf, secret) { |
| 53 | const salt = buf.subarray(0, SALT); |
| 54 | const tag = buf.subarray(SALT, SALT + TAG); |
| 55 | const iv = buf.subarray(SALT + TAG, SALT + TAG + IV); |
| 56 | const msg = buf.subarray(SALT + TAG + IV); |
| 57 | const key = crypto.pbkdf2Sync(secret, salt, ITER, KEYLEN, DIGEST); |
| 58 | const d = crypto.createDecipheriv('aes-256-gcm', key, iv, { authTagLength: TAG }); |
| 59 | d.setAuthTag(tag); |
| 60 | return d.update(msg, undefined, 'utf-8') + d.final('utf-8'); |
| 61 | } |
| 62 | |
| 63 | function appJwt() { |
| 64 | const appId = need('GITHUB_APP_ID'); |
no test coverage detected