Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update alpha branch #343

Merged
merged 15 commits into from
Jul 19, 2024
15,826 changes: 0 additions & 15,826 deletions examples/angular-app/package-lock.json

This file was deleted.

2 changes: 1 addition & 1 deletion examples/angular-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@angular/platform-browser": "~12.1.1",
"@angular/platform-browser-dynamic": "~12.1.1",
"@angular/router": "~12.1.1",
"@toruslabs/customauth": "file:../../toruslabs-customauth-5.0.3.tgz",
"@toruslabs/customauth": "19.0.0-alpha.8",
"crypto-browserify": "^3.12.0",
"process": "^0.11.10",
"rxjs": "~6.6.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/angular-app/src/app/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from "@angular/core";
import TorusSdk from "@toruslabs/customauth";
import { CustomAuth } from "@toruslabs/customauth";

import {
verifierMap,
Expand Down Expand Up @@ -57,7 +57,7 @@ export class HomeComponent implements OnInit {
queryParams[key] = url.searchParams.get(key);
}
const { error, instanceParameters } = this.handleRedirectParameters(hash, queryParams);
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: `${window.location.origin}/serviceworker`,
enableLogging: true,
network: "testnet", // details for test net
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from "@angular/core";
import TorusSdk from "@toruslabs/customauth";
import { CustomAuth } from "@toruslabs/customauth";

import {
verifierMap,
Expand Down Expand Up @@ -35,7 +35,7 @@ export class PopupModeLoginComponent implements OnInit {

async ngOnInit() {
try {
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: `${location.origin}/serviceworker`,
enableLogging: true,
network: "testnet", // details for test net
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from "@angular/core";
import TorusSdk from "@toruslabs/customauth";
import { CustomAuth } from "@toruslabs/customauth";

@Component({
selector: "app-redirect-mode-auth",
Expand All @@ -10,7 +10,7 @@ export class RedirectModeAuthComponent implements OnInit {
consoleText = "";

async ngOnInit(): Promise<void> {
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: window.location.origin,
redirectPathName: "auth",
enableLogging: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from "@angular/core";
import TorusSdk, { Auth0ClientOptions } from "@toruslabs/customauth";
import { CustomAuth, Auth0ClientOptions } from "@toruslabs/customauth";

import {
verifierMap,
Expand All @@ -25,7 +25,7 @@ import {
styleUrls: ["./redirect-mode-login.component.css"],
})
export class RedirectModeLoginComponent implements OnInit {
torusdirectsdk: TorusSdk | null = null;
torusdirectsdk: CustomAuth | null = null;
selectedVerifier = GOOGLE;

verifierMap = verifierMap;
Expand All @@ -34,7 +34,7 @@ export class RedirectModeLoginComponent implements OnInit {

async ngOnInit() {
try {
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: location.origin,
redirectPathName: "auth",
enableLogging: true,
Expand Down
4 changes: 2 additions & 2 deletions examples/nextjs-app/pages/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* User will be redirected to this page in redirect uxMode
*/
import React from "react";
import TorusSdk, { RedirectResult } from "@toruslabs/customauth";
import { CustomAuth, RedirectResult } from "@toruslabs/customauth";
import dynamic from "next/dynamic";

let ReactJsonView;
Expand All @@ -25,7 +25,7 @@ class RedirectAuth extends React.Component<IProps, IState> {
}

async componentDidMount() {
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: window.location.origin,
redirectPathName: "auth",
enableLogging: true,
Expand Down
6 changes: 3 additions & 3 deletions examples/nextjs-app/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable class-methods-use-this */
import React from "react";
import Link from "next/link";
import TorusSdk, { TorusLoginResponse } from "@toruslabs/customauth";
import { CustomAuth, TorusLoginResponse } from "@toruslabs/customauth";
import dynamic from "next/dynamic";

import {
Expand All @@ -27,7 +27,7 @@ if (typeof window === "object") {

interface IState {
selectedVerifier: string;
torusdirectsdk: TorusSdk | null;
torusdirectsdk: CustomAuth | null;
loginHint: string;
loginResponse?: TorusLoginResponse | null;
}
Expand Down Expand Up @@ -69,7 +69,7 @@ class HomePage extends React.PureComponent<IProps, IState> {
queryParams[key] = url.searchParams.get(key);
}
const { error, instanceParameters } = this.handleRedirectParameters(hash, queryParams);
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: `${window.location.origin}/serviceworker`,
enableLogging: true,
network: "testnet", // details for test net
Expand Down
8 changes: 4 additions & 4 deletions examples/nextjs-app/pages/popupMode/login.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import TorusSdk, { TorusLoginResponse } from "@toruslabs/customauth";
import { CustomAuth, TorusLoginResponse } from "@toruslabs/customauth";
import dynamic from "next/dynamic";
import {
verifierMap,
Expand All @@ -26,7 +26,7 @@ if (typeof window === "object") {

interface IState {
selectedVerifier: string;
torusdirectsdk: TorusSdk | null;
torusdirectsdk: CustomAuth | null;
loginHint: string;
loginDetails?: TorusLoginResponse | null;
}
Expand All @@ -37,15 +37,15 @@ class MyApp extends React.Component<IProps, IState> {
super(props);
this.state = {
selectedVerifier: GOOGLE,
torusdirectsdk: null as TorusSdk | null,
torusdirectsdk: null as CustomAuth | null,
loginHint: "",
loginDetails: null,
};
}

componentDidMount = async () => {
try {
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: `${window.location.origin}/serviceworker`,
enableLogging: true,
network: "testnet", // details for test net
Expand Down
6 changes: 3 additions & 3 deletions examples/nextjs-app/pages/redirectMode/login.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import TorusSdk, { UX_MODE } from "@toruslabs/customauth";
import { CustomAuth, UX_MODE } from "@toruslabs/customauth";

import {
verifierMap,
Expand All @@ -21,7 +21,7 @@ import {

interface IState {
selectedVerifier: string;
torusdirectsdk: TorusSdk | null;
torusdirectsdk: CustomAuth | null;
loginHint: string;
consoleText?: string;
}
Expand All @@ -40,7 +40,7 @@ class RedirectMode extends React.Component<IProps, IState> {

componentDidMount = async () => {
try {
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: window.location.origin,
// user will be redirect to auth page after login
redirectPathName: "auth",
Expand Down
6 changes: 3 additions & 3 deletions examples/react-app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable class-methods-use-this */
import React from "react";
import { Link } from "react-router-dom";
import TorusSdk, { TorusLoginResponse } from "@toruslabs/customauth";
import { CustomAuth, TorusLoginResponse } from "@toruslabs/customauth";
import ReactJsonView from "react-json-view";

import {
Expand All @@ -22,7 +22,7 @@ import {

interface IState {
selectedVerifier: string;
torusdirectsdk: TorusSdk | null;
torusdirectsdk: CustomAuth | null;
loginHint: string;
loginResponse?: TorusLoginResponse | null;
}
Expand Down Expand Up @@ -65,7 +65,7 @@ class HomePage extends React.PureComponent<IProps, IState> {
queryParams[key] = url.searchParams.get(key);
}
const { error, instanceParameters } = this.handleRedirectParameters(hash, queryParams);
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: `${window.location.origin}/serviceworker`,
enableLogging: true,
network: "testnet", // details for test net
Expand Down
6 changes: 3 additions & 3 deletions examples/react-app/src/popupMode/login.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import "../App.css";
import TorusSdk, { TorusLoginResponse } from "@toruslabs/customauth";
import { CustomAuth, TorusLoginResponse } from "@toruslabs/customauth";
import ReactJsonView from "react-json-view";
import {
verifierMap,
Expand All @@ -22,7 +22,7 @@ import {

interface IState {
selectedVerifier: string;
torusdirectsdk: TorusSdk | null;
torusdirectsdk: CustomAuth | null;
loginResponse?: TorusLoginResponse | null;
}

Expand All @@ -40,7 +40,7 @@ class PopupMode extends React.Component<IProps, IState> {

componentDidMount = async () => {
try {
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: `${window.location.origin}/serviceworker`,
enableLogging: true,
network: "testnet", // details for test net
Expand Down
4 changes: 2 additions & 2 deletions examples/react-app/src/redirectMode/auth.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import "../App.css";
import TorusSdk, { RedirectResult } from "@toruslabs/customauth";
import { CustomAuth, RedirectResult } from "@toruslabs/customauth";
import ReactJsonView from "react-json-view";

interface IState {
Expand All @@ -18,7 +18,7 @@ class RedirectAuth extends React.Component<IProps, IState> {
}

async componentDidMount() {
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: window.location.origin,
redirectPathName: "auth",
enableLogging: true,
Expand Down
6 changes: 3 additions & 3 deletions examples/react-app/src/redirectMode/login.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import "../App.css";
import TorusSdk, { UX_MODE } from "@toruslabs/customauth";
import { CustomAuth, UX_MODE } from "@toruslabs/customauth";
import {
verifierMap,
GOOGLE,
Expand All @@ -21,7 +21,7 @@ import {

interface IState {
selectedVerifier: string;
torusdirectsdk: TorusSdk | null;
torusdirectsdk: CustomAuth | null;
consoleText?: string;
}

Expand All @@ -38,7 +38,7 @@ class RedirectMode extends React.Component<IProps, IState> {

componentDidMount = async () => {
try {
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: window.location.origin,
// user will be redirect to auth page after login
redirectPathName: "auth",
Expand Down
6 changes: 3 additions & 3 deletions examples/starkware-react-example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable class-methods-use-this */
import React from "react";
import { Link } from "react-router-dom";
import TorusSdk, { TorusLoginResponse } from "@toruslabs/customauth";
import { CustomAuth, TorusLoginResponse } from "@toruslabs/customauth";
import ReactJsonView from "react-json-view";

import {
Expand All @@ -22,7 +22,7 @@ import {

interface IState {
selectedVerifier: string;
torusdirectsdk: TorusSdk | null;
torusdirectsdk: CustomAuth | null;
loginHint: string;
loginResponse?: TorusLoginResponse | null;
}
Expand Down Expand Up @@ -65,7 +65,7 @@ class HomePage extends React.PureComponent<IProps, IState> {
queryParams[key] = url.searchParams.get(key);
}
const { error, instanceParameters } = this.handleRedirectParameters(hash, queryParams);
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: `${window.location.origin}/serviceworker`,
enableLogging: true,
network: "testnet", // details for test net
Expand Down
6 changes: 3 additions & 3 deletions examples/starkware-react-example/src/popupMode/login.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import "../App.css";
import TorusSdk, { TorusLoginResponse } from "@toruslabs/customauth";
import { CustomAuth, TorusLoginResponse } from "@toruslabs/customauth";

import { getStarkHDAccount, starkEc, sign, verify, pedersen, STARKNET_NETWORKS } from "@toruslabs/openlogin-starkkey";
import { binaryToHex, binaryToUtf8, bufferToBinary, bufferToHex, hexToBinary } from "enc-utils";
Expand All @@ -26,7 +26,7 @@ import {

interface IState {
selectedVerifier: string;
torusdirectsdk: TorusSdk | null;
torusdirectsdk: CustomAuth | null;
loginResponse?: TorusLoginResponse | null;
signingMessage?: string | null;
signedMessage?: ec.Signature | null;
Expand All @@ -48,7 +48,7 @@ class PopupMode extends React.Component<IProps, IState> {

componentDidMount = async () => {
try {
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: `${window.location.origin}/serviceworker`,
enableLogging: true,
network: "testnet", // details for test net
Expand Down
6 changes: 3 additions & 3 deletions examples/starkware-react-example/src/redirectMode/auth.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import "../App.css";
import TorusSdk, { RedirectResult } from "@toruslabs/customauth";
import { CustomAuth, RedirectResult } from "@toruslabs/customauth";
import { getStarkHDAccount, starkEc, sign, verify, pedersen, STARKNET_NETWORKS } from "@toruslabs/openlogin-starkkey";
import { binaryToHex, binaryToUtf8, bufferToBinary, bufferToHex, hexToBinary } from "enc-utils";
import type { ec } from "elliptic";
Expand All @@ -24,7 +24,7 @@ class RedirectAuth extends React.Component<IProps, IState> {
}

async componentDidMount() {
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: window.location.origin,
redirectPathName: "auth",
enableLogging: true,
Expand All @@ -50,7 +50,7 @@ class RedirectAuth extends React.Component<IProps, IState> {
const account = getStarkHDAccount(
((this.state.loginDetails?.result as any)?.privateKey as string).padStart(64, "0"),
index,
STARKNET_NETWORKS.testnet
STARKNET_NETWORKS.testnet,
);
return account;
};
Expand Down
6 changes: 3 additions & 3 deletions examples/starkware-react-example/src/redirectMode/login.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import "../App.css";
import TorusSdk, { UX_MODE } from "@toruslabs/customauth";
import { CustomAuth, UX_MODE } from "@toruslabs/customauth";
import {
verifierMap,
GOOGLE,
Expand All @@ -21,7 +21,7 @@ import {

interface IState {
selectedVerifier: string;
torusdirectsdk: TorusSdk | null;
torusdirectsdk: CustomAuth | null;
consoleText?: string;
}

Expand All @@ -38,7 +38,7 @@ class RedirectMode extends React.Component<IProps, IState> {

componentDidMount = async () => {
try {
const torusdirectsdk = new TorusSdk({
const torusdirectsdk = new CustomAuth({
baseUrl: window.location.origin,
// user will be redirect to auth page after login
redirectPathName: "auth",
Expand Down
Loading