UNPKG

bam-ticketing-sdk

Version:

SDK for B.A.M Ticketing API

51 lines 2.29 kB
import { KJUR } from 'jsrsasign'; import { TickedIds } from '..'; /** * Encodes the payload and the signature into the expected QR code payload * * @param payload JSON stringified payload * @param signatureHex Hex encoded signature of the payload * @returns base 45 encoded string */ export declare function encodeQrPayload(payload: string, signatureHex: string): string; /** * Decode a base 45 encoded QR code payload * * @param encodedPayload what you scanned from the QR code * @returns payload and its signature */ export declare function decodeQrPayload(encodedPayload: string): { payload: string; signature: string; }; /** * Signs and encodes ticket data into the string which will be put in the QR code * * @param eventId event to which the ticket belongs * @param ticketConfigId ticket config of the ticket * @param sequenceNumber the serial number of the ticket * @param privateKey the private key which is used to sign the ticket * @returns string to display as a tickets QR code */ export declare function createQrPayloadForTicket(eventId: number, ticketConfigId: number, sequenceNumber: number, privateKey: string | KJUR.crypto.ECDSA): string; /** * Decodes, verifies the signature of the QR code payload and constructs the blockchain * function call to invalidate the ticket * * @param qrCodePayload content of the QR code * @param invalidationDate the time at which the ticket was scanned * @param publicKey key used to verify the ticket signature, if specified * @returns blockchain function call for ticket invalidation * @throws Error if the signature does not match the payload */ export declare function qrToTicketInvalidateCall(qrCodePayload: string, invalidationDate: Date, publicKey?: string | KJUR.crypto.ECDSA): import("..").BlockchainFunctionParams<import("..").InvalidateTicket>; /** * Decodes and verifies the signature of the QR code payload and returns the IDs * * @param qrCodePayload content of the QR code * @param publicKey key used to verify the ticket signature, if specified * @returns ticket IDs * @throws Error if the signature does not match the payload */ export declare function qrToTicketData(qrCodePayload: string, publicKey?: string | KJUR.crypto.ECDSA): TickedIds; //# sourceMappingURL=qr.d.ts.map