Merge pull request #48 from ChainSafe/cayman/secretKeyToPublicKey
Add secretKeyToPublicKey function
This commit is contained in:
commit
380487e410
|
@ -106,6 +106,14 @@ export function functionalInterfaceFactory({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Computes a public key from a secret key
|
||||||
|
*/
|
||||||
|
function secretKeyToPublicKey(secretKey: Uint8Array): Uint8Array {
|
||||||
|
validateBytes(secretKey, "secretKey");
|
||||||
|
return SecretKey.fromBytes(secretKey).toPublicKey().toBytes();
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sign,
|
sign,
|
||||||
aggregateSignatures,
|
aggregateSignatures,
|
||||||
|
@ -113,5 +121,6 @@ export function functionalInterfaceFactory({
|
||||||
verify,
|
verify,
|
||||||
verifyAggregate,
|
verifyAggregate,
|
||||||
verifyMultiple,
|
verifyMultiple,
|
||||||
|
secretKeyToPublicKey,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ export declare let aggregatePublicKeys: IBls["aggregatePublicKeys"];
|
||||||
export declare let verify: IBls["verify"];
|
export declare let verify: IBls["verify"];
|
||||||
export declare let verifyAggregate: IBls["verifyAggregate"];
|
export declare let verifyAggregate: IBls["verifyAggregate"];
|
||||||
export declare let verifyMultiple: IBls["verifyMultiple"];
|
export declare let verifyMultiple: IBls["verifyMultiple"];
|
||||||
|
export declare let secretKeyToPublicKey: IBls["secretKeyToPublicKey"];
|
||||||
|
|
||||||
export declare class SecretKey implements ISecretKey {
|
export declare class SecretKey implements ISecretKey {
|
||||||
static fromBytes(bytes: Uint8Array): SecretKey;
|
static fromBytes(bytes: Uint8Array): SecretKey;
|
||||||
|
|
|
@ -21,6 +21,7 @@ export interface IBls {
|
||||||
verify(publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
|
verify(publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
|
||||||
verifyAggregate(publicKeys: Uint8Array[], message: Uint8Array, signature: Uint8Array): boolean;
|
verifyAggregate(publicKeys: Uint8Array[], message: Uint8Array, signature: Uint8Array): boolean;
|
||||||
verifyMultiple(publicKeys: Uint8Array[], messages: Uint8Array[], signature: Uint8Array): boolean;
|
verifyMultiple(publicKeys: Uint8Array[], messages: Uint8Array[], signature: Uint8Array): boolean;
|
||||||
|
secretKeyToPublicKey(secretKey: Uint8Array): Uint8Array;
|
||||||
|
|
||||||
init(): Promise<void>;
|
init(): Promise<void>;
|
||||||
destroy(): void;
|
destroy(): void;
|
||||||
|
|
Reference in New Issue