New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

@canvas-js/chain-ethereum-viem

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@canvas-js/chain-ethereum-viem

The Viem Ethereum signer takes a Viem `WalletClient`, or generates a random WalletClient, and uses it to sign a SIWE message authenticating a new session.

0.13.14
latest
Version published
Weekly downloads
140
28.44%
Maintainers
3
Weekly downloads
 
Created

@canvas-js/chain-ethereum-viem

The Viem Ethereum signer takes a Viem WalletClient, or generates a random WalletClient, and uses it to sign a SIWE message authenticating a new session.

It also handles verification of messages matching this standard, and can be used in conjuction with @canvas-js/chain-ethereum.

Table of Contents

Installation

npm i @canvas-js/chain-ethereum-viem

API

import { WalletClient } from "viem"
import type { Signature, SessionSigner, Action, Message, Session } from "@canvas-js/interfaces"
import type { SIWESessionData } from "./types.js"
export interface SIWESignerViemInit {
  chainId?: number
  signer?: WalletClient
  sessionDuration?: number
}
export declare class SIWESignerViem implements SessionSigner<SIWESessionData> {
  constructor(init?: SIWESignerViemInit)
  readonly match: (address: string) => boolean
  verifySession(topic: string, session: Session<SIWESessionData>): Promise<void>
  getSession(
    topic: string,
    options?: {
      timestamp?: number
      fromCache?: boolean
    },
  ): Promise<Session<SIWESessionData>>
  sign(message: Message<Action | Session>): Signature
  clear(topic: string): Promise<void>
}

FAQs

Package last updated on 29 Jan 2025

Did you know?

Socket

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.

Install

Related posts