
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@worldcerts/decentralized-renderer-react-components
Advanced tools
React components abstracting the communication with `Open Attestation` decentralized renderer. More information on this:
React components abstracting the communication with Open Attestation
decentralized renderer. More information on this:
To begin with, makes sure you read the initial introduction and explanation about decentralized renderer
In order to render a document, hosts will load the corresponding decentralized renderer (as specified by the document) and embed it using an iframe. Communication between host and iframe is made using postMessage API and has been designed using actions.
All actions follow the same structure and are composed of type
and payload
type
indicates the kind of action being executed, for instance RENDER_DOCUMENT
to render a document. The type of an action is mandatorypayload
indicates optional data associated to the type, for instance the content of the document to render.Example:
const renderDocumentAction = {
type: "RENDER_DOCUMENT",
payload: {
document: documentToRender
}
};
const printAction = {
type: "PRINT"
};
The following list of actions are made for host to communicate to the iframe (and thus must be handled by application embed in the iframe):
RENDER_DOCUMENT
getData
method from @worldcerts/worldcerts-attestationconst action = {
type: "RENDER_DOCUMENT",
payload: {
document: getData(document),
rawDocument: document
}
};
const action = {
type: "SELECT_TEMPLATE",
payload: "CUSTOM_TEMPLATE"
};
const action = {
type: "PRINT"
};
There is a 4th action that can be used in the context of react-native application (which doesn't use iframe under the hood)
GET_TEMPLATES
getData
method from @worldcerts/worldcerts-attestationconst action = {
type: "GET_TEMPLATES",
payload: getData(document)
};
The following list of actions are made for iframe to communicate to the host (and thus must be handled by application embedding the iframe):
const action = {
type: "UPDATE_HEIGHT",
payload: 150
};
const action = {
type: "OBFUSCATE",
payload: "a[0].b.c"
};
const action = {
type: "UPDATE_TEMPLATES",
payload: [
{
id: "certificate",
label: "Certificate"
},
{
id: "transcript",
label: "Transcript"
}
]
};
The library provide 2 mains components
This component will create a frame and establish a connection with the provided decentralized renderer. Properties are:
source
: url to the decentralized renderer that will handle the document to displaydispatch
: function listening for actions triggered by the decentralized rendereronConnected
: function called when the connection to the decentralized renderer has been established. The function will be provided as first parameter another which can be used to send actions to the iframePlease check the code in example/application
to see how to use this component. You can also start the example application using the command npm run example:application
This component will establish a connection with a host embedding the application within an iframe. Properties are:
templateRegistry
: the configuration of the templates handled by the decentralized renderer. templateRegistry
is an object where each key hold an array of Template Configuration
. One Template Configuration
consist of :
Template
, that is to say a react component that will render a documentattachmentToComponent
: a function that map attachments to component depending on the attachment type. Currently the library exposes 2 functions:
noAttachmentRenderer
: which uses UnsupportedRenderer
(basically it's doing nothing)fullAttachmentRenderer
: which uses all the supported attachment type by the library (see the function).
This property default to noAttachmentRenderer
, to avoid bundles growing huge unnecessarily.FramedDocumentRenderer
handle all the logic around the communication with the hosted application and the renderer:
UPDATE_HEIGHT
action, when the iframe is resized or when there is a change within the iframe (using Mutation Observer)Template
to render depending on information provided by the hostUPDATE_TEMPLATES
action once the document has been renderer)OBFUSCATE
action when requested by a Template
Please check the code in example/decentralized-renderer
to see how to use this component. You can also start the example application using the command npm run example:renderer
Each configured Template
will be provided the following properties, when rendering a document:
document
: (mandatory) document data as returned by getData
method from @worldcerts/worldcerts-attestationrawDocument
: (optional) Open Attestation documenthandleObfuscation
: (mandatory) A function to call to handle obfuscation in the document. The value provided must follow path property as handlded by lodash#getnpm run storybook
: to start storybook, create stories and visualize the different componentnpm run test
: to run testsnpm run lint
: to run lintnpm run example:application
: to run the example build with the library to develop an hosting application. Don't forget to update the example if you update this library.npm run example:renderer
: to run the example build with the library to develop a decentralized renderer. Don't forget to update the example if you update this library.We also provided a github template to build your own decentralized-renderer based on this library
FAQs
React components abstracting the communication with `Open Attestation` decentralized renderer. More information on this:
We found that @worldcerts/decentralized-renderer-react-components demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.