Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
- generateKey | importKey |
Live Table: https://diafygi.github.io/webcrypto-examples/
I couldn't find anywhere that had clear examples of WebCryptoAPI, so I wrote examples and made a live table with them. Pull requests welcome!
This tutorial will show you how to polyfill crypto and other NodeJS modules globally in a React-Native environment.
Please note that these implementations are purely javascript and don't use native modules to generate random numbers
Run the following command
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <link rel="shortcut icon" href="/favicon.ico" /> | |
| <meta | |
| name="viewport" | |
| content="width=device-width, initial-scale=1, shrink-to-fit=no" | |
| /> | |
| <meta name="theme-color" content="#000000" /> | |
| <title>WalletConnect Example</title> |
WalletConnect Instant feature introduces the ability to make an ephemeral session that bypasses the process of session approval by the wallet, displaying to the user a call request to be signed from the Dapp right after scanning the QR Code. This is useful for one-time use-cases like payments, topping-up or withdrawals. This is still highly experimental and hasn't been published to the official library. A PoC to aggregate feedback on this feature!
Source code available at WalletConnect/walletconnect-monorepo on walletconnect-instant branch.
| import React from "react"; | |
| import * as uuid from 'uuid'; | |
| import { WindowProvider } from "@wagmi/connectors" | |
| import defaultProviderIcon from "../assets/defaultProviderIcon.png" | |
| // copied from https://github.com/wagmi-dev/references/blob/main/packages/connectors/src/utils/getInjectedName.ts | |
| function getInjectedName(ethereum?: WindowProvider) { | |
| if (!ethereum) return 'Injected' |
| // @desc Creates a list of domains with custom TLDs using a pattern string with fixed length with option for keywords | |
| // @param {String} pattern | |
| // @param {Array|String} tlds | |
| // @returns {Array} domainList | |
| // | |
| // | |
| // Pattern string is defined by: | |
| // - keywords lowercase | |
| // - any letter uppercase A | |
| // - consonants uppercase C |
| REQ wc_pairingDelete | |
| - ttl = 86400 | |
| - tag = 1000 | |
| - msg = 400 (~312) | |
| RES wc_pairingDelete | |
| - ttl = 86400 | |
| - tag = 1001 | |
| - msg = ?? |
| // Our RPC id's are expected to be the same "length" | |
| // generating id's should use Unix epoch timestamp in miliseconds and append 3 random digits | |
| // currently Kotlin SDK has at least 3 more digits than all other SDKs | |
| // yet while Kotlin is the minority, it's preferable to increase integers than decrease them | |
| // this way we can keep backwards-compatibility for Kotlin clients in older releases | |
| // thus we could also increase entropy by also increasing other SDKs to 6 random digits | |
| function payloadId() { | |
| const date = Date.now() * Math.pow(10, 6); | |
| const extra = Math.ceil(Math.random() * Math.pow(10, 6)); |