(
managementEndpoint, instanceId, creds, log, callback)
| 55 | } |
| 56 | |
| 57 | function confirmInstanceCredentials( |
| 58 | managementEndpoint, instanceId, creds, log, callback) { |
| 59 | const postData = { |
| 60 | serial: creds.serial || 0, |
| 61 | publicKey: creds.publicKey, |
| 62 | }; |
| 63 | |
| 64 | const opts = { |
| 65 | headers: { |
| 66 | 'x-instance-authentication-token': creds.token, |
| 67 | }, |
| 68 | body: postData, |
| 69 | }; |
| 70 | |
| 71 | request.post(`${managementEndpoint}/${instanceId}/confirm`, |
| 72 | opts, (error, response) => { |
| 73 | if (error) { |
| 74 | return callback(error); |
| 75 | } |
| 76 | if (response.statusCode === 200) { |
| 77 | return callback(null, instanceId, creds.token); |
| 78 | } |
| 79 | return callback(arsenal.errors.InternalError); |
| 80 | }); |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Initializes credentials and PKI in the management database. |
no outgoing calls
no test coverage detected