19 lines
646 B
JavaScript
19 lines
646 B
JavaScript
|
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
exports.makeMaxTarget = void 0;
|
||
|
const types_1 = require("../types");
|
||
|
/**
|
||
|
* Utility function that for given strings/reference takes the most specific
|
||
|
* target that Bee node will except.
|
||
|
*
|
||
|
* @param target is a non-prefixed hex string Bee address
|
||
|
* @see [Bee docs - PSS](https://docs.ethswarm.org/docs/dapps-on-swarm/pss)
|
||
|
*/
|
||
|
function makeMaxTarget(target) {
|
||
|
if (typeof target !== 'string') {
|
||
|
throw new TypeError('target has to be an string!');
|
||
|
}
|
||
|
return target.slice(0, types_1.PSS_TARGET_HEX_LENGTH_MAX);
|
||
|
}
|
||
|
exports.makeMaxTarget = makeMaxTarget;
|