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

@canvas-js/interfaces

Package Overview
Dependencies
Maintainers
0
Versions
222
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.10.0-beta.2 to 0.10.0-beta.4

10

lib/Action.d.ts
export type Action = {
type: "action";
/** DID or CAIP-2 address (e.g. "eip155:1:0xb94d27...") */
address: string;
/** DID of the user that authorized the session (e.g. "did:pkh:eip155:1:0xb94d27...") */
did: `did:${string}`;
name: string;
args: any;
timestamp: number;
blockhash: string | null;
context: {
timestamp: number;
blockhash?: string;
};
};

12

lib/Session.d.ts

@@ -8,4 +8,4 @@ /**

type: "session";
/** DID or CAIP-2 address that authorized the session (e.g. "eip155:1:0xb94d27...") */
address: string;
/** DID of the user that authorized the session (e.g. "did:pkh:eip155:1:0xb94d27...") */
did: `did:${string}`;
/** did:key URI of the ephemeral session key used to sign subsequent actions */

@@ -15,5 +15,7 @@ publicKey: string;

authorizationData: AuthorizationData;
blockhash: string | null;
timestamp: number;
duration: number | null;
context: {
timestamp: number;
blockhash?: string;
duration?: number;
};
};

@@ -5,16 +5,21 @@ import type { SignatureScheme, Signer } from "./Signer.js";

import type { Awaitable } from "./Awaitable.js";
export type DidIdentifier = `did:${string}`;
export interface AbstractSessionData {
topic: string;
address: string;
did: DidIdentifier;
publicKey: string;
timestamp: number;
duration: number | null;
context: {
timestamp: number;
duration: number | null;
};
}
export interface SessionSigner<AuthorizationData = any> {
scheme: SignatureScheme<Action | Session<AuthorizationData>>;
match: (address: string) => boolean;
getAddress: () => Awaitable<string>;
hasSession: (topic: string, address: string) => boolean;
match: (did: DidIdentifier) => boolean;
getDid: () => Awaitable<DidIdentifier>;
getDidParts: () => number;
getAddressFromDid: (did: DidIdentifier) => string;
hasSession: (topic: string, did: DidIdentifier) => boolean;
getSession: (topic: string, options?: {
address?: string;
did?: DidIdentifier;
}) => Awaitable<{

@@ -30,3 +35,3 @@ payload: Session<AuthorizationData>;

* Verify that `session.data` authorizes `session.publicKey`
* to take actions on behalf of the user `${session.chain}:${session.address}`
* to take actions on behalf of the user `session.did`
*/

@@ -33,0 +38,0 @@ verifySession: (topic: string, session: Session<AuthorizationData>) => Awaitable<void>;

{
"name": "@canvas-js/interfaces",
"version": "0.10.0-beta.2",
"type": "module",
"author": "Canvas Technologies, Inc. (https://canvas.xyz)",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"lib"
],
"scripts": {
"test": "ava"
},
"dependencies": {
"multiformats": "^13.0.1"
},
"devDependencies": {
"@canvas-js/chain-cosmos": "0.10.0-beta.2",
"@canvas-js/chain-ethereum": "0.10.0-beta.2",
"@canvas-js/chain-ethereum-viem": "0.10.0-beta.2",
"@canvas-js/chain-solana": "0.10.0-beta.2",
"@canvas-js/chain-substrate": "0.10.0-beta.2",
"@canvas-js/interfaces": "0.10.0-beta.2",
"@canvas-js/signatures": "0.10.0-beta.2",
"@cosmjs/amino": "^0.32.3",
"@noble/curves": "^1.4.0"
}
"name": "@canvas-js/interfaces",
"version": "0.10.0-beta.4",
"type": "module",
"author": "Canvas Technologies, Inc. (https://canvas.xyz)",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"files": [
"lib"
],
"scripts": {
"test": "ava"
},
"devDependencies": {
"@cosmjs/amino": "^0.32.3",
"@noble/curves": "^1.4.0"
}
}

@@ -65,3 +65,3 @@ # @canvas-js/interfaces

/** DID or CAIP-2 address (e.g. "eip155:1:0xb94d27...") */
/** DID of the user that authorized the session (e.g. "did:pkh:eip155:1:0xb94d27...") */
address: string

@@ -72,4 +72,6 @@

timestamp: number
blockhash: string | null
context: {
timestamp: number
blockhash?: string
}
}

@@ -81,6 +83,6 @@ ```

```ts
export type Session<Data = any> = {
export type Session<AuthorizationData = any> = {
type: "session"
/** DID or CAIP-2 address (e.g. "eip155:1:0xb94d27...") */
/** DID of the user that authorized the session (e.g. "did:pkh:eip155:1:0xb94d27...") */
address: string

@@ -94,5 +96,7 @@

blockhash: string | null
timestamp: number
duration: number | null
context: {
blockhash?: string
duration?: number
timestamp: number
}
}

@@ -99,0 +103,0 @@ ```

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