@particle-network/auth
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -18,2 +18,3 @@ "use strict"; | ||
__exportStar(require("./particle-network"), exports); | ||
__exportStar(require("./utils"), exports); | ||
//# sourceMappingURL=index.js.map |
export * from "./particle-network"; | ||
export type { AuthType, UserInfo, Wallet, supportChains, Config, ChainName, ChainInfo } from "./types"; | ||
export * from "./utils"; |
@@ -12,2 +12,23 @@ export declare class AuthError { | ||
} | ||
export interface RequestArguments { | ||
method: string; | ||
params?: unknown; | ||
} | ||
export interface JsonRpcRequest extends RequestArguments { | ||
id: number | string; | ||
jsonrpc: string; | ||
} | ||
export interface JsonRpcError { | ||
code: number; | ||
message: string; | ||
} | ||
export interface JsonRpcResponse { | ||
id: number | string; | ||
jsonrpc: string; | ||
result?: any; | ||
error?: JsonRpcError; | ||
} | ||
export interface ParticleRpcRequest extends JsonRpcRequest { | ||
chainId: number; | ||
} | ||
export declare type AuthType = "email" | "phone" | "google" | "facebook" | "apple"; | ||
@@ -14,0 +35,0 @@ export interface UserInfo { |
@@ -0,2 +1,3 @@ | ||
export declare function isHttpUrl(url: string): boolean; | ||
export declare function getDeviceId(): string; | ||
export declare function getVersion(): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getVersion = exports.getDeviceId = void 0; | ||
exports.getVersion = exports.getDeviceId = exports.isHttpUrl = void 0; | ||
const uuid_1 = require("uuid"); | ||
const HTTP_REGEX = "^https?:"; | ||
function getUrlProtocol(url) { | ||
const matches = url.match(new RegExp(/^\w+:/, "gi")); | ||
if (!matches || !matches.length) | ||
return; | ||
return matches[0]; | ||
} | ||
function matchRegexProtocol(url, regex) { | ||
const protocol = getUrlProtocol(url); | ||
if (typeof protocol === "undefined") | ||
return false; | ||
return new RegExp(regex).test(protocol); | ||
} | ||
function isHttpUrl(url) { | ||
return matchRegexProtocol(url, HTTP_REGEX); | ||
} | ||
exports.isHttpUrl = isHttpUrl; | ||
function getDeviceId() { | ||
@@ -6,0 +23,0 @@ const storeKey = "pn_device_id"; |
{ | ||
"name": "@particle-network/auth", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"files": [ | ||
@@ -5,0 +5,0 @@ "lib", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
44013
536
0