-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Use async functions from c2pa-rs #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Settings need to be applied at the beginning of the tokio::spawn, since a thread may be reused and not have settings applied.
js-src/Reader.spec.ts
Outdated
| }); | ||
|
|
||
| // Call postValidateCawg to decode CAWG assertions | ||
| // this is now a NO-OP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why leave it in if it's a no-op? Backwards compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I just told people they had to use that method.
js-src/Reader.ts
Outdated
|
|
||
| async postValidateCawg(): Promise<void> { | ||
| return getNeonBinary().readerPostValidateCawg.call(this.reader); | ||
| // No-op: CAWG validation is now handled automatically by async reader constructors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kept for backwards compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
| } from "./Settings.js"; | ||
|
|
||
| describe("Settings", () => { | ||
| afterAll(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Do it in beforeAll too? So if something else would run on the same thread before, only the settings from the tests would be set, no doubts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could do it beforeAll in all of the test suites or none of them. It's been a real headache in c2pa-rs finding all of the tests that modify and don't reset the settings. I like the idea of detecting when tests don't put things back as they should.
| pub fn reset_settings(mut cx: FunctionContext) -> JsResult<JsUndefined> { | ||
| // Create default settings and get their TOML representation | ||
| let default_settings = Settings::default(); | ||
| let default_toml = toml::to_string(&default_settings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contentauth/c2pa-rs#1533 may be of interest once it lands
emensch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but I think we might be better off removing postValidateCawg, lest people get confused down the line just looking at the public API surface
Settings need to be applied at the beginning of the tokio::spawn, since a thread may be reused and not have settings applied.