57 lines
2.3 KiB
JavaScript
57 lines
2.3 KiB
JavaScript
/**
|
|
* Electron platform implementation.
|
|
* Delegates to the window.* APIs exposed by preload.cjs.
|
|
*/
|
|
const electronPlatform = {
|
|
crypto: {
|
|
generateKeys: () => window.cryptoAPI.generateKeys(),
|
|
randomBytes: (size) => window.cryptoAPI.randomBytes(size),
|
|
sha256: (data) => window.cryptoAPI.sha256(data),
|
|
signMessage: (privateKey, message) => window.cryptoAPI.signMessage(privateKey, message),
|
|
verifySignature: (publicKey, message, signature) => window.cryptoAPI.verifySignature(publicKey, message, signature),
|
|
deriveAuthKeys: (password, salt) => window.cryptoAPI.deriveAuthKeys(password, salt),
|
|
encryptData: (data, key) => window.cryptoAPI.encryptData(data, key),
|
|
decryptData: (encryptedData, key, iv, tag, options) => window.cryptoAPI.decryptData(encryptedData, key, iv, tag, options),
|
|
decryptBatch: (items) => window.cryptoAPI.decryptBatch(items),
|
|
verifyBatch: (items) => window.cryptoAPI.verifyBatch(items),
|
|
publicEncrypt: (publicKey, data) => window.cryptoAPI.publicEncrypt(publicKey, data),
|
|
privateDecrypt: (privateKey, encryptedHex) => window.cryptoAPI.privateDecrypt(privateKey, encryptedHex),
|
|
},
|
|
session: {
|
|
save: (data) => window.sessionPersistence.save(data),
|
|
load: () => window.sessionPersistence.load(),
|
|
clear: () => window.sessionPersistence.clear(),
|
|
},
|
|
settings: {
|
|
get: (key) => window.appSettings.get(key),
|
|
set: (key, value) => window.appSettings.set(key, value),
|
|
},
|
|
idle: {
|
|
getSystemIdleTime: () => window.idleAPI.getSystemIdleTime(),
|
|
onIdleStateChanged: (callback) => window.idleAPI.onIdleStateChanged(callback),
|
|
removeIdleStateListener: () => window.idleAPI.removeIdleStateListener(),
|
|
},
|
|
links: {
|
|
openExternal: (url) => window.cryptoAPI.openExternal(url),
|
|
fetchMetadata: (url) => window.cryptoAPI.fetchMetadata(url),
|
|
},
|
|
screenCapture: {
|
|
getScreenSources: () => window.cryptoAPI.getScreenSources(),
|
|
},
|
|
windowControls: {
|
|
minimize: () => window.windowControls.minimize(),
|
|
maximize: () => window.windowControls.maximize(),
|
|
close: () => window.windowControls.close(),
|
|
},
|
|
updates: {
|
|
checkUpdate: () => window.updateAPI.checkFlatpakUpdate(),
|
|
},
|
|
features: {
|
|
hasWindowControls: true,
|
|
hasScreenCapture: true,
|
|
hasNativeUpdates: true,
|
|
},
|
|
};
|
|
|
|
export default electronPlatform;
|