mirror of
https://github.com/tauri-apps/tauri-forage.git
synced 2026-02-04 02:31:20 +01:00
216 lines
8.6 KiB
HTML
216 lines
8.6 KiB
HTML
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
<title>JSDoc: cryptoForage.esm.js</title>
|
|
|
|
<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
|
|
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
|
<script src="./build/entry.js"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
|
<!--[if lt IE 9]>
|
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
<![endif]-->
|
|
<link href="https://fonts.googleapis.com/css?family=Muli:100,400,700|Oswald:300|Inconsolata,700" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
|
|
<link type="text/css" rel="stylesheet" href="https://jmblog.github.io/color-themes-for-google-code-prettify/themes/tomorrow-night.min.css">
|
|
<link type="text/css" rel="stylesheet" href="styles/app.min.css">
|
|
<link type="text/css" rel="stylesheet" href="styles/iframe.css">
|
|
</head>
|
|
|
|
<body>
|
|
<div id="stickyNavbarOverlay"></div>
|
|
<div class="top-navbar">
|
|
<div class="container">
|
|
<nav class="navbar" role="navigation" aria-label="main navigation">
|
|
<div class="navbar-brand">
|
|
|
|
|
|
<h1 class="navbar-item">tauri-forage Documentation</h1>
|
|
|
|
<a id="hamburger" role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
|
|
<span aria-hidden="true"></span>
|
|
<span aria-hidden="true"></span>
|
|
<span aria-hidden="true"></span>
|
|
</a>
|
|
</div>
|
|
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
<div class="container">
|
|
<div class="columns">
|
|
<div class="column is-3" id="sidebarNav">
|
|
<div class="sidebar">
|
|
<nav>
|
|
<h2><a href="index.html">Home</a></h2><div class="category"></div><div class="category"><h2>crypto</h2><h3>Namespaces</h3><ul><li><a href="crypto.html">crypto</a></li><li><a href="crypto.box.html">box</a></li><li><a href="crypto.secretBox.html">secretBox</a></li></ul></div><div class="category"><h2>forage</h2><h3>Namespaces</h3><ul><li><a href="cryptoForage.html">cryptoForage</a></li><li><a href="forage.html">forage</a></li></ul></div><div class="category"><h2>handler</h2><h3>Namespaces</h3><ul><li><a href="handler.html">handler</a></li></ul></div>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
<div class="column is-9-desktop">
|
|
<div class="content" id="main-content-wrapper">
|
|
<header class="page-title">
|
|
<p>Source</p>
|
|
<h1>cryptoForage.esm.js</h1>
|
|
</header>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section>
|
|
<article>
|
|
<pre class="prettyprint source linenums"><code>import { _ as __awaiter, a as __generator } from './_tslib-ca2dd4fc.js';
|
|
import 'tweetnacl';
|
|
import 'tweetnacl-util';
|
|
import { crypto } from './cryptoPrimitives.esm.js';
|
|
import { handler } from './handler.esm.js';
|
|
|
|
/**
|
|
* @description Use currying process to inject
|
|
* @namespace
|
|
* @category forage
|
|
*/
|
|
var cryptoForage = {
|
|
/**
|
|
* @description encrypt a functional
|
|
* @name enBox
|
|
* @category forage
|
|
* @uses forage.mergeItem
|
|
* @memberof cryptoForage
|
|
* @param {string} key - encryption key
|
|
* @param {array} logger - loglevel of errors (forage)
|
|
* @param {array} returner - return type (forage)
|
|
* @returns {object|*} - the JSON results of our box
|
|
* @function
|
|
* @example
|
|
* const boxFn = await cryptoForage.enBox({
|
|
* key:key,
|
|
* loggerType: 'throw',
|
|
* returnType: 7
|
|
* })(new Date().now())
|
|
*/
|
|
enBox: function (_a) {
|
|
var _b = _a === void 0 ? {} : _a, key = _b.key, loggerType = _b.loggerType, returnType = _b.returnType;
|
|
return function (val) {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var _a, _b, _c, _d, _e;
|
|
return __generator(this, function (_f) {
|
|
switch (_f.label) {
|
|
case 0:
|
|
_b = (_a = handler).returner;
|
|
_d = (_c = crypto.secretBox).encrypt;
|
|
_e = {};
|
|
return [4 /*yield*/, val];
|
|
case 1: return [4 /*yield*/, _d.apply(_c, [(_e.json = _f.sent(),
|
|
_e.key = key,
|
|
_e)]).catch(function (err) {
|
|
/* istanbul ignore next */
|
|
return handler.logger(err)(loggerType);
|
|
})];
|
|
case 2: return [2 /*return*/, _b.apply(_a, [_f.sent()])(returnType)];
|
|
}
|
|
});
|
|
});
|
|
};
|
|
},
|
|
/**
|
|
* @name deBox
|
|
* @description use the "box" system to decrypt something from the storage
|
|
* @category forage
|
|
* @memberof cryptoForage
|
|
* @uses forage.getKeyValue
|
|
* @param {string} key - encryption key
|
|
* @param {array} model - array of acceptable properties (validate)
|
|
* @param {string} maxlen - forage name of key (validate)
|
|
* @param {string} row - forage row (forage)
|
|
* @param {string} name - forage name of key (forage)
|
|
* @param {string} logger - loglevel of errors (forage)
|
|
* @param {number} returner - return type (forage)
|
|
* @returns {object|*} - the JSON results of our box
|
|
* @function
|
|
* @example
|
|
* const curry = async function (val) {
|
|
* const box = await crypto.secretBox.encrypt({
|
|
* json: val,
|
|
* key: key
|
|
* })
|
|
* console.log(box)
|
|
* return box
|
|
* }
|
|
*/
|
|
deBox: function (_a) {
|
|
var _b = _a === void 0 ? {} : _a, key = _b.key, model = _b.model, maxLen = _b.maxLen, loggerType = _b.loggerType, returnType = _b.returnType;
|
|
return function (val) {
|
|
return __awaiter(this, void 0, void 0, function () {
|
|
var result, _a, _b, _c, _d, _e;
|
|
return __generator(this, function (_f) {
|
|
switch (_f.label) {
|
|
case 0:
|
|
_b = (_a = handler).returner;
|
|
_d = (_c = crypto.secretBox).decrypt;
|
|
_e = {};
|
|
return [4 /*yield*/, val];
|
|
case 1: return [4 /*yield*/, _d.apply(_c, [(_e.msg = _f.sent(),
|
|
_e.key = key,
|
|
_e)]).catch(function (err) {
|
|
/* istanbul ignore next */
|
|
return handler.logger(err)(loggerType);
|
|
})
|
|
/* istanbul ignore */
|
|
];
|
|
case 2:
|
|
result = _b.apply(_a, [_f.sent()
|
|
/* istanbul ignore */
|
|
])(returnType);
|
|
if (model && typeof model === 'object') {
|
|
return [2 /*return*/, handler.jsonPurify({
|
|
model: model,
|
|
maxLen: maxLen || null
|
|
})(JSON.stringify(result))];
|
|
}
|
|
else {
|
|
return [2 /*return*/, result];
|
|
}
|
|
}
|
|
});
|
|
});
|
|
};
|
|
}
|
|
};
|
|
|
|
export { cryptoForage };
|
|
//# sourceMappingURL=cryptoForage.esm.js.map
|
|
</code></pre>
|
|
</article>
|
|
</section>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<footer class="footer">
|
|
<div class="content has-text-centered">
|
|
<p>Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a></p>
|
|
<p class="sidebar-created-by">
|
|
<a href="https://github.com/SoftwareBrothers/better-docs" target="_blank">BetterDocs theme</a> provided with <i class="fas fa-heart"></i> by
|
|
<a href="http://softwarebrothers.co" target="_blank">SoftwareBrothers - JavaScript Development Agency</a>
|
|
</p>
|
|
</div>
|
|
</footer>
|
|
|
|
|
|
<script src="scripts/app.min.js"></script>
|
|
<script src="scripts/linenumber.js"> </script>
|
|
</body>
|
|
</html>
|