New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@canvas-js/signatures

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@canvas-js/signatures - npm Package Compare versions

Comparing version 0.13.10 to 0.13.11

15

lib/AbstractSessionSigner.d.ts

@@ -6,3 +6,3 @@ import { Logger } from "@libp2p/logger";

}
export declare abstract class AbstractSessionSigner<AuthorizationData, WalletAddress extends string = string> implements SessionSigner<AuthorizationData> {
export declare abstract class AbstractSessionSigner<AuthorizationData, WalletAddress extends string = string, AuthorizationContext = never> implements SessionSigner<AuthorizationData> {
#private;

@@ -27,3 +27,11 @@ readonly key: string;

getWalletAddress(): Promise<WalletAddress>;
/**
* Get a new Session<AuthorizationData> by asking the signer's wallet to
* produce an authorization signature.
*/
abstract authorize(data: AbstractSessionData): Awaitable<Session<AuthorizationData>>;
/**
* Start a new session, either by requesting a signature from a wallet right now,
* or by using a provided AuthorizationData and timestamp (for services like Farcaster).
*/
newSession(topic: string): Promise<{

@@ -33,2 +41,7 @@ payload: Session<AuthorizationData>;

}>;
/**
* Create and validate a Session<AuthorizationData> from a preexisting, externally
* provided AuthorizationData.
*/
getSessionFromAuthorizationData(data: AbstractSessionData, authorizationData: AuthorizationData): Promise<Session<AuthorizationData>>;
getSession(topic: string, options?: {

@@ -35,0 +48,0 @@ did?: string;

@@ -28,4 +28,5 @@ import * as json from "@ipld/dag-json";

}
/*
* Create a new session and cache it for the given `topic`.
/**
* Start a new session, either by requesting a signature from a wallet right now,
* or by using a provided AuthorizationData and timestamp (for services like Farcaster).
*/

@@ -35,3 +36,3 @@ async newSession(topic) {

const did = await this.getDid();
const session = await this.authorize({
const sessionData = {
topic,

@@ -44,3 +45,4 @@ did,

},
});
};
const session = await this.authorize(sessionData);
const key = `canvas/${topic}/${did}`;

@@ -51,2 +53,18 @@ this.#cache.set(key, { session, signer });

}
/**
* Create and validate a Session<AuthorizationData> from a preexisting, externally
* provided AuthorizationData.
*/
async getSessionFromAuthorizationData(data, authorizationData) {
const { did, publicKey, topic, context: { duration, timestamp }, } = data;
const session = {
type: "session",
did: did,
publicKey: publicKey,
authorizationData,
context: duration ? { duration, timestamp } : { timestamp },
};
await this.verifySession(topic, session);
return session;
}
/*

@@ -53,0 +71,0 @@ * Get an existing session for `topic`. You may also provide a specific DID to check

6

package.json
{
"name": "@canvas-js/signatures",
"version": "0.13.10",
"version": "0.13.11",
"author": "Canvas Technologies, Inc. (https://canvas.xyz)",

@@ -27,4 +27,4 @@ "type": "module",

"dependencies": {
"@canvas-js/interfaces": "0.13.10",
"@canvas-js/utils": "0.13.10",
"@canvas-js/interfaces": "0.13.11",
"@canvas-js/utils": "0.13.11",
"@ipld/dag-cbor": "^9.2.2",

@@ -31,0 +31,0 @@ "@ipld/dag-json": "^10.2.3",

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