@canvas-js/chain-atp
TypeScript icon, indicating that this package has built-in type declarations

0.10.0-beta.1 • Public • Published

@canvas-js/chain-atp

The Bluesky/AT Protocol session signer prompts the user for an app password, and uses it to generate a new signed post on Bluesky, authenticating a new session. The posted authentication message is then immediately deleted.

It also handles verification of messages matching this authentication method.

Table of Contents

Installation

npm i @canvas-js/chain-atp

API

import type { Action, Message, Session, SessionSigner, Signature } from "@canvas-js/interfaces";
import { Operation } from "./operation.js";

export type ATPSessionData = {
    verificationMethod: string;
    plcOperationLog: Operation[];
    recordArchive: Uint8Array;
    recordURI: string;
};

export interface ATPSignerOptions {
    login?: () => Promise<{
        identifier: string;
        password: string;
    }>;
}

export declare class ATPSigner implements SessionSigner<ATPSessionData> {
    constructor(options?: ATPSignerOptions);

    static createAuthenticationMessage(topic: string, publicKey: string, address: string): string;

    match: (address: string) => boolean;
    verifySession(topic: string, session: Session<ATPSessionData>): Promise<void>;
    getSession(topic: string, options?: {
        chain?: string;
        timestamp?: number;
        fromCache?: boolean;
    }): Promise<Session<ATPSessionData>>;
    sign(message: Message<Action | Session>): Signature;
    clear(topic: string): void;
}

Readme

Keywords

none

Package Sidebar

Install

npm i @canvas-js/chain-atp

Weekly Downloads

183

Version

0.10.0-beta.1

License

none

Unpacked Size

14.8 kB

Total Files

12

Last publish

Collaborators

  • rjwebb
  • joelg
  • raykyri