@canvas-js/chain-cosmos
Advanced tools
Comparing version 0.8.15 to 0.8.16
@@ -10,2 +10,3 @@ import type { Signature, SessionSigner, Action, Message, Session } from "@canvas-js/interfaces"; | ||
#private; | ||
readonly key: string; | ||
readonly sessionDuration: number | null; | ||
@@ -12,0 +13,0 @@ private readonly log; |
@@ -44,2 +44,3 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
this.sessionDuration = sessionDuration ?? null; | ||
this.key = `CosmosSigner-${signer ? "signer-" + signer.type : "burner"}`; | ||
} | ||
@@ -46,0 +47,0 @@ async verifySession(topic, session) { |
{ | ||
"name": "@canvas-js/chain-cosmos", | ||
"version": "0.8.15", | ||
"version": "0.8.16", | ||
"type": "module", | ||
@@ -19,4 +19,4 @@ "author": "Canvas Technologies, Inc. (https://canvas.xyz)", | ||
"dependencies": { | ||
"@canvas-js/interfaces": "0.8.15", | ||
"@canvas-js/signed-cid": "0.8.15", | ||
"@canvas-js/interfaces": "0.8.16", | ||
"@canvas-js/signed-cid": "0.8.16", | ||
"@cosmjs/amino": "^0.30.1", | ||
@@ -23,0 +23,0 @@ "@cosmjs/crypto": "^0.30.1", |
# @canvas-js/chain-cosmos | ||
TBD | ||
The Cosmos session signer takes an injected Cosmos signer, which may be an `EthereumSigner`, `AminoSigner`, or `BytesSigner`, and uses it to authenticate a new session. | ||
It also handles verification of messages matching any of these authentication methods. | ||
## Table of Contents | ||
- [Installation](#installation) | ||
- [API](#api) | ||
## Installation | ||
``` | ||
npm i @canvas-js/chain-cosmos | ||
``` | ||
## API | ||
```ts | ||
import type { Signature, SessionSigner, Action, Message, Session } from "@canvas-js/interfaces"; | ||
import { CosmosSessionData, ExternalCosmosSigner } from "./types.js"; | ||
export interface CosmosSignerInit { | ||
signer?: ExternalCosmosSigner; | ||
sessionDuration?: number; | ||
bech32Prefix?: string; | ||
} | ||
export declare class CosmosSigner implements SessionSigner { | ||
constructor({ signer, sessionDuration, bech32Prefix }?: CosmosSignerInit); | ||
readonly match: (address: string) => boolean; | ||
verifySession(topic: string, session: Session): Promise<void>; | ||
getSession(topic: string, options?: { | ||
timestamp?: number; | ||
fromCache?: boolean; | ||
}): Promise<Session<CosmosSessionData>>; | ||
sign(message: Message<Action | Session>): Signature; | ||
clear(topic: string): Promise<void>; | ||
} | ||
``` |
30429
668
40
+ Added@canvas-js/interfaces@0.8.16(transitive)
+ Added@canvas-js/signed-cid@0.8.16(transitive)
- Removed@canvas-js/interfaces@0.8.15(transitive)
- Removed@canvas-js/signed-cid@0.8.15(transitive)
Updated@canvas-js/interfaces@0.8.16
Updated@canvas-js/signed-cid@0.8.16