UNPKG

@tangle.js/anchors

Version:

Anchoring messages to the Tangle. Powered by IOTA Streams

24 lines (18 loc) 491 B
import * as crypto from "crypto"; export class SeedHelper { /** * Generates a new seed * @param length Seed length * * @returns The seed */ public static generateSeed(length: number = 80) { const alphabet = "abcdefghijklmnopqrstuvwxyz"; let seed = ""; while (seed.length < length) { const bytes = crypto.randomBytes(1); seed += alphabet[bytes[0] % alphabet.length]; } return seed; } }