UNPKG

@ucanto/principal

Version:
81 lines 2.89 kB
/** @type {API.MulticodecCode<0x1309, 'bls12-381-private-key'>} */ export const code: API.MulticodecCode<0x1309, 'bls12-381-private-key'>; export const name: "BLS12-381"; export const PREFIX: Uint8Array; export const SIZE: 32; export const signatureCode: API.MulticodecCode<53483, "BLS12381G2">; export const signatureAlgorithm: "BLS12381G2"; export function generate(): Promise<API.BLSSigner>; export function from({ id, keys }: API.SignerArchive<API.DID, typeof signatureCode>): API.BLSSigner; export function decode(bytes: Uint8Array): API.BLSSigner; export function encode(signer: API.BLSSigner): API.ByteView<API.BLSSigner & CryptoKeyPair>; export function format<Prefix extends string>(signer: API.BLSSigner, encoder?: API.MultibaseEncoder<Prefix> | undefined): import("multiformats").Multibase<Prefix>; export function parse<Prefix extends string>(principal: string, decoder?: API.MultibaseDecoder<Prefix> | undefined): API.BLSSigner; export function fromFilecoinWallet(archive: string): API.BLSSigner; import * as API from './type.js'; /** * @implements {API.BLSSigner} */ declare class BLSSigner implements API.BLSSigner { /** * * @param {Uint8Array} bytes */ constructor(bytes: Uint8Array); bytes: Uint8Array; /** * Raw public key without multiformat code. */ secret: Uint8Array; /** @type {API.BLSVerifier|undefined} */ _verifier: API.BLSVerifier | undefined; /** * @type {typeof code} */ get code(): API.MulticodecCode<4873, "bls12-381-private-key">; /** * @type {API.BLSSigner} */ get signer(): API.BLSSigner; /** * @type {API.BLSVerifier} */ get verifier(): API.BLSVerifier; /** * DID of this principal in `did:key` format. */ did(): `did:key:${string}`; toDIDKey(): `did:key:${string}`; /** * @template {API.DID} ID * @param {ID} id * @returns {API.Signer<ID, API.SigAlg>} */ withDID<ID extends `did:${string}:${string}`>(id: ID): API.Signer<ID, API.SigAlg>; /** * @template T * @param {API.ByteView<T>} payload * @returns {Promise<API.SignatureView<T, API.SigAlg>>} */ sign<T>(payload: API.ByteView<T>): Promise<API.SignatureView<T, API.SigAlg>>; /** * @template T * @param {API.ByteView<T>} payload * @param {API.Signature<T, API.SigAlg>} signature */ verify<T_1>(payload: API.ByteView<T_1>, signature: API.Signature<T_1, API.SigAlg>): API.Crypto.Await<boolean>; /** @type {typeof signatureAlgorithm} */ get signatureAlgorithm(): "BLS12381G2"; /** @type {typeof Signature.BLS12381G2} */ get signatureCode(): 53483; encode(): Uint8Array; toArchive(): { id: `did:key:${string}`; keys: { [x: string]: Uint8Array; }; }; toFilecoinWallet(): string; } export {}; //# sourceMappingURL=signer.d.ts.map