
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@arcana/auth
Advanced tools
npm install --save @arcana/auth
yarn add @arcana/auth
<script src="https://cdn.jsdelivr.net/npm/@arcana/auth"></script>
<script src="https://unpkg.com/@arcana/auth"></script>
const { AuthProvider } = window.arcana.auth
// or
import { AuthProvider } from '@arcana/auth'
import { AppMode } from '@arcana/auth'
const auth = new AuthProvider(`${appId}`)
const position = 'left' // values - 'left' or 'right'
await auth.init({ appMode: AppMode.Widget, position })
provider = auth.provider
// or
provider = window.arcana.provider
// or
provider = window.ethereum
Social login
await auth.loginWithSocial(`${verifier}`)
Email link login
await auth.loginWithLink(`${email}`)
Check is logged in
const loggedIn = await auth.isLoggedIn()
User Info
const info = await auth.getUser()
/*
interface UserInfo {
id: string
email?: string
name?: string
picture?: string
}
*/
Logout
await auth.logout()
await auth.getPublicKey(`${email}`)
import { encryptWithPublicKey } from '@arcana/auth'
encryptWithPublicKey({
publicKey: '',
message: 'test-message',
}).then((ciphertext) => {
// Do something with ciphertext
})
import { computeAddress } from '@arcana/auth'
const address = computeAddress(publicKey: string);
Subscribing
provider.on('chainChanged', handler: (chainId: number) => void);
provider.on('accountsChanged', handler: (accounts: string[]) => void);
provider.on('connect', handler: ({ chainId: number }) => void);
provider.isConnected(): Promise<boolean>;
Unsubscribing
provider.removeListener(`${eventName}`, handler)
Installation
npm install --save ethers
Usage
import { ethers } from 'ethers'
const provider = new ethers.providers.Web3Provider(auth.provider)
const signer = provider.getSigner()
const signedMessage = await signer.signMessage('sample_message')
Installation
npm install --save web3
Usage
import Web3 from 'web3'
const provider = new Web3(auth.provider)
const signer = provider.getSigner()
const signedMessage = await signer.signMessage('sample_message')
provider.request({ method: 'eth_accounts' }).then((accounts) => {
// Set default account to accounts[0]
from = accounts[0]
})
provider
.request({
method: 'eth_sign',
params: [from, 'some_random_data'],
})
.then((signature) => {
// Use signature
})
provider
.request({
method: 'personal_sign',
params: ['some personal signing data', from],
})
.then((personalSignature) => {
// Use personal signature
})
provider
.request({
method: 'eth_getEncryptionPublicKey',
params: [from],
})
.then((publicKey) => {
// Use public key
})
provider
.request({
method: 'eth_decrypt',
params: [ciphertext, from],
})
.then((plaintext) => {
// Use plaintext
})
provider
.request({
method: 'eth_signTypedData_v4',
params: [from, msgParams],
})
.then((signature) => {
// Use signature
})
FAQs
Arcana Auth
The npm package @arcana/auth receives a total of 615 weekly downloads. As such, @arcana/auth popularity was classified as not popular.
We found that @arcana/auth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.