### Install Dependencies Source: https://github.com/eugenehp/react-native-uuid/blob/master/README.md Install project dependencies using npm. This is a standard step for setting up the development environment. ```bash npm install ``` -------------------------------- ### Install react-native-uuid Source: https://github.com/eugenehp/react-native-uuid/blob/master/README.md Install the library using npm. Ensure you have Node.js 18.0.0 or higher and npm 9.0.0 or higher. ```shell npm install react-native-uuid ``` -------------------------------- ### Run Tests Source: https://github.com/eugenehp/react-native-uuid/blob/master/CONTRIBUTING.md Executes the full test suite for the project. ```bash npm test ``` -------------------------------- ### Building the Project Source: https://github.com/eugenehp/react-native-uuid/blob/master/README.md Build the TypeScript code into JavaScript for distribution. The 'prepublishOnly' script ensures a build before publishing. ```bash npm run build # Build TypeScript to JavaScript ``` ```bash npm run prepublishOnly # Build before publishing (auto on npm publish) ``` -------------------------------- ### Run Tests Source: https://github.com/eugenehp/react-native-uuid/blob/master/README.md Execute the project's test suite using npm. Options for watch mode and coverage reports are available. ```bash npm test ``` ```bash npm test -- --watch # Watch mode ``` ```bash npm test -- --coverage # With coverage report ``` -------------------------------- ### Run Full Test Suite Source: https://github.com/eugenehp/react-native-uuid/blob/master/CONTRIBUTING.md Ensures all tests, linting, formatting checks, and builds pass before submitting a pull request. ```bash npm test npm run lint npm run prettier:check npm run build ``` -------------------------------- ### Benchmarking Scripts Source: https://github.com/eugenehp/react-native-uuid/blob/master/README.md Run various benchmarking scripts to assess performance. Includes React Native specific benchmarks and security tests. ```bash npm run bench:rn # Generate benchmark matrix for RN 0.71 - 0.77 ``` ```bash npm run bench:security # Run security benchmark with pass/fail thresholds ``` -------------------------------- ### Generate Documentation Source: https://github.com/eugenehp/react-native-uuid/blob/master/CONTRIBUTING.md Generates project documentation, likely from source code comments or other documentation sources. ```bash npm run docs ``` -------------------------------- ### Generate Fresh Benchmark Results Source: https://github.com/eugenehp/react-native-uuid/blob/master/README.md Locally generate fresh benchmark results and test reports. This involves running specific npm scripts and test commands. ```bash npm run bench:rn ``` ```bash npm test -- --runInBand --json --outputFile benchmarks/results/test-results.json ``` ```bash npm run bench:security ``` ```bash npm run bench:figures ``` -------------------------------- ### Check Code Formatting Source: https://github.com/eugenehp/react-native-uuid/blob/master/CONTRIBUTING.md Verifies that the codebase adheres to the project's formatting standards using Prettier. ```bash npm run prettier:check ``` -------------------------------- ### Run Tests with Coverage Source: https://github.com/eugenehp/react-native-uuid/blob/master/CONTRIBUTING.md Executes the test suite and generates a coverage report to assess the extent of code tested. ```bash npm test -- --coverage ``` -------------------------------- ### Linting and Formatting Source: https://github.com/eugenehp/react-native-uuid/blob/master/README.md Perform code linting and formatting checks. Use 'prettier:write' to automatically format files. ```bash npm run lint # Lint TypeScript and JavaScript ``` ```bash npm run prettier:write # Format all files ``` ```bash npm run prettier:check # Check formatting without changes ``` -------------------------------- ### Public API Entry Point Source: https://github.com/eugenehp/react-native-uuid/blob/master/ARCHITECTURE.md The main entry point exports the public API for consumers to use default or named exports. ```typescript export default { v1, v3, v4, v5, parse, stringify, validate, version, }; ``` -------------------------------- ### Run Linter Source: https://github.com/eugenehp/react-native-uuid/blob/master/CONTRIBUTING.md Checks the codebase for potential errors and style issues using ESLint. ```bash npm run lint ``` -------------------------------- ### Build TypeScript Source: https://github.com/eugenehp/react-native-uuid/blob/master/CONTRIBUTING.md Compiles the TypeScript code into JavaScript, preparing the project for distribution or testing. ```bash npm run build ``` -------------------------------- ### UUID v4 Generation Flow Source: https://github.com/eugenehp/react-native-uuid/blob/master/ARCHITECTURE.md Illustrates the step-by-step process for generating a UUID v4, including random byte generation, setting version and variant bits, and stringification. This flow is used when calling `uuid.v4()`. ```text uuid.v4() ↓ v4.ts: v4() ├─ Get RNG (default or custom) ├─ Generate 16 random bytes ├─ Set version bits (010 in 13-15 bits of time_hi_and_version) ├─ Set variant bits (10 in 6-7 bits of clock_seq_hi_and_reserved) └─ Call stringify() ├─ Convert bytes to hex └─ Format as: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx ↓ Return: "f47ac10b-58cc-4372-a567-0e02b2c3d479" ``` -------------------------------- ### any_md5 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/md5.md Generates an MD5 hash of a given string and returns it in a specified encoding (e.g., hex or base64). ```APIDOC ## any_md5 ### Description Generates an MD5 hash of a given string and returns it in a specified encoding (e.g., hex or base64). ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **s** (string) - The input string to hash. - **e** (string) - The desired encoding for the output hash (e.g., 'hex' or 'base64'). ### Returns - **string** - The MD5 hash in the specified encoding. ### Request Example ```javascript // Example usage (assuming you have imported the function) // const any_md5 = require('react-native-uuid').any_md5; // const hexHash = any_md5('hello world', 'hex'); // console.log(hexHash); // Output: 5eb63bbbe01eeed093cb22bb8f5acdc3 // const b64Hash = any_md5('hello world', 'base64'); // console.log(b64Hash); // Output: X7Y7b7AS7tA5yyK7j1rMww== ``` ### Response Example ```json { "example": "5eb63bbbe01eeed093cb22bb8f5acdc3" } ``` ``` -------------------------------- ### Run Tests in Watch Mode Source: https://github.com/eugenehp/react-native-uuid/blob/master/CONTRIBUTING.md Runs tests continuously and re-runs them when files change, useful for active development. ```bash npm test -- --watch ``` -------------------------------- ### version Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/version.md Returns the version of a given UUID. ```APIDOC ## version ### Description Returns the version of a given UUID. ### Signature `version(uuid: string): number` ### Parameters #### Parameters - **uuid** (string) - The UUID string. ### Returns *number* - The version of the UUID. ``` -------------------------------- ### Format and Fix Code Source: https://github.com/eugenehp/react-native-uuid/blob/master/CONTRIBUTING.md Automatically formats the codebase to meet Prettier standards and fixes any detected formatting issues. ```bash npm run prettier:write ``` -------------------------------- ### URL Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/utils.md A predefined constant representing the URL namespace UUID. ```APIDOC ## URL ### Description A predefined constant representing the URL namespace UUID. ### Type string ### Value '6ba7b811-9dad-11d1-80b4-00c04fd430c8' ``` -------------------------------- ### any_hmac_md5 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/md5.md Generates an HMAC-MD5 hash of a given string using a key and returns it in a specified encoding. ```APIDOC ## any_hmac_md5 ### Description Generates an HMAC-MD5 hash of a given string using a key and returns it in a specified encoding. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **k** (string) - The secret key for HMAC. - **d** (string) - The input string to hash. - **e** (string) - The desired encoding for the output hash (e.g., 'hex' or 'base64'). ### Returns - **string** - The HMAC-MD5 hash in the specified encoding. ### Request Example ```javascript // Example usage (assuming you have imported the function) // const any_hmac_md5 = require('react-native-uuid').any_hmac_md5; // const hexHash = any_hmac_md5('mysecretkey', 'hello world', 'hex'); // console.log(hexHash); // Output: a3b1c4d5e6f708192a3b4c5d6e7f8091 // const b64Hash = any_hmac_md5('mysecretkey', 'hello world', 'base64'); // console.log(b64Hash); // Output: o7wM1e94GZkqO0xZ3luYQ== ``` ### Response Example ```json { "example": "a3b1c4d5e6f708192a3b4c5d6e7f8091" } ``` ``` -------------------------------- ### b64_md5 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/md5.md Generates an MD5 hash of a given string and returns it as a base64 encoded string. ```APIDOC ## b64_md5 ### Description Generates an MD5 hash of a given string and returns it as a base64 encoded string. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **s** (string) - The input string to hash. ### Returns - **string** - The base64 encoded MD5 hash of the input string. ### Request Example ```javascript // Example usage (assuming you have imported the function) // const b64_md5 = require('react-native-uuid').b64_md5; // const hash = b64_md5('hello world'); // console.log(hash); // Output will be the base64 string ``` ### Response Example ```json { "example": "X7Y7b7AS7tA5yyK7j1rMww==" } ``` ``` -------------------------------- ### Create a UUID (v4) Source: https://github.com/eugenehp/react-native-uuid/blob/master/README.md Generate a version 4 UUID using the imported library. This method uses a pseudo-random generator. ```javascript import uuid from 'react-native-uuid'; uuid.v4(); // ⇨ '11edc52b-2918-4d71-9058-f7285e29d894' ``` -------------------------------- ### X500 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/utils.md A predefined constant representing the X500 namespace UUID. ```APIDOC ## X500 ### Description A predefined constant representing the X500 namespace UUID. ### Type string ### Value '6ba7b814-9dad-11d1-80b4-00c04fd430c8' ``` -------------------------------- ### UUID v5 (Name-based) Generation Flow Source: https://github.com/eugenehp/react-native-uuid/blob/master/ARCHITECTURE.md Details the process for generating a UUID v5, which involves parsing a namespace UUID, combining it with a name string, hashing using SHA1, and then stringifying with specific version and variant bits. This flow is used when calling `uuid.v5(name, namespace)`. ```text uuid.v5(name, namespace) ↓ v5.ts: v5() ├─ Parse namespace UUID to bytes ├─ Combine namespace bytes + name string ├─ Hash with SHA1 └─ Call stringify() with version=5, variant=10 ↓ Return: "886313e1-3b8a-5372-9b90-0c9aee199e5d" ``` -------------------------------- ### DNS Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/utils.md A predefined constant representing the DNS namespace UUID. ```APIDOC ## DNS ### Description A predefined constant representing the DNS namespace UUID. ### Type string ### Value '6ba7b810-9dad-11d1-80b4-00c04fd430c8' ``` -------------------------------- ### v3 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/v3.md Generates a version 3 UUID based on a namespace and a name. It can optionally use a provided buffer and offset for the output. ```APIDOC ## v3 ### Description Generates a version 3 UUID based on a namespace and a name. It can optionally use a provided buffer and offset for the output. ### Signature `v3(value: string | Uint8Array, namespace: string | number[], buf?: number[], offset?: number): string | number[]` ### Parameters #### Parameters - **value** (string | Uint8Array) - The name or value to generate the UUID from. - **namespace** (string | number[]) - The namespace to use for generation. - **buf?** (number[]) - Optional buffer to store the generated UUID. - **offset?** (number) - Optional offset within the buffer to start writing the UUID. ### Returns *string* | *number[]* - The generated UUID as a string or an array of numbers. ``` -------------------------------- ### hex_md5 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/md5.md Generates an MD5 hash of a given string and returns it as a hexadecimal string. ```APIDOC ## hex_md5 ### Description Generates an MD5 hash of a given string and returns it as a hexadecimal string. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **s** (string) - The input string to hash. ### Returns - **string** - The hexadecimal MD5 hash of the input string. ### Request Example ```javascript // Example usage (assuming you have imported the function) // const hex_md5 = require('react-native-uuid').hex_md5; // const hash = hex_md5('hello world'); // console.log(hash); // Output will be the hex string ``` ### Response Example ```json { "example": "5eb63bbbe01eeed093cb22bb8f5acdc3" } ``` ``` -------------------------------- ### NIL Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/utils.md A predefined constant representing the NIL UUID (all zeros). ```APIDOC ## NIL ### Description A predefined constant representing the NIL UUID (all zeros). ### Type string ### Value '00000000-0000-0000-0000-000000000000' ``` -------------------------------- ### b64_hmac_md5 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/md5.md Generates an HMAC-MD5 hash of a given string using a key and returns it as a base64 encoded string. ```APIDOC ## b64_hmac_md5 ### Description Generates an HMAC-MD5 hash of a given string using a key and returns it as a base64 encoded string. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **k** (string) - The secret key for HMAC. - **d** (string) - The input string to hash. ### Returns - **string** - The base64 encoded HMAC-MD5 hash. ### Request Example ```javascript // Example usage (assuming you have imported the function) // const b64_hmac_md5 = require('react-native-uuid').b64_hmac_md5; // const hash = b64_hmac_md5('mysecretkey', 'hello world'); // console.log(hash); // Output will be the base64 string ``` ### Response Example ```json { "example": "o7wM1e94GZkqO0xZ3luYQ==" } ``` ``` -------------------------------- ### v5 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/v5.md Generates a version 5 UUID based on a given value and namespace. It can optionally write the UUID to a provided buffer at a specified offset. ```APIDOC ## v5 ### Description Generates a version 5 UUID based on a given value and namespace. It can optionally write the UUID to a provided buffer at a specified offset. ### Signature `v5(value: string | Uint8Array, namespace: string | number[], buf?: number[], offset?: number): string | number[]` ### Parameters #### Parameters - **value** (string | Uint8Array) - The input value to generate the UUID from. - **namespace** (string | number[]) - The namespace to use for UUID generation. - **buf?** (number[]) - Optional. A buffer to write the UUID into. - **offset?** (number) - Optional. The offset within the buffer to start writing. ### Returns *string* | *number[]* - The generated UUID as a string or a number array. ``` -------------------------------- ### OID Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/utils.md A predefined constant representing the OID namespace UUID. ```APIDOC ## OID ### Description A predefined constant representing the OID namespace UUID. ### Type string ### Value '6ba7b812-9dad-11d1-80b4-00c04fd430c8' ``` -------------------------------- ### UUID Generation and Utility Functions Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/index.md The default export provides a comprehensive set of functions for working with UUIDs, including generation (v1, v3, v4, v5), parsing, unparsing, validation, and version checking. It also exposes constants for common UUID namespaces. ```APIDOC ## Module: index ### Properties - **default**: *object* The main export object containing UUID utility functions and constants. #### Type declaration: Name | Type | Description :------ | :------ | :---------- **DNS** | *string* | Constant for the DNS namespace. **NIL** | *string* | Constant for the NIL UUID. **OID** | *string* | Constant for the OID namespace. **URL** | *string* | Constant for the URL namespace. **X500** | *string* | Constant for the X.500 Distinguished Name namespace. **parse** | (`s`: *string*, `buf?`: *number*[], `offset?`: *number*) => *number*[] | Parses a UUID string into a byte array. **unparse** | (`buf`: *number*[], `offset?`: *number*) => *string* | Converts a byte array representation of a UUID into a string. **v1** | (`options?`: V1Options, `buf?`: *Uint8Array*, `offset`: *number*) => *string* | *Uint8Array* | Generates a version 1 UUID based on timestamp and MAC address. **v3** | [*GenerateUUID*](v35.md#generateuuid) | Generates a version 3 UUID using MD5 hashing. **v4** | (`options?`: *string* | V4Options, `buf?`: *number*[], `offset?`: *number*) => *string* | *number*[] | Generates a version 4 UUID using random numbers. **v5** | [*GenerateUUID*](v35.md#generateuuid) | Generates a version 5 UUID using SHA-1 hashing. **validate** | (`uuid`: *string*) => *boolean* | Validates if a given string is a valid UUID. **version** | (`uuid`: *string*) => *number* | Returns the version number of a given UUID string. ``` -------------------------------- ### b64_sha1 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/sha1.md Computes SHA1 hash and returns the result in Base64 encoding. ```APIDOC ## b64_sha1 ### Description Computes SHA1 hash and returns the result in Base64 encoding. ### Method Const ### Signature b64_sha1(s: string): string ### Parameters #### Parameters - **s** (string) - ### Returns *string* ### Defined in sha1.ts:27 ``` -------------------------------- ### any_sha1 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/sha1.md Computes SHA1 hash with a specified encoding. ```APIDOC ## any_sha1 ### Description Computes SHA1 hash with a specified encoding. ### Method Const ### Signature any_sha1(s: string, e: string): string ### Parameters #### Parameters - **s** (string) - - **e** (string) - ### Returns *string* ### Defined in sha1.ts:29 ``` -------------------------------- ### v35 Function Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/v35.md Creates a UUID generator function for version 35. It requires a name, version, and a hashing function. ```APIDOC ## Function: v35 ### Description Creates a UUID generator function for version 35. ### Signature `Const`**v35**(`name`: *string*, `version`: *number*, `hashfunc`: (`s`: *string*) => *string*): [*GenerateUUID*](v35.md#generateuuid) ### Parameters #### Parameters - **name** (*string*) - The name to use for UUID generation. - **version** (*number*) - The version of the UUID to generate (should be 35). - **hashfunc** (`s`: *string*) => *string* - The hashing function to use. ### Returns [*GenerateUUID*](v35.md#generateuuid) - A function that generates UUIDs according to the specified parameters. ``` -------------------------------- ### v1 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/v1.md Generates a version 1 UUID. This function can optionally take V1Options, a Uint8Array buffer, and an offset to customize the UUID generation process. It returns either a string representation of the UUID or a Uint8Array. ```APIDOC ## v1 ### Description Generates a version 1 UUID. This function can optionally take V1Options, a Uint8Array buffer, and an offset to customize the UUID generation process. It returns either a string representation of the UUID or a Uint8Array. ### Method `Const` ### Parameters #### Parameters - **options?** (V1Options) - Optional - - **buf?** (*Uint8Array*) - Optional - - **offset** (*number*) - Optional - Default value: 0 ### Returns *string* | *Uint8Array* ### Defined in v1.ts:27 ``` -------------------------------- ### hex_hmac_md5 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/md5.md Generates an HMAC-MD5 hash of a given string using a key and returns it as a hexadecimal string. ```APIDOC ## hex_hmac_md5 ### Description Generates an HMAC-MD5 hash of a given string using a key and returns it as a hexadecimal string. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **k** (string) - The secret key for HMAC. - **d** (string) - The input string to hash. ### Returns - **string** - The hexadecimal HMAC-MD5 hash. ### Request Example ```javascript // Example usage (assuming you have imported the function) // const hex_hmac_md5 = require('react-native-uuid').hex_hmac_md5; // const hash = hex_hmac_md5('mysecretkey', 'hello world'); // console.log(hash); // Output will be the hex string ``` ### Response Example ```json { "example": "a3b1c4d5e6f708192a3b4c5d6e7f8091" } ``` ``` -------------------------------- ### Create Feature Branch Source: https://github.com/eugenehp/react-native-uuid/blob/master/CONTRIBUTING.md Creates a new Git branch for developing a specific feature, branching from the 'master' branch. ```bash git checkout -b feature/your-feature-name ``` -------------------------------- ### stringify Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/stringify.md Converts a Uint8Array to its string representation. This is commonly used for generating or parsing UUIDs. ```APIDOC ## stringify ### Description Converts a Uint8Array to its string representation. ### Method `Const stringify(arr: Uint8Array, offset?: number): string` ### Parameters #### Parameters - **arr** (Uint8Array) - Required - The byte array to convert. - **offset** (number) - Optional - The starting offset in the byte array. Defaults to 0. ### Returns - **string** - The string representation of the byte array. ``` -------------------------------- ### byteToHex Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/utils.md A constant array mapping byte values to their hexadecimal string representation. ```APIDOC ## byteToHex ### Description A constant array mapping byte values to their hexadecimal string representation. ### Type string[] ``` -------------------------------- ### b64_hmac_sha1 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/sha1.md Computes HMAC-SHA1 hash and returns the result in Base64 encoding. ```APIDOC ## b64_hmac_sha1 ### Description Computes HMAC-SHA1 hash and returns the result in Base64 encoding. ### Method Const ### Signature b64_hmac_sha1(k: string, d: string): string ### Parameters #### Parameters - **k** (string) - - **d** (string) - ### Returns *string* ### Defined in sha1.ts:35 ``` -------------------------------- ### any_hmac_sha1 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/sha1.md Computes HMAC-SHA1 hash with a specified encoding. ```APIDOC ## any_hmac_sha1 ### Description Computes HMAC-SHA1 hash with a specified encoding. ### Method Const ### Signature any_hmac_sha1(k: string, d: string, e: string): string ### Parameters #### Parameters - **k** (string) - - **d** (string) - - **e** (string) - ### Returns *string* ### Defined in sha1.ts:38 ``` -------------------------------- ### MD5 Hashing Function Source: https://github.com/eugenehp/react-native-uuid/blob/master/ARCHITECTURE.md Provides the MD5 message digest algorithm implementation. It takes a string or number array and returns a hex digest. ```typescript md5(msg: string | number[]): string ``` -------------------------------- ### stringToBytes Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/utils.md Converts a string into a Uint8Array of byte data. ```APIDOC ## stringToBytes ### Description Converts a string into a Uint8Array of byte data. ### Method `Const` ### Parameters #### Parameters - **str** (string) - Description: The string to convert. ### Returns *Uint8Array* ### Defined in [utils.ts:18](https://github.com/eugenehp/react-native-uuid/blob/d476a1f/src/utils.ts#L18) ``` -------------------------------- ### unparse Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/unparse.md Converts a byte array representation of a UUID into its string format. ```APIDOC ## unparse ### Description Converts a byte array representation of a UUID into its string format. ### Signature `Const unparse(buf: number[], offset?: number): string` ### Parameters #### Parameters - **buf** (number[]) - The byte array representing the UUID. - **offset** (number) - Optional. The starting offset in the buffer. ### Returns *string* - The UUID string representation. ``` -------------------------------- ### hex_sha1 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/sha1.md Computes SHA1 hash and returns the result in hexadecimal encoding. ```APIDOC ## hex_sha1 ### Description Computes SHA1 hash and returns the result in hexadecimal encoding. ### Method Const ### Signature hex_sha1(s: string): string ### Parameters #### Parameters - **s** (string) - ### Returns *string* ### Defined in sha1.ts:24 ``` -------------------------------- ### SHA1 Hashing Function Source: https://github.com/eugenehp/react-native-uuid/blob/master/ARCHITECTURE.md Provides the SHA1 algorithm implementation. It takes a string or number array and returns a hex digest. ```typescript sha1(msg: string | number[]): string ``` -------------------------------- ### parse Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/parse.md Parses a UUID string into an array of numbers representing bytes. Optional buffer and offset can be provided for in-place parsing. ```APIDOC ## parse ### Description Parses a UUID string into an array of numbers representing bytes. Optional buffer and offset can be provided for in-place parsing. ### Signature `Const parse(s: string, buf?: number[], offset?: number): number[]` ### Parameters #### Parameters - **s** (string) - The UUID string to parse. - **buf** (number[]) - Optional. The buffer to write the parsed bytes into. - **offset** (number) - Optional. The offset in the buffer to start writing at. ### Returns *number[]* - An array of numbers representing the parsed UUID bytes. ``` -------------------------------- ### hex_hmac_sha1 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/sha1.md Computes HMAC-SHA1 hash and returns the result in hexadecimal encoding. ```APIDOC ## hex_hmac_sha1 ### Description Computes HMAC-SHA1 hash and returns the result in hexadecimal encoding. ### Method Const ### Signature hex_hmac_sha1(k: string, d: string): string ### Parameters #### Parameters - **k** (string) - - **d** (string) - ### Returns *string* ### Defined in sha1.ts:32 ``` -------------------------------- ### validate Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/validate.md Checks if a given string is a valid UUID. ```APIDOC ## validate ### Description Checks if a given string is a valid UUID. ### Parameters #### Path Parameters - **uuid** (string) - Required - The string to validate. ### Returns *boolean* - True if the string is a valid UUID, false otherwise. ### Defined in validate.ts:3 ``` -------------------------------- ### v4 Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/v4.md Generates a version 4 UUID. This function can optionally take options, a buffer, and an offset for custom generation. ```APIDOC ## v4 ### Description Generates a version 4 UUID. This function can optionally take options, a buffer, and an offset for custom generation. ### Signature `v4(options?: string | V4Options, buf?: number[], offset?: number): string | number[]` ### Parameters #### Optional Parameters - **options** (string | V4Options) - Optional - Configuration options for UUID generation. - **buf** (number[]) - Optional - A buffer to store the generated UUID. - **offset** (number) - Optional - The offset within the buffer to start writing the UUID. ### Returns - *string* | *number[]* - The generated UUID as a string or an array of numbers. ``` -------------------------------- ### bytesToString Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/utils.md Converts an ArrayBuffer containing byte data into a string. ```APIDOC ## bytesToString ### Description Converts an ArrayBuffer containing byte data into a string. ### Method `Const` ### Parameters #### Parameters - **buf** (ArrayBuffer) - Description: The ArrayBuffer to convert. ### Returns *string* ### Defined in [utils.ts:30](https://github.com/eugenehp/react-native-uuid/blob/d476a1f/src/utils.ts#L30) ``` -------------------------------- ### UUID Regex Pattern Source: https://github.com/eugenehp/react-native-uuid/blob/master/ARCHITECTURE.md Regular expression for validating UUID formats, supporting both hyphenated and non-hyphenated versions, and specific version/variant bits. ```regex export const REGEX = /^(?:xxxxxxxx-?xxxx-?[1-5]xxx-?[89ab]xxx-?xxxxxxxxxxxx|00000000-?0000-?0000-?0000-?000000000000)$/i ``` -------------------------------- ### hexToByte Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/utils.md A constant object used for converting hexadecimal strings to byte values. ```APIDOC ## hexToByte ### Description A constant object used for converting hexadecimal strings to byte values. ### Type object ``` -------------------------------- ### rng Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/rng.md Generates an array of random numbers. This is a constant function. ```APIDOC ## rng ### Description Generates an array of random numbers. This is a constant function. ### Signature `Const rng(): number[]` ### Returns `number[]` - An array of random numbers. ### Defined in rng.ts:10 ``` -------------------------------- ### Version 1 UUID Function Signature Source: https://github.com/eugenehp/react-native-uuid/blob/master/ARCHITECTURE.md Signature for the time-based UUID generation function. It accepts optional options, buffer, and offset parameters. ```typescript export function v1(options?, buffer?, offset?): string ``` -------------------------------- ### GenerateUUID Type Alias Source: https://github.com/eugenehp/react-native-uuid/blob/master/docs/modules/v35.md Represents the signature of a function that generates a UUID. It takes a value, a namespace, and optional buffer and offset, returning either a string or an array of numbers. ```APIDOC ## Type Alias: GenerateUUID ### Description Represents a function that generates a UUID. ### Signature (`value`: *string* | Uint8Array, `namespace`: *string* | *number*[], `buf?`: *number*[], `offset?`: *number*) => *string* | *number*[] ### Parameters #### Parameters - **value** (*string* | Uint8Array) - The input value for UUID generation. - **namespace** (*string* | *number*[]) - The namespace to use for generation. - **buf?** (*number*[]) - Optional buffer to store the UUID. - **offset?** (*number*) - Optional offset within the buffer. ### Returns *string* | *number*[] - The generated UUID as a string or an array of numbers. ``` -------------------------------- ### Stringify UUID Bytes Function Source: https://github.com/eugenehp/react-native-uuid/blob/master/ARCHITECTURE.md Converts a byte array back into a hyphenated UUID string, ensuring RFC 4122 formatting. The `unparse.ts` file is an alias for this function. ```typescript export function stringify(arr: ArrayLike): string ``` -------------------------------- ### Extract UUID Version Function Source: https://github.com/eugenehp/react-native-uuid/blob/master/ARCHITECTURE.md Extracts the version number from a UUID string. An additional function `getVariant` is available to extract the variant from a Uint8Array. ```typescript export function version(uuid: string): number ``` ```typescript export function getVariant(uuid: Uint8Array): string ``` -------------------------------- ### Validate UUID String Function Source: https://github.com/eugenehp/react-native-uuid/blob/master/ARCHITECTURE.md Validates the format of a UUID string using regex pattern matching. Supports both hyphenated and non-hyphenated formats, and is case-insensitive. ```typescript export function validate(uuid: string): boolean ``` -------------------------------- ### Parse UUID String Function Source: https://github.com/eugenehp/react-native-uuid/blob/master/ARCHITECTURE.md Converts a UUID string into a 16-byte array. It strips validation of the input format and is used internally by stringify operations. ```typescript export function parse(uuid: string): Uint8Array ``` -------------------------------- ### Random Number Generator Type Source: https://github.com/eugenehp/react-native-uuid/blob/master/ARCHITECTURE.md Defines the type for a Random Number Generator function, which should return an array of numbers. ```typescript export type RngFunction = () => number[]; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.