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.
react-native-webln
Advanced tools
Library for handling all the boilerplate needed for supporting WebLN in a react-native-webview, so you can focus on actually implementing all the features of WebLN in your app or wallet.
Just plug and play.
To use this library you also need to install react-native-webview
. If you want Typescript typings, you need to install webln
.
# Install react-native-webln and its peer dependencies
npm install --save react-native-webln react-native-webview
# If you want Typescript definitions
npm install --save-dev webln
or if you prefer Yarn.
# Install react-native-webln and its peer dependencies
yarn add react-native-webln react-native-webview
# If you want Typescript definitions
yarn add --dev webln
import { injectJs, postMessageHandler } from "react-native-webln";
const WebLNBrowser = () => {
const webview = useRef<WebView>();
const [jsInjected, setJsInjected] = useState(false);
return (
<WebView
ref={webview}
source={{ uri: "https://webln-capable-site.com" }}
onLoadStart={() => setJsInjected(false)}
onLoadProgress={(e) => {
if (!jsInjected && e.nativeEvent.progress > 0.75) {
webview.current.injectJavaScript(injectJs());
setJsInjected(true);
}
}}
onMessage={postMessageHandler(webview, {
enable: async () => { /* Your implementation goes here */ },
getInfo: async () => { /* Your implementation goes here */ },
makeInvoice: async (args) => { /* Your implementation goes here */ },
sendPayment: async (paymentRequestStr) => { /* Your implementation goes here */ },
signMessage: async (message) => { /* Your implementation goes here */ },
verifyMessage: async (signature, message) => { /* Your implementation goes here */ },
// Non-WebLN
// Called when an a-tag containing a `lightning:` uri is found on a page
foundInvoice: async (paymentRequestStr) => { /* Your implementation goes here */ }
})}
style={{ width: "100%", height: "100%", flex: 1 }}
/>
)
}
MIT
FAQs
Library for supporting WebLN in a WebView
The npm package react-native-webln receives a total of 51 weekly downloads. As such, react-native-webln popularity was classified as not popular.
We found that react-native-webln 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
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.