mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-25 14:07:58 +00:00
24 lines
894 B
JavaScript
24 lines
894 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.ed25519PairFromString = ed25519PairFromString;
|
|
const util_1 = require("@pezkuwi/util");
|
|
const asU8a_js_1 = require("../../blake2/asU8a.js");
|
|
const fromSeed_js_1 = require("./fromSeed.js");
|
|
/**
|
|
* @name ed25519PairFromString
|
|
* @summary Creates a new public/secret keypair from a string.
|
|
* @description
|
|
* Returns a object containing a `publicKey` & `secretKey` generated from the supplied string. The string is hashed and the value used as the input seed.
|
|
* @example
|
|
* <BR>
|
|
*
|
|
* ```javascript
|
|
* import { ed25519PairFromString } from '@pezkuwi/util-crypto';
|
|
*
|
|
* ed25519PairFromString('test'); // => { secretKey: [...], publicKey: [...] }
|
|
* ```
|
|
*/
|
|
function ed25519PairFromString(value) {
|
|
return (0, fromSeed_js_1.ed25519PairFromSeed)((0, asU8a_js_1.blake2AsU8a)((0, util_1.stringToU8a)(value)));
|
|
}
|