
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
@canvas-js/interfaces
Advanced tools
This package exports TypeScript types for Canvas messages and other interfaces.
This package exports TypeScript types for Canvas messages and other interfaces.
npm i @canvas-js/interfaces
import type { CID } from "multiformats"
export type Signature = {
publicKey: string
signature: Uint8Array
cid: CID
}
import type { Signature } from "./Signature.js"
export interface Signer<T = any> {
sign(value: T): Signature
}
export type Message<Payload = unknown> = {
topic: string
clock: number
parents: string[]
payload: Payload
}
export type Action = {
type: "action"
/** DID of the user that authorized the session (e.g. "did:pkh:eip155:1:0xb94d27...") */
address: string
name: string
args: any
context: {
timestamp: number
blockhash?: string
}
}
export type Session<AuthorizationData = any> = {
type: "session"
/** DID of the user that authorized the session (e.g. "did:pkh:eip155:1:0xb94d27...") */
address: string
/** did:key URI of the ephemeral session key used to sign subsequent actions */
publicKey: string
/** signer-specific session payload, e.g. a SIWE message & signature */
authorizationData: AuthorizationData
context: {
blockhash?: string
duration?: number
timestamp: number
}
}
import type { Signer } from "./Signer.js"
import type { Message } from "./Message.js"
import type { Session } from "./Session.js"
import type { Action } from "./Action.js"
import type { Awaitable } from "./Awaitable.js"
export interface SessionSigner extends Signer<Action | Session> {
match: (chain: string) => boolean
/**
* Produce an signed Session object, which authorizes `session.publicKey`
* to represent the user `${session.chain}:${session.address}`.
*
* The signature is stored in `session.data`, and the entire Session
* object is then signed using the session-key, and appended to our message log.
*/
getSession: (topic: string, options?: { chain?: string; timestamp?: number }) => 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>
}
Awaitable
export type Awaitable<T> = T | Promise<T>
FAQs
This package exports TypeScript types for Canvas messages and other interfaces.
The npm package @canvas-js/interfaces receives a total of 615 weekly downloads. As such, @canvas-js/interfaces popularity was classified as not popular.
We found that @canvas-js/interfaces demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.