Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@canvas-js/interfaces

Package Overview
Dependencies
Maintainers
3
Versions
223
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@canvas-js/interfaces - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

2

lib/Action.d.ts
export type Action = {
type: "action";
/** CAIP-2 prefix, e.g. "eip155:1" */
chain: string;
/** CAIP-2 address (without the prefix, e.g. "0xb94d27...") */
address: string;

@@ -5,0 +7,0 @@ name: string;

import type { SignatureType } from "./Signature.js";
/**
* Sessions consist of an ephemeral keypair and some chain-specific
* data representing a user's (temporary) authorization of that
* keypair to sign actions on their behalf.
*/
export type Session<Data = any> = {
type: "session";
/** CAIP-2 prefix, e.g. "eip155:1" for mainnet Ethereum */
chain: string;
/** CAIP-2 address (without the prefix, e.g. "0xb94d27...") */
address: string;
/** ephemeral session key used to sign subsequent actions */
publicKeyType: SignatureType;
publicKey: Uint8Array;
/** chain-specific session payload, e.g. a SIWE message & signature */
data: Data;

@@ -9,0 +18,0 @@ timestamp: number;

@@ -7,2 +7,16 @@ import type { MessageSigner } from "./MessageSigner.js";

match: (chain: string) => boolean;
/**
* `getSession` is called by the Canvas runtime for every new action appended
* to the log (ie for new actions taken by local users, not existing messages
* received from other peers via merkle sync or GossipSub).
*
* It's responsible for returning a `Session` that matches the given parameters,
* either by looking up a cached session, or by getting user authorization to create
* a new one (and then caching it).
*
* "Matching the given parameters" means that the caller passes a `topic: string`
* and an optional `chain?: string; timestamp?: number`, and `getSession` must return
* a `Session` authorized for that topic, that specific chain (if provided), and that
* is valid for the given timestamp (if provided).
*/
getSession: (topic: string, options?: {

@@ -12,3 +26,7 @@ chain?: string;

}) => Awaitable<Session>;
/**
* Verify that `session.data` authorizes `session.publicKey`
* to take actions on behalf of the user `${session.chain}:${session.address}`
*/
verifySession: (session: Session) => Awaitable<void>;
}

4

package.json
{
"name": "@canvas-js/interfaces",
"version": "0.5.0",
"version": "0.5.1",
"type": "module",

@@ -18,4 +18,4 @@ "author": "Canvas Technologies, Inc. (https://canvas.xyz)",

"devDependencies": {
"@canvas-js/chain-ethereum": "0.5.0"
"@canvas-js/chain-ethereum": "0.5.1"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc