Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 1x 1x 1x 1x 1x 1x 71x 33x 38x | // SPDX-License-Identifier: Apache-2.0
import { PrivateKey } from '@hashgraph/sdk';
export enum KeyType {
ED25519 = 'ED25519',
ECDSA = 'ECDSA',
DER = 'DER'
}
export interface IPrivateKey {
value: string;
type: KeyType;
}
export function getPrivateKey(key: IPrivateKey): PrivateKey {
switch (key.type) {
case KeyType.ED25519:
return PrivateKey.fromStringED25519(key.value);
case KeyType.ECDSA:
return PrivateKey.fromStringECDSA(key.value);
case KeyType.DER:
return PrivateKey.fromStringDer(key.value);
default:
throw new Error(`Unsupported key type: ${key.type}`);
}
}
|