@manifoldxyz/frontend-provider-types
Advanced tools
Comparing version 1.0.1-beta.1 to 1.1.0
import { Contract, ContractFactory } from '@ethersproject/contracts'; | ||
import { ExternalProvider, JsonRpcProvider, Web3Provider } from '@ethersproject/providers'; | ||
import { EthereumNetwork } from './network'; | ||
import { OAuthOptions } from './oAuth'; | ||
import { IOAuthSignatureHandler, OAuthOptions } from './oAuth'; | ||
/** | ||
@@ -213,2 +213,17 @@ * @dev InitializeOptions are the options that can be passed to initialize | ||
static getOAuth(options: OAuthOptions): Promise<string | null>; | ||
/** | ||
* Retrieve and validate an existing oauth token for the current user. If there is | ||
* no oauth token, the user will not be prompted to authenticate. Useful for checking if a user | ||
* is currently authenticated or not. This is the same as calling `getOAuth` with `delayAuth` set to true. | ||
*/ | ||
static getOAuthReadOnly(strictAuth?: boolean): Promise<string | null>; | ||
/** | ||
* Get an OAuthSignatureHandler instance, particular for modular authentication | ||
* e.g. an integration with Rainbowkit | ||
* | ||
* @returns the oauth token for the current user | ||
* @throws 'Custom `message` can only be used with the `signature` grant type' | ||
* @throws `Invalid grant type` if grant type is not `signature` or `token` | ||
*/ | ||
static OAuthSignatureHandler: new (options: Omit<OAuthOptions, 'grantType'>) => IOAuthSignatureHandler; | ||
} |
@@ -0,1 +1,2 @@ | ||
import { JsonRpcProvider } from '@ethersproject/providers'; | ||
/** | ||
@@ -27,3 +28,9 @@ * Refer to our documentation at https://docs.manifold.xyz/v/manifold-for-developers/resources/apps/grant-types#signature-grant to learn more about Grant Type | ||
delayAuth?: boolean; | ||
userCallback?: (message: string) => Promise<void>; | ||
userCallback?: (message: string) => Promise<string>; | ||
} | ||
export interface IOAuthSignatureHandler { | ||
getOneTimeUseCode(): Promise<string>; | ||
formatMessage(oneTimeUseCode: string): string; | ||
getAccessToken(oneTimeUseCode: string, message: string, signature: string, chainId: number): Promise<string>; | ||
signMessage(message: string, provider: JsonRpcProvider): Promise<string>; | ||
} |
{ | ||
"name": "@manifoldxyz/frontend-provider-types", | ||
"version": "1.0.1-beta.1", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "typings": "./dist/index.d.ts", |
import { Contract, ContractFactory } from '@ethersproject/contracts'; | ||
import { ExternalProvider, JsonRpcProvider, Web3Provider } from '@ethersproject/providers'; | ||
import { EthereumNetwork } from './network'; | ||
import { OAuthOptions } from './oAuth'; | ||
import { IOAuthSignatureHandler, OAuthOptions } from './oAuth'; | ||
@@ -242,2 +242,21 @@ /** | ||
public static getOAuth(options: OAuthOptions): Promise<string | null>; | ||
/** | ||
* Retrieve and validate an existing oauth token for the current user. If there is | ||
* no oauth token, the user will not be prompted to authenticate. Useful for checking if a user | ||
* is currently authenticated or not. This is the same as calling `getOAuth` with `delayAuth` set to true. | ||
*/ | ||
public static getOAuthReadOnly(strictAuth?: boolean): Promise<string | null>; | ||
/** | ||
* Get an OAuthSignatureHandler instance, particular for modular authentication | ||
* e.g. an integration with Rainbowkit | ||
* | ||
* @returns the oauth token for the current user | ||
* @throws 'Custom `message` can only be used with the `signature` grant type' | ||
* @throws `Invalid grant type` if grant type is not `signature` or `token` | ||
*/ | ||
public static OAuthSignatureHandler: new ( | ||
options: Omit<OAuthOptions, 'grantType'> | ||
) => IOAuthSignatureHandler; | ||
} |
@@ -0,1 +1,3 @@ | ||
import { JsonRpcProvider } from '@ethersproject/providers'; | ||
/** | ||
@@ -28,3 +30,15 @@ * Refer to our documentation at https://docs.manifold.xyz/v/manifold-for-developers/resources/apps/grant-types#signature-grant to learn more about Grant Type | ||
delayAuth?: boolean; | ||
userCallback?: (message: string) => Promise<void>; | ||
userCallback?: (message: string) => Promise<string>; | ||
} | ||
export interface IOAuthSignatureHandler { | ||
getOneTimeUseCode(): Promise<string>; | ||
formatMessage(oneTimeUseCode: string): string; | ||
getAccessToken( | ||
oneTimeUseCode: string, | ||
message: string, | ||
signature: string, | ||
chainId: number | ||
): Promise<string>; | ||
signMessage(message: string, provider: JsonRpcProvider): Promise<string>; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
34473
749
1