Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@civic/gateway-client-core
Advanced tools
Sample project for creating typescript library with support of iife and types.
npm run build
builds the library to dist
, generating three files:
dist/civic-gateway-client-core.cjs.js
A CommonJS bundle, suitable for use in Node.js, that require
s the external dependency. This corresponds to the "main"
field in package.jsondist/civic-gateway-client-core.esm.js
an ES module bundle, suitable for use in other people's libraries and applications, that import
s the external dependency. This corresponds to the "module"
field in package.jsondist/civic-gateway-client-core.umd.js
a UMD build, suitable for use in any environment (including the browser, as a <script>
tag), that includes the external dependency. This corresponds to the "browser"
field in package.jsonnpm run dev
builds the library, then keeps rebuilding it whenever the source files change using rollup-watch.
npm test
builds the library, then tests it.
The library uses zustand for inernal state management, where the state is divided into separate concerns:
inputs: ClientCoreInput;
internal: ClientCoreInternal;
output?: ClientCoreOutput;
functions: {
reset: () => void;
};
The high-level flow is that:
This represents the state of different external inputs to the client-core:
civicSign: GatewayInput<CivicSignEventTypeRequestMessage, ChainError>;
civicPass: GatewayInput<CivicPassMessageResponse>;
gatewayToken: GatewayInput<GatewayToken>;
gatekeeperRecord: GatewayInput<GatekeeperRecordResponse>;
parameters: GatewayClientParameters | null;
civicSign events are sent and received using postMessage and can be considered 'outside' of the gatewayStatus flow, in that a signature request or did request can be received at any point in any flow. CivicSign events are subscribed to in the listenerManager and handled by 'remoteSign'
civicPass is an external frontend application that collects data and posts events that gateway-client-core listens to. These events are subscribed to in the listener manager and normally cause a change in the computed gatewayStatus that in turn can trigger orchestration flows
gatewayToken represents the on-chain state, where the input chainImplementation is used to query for and listen to token events. Changes to gatewayToken will also trigger gatewayStatus changes and trigger orchestration flows
gatekeeperRecord represents the civic-gatekeeper-api view of a pass: civic checks are applied on requests to the gatekeeper and can result in token rejections. The orchestrator's main function is to call the gatekeeper-api during different orchestration flows (issuance, refresh etc.) using data collected and provided by civic-pass events.
The parameters represent the instantiation parameters of gateway-client-core and represent options for things like wallet address, gatekeeper-network etc. that remain constant during a flow.
export type ClientCoreOutput = {
gatewayStatus: GatewayStatus;
gatewayToken?: GatewayToken;
flowParameters: FlowParameters | null;
pendingRequests: PendingPayload | undefined;
flowState?: {
status?: FlowStatus;
userInteraction: UserInteraction;
};
};
The outputs represent states that the instantiator of the gateway-client-core would be interested in:
Most of the input parameters to the client-core are static, i.e. any change in them should cause state to be reset and a new instance of the client-core to be used. However, there are some dynamic inputs that should not cause a reset but instead should trigger a new flow.
In order to allow a dApp to implement custom refresh logic, a boolean flag forceRequireRefresh
can be set by calling the updateDynamicParameters()
function on a gateway-client-core instance.
This flag will only cause a flow if an ACTIVE gatewayToken already exists for a given wallet. Setting it will cause the client-core to view the currrent gatewayToken as expired, and thus trigger set the gatewayStatus to REFRESH_TOKEN_REQUIRED, and to guide the user through a refresh-token flow. When the token expiry is updated to a value in the future, then the flow is viewed as finished and the gatewayStatus will once again be ACTIVE.
FAQs
Sample project for creating typescript library with support of iife and types.
We found that @civic/gateway-client-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.