@subsocial/utils
Version:
JavaScript utils for Subsocial blockchain.
26 lines (25 loc) • 847 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.naclOpen = void 0;
const tweetnacl_1 = __importDefault(require("tweetnacl"));
/**
* @name naclOpen
* @summary Opens a message using the receiver's secretKey and nonce
* @description
* Returns a message sealed by the sender, using the receiver's `secret` and `nonce`.
* @example
* <BR>
*
* ```javascript
* import { naclOpen } from '@subsocial/utils';
*
* naclOpen([...], [...], [...]); // => [...]
* ```
*/
function naclOpen(sealed, nonce, senderBoxPublic, receiverBoxSecret) {
return (tweetnacl_1.default.box.open(sealed, nonce, senderBoxPublic, receiverBoxSecret) || null);
}
exports.naclOpen = naclOpen;