Closed wighawag closed 3 years ago
Is this on dev or on build? Tauri relies on the crypto API so it should be available.
both
Can you please give us more details about your system? yarn tauri info
is a good start, as is the frontend framework you are using.
What OS are you running and which API are you trying to use? Tauri relies on crypto.getRandomValues
.
tauri info
Operating System - Windows, version 10.0.19042 X64
Node.js environment
Node.js - 14.16.0
@tauri-apps/cli - 1.0.0-beta-rc.4
@tauri-apps/api Not installed
Global packages
npm - 6.14.11
yarn - 1.22.5
Rust environment
rustc - 1.51.0
cargo - 1.51.0
App directory structure
/.svelte
/.vscode
/build
/node_modules
/src
/src-tauri
/static
App
tauri.rs - 1.0.0-beta-rc.4
build-type - bundle
CSP - default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'
distDir - ../build
devPath - ../build
framework: svelte+svelte-kit
the library that is causing problem is loaded via a script tag element created at runtime. I need to look deeper what exactly they are using : https://www.npmjs.com/package/@portis/web3
this is their detection function
export function validateSecureOrigin() {
const isLocalhost = location.hostname === 'localhost' || location.hostname === '127.0.0.1';
const isSecureOrigin = location.protocol === 'https:';
const isSecure = isLocalhost || isSecureOrigin;
if (!isSecure) {
throw `[Portis] Access to the WebCrypto API is restricted to secure origins.\nIf this is a development environment please use http://localhost:${
location.port
} instead.\nOtherwise, please use an SSL certificate.`;
}
}
So I think we already fixed this
at least on windows we are using https:
protocol, we need to check linux and macOs
This change is on wry 0.9, so it'll be available on the next release.
Describe the bug I am using a library that relies on WebCrypto API and get this error when that library is loaded (it is loaded on demand)
is webcrypto not available in tauri ?