biketrack-app/node_modules/@ethersphere/bee-js/dist/mjs/utils/pss.js

16 lines
514 B
JavaScript
Raw Normal View History

2022-07-11 10:27:11 +02:00
import { PSS_TARGET_HEX_LENGTH_MAX } from "../types/index.js";
/**
* 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)
*/
export function makeMaxTarget(target) {
if (typeof target !== 'string') {
throw new TypeError('target has to be an string!');
}
return target.slice(0, PSS_TARGET_HEX_LENGTH_MAX);
}