tickethead-sdk
Version:
SDK for the Tickethead API
48 lines • 2.33 kB
TypeScript
import { KJUR } from 'jsrsasign';
export declare function extractEnrollment(certificate: string): string;
/**
* @param payload String which is signed
* @param privateKey Contains the private key of an ECDSA pair
* @returns hex encoded string of the signature
*/
export declare function sign(payload: string, privateKey: string | KJUR.crypto.ECDSA): string;
/**
* @param payload String which is signed
* @param privateKey Contains the private key of an ECDSA pair
* @returns hex encoded string of the signature
*/
export declare function signNative(payload: string, privateKey: string, crypto: Crypto): string;
/**
* @param payload String which is signed
* @param privateKey Contains the private key of an ECDSA pair
* @returns hex encoded string of the signature
*/
export declare function signWithFallback(payload: string, privateKey: string | KJUR.crypto.ECDSA): Promise<string>;
/**
* @param payload The payload whose signature is verified
* @param signature The signature for the payload
* @param publicKey Contains the public key of an ECDSA pair
* @return true if the signature is valid
*/
export declare function verify(payload: string, signature: string, publicKey: string | KJUR.crypto.ECDSA): boolean;
type Crypto = typeof import('crypto');
/**
* @param payload The payload whose signature is verified
* @param signature The signature for the payload
* @param publicKey Contains the public key of an ECDSA pair
* @return true if the signature is valid
*/
export declare function verifyWithFallback(payload: string, signature: string, publicKey: string | KJUR.crypto.ECDSA): Promise<boolean>;
/**
* Verifies the signature of a message using a PEM-encoded ECDSA public key.
*
* @param {string} message - The original message (plaintext) that was signed.
* @param {string} signature - The signature to verify as a hex-encoded string
* @param {string} publicKeyPem - The PEM-encoded ECDSA public key.
* @param {Crypto} crypto - The `crypto` library export
* @returns {boolean} - True if the signature is valid, false otherwise.
* @throws Error if the algorithm for the key is not supported by the crypto library
*/
export declare function verifyNative(message: string, signature: string, publicKeyPem: string, crypto: Crypto): boolean;
export {};
//# sourceMappingURL=certificate.d.ts.map