UNPKG

@plugnet/util-crypto

Version:
32 lines (27 loc) 981 B
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = naclKeypairFromSecret; var _tweetnacl = _interopRequireDefault(require("tweetnacl")); // Copyright 2017-2019 @polkadot/util-crypto authors & contributors // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. /** * @name naclKeypairFromSecret * @summary Creates a new public/secret keypair from a secret. * @description * Returns a object containing a `publicKey` & `secretKey` generated from the supplied secret. * @example * <BR> * * ```javascript * import { naclKeypairFromSecret } from '@plugnet/util-crypto'; * * naclKeypairFromSecret(...); // => { secretKey: [...], publicKey: [...] } * ``` */ function naclKeypairFromSecret(secret) { return _tweetnacl.default.sign.keyPair.fromSecretKey(secret); }