2023-03-15 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2022-04-20 18:40:27 +00:00
|
|
|
export default function (server) {
|
|
|
|
server.get('keymgmt/key?list=true', function () {
|
|
|
|
return {
|
|
|
|
data: {
|
|
|
|
keys: ['example-1', 'example-2', 'example-3'],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
server.get('keymgmt/key/:name', function (_, request) {
|
2022-11-09 23:15:31 +00:00
|
|
|
const name = request.params.name;
|
2022-04-20 18:40:27 +00:00
|
|
|
return {
|
|
|
|
data: {
|
|
|
|
name,
|
|
|
|
deletion_allowed: false,
|
|
|
|
keys: {
|
|
|
|
1: {
|
|
|
|
creation_time: '2020-11-02T15:54:58.768473-08:00',
|
|
|
|
public_key: '-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----',
|
|
|
|
},
|
|
|
|
2: {
|
|
|
|
creation_time: '2020-11-04T16:58:47.591718-08:00',
|
|
|
|
public_key: '-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
latest_version: 2,
|
|
|
|
min_enabled_version: 1,
|
|
|
|
type: 'rsa-2048',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
server.get('keymgmt/key/:name/kms', function () {
|
|
|
|
return {
|
|
|
|
data: {
|
|
|
|
keys: ['example-kms'],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
server.post('keymgmt/key/:name', function () {
|
|
|
|
return {};
|
|
|
|
});
|
|
|
|
|
|
|
|
server.put('keymgmt/key/:name', function () {
|
|
|
|
return {};
|
|
|
|
});
|
|
|
|
|
|
|
|
server.get('/keymgmt/kms/:provider/key', () => {
|
|
|
|
const keys = [];
|
|
|
|
let i = 1;
|
|
|
|
while (i <= 75) {
|
|
|
|
keys.push(`testkey-${i}`);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return { data: { keys } };
|
|
|
|
});
|
|
|
|
}
|