-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(flutter/catalyst_key_derivation): Key derivation integration (#1149
) * feat(cat-voice-package): add rust key derivation implementation Signed-off-by: bkioshn <[email protected]> * refactor: move uikit_example into utilities dir * fix: exclude example packages from melos bootstrap * refactor: move poc_local_storage into catalyst_voices/utilities * fix: key derivation implementation Signed-off-by: bkioshn <[email protected]> * fix: auto gen file Signed-off-by: bkioshn <[email protected]> * refactor: move catalyst_voices_remote_widgets package to catalyst_voices/utilities dir * refactor: move scripts into catalyst_voices dir * refactor: move catalyst_voices/packages into catalyst_voices/packages/internal * refactor: move catalyst_voices_packages into catalyst_voices/packages/external * refactor: move melos.yaml into catalyst_voices * fix: add word to dict Signed-off-by: bkioshn <[email protected]> * fix: key derivation implementation Signed-off-by: bkioshn <[email protected]> * fix: remove simple rs Signed-off-by: bkioshn <[email protected]> * fix: flutter format Signed-off-by: bkioshn <[email protected]> * refactor: move app into apps/voices dir * refactor: rename packages/external to packages/libs * docs: update README * style: dart lint issues * fix: builder target * fix: update paths in Earthfile * fix: uikit_example pubspec + libs examples deps override * chore: test * fix: update cspell and check markdown rules * fix: README formatting * fix: add description to module Signed-off-by: bkioshn <[email protected]> * fix: add cspell dict Signed-off-by: bkioshn <[email protected]> * feat: add sign data, verify sig, get pubkey Signed-off-by: bkioshn <[email protected]> * fix: auto gen file Signed-off-by: bkioshn <[email protected]> * feat: add rust project setup files Signed-off-by: bkioshn <[email protected]> * fix: flutter example Signed-off-by: bkioshn <[email protected]> * fix: build-web target path * fix: remove build-web target suffix separator * fix: wallet-automation tests target path * fix: wallet-automation builder target * fix: voices automation tests target * fix: code-generator target path * fix: typo and comment Signed-off-by: bkioshn <[email protected]> * fix: vscode launch.recommended paths * feat: catalyst_voices justfile * refactor: rename catalyst_voices_remote_widgets to remote_widgets * fix: remote_widget spelling and licence checks * fix: remote_widget analyzer * refactor: move repo-catalyst-voices from root Earthfile to catalyst_voices/Earthfile * fix: restructure rust key derivation and solve dispose value Signed-off-by: bkioshn <[email protected]> * fix: auto gen file Signed-off-by: bkioshn <[email protected]> * fix: ignore auto gen file Signed-off-by: bkioshn <[email protected]> * fix: remove auto gen file Signed-off-by: bkioshn <[email protected]> * fix: add justfile, fix readme, and remove run.sh Signed-off-by: bkioshn <[email protected]> * fix: markdown Signed-off-by: bkioshn <[email protected]> * fix: update git ignore Signed-off-by: bkioshn <[email protected]> * fix: ignore spelling check for dart auto gen file Signed-off-by: bkioshn <[email protected]> * chore: add flutter_rust_bridge headers to launch.recommended.json for web * feat: add loader to transaction panel * chore: move ed25519 code to catalyst_key_derivation package * fix: add ci check and build Signed-off-by: bkioshn <[email protected]> * fix: add earthfile and fix justfile Signed-off-by: bkioshn <[email protected]> * fix: deprecated api * fix: file drop * fix: force downgraded version of flutter_dropzone * chore: update repository links + codeowners paths * fix: deploy uikit workflow * fix: uikit_example earthly build target * fix: uikit deploy workflow path * chore: integration tests docs readme paths * chore: remote widget readme path * chore: markdown ignore macos pods path fix * chore: integration test scripts * chore: build_runner assets * chore: document flutter_dropzone issue * chore: revert dropzone fixes * chore: regenerate code * feat: key derivation * fix: remove frb generated rust file Signed-off-by: bkioshn <[email protected]> * fix: rename Signed-off-by: bkioshn <[email protected]> * fix: add word to dict Signed-off-by: bkioshn <[email protected]> * fix: cspell ignore auto gen flutter file Signed-off-by: bkioshn <[email protected]> * fix: auto gen file Signed-off-by: bkioshn <[email protected]> * fix: file path cspell Signed-off-by: bkioshn <[email protected]> * test: check target Signed-off-by: bkioshn <[email protected]> * fix: rust earthfile Signed-off-by: bkioshn <[email protected]> * chore: add blueprint.cue along with new Earthfile Signed-off-by: bkioshn <[email protected]> * chore: fix blueprint.cue Signed-off-by: bkioshn <[email protected]> * fix: linter and format Signed-off-by: bkioshn <[email protected]> * fix: remove simple.rs Signed-off-by: bkioshn <[email protected]> * fix: ci check create dummy Signed-off-by: bkioshn <[email protected]> * chore: adjust breaking changes * fix: ci check create dummy Signed-off-by: bkioshn <[email protected]> * fix: rust ci Signed-off-by: bkioshn <[email protected]> * fix: rust format Signed-off-by: bkioshn <[email protected]> * feat: add to hex functions Signed-off-by: bkioshn <[email protected]> * fix: auto gen file Signed-off-by: bkioshn <[email protected]> * fix: add toHex example to dart Signed-off-by: bkioshn <[email protected]> * fix: tests * docs: update example * feat: update code generation to include web/pkg, it's needed for package distrubution * chore: code generation * fix: initializer * chore: cleanup * fix: code-generator Signed-off-by: bkioshn <[email protected]> * docs: document how to contribute changes to the package * feat: add earthlyignore * chore: regenerate files * fix: bump ci version to 3.2.24 Signed-off-by: bkioshn <[email protected]> * fix: update rustfmt.toml Signed-off-by: bkioshn <[email protected]> * fix: point flutter_rust_bridge ci to 3.2.23 Signed-off-by: bkioshn <[email protected]> * fix: ci bump version and deny.toml Signed-off-by: bkioshn <[email protected]> * fix: typo Signed-off-by: bkioshn <[email protected]> * chore: add integration tests for catalyst_key_derivation * docs: document that a private key should be dropped * docs: add flutter_rust_bridge issue link * style: typo * style: reformat * docs: update readme * docs: update readme * chore: disable cache * chore: workaround integration tests * chore: revert workaround * chore: configure nginx headers for flutter_rust_bridge * chore: drop enable-threads.js to test if it fixes ci * chore: make global nginx headers * chore: add again the workaround * chore: don't compile the app for integration tests, they do it themselves * chore: run tests on firefox only * chore: run only on chrome without workaround * chore: script load order * chore: reenable firefox tests * docs: clarify todo * feat: skip catalyst key derivation tests if init didn't work * chore: update flutter ci --------- Signed-off-by: bkioshn <[email protected]> Co-authored-by: bkioshn <[email protected]> Co-authored-by: Damian Molinski <[email protected]> Co-authored-by: bkioshn <[email protected]> Co-authored-by: Steven Johnson <[email protected]>
- Loading branch information
1 parent
0712347
commit 618f769
Showing
76 changed files
with
2,932 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
**/*.iml | ||
**/coverage/ | ||
**/test_reports/ | ||
**/*.log | ||
|
||
# node related | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
**/*.iml | ||
**/coverage/ | ||
**/test_reports/ | ||
**/*.log | ||
|
||
# node related | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// TODO(dtscalac): remove workaround when flutter_rust_bridge supports crossOriginIsolated for flutter drive: | ||
// https://github.com/fzyzcjy/flutter_rust_bridge/issues/2407 | ||
|
||
// https://github.com/orgs/community/discussions/13309#discussioncomment-3844940 | ||
// NOTE: This file creates a service worker that cross-origin-isolates the page (read more here: https://web.dev/coop-coep/) which allows us to use wasm threads. | ||
// Normally you would set the COOP and COEP headers on the server to do this, but Github Pages doesn't allow this, so this is a hack to do that. | ||
|
||
/* Edited version of: coi-serviceworker v0.1.6 - Guido Zuidhof, licensed under MIT */ | ||
// From here: https://github.com/gzuidhof/coi-serviceworker | ||
if (typeof window === 'undefined') { | ||
self.addEventListener("install", () => self.skipWaiting()); | ||
self.addEventListener("activate", e => e.waitUntil(self.clients.claim())); | ||
|
||
async function handleFetch(request) { | ||
if (request.cache === "only-if-cached" && request.mode !== "same-origin") { | ||
return; | ||
} | ||
|
||
if (request.mode === "no-cors") { // We need to set `credentials` to "omit" for no-cors requests, per this comment: https://bugs.chromium.org/p/chromium/issues/detail?id=1309901#c7 | ||
request = new Request(request.url, { | ||
cache: request.cache, | ||
credentials: "omit", | ||
headers: request.headers, | ||
integrity: request.integrity, | ||
destination: request.destination, | ||
keepalive: request.keepalive, | ||
method: request.method, | ||
mode: request.mode, | ||
redirect: request.redirect, | ||
referrer: request.referrer, | ||
referrerPolicy: request.referrerPolicy, | ||
signal: request.signal, | ||
}); | ||
} | ||
|
||
let r = await fetch(request).catch(e => console.error(e)); | ||
|
||
if (r.status === 0) { | ||
return r; | ||
} | ||
|
||
const headers = new Headers(r.headers); | ||
// NOTE https://github.com/fzyzcjy/flutter_rust_bridge/issues/1618 changes to require-corp | ||
headers.set("Cross-Origin-Embedder-Policy", "require-corp"); // credentialless or require-corp | ||
headers.set("Cross-Origin-Opener-Policy", "same-origin"); | ||
|
||
return new Response(r.body, { status: r.status, statusText: r.statusText, headers }); | ||
} | ||
|
||
self.addEventListener("fetch", function (e) { | ||
e.respondWith(handleFetch(e.request)); // respondWith must be executed synchonously (but can be passed a Promise) | ||
}); | ||
|
||
} else { | ||
(async function () { | ||
if (window.crossOriginIsolated !== false) return; | ||
|
||
let registration = await navigator.serviceWorker.register(window.document.currentScript.src).catch(e => console.error("COOP/COEP Service Worker failed to register:", e)); | ||
if (registration) { | ||
console.log("COOP/COEP Service Worker registered", registration.scope); | ||
|
||
registration.addEventListener("updatefound", () => { | ||
console.log("Reloading page to make use of updated COOP/COEP Service Worker."); | ||
window.location.reload(); | ||
}); | ||
|
||
// If the registration is active, but it's not controlling the page | ||
if (registration.active && !navigator.serviceWorker.controller) { | ||
console.log("Reloading page to make use of COOP/COEP Service Worker."); | ||
window.location.reload(); | ||
} | ||
} | ||
})(); | ||
} | ||
|
||
// Code to deregister: | ||
// let registrations = await navigator.serviceWorker.getRegistrations(); | ||
// for(let registration of registrations) { | ||
// await registration.unregister(); | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 24 additions & 23 deletions
47
...lyst_voices/packages/internal/catalyst_voices_services/lib/src/crypto/key_derivation.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.