# @canvas-js/signer-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.

Latest version **0.16.1** (published 2025-07-30) · 0 weekly downloads

## Install

```sh
npm install @canvas-js/signer-substrate
pnpm add @canvas-js/signer-substrate
yarn add @canvas-js/signer-substrate
bun add @canvas-js/signer-substrate
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.16.1 |
| Published | 2025-07-30 |
| First published | 2025-04-18 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 10 |
| Unpacked size | 14.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Canvas Technologies, Inc. |
| Maintainers | joelg, raykyri, rjwebb |

## Links

- npm: https://www.npmjs.com/package/@canvas-js/signer-substrate
- npm.io page: https://npm.io/package/@canvas-js/signer-substrate

## Dependencies (10)

- [multiformats](https://npm.io/package/multiformats.md) ^13.3.7
- [@noble/hashes](https://npm.io/package/@noble/hashes.md) ^1.8.0
- [@ipld/dag-json](https://npm.io/package/@ipld/dag-json.md) ^10.2.5
- [@libp2p/logger](https://npm.io/package/@libp2p/logger.md) ^5.1.13
- [@canvas-js/utils](https://npm.io/package/@canvas-js/utils.md) 1.0.0
- [@polkadot/keyring](https://npm.io/package/@polkadot/keyring.md) ^12.6.2
- [@canvas-js/interfaces](https://npm.io/package/@canvas-js/interfaces.md) 0.16.1
- [@canvas-js/signatures](https://npm.io/package/@canvas-js/signatures.md) 0.16.1
- [@polkadot/util-crypto](https://npm.io/package/@polkadot/util-crypto.md) ^12.2.1
- [@polkadot/extension-inject](https://npm.io/package/@polkadot/extension-inject.md) ^0.46.3

## Recent versions

- 0.16.1 (latest) — 2025-07-30
- 0.16.0-next.9 (next) — 2025-07-13
- 0.16.0 — 2025-07-08
- 0.16.0-next.8 — 2025-06-26
- 0.16.0-next.7 — 2025-06-25
- 0.16.0-next.6 — 2025-06-25
- 0.16.0-next.5 — 2025-06-18
- 0.16.0-next.4 — 2025-06-18
- 0.16.0-next.3 — 2025-06-13
- 0.16.0-next.2 — 2025-06-13
- 0.16.0-next.1 — 2025-06-13
- 0.16.0-next.0 — 2025-06-13
- 0.15.2-next.0 — 2025-06-11
- 0.15.1 — 2025-06-05
- 0.15.0 — 2025-05-22
- … 16 more at https://npm.io/package/@canvas-js/signer-substrate/versions

## README

# @canvas-js/signer-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](#installation)
- [API](#api)

## Installation

```
npm i @canvas-js/signer-substrate
```

## API

```ts
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>
}
```

---
_Source: https://npm.io/package/@canvas-js/signer-substrate · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
