@canvas-js/chain-substrate
TypeScript icon, indicating that this package has built-in type declarations

0.12.5 • Public • Published

@canvas-js/chain-substrate

The Substrate session signer takes an injected polkadot-js extension, or generates a random Substrate keypair, and uses it to authenticate a new session.

It also handles verification of messages matching this authentication method.

Table of Contents

Installation

npm i @canvas-js/chain-atp

API

import type { Signature, SessionSigner, Action, Message, Session } from "@canvas-js/interfaces"
import { InjectedExtension } from "@polkadot/extension-inject/types"
import { KeypairType } from "@polkadot/util-crypto/types"
import type { SubstrateSessionData } from "./types.js"
type SubstrateSignerInit = {
  sessionDuration?: number
  extension?: InjectedExtension
  substrateKeyType?: KeypairType
}
export declare class SubstrateSigner implements SessionSigner {
  constructor(init?: SubstrateSignerInit)
  readonly match: (address: string) => boolean
  verifySession(topic: string, session: Session): Promise<void>
  getSession(
    topic: string,
    options?: {
      chain?: string
      timestamp?: number
      fromCache?: boolean
    },
  ): Promise<Session<SubstrateSessionData>>
  sign(message: Message<Action | Session | Snapshot>): Signature
  clear(topic: string): Promise<void>
}

Readme

Keywords

none

Package Sidebar

Install

npm i @canvas-js/chain-substrate

Weekly Downloads

193

Version

0.12.5

License

none

Unpacked Size

15 kB

Total Files

10

Last publish

Collaborators

  • rjwebb
  • joelg
  • raykyri