Add support for client certificates
This commit is contained in:
parent
d9b63dd0ef
commit
937560e859
20 changed files with 376 additions and 39 deletions
45
client/src/js/actions/settings.js
Normal file
45
client/src/js/actions/settings.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
import base64 from 'base64-arraybuffer';
|
||||
import * as actions from '../actions';
|
||||
|
||||
export function setCertError(message) {
|
||||
return {
|
||||
type: actions.SET_CERT_ERROR,
|
||||
message
|
||||
};
|
||||
}
|
||||
|
||||
export function uploadCert() {
|
||||
return (dispatch, getState) => {
|
||||
const { settings } = getState();
|
||||
if (settings.has('cert') && settings.has('key')) {
|
||||
dispatch({
|
||||
type: actions.UPLOAD_CERT,
|
||||
socket: {
|
||||
type: 'cert',
|
||||
data: {
|
||||
cert: settings.get('cert'),
|
||||
key: settings.get('key')
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
dispatch(setCertError('Missing certificate or key'));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function setCert(fileName, cert) {
|
||||
return {
|
||||
type: actions.SET_CERT,
|
||||
fileName,
|
||||
cert: base64.encode(cert)
|
||||
};
|
||||
}
|
||||
|
||||
export function setKey(fileName, key) {
|
||||
return {
|
||||
type: actions.SET_KEY,
|
||||
fileName,
|
||||
key: base64.encode(key)
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue