@ucanto/principal
Version:
ucanto principal
86 lines • 2.77 kB
TypeScript
/**
* @type {API.MulticodecCode<0xeb, 'BLS12-381'>}
* @see https://w3c-ccg.github.io/did-method-key/#bls-12381
*/
export const code: API.MulticodecCode<0xeb, 'BLS12-381'>;
export const name: "BLS12-381";
/**
* @type {API.MulticodecCode<0xd0eb, 'BLS12381G2'>}
*/
export const signatureCode: API.MulticodecCode<0xd0eb, 'BLS12381G2'>;
export const signatureAlgorithm: "BLS12381G2";
export const SIGNATURE_SIZE: number;
export const KEY_PREFIX: Uint8Array;
export const SIZE: number;
export function parse(did: API.DID | string): API.BLSVerifier;
export function format(principal: API.Principal<API.DID>): `did:${string}:${string}`;
export function encode(principal: API.Principal<API.DID<"key">>): API.UCAN.PrincipalView<`did:key:${string}`>;
export namespace SIGNATURES {
const BLS: "3";
}
export namespace NETWORKS {
const mainnet: "f";
const testnet: "t";
}
export function fromFilecoinAddress(address: string): API.BLSVerifier;
export function decode(bytes: Uint8Array): API.BLSVerifier;
import * as API from './type.js';
import * as DID from '@ipld/dag-ucan/did';
/**
* @implements {API.BLSVerifier}
*/
declare class BLSVerifier implements API.BLSVerifier {
/**
* @param {Uint8Array} bytes
*/
constructor(bytes: Uint8Array);
bytes: Uint8Array;
/**
* @type {typeof code}
*/
get code(): API.MulticodecCode<235, "BLS12-381">;
/**
* @type {typeof signatureCode}
*/
get signatureCode(): API.MulticodecCode<53483, "BLS12381G2">;
/**
* @type {typeof signatureAlgorithm}
*/
get signatureAlgorithm(): "BLS12381G2";
/**
* Raw public key without a multiformat code.
*
* @readonly
*/
readonly get publicKey(): Uint8Array;
_publicKey: Uint8Array | undefined;
/**
* DID of the Principal in `did:key` format.
* @returns {API.DID<"key">}
*/
did(): API.DID<"key">;
/**
* @template T
* @param {API.ByteView<T>} payload
* @param {API.Signature<T, Signature.BLS12381G2>} signature
* @returns {API.Await<boolean>}
*/
verify<T>(payload: API.ByteView<T>, signature: API.Signature<T, 53483>): API.Await<boolean>;
/**
* @template {API.DID} ID
* @param {ID} id
* @returns {API.Verifier<ID, typeof signatureCode>}
*/
withDID<ID extends `did:${string}:${string}`>(id: ID): API.Verifier<ID, API.MulticodecCode<53483, "BLS12381G2">>;
toDIDKey(): `did:key:${string}`;
/**
* @param {typeof NETWORKS[keyof NETWORKS]} network
*/
toFilecoinAddress(network?: (typeof NETWORKS)[keyof {
readonly mainnet: "f";
readonly testnet: "t";
}]): string;
}
import * as Signature from '@ipld/dag-ucan/signature';
export {};
//# sourceMappingURL=verifier.d.ts.map