Add custom metadata
Add custom metadata to findings
registerMetadataGetter
registerMetadataGetter(metadata: (() => Record<string, unknown> | Promise<Record<string, unknown>>))
=> number
Register a custom metadata getter. This function is used to provide custom metadata to the SDK. The getter is called every time a finding is created and the returned data is added to the custom
field of the finding's metadata.
You may register more than one getter in your function, and all of them will be called and their data will be merged.
🚨 Make sure that the getter returns data with unique keys or that all data is stored in one unique top-level key, since the companion will flat-merge the data from all registered getters.
unregisterMetadataGetter
unregisterMetadataGetter(handle: number) => boolean
Unregister a custom metadata getter. May be used when i.e. leaving a page or when a component in react is re-rendered.
Examples
To look at a specific example, you should definitely check out the official npm package.