# @types/sodium-uuid

> TypeScript definitions for sodium-uuid

Latest version **2.0.2** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/sodium-uuid
pnpm add @types/sodium-uuid
yarn add @types/sodium-uuid
bun add @types/sodium-uuid
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2023-11-07 |
| First published | 2022-08-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51360 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/sodium-uuid
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sodium-uuid
- npm.io page: https://npm.io/package/@types/sodium-uuid

## Dependencies (1)

- [@types/node](https://npm.io/package/@types/node.md) *

## Recent versions

- 2.0.2 (latest) — 2023-11-07
- 2.0.0 (ts4.0) — 2022-08-29
- 2.0.1 — 2023-10-18

## README

# Installation
> `npm install --save @types/sodium-uuid`

# Summary
This package contains type definitions for sodium-uuid (https://github.com/emilbayes/sodium-uuid).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sodium-uuid.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sodium-uuid/index.d.ts)
````ts
/// <reference types="node" />

export = uuid;

/**
 * Generate v4 UUIDs using libsodium's RNG.
 *
 * Will fill the first 16 bytes of returned buffer with random bits but set the appropriate
 * bits to be recognised as a UUID v4. This leaves 122 bits of entropy. This method does not
 * insert dashes in the formatting, but this can be done with the `stringify()` method.
 *
 * @param buffer The buffer to generate the UUID to. Must be at least length 128 bits (16 bytes).
 *
 * @example
 * import uuid = require('sodium-uuid')
 *
 * uuid() // => Buffer
 * uuid(Buffer.allocUnsafe(uuid.BYTES)) // => allocUnsafe'ed 16 byte Buffer
 */
declare function uuid(buffer?: Buffer): Buffer;

declare namespace uuid {
    /**
     * Convert a buffer to string representation of UUID eg. 4a181507-72e2-45c7-a512-9d9601425b2d.
     * Will only read the first 16 bytes of `buffer`.
     */
    function stringify(buffer: Buffer): string;
    /**
     * Convert a string to a buffer representation of UUID. Will fail if str is not a valid UUIDv4.
     *
     * @param uuid The UUID to parse.
     * @param buffer The buffer to parse the UUID to. Must be at least length `BYTES`. Will be allocated if not given.
     */
    function parse(uuid: string, buffer?: Buffer): Buffer;
    /**
     * Check that `uuid` is a valid UUIDv4.
     */
    function isUUID(uuid: string | Buffer): boolean;
    /** The number of bytes a UUID buffer must be able to contain. */
    const BYTES: 16;
}

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
 * Dependencies: [@types/node](https://npmjs.com/package/@types/node)

# Credits
These definitions were written by [BendingBender](https://github.com/BendingBender).

---
_Source: https://npm.io/package/@types/sodium-uuid · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
