Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: torusresearch/torus-embed
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.26.0
Choose a base ref
...
head repository: torusresearch/torus-embed
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: develop
Choose a head ref
Loading
Showing with 20,468 additions and 48,243 deletions.
  1. +0 −3 .browserslistrc
  2. +0 −5 .editorconfig
  3. +13 −0 .eslintrc.js
  4. +0 −11 .eslintrc.json
  5. +13 −27 .github/workflows/ci.yml
  6. +1 −1 .nvmrc
  7. +2 −1 .prettierrc.yaml
  8. +7 −1 .vscode/settings.json
  9. +1 −1 LICENSE
  10. +49 −2 README.md
  11. +0 −4 examples/angular-example/src/app/app.component.ts
  12. +0 −4 examples/next-app/pages/index.tsx
  13. +0 −4 examples/react-basic-app/src/App.tsx
  14. +7 −5 examples/vue-app/.eslintrc.json
  15. +10,473 −33,173 examples/vue-app/package-lock.json
  16. +35 −25 examples/vue-app/package.json
  17. BIN examples/vue-app/public/favicon.ico
  18. +5 −1 examples/vue-app/public/index.html
  19. +425 −0 examples/vue-app/src/App.css
  20. +399 −247 examples/vue-app/src/App.vue
  21. +3 −0 examples/vue-app/src/assets/copy.svg
  22. +3 −0 examples/vue-app/src/assets/down.svg
  23. +3 −0 examples/vue-app/src/assets/logout.svg
  24. +4 −0 examples/vue-app/src/assets/mail.svg
  25. +5 −0 examples/vue-app/src/assets/tailwind.css
  26. +3 −0 examples/vue-app/src/assets/wifi.svg
  27. +1 −1 examples/vue-app/src/helpers.ts
  28. +4 −6 examples/vue-app/src/main.ts
  29. +3 −3 examples/vue-app/src/vue-shim.d.ts
  30. +981 −0 examples/vue-app/tailwind.config.js
  31. +36 −8 examples/vue-app/vue.config.js
  32. +7,045 −14,007 package-lock.json
  33. +28 −47 package.json
  34. +1 −3 rollup.config.js → rollup.config.mjs
  35. +14 −11 src/PopupHandler.ts
  36. +171 −47 src/config.ts
  37. +120 −188 src/embed.ts
  38. +0 −30 src/embedUtils.ts
  39. +21 −156 src/inpage-provider.ts
  40. +0 −44 src/integrity.ts
  41. +49 −92 src/interfaces.ts
  42. +16 −0 src/isStream.ts
  43. +0 −15 src/messages.ts
  44. +478 −0 src/supportedCurrencies.ts
  45. +37 −41 src/utils.ts
  46. +10 −0 test/index.html
  47. +1 −5 torus.config.js
  48. +1 −17 tsconfig.json
  49. +0 −7 webpack.config.js
3 changes: 0 additions & 3 deletions .browserslistrc

This file was deleted.

5 changes: 0 additions & 5 deletions .editorconfig

This file was deleted.

13 changes: 13 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require("@rushstack/eslint-patch/modern-module-resolution");

module.exports = {
root: true,
extends: ["@toruslabs/eslint-config-typescript"],
parser: "@typescript-eslint/parser",
ignorePatterns: ["*.config.js", ".eslintrc.js", "*.config.mjs"],
parserOptions: {
sourceType: "module",
ecmaVersion: 2022,
project: "./tsconfig.json",
},
};
11 changes: 0 additions & 11 deletions .eslintrc.json

This file was deleted.

40 changes: 13 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -6,33 +6,20 @@ jobs:
build:
strategy:
matrix:
node: ["16.x"]
node: ["18.x"]
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}

steps:
- name: Check out Git repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
registry-url: "https://registry.npmjs.org"

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Node dependency cache
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ matrix.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ matrix.os }}-node-
cache: "npm"

- name: Install dependencies
run: npm install
@@ -42,7 +29,7 @@ jobs:

- name: Deploy to npm
if: startsWith(github.ref, 'refs/tags/v')
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" > ~/.npmrc && npm publish
run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" > ~/.npmrc && npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

@@ -51,13 +38,13 @@ jobs:
run: |
npm pack
cd examples/vue-app
npm install
npm install --legacy-peer-deps
npm run build
# Set the credentials from repository settings/secrets
- name: Configure AWS credentials
if: github.ref == 'refs/heads/master'
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -78,10 +65,9 @@ jobs:
# Invalidate Cloudfront (this action)
- name: invalidate
if: github.ref == 'refs/heads/master'
uses: chetan/invalidate-cloudfront-action@master
env:
DISTRIBUTION: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}
PATHS: "/*"
AWS_REGION: ${{ secrets.AWS_REGION_US }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
uses: chaitanyapotti/cloudfront-update-distribution@v2
with:
cloudfront-distribution-id: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }}
cloudfront-invalidation-required: true
cloudfront-invalidation-path: "/*"
cloudfront-wait-for-service-update: false
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
>=14.17
>=18.x
3 changes: 2 additions & 1 deletion .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# .prettierrc or .prettierrc.yaml
printWidth: 150
singleQuote: false
semi: true
semi: true
trailingComma: es5
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"cSpell.words": ["latestversion", "topup", "toruslabs", "Whitelabel"]
"cSpell.words": ["latestversion", "topup", "toruslabs", "Whitelabel"],
"eslint.workingDirectories": [
{
"changeProcessCWD": true,
"directory": "./examples/vue-app/*"
}
]
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Torus
Copyright (c) 2019 Torus Labs Private Limited

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
51 changes: 49 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,54 @@
# Torus Embed — New Frictionless login for Dapps
# Torus Embed — New Frictionless login for Dapps by [Web3Auth](https://docs.tor.us)

[![npm version](https://badge.fury.io/js/%40toruslabs%2Ftorus-embed.svg)](https://badge.fury.io/js/%40toruslabs%2Ftorus-embed)
![npm](https://img.shields.io/npm/dw/@toruslabs/torus-embed)
[![minzip](https://img.shields.io/bundlephobia/minzip/@toruslabs/torus-embed?label=%22%22)](https://bundlephobia.com/result?p=@toruslabs/torus-embed)

> [Web3Auth](https://web3auth.io) is where passwordless auth meets non-custodial key infrastructure for Web3 apps and wallets. By aggregating OAuth (Google, Twitter, Discord) logins, different wallets and innovative Multi Party Computation (MPC) - Web3Auth provides a seamless login experience to every user on your application.
## 📖 Documentation

Checkout the official [Torus Documentation for Torus Embed](https://docs.tor.us/wallet/api-reference/installation) to get started.

## 🔗 Installation

```shell
npm install --save @toruslabs/torus-embed
```

## ⚡ Quick Start

### Get your Client ID from Web3Auth Dashboard

Hop on to the [Web3Auth Dashboard](https://dashboard.web3auth.io/) and create a new Torus Wallet project. Use the Client ID of the project to start your integration.

![Web3Auth Dashboard - Torus Wallets](https://user-images.githubusercontent.com/6962565/187207423-d7b8f085-3388-477c-b945-c7db1b991839.png)

## Initialize & Login

```ts
import Torus from "@toruslabs/torus-embed";
import Web3 from "web3";

const torus = new Torus();
await torus.init();
await torus.login(); // await torus.ethereum.enable()
const web3 = new Web3(torus.provider);
```

## 🩹 Examples

Checkout the example of `Torus Embed` in our [example directory.](https://github.com/torusresearch/torus-embed/tree/develop/examples)

## 🌐 Demo

Checkout the [Torus Embed Demo](https://demo-eth.tor.us) to see how `Torus Embed` can be used in your application.

## 💬 Troubleshooting and Discussions

- Have a look at our [GitHub Discussions](https://github.com/Web3Auth/Web3Auth/discussions?discussions_q=sort%3Atop) to see if anyone has any questions or issues you might be having.
- Checkout our [Troubleshooting Documentation Page](https://web3auth.io/docs/troubleshooting) to know the common issues and solutions
- Join our [Discord](https://discord.gg/web3auth) to join our community and get private integration support or help with your integration.

## Introduction

@@ -88,7 +135,7 @@ entry-point: `index.js`
## Requirements

- This package requires a peer dependency of `@babel/runtime`
- Node 14+
- Node 16+

## License

4 changes: 0 additions & 4 deletions examples/angular-example/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -91,9 +91,6 @@ export class AppComponent {
const { buildEnv, chainIdNetworkMap, chainId } = this;
await torus.init({
buildEnv,
enabledVerifiers: {
reddit: false,
},
enableLogging: true,
network: {
host: chainIdNetworkMap[chainId.toString()], // mandatory
@@ -121,7 +118,6 @@ export class AppComponent {
}
: undefined,
whiteLabel: whiteLabelData,
skipTKey: true,
});
await torus.login(); // await torus.ethereum.enable()
sessionStorage.setItem("pageUsingTorus", buildEnv);
4 changes: 0 additions & 4 deletions examples/next-app/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -59,9 +59,6 @@ export default function Home() {
const { torus, web3 } = web3Obj;
await torus.init({
buildEnv,
enabledVerifiers: {
reddit: false,
},
enableLogging: true,
network: {
host: chainIdNetworkMap[chainId.toString()], // mandatory
@@ -89,7 +86,6 @@ export default function Home() {
}
: undefined,
whiteLabel: whiteLabelData,
skipTKey: true,
});
await torus.login(); // await torus.ethereum.enable()
sessionStorage.setItem("pageUsingTorus", buildEnv);
4 changes: 0 additions & 4 deletions examples/react-basic-app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -43,9 +43,6 @@ class App extends React.Component {
const { buildEnv, chainIdNetworkMap, chainId } = this.state;
await torus.init({
buildEnv,
enabledVerifiers: {
reddit: false,
},
enableLogging: true,
network: {
host: chainIdNetworkMap[chainId.toString()], // mandatory
@@ -70,7 +67,6 @@ class App extends React.Component {
},
} : undefined,
whiteLabel: whiteLabelData,
skipTKey: true,
});
const acc = await torus.login(); // await torus.ethereum.enable()
console.log('acc', acc);
12 changes: 7 additions & 5 deletions examples/vue-app/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -6,14 +6,16 @@
"es6": true
},
"extends": [
"plugin:vue/essential",
"vue",
"plugin:vue/recommended",
"eslint:recommended",
"@vue/typescript/recommended",
"@vue/prettier",
"@vue/prettier/@typescript-eslint"
"plugin:prettier/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"prettier"
],
"plugins": ["simple-import-sort"],
"plugins": ["simple-import-sort", "prettier"],
"parserOptions": {
"ecmaVersion": 2020
},
Loading