ontology-ts-sdk
Version:
Comprehensive TypeScript library for the Ontology blockchain.
50 lines (49 loc) • 1.46 kB
TypeScript
import { SignatureScheme } from './SignatureScheme';
/**
* Signature generated by signing data with Private Key.
*/
export declare class Signature {
static deserializeJWT(encoded: string, algorithm: SignatureScheme, publicKeyId: string): Signature;
/**
* Deserializes PgpSignature to Signature.
* @param pgpSignature PgpSignature
*/
static deserializePgp(pgpSignature: PgpSignature): Signature;
/**
* Deserializes hex representation to Signature
* @param data hex string
*/
static deserializeHex(data: string): Signature;
algorithm: SignatureScheme;
value: string;
/**
* Public key Id used for create this signature.
*
*/
publicKeyId?: string;
constructor(algorithm: SignatureScheme, value: string, publicKeyId?: string);
/**
* Serializes signature to Hex representation.
* For transfer to java backend and verify it.
*/
serializeHex(): string;
/**
* Serializes signature to PGP representation with optional PublicKeyId.
*
* @param keyId Whole Public Key Id in the form <ONTID>#keys-<id>
*/
serializePgp(keyId?: string): PgpSignature;
/**
* Serializes signature to base64url format.
*/
serializeJWT(): string;
}
/**
* PGP representation of the signature with embedded KeyId
*/
export interface PgpSignature {
PublicKeyId?: string;
Format: 'pgp';
Algorithm: string;
Value: string;
}