FLUTTER ECOSYSTEM

james-alex/nonce

Nonce में एक स्थिर जनरेटर है जो यादृच्छिक अल्फान्यूमेरिक स्ट्रिंग्स का उत्पादन करता है, और उत्पन्न स्ट्रिंग को समाविष्ट करने वाली ऑब्जेक्ट के रूप में बनाया जा सकता है।

नॉन्स प्रोजेक्ट कवर
Stars
4
Forks
2
अंतिम पुश (UTC)
16 सित॰ 2023
प्रोजेक्ट स्थिति
सक्रिय
James GitHub avatar
GITHUB User

James ↗

भाषाएँDart

इस रिपॉज़िटरी के पैकेज

उपयोग की गई निर्भरताएँ

निर्भरता सूची 2 आइटम
  • pedanticडेवलपमेंट^1.11.0
  • testडेवलपमेंट^1.16.5

मूल README

यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।

README खोलें / बंद करें

nonce

pub package

[Nonce] contains a static generator that generates random alphanumeric strings, and can be constructed as an object containing a generated string.

Usage

import 'package:nonce/nonce.dart';

Generator

The static method [generate] can be used to generate random alphanumeric strings.

[generate] has 2 optional parameters, [length] which defines how many characters to generate, and [random] which allows you provide a [Random] to use to generate the characters.

// Generate a string 32 characters long.
print(Nonce.generate()); // Osp54up7WU6P3U97Jz92p9j892n9LP7z

// Generate a string 64 characters long.
print(Nonce.generate(64)); // LDwpr1H74qm894jbd15Lj63wF5RUL07r4L9XOY7zVMz7fLbBCXa68Y6oPw0N9XgV

// Generate a nonce using a secure [Random].
print(Nonce.generate(32, Random.secure()));

generate() does not rely on Base64 encoding, instead it generates ASCII character codes directly.

Constructors

[Nonce]'s default constructor constructs a [Nonce] of the specified length; 32 characters by default.

Nonce();
Nonce(64);
unique

[Nonce]'s [unique] constructor references a global set of every nonce generated by it, and ensures that every nonce returned by it is unique.

Nonce.unique();
Nonce.unique(64);
secure

[Nonce]'s [secure] constructor generates a unique nonce using a secure [Random].

Nonce.secure();
Nonce.secure(64);
key

The [key] constructor is shorthand to generate a [unique] nonce 16 characters in length.

Nonce.key(); // Osp54up7WU6P3U97