@river-build/sdk
Version:
For more details, visit the following resources:
41 lines • 3.3 kB
TypeScript
/// <reference types="node" />
import { Envelope, EventRef, StreamEvent, Miniblock, StreamAndCookie, Tags, PlainMessage } from '@river-build/proto';
import { ParsedEvent, ParsedMiniblock, ParsedStreamAndCookie, ParsedStreamResponse } from './types';
import { SignerContext } from './signerContext';
export interface UnpackEnvelopeOpts {
disableHashValidation?: boolean;
disableSignatureValidation?: boolean;
}
export declare const _impl_makeEvent_impl_: (context: SignerContext, payload: PlainMessage<StreamEvent>['payload'], prevMiniblockHash?: Uint8Array, tags?: PlainMessage<Tags>) => Promise<Envelope>;
export declare const makeEvent: (context: SignerContext, payload: PlainMessage<StreamEvent>['payload'], prevMiniblockHash?: Uint8Array, tags?: PlainMessage<Tags>) => Promise<Envelope>;
export declare const makeEvents: (context: SignerContext, payloads: PlainMessage<StreamEvent>['payload'][], prevMiniblockHash?: Uint8Array) => Promise<Envelope[]>;
export declare const unpackStream: (stream: StreamAndCookie | undefined, opts: UnpackEnvelopeOpts | undefined) => Promise<ParsedStreamResponse>;
export declare const unpackStreamEx: (miniblocks: Miniblock[], opts: UnpackEnvelopeOpts | undefined) => Promise<ParsedStreamResponse>;
export declare const unpackStreamAndCookie: (streamAndCookie: StreamAndCookie, opts: UnpackEnvelopeOpts | undefined) => Promise<ParsedStreamAndCookie>;
export declare const unpackMiniblock: (miniblock: Miniblock, opts: UnpackEnvelopeOpts | undefined) => Promise<ParsedMiniblock>;
export declare const unpackEnvelope: (envelope: Envelope, opts: UnpackEnvelopeOpts | undefined) => Promise<ParsedEvent>;
export declare function checkEventSignature(event: {
creatorAddress: Uint8Array;
delegateSig: Uint8Array;
delegateExpiryEpochMs: bigint;
}, hash: Uint8Array, signature: Uint8Array): void;
export declare function makeParsedEvent(event: StreamEvent, hash: Uint8Array | undefined, signature: Uint8Array | undefined): {
event: StreamEvent;
hash: Uint8Array;
hashStr: string;
signature: Uint8Array | undefined;
creatorUserId: string;
};
export declare const unpackEnvelopes: (event: Envelope[], opts: UnpackEnvelopeOpts | undefined) => Promise<ParsedEvent[]>;
export declare const unpackStreamEnvelopes: (stream: StreamAndCookie, opts: UnpackEnvelopeOpts | undefined) => Promise<ParsedEvent[]>;
export declare const makeEventRef: (streamId: string | Uint8Array, event: Envelope) => EventRef;
export declare function riverHash(data: Uint8Array): Uint8Array;
export declare function riverDelegateHashSrc(devicePublicKey: Uint8Array, expiryEpochMs: bigint): Uint8Array;
export declare function notificationServiceHash(userId: Uint8Array, expiration: bigint, // unix seconds
challenge: Uint8Array): Buffer;
export declare function riverSign(hash: Uint8Array, privateKey: Uint8Array | string): Promise<Uint8Array>;
export declare function riverVerifySignature(hash: Uint8Array, signature: Uint8Array, publicKey: Uint8Array | string): boolean;
export declare function riverRecoverPubKey(hash: Uint8Array, signature: Uint8Array): Uint8Array;
export declare function publicKeyToAddress(publicKey: Uint8Array): Uint8Array;
export declare function publicKeyToUint8Array(publicKey: string): Uint8Array;
//# sourceMappingURL=sign.d.ts.map