Skip to content

Commit

Permalink
UUID update and link fixes to be absolute without the domain
Browse files Browse the repository at this point in the history
  • Loading branch information
voidmain committed Jun 5, 2023
1 parent 451ded1 commit fd000fc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
4 changes: 2 additions & 2 deletions astro/src/content/dev-tools/base64-encoder-decoder.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ In Java, Base64 encoding is commonly used when there is a need to encode binary

## Base64 and OAuth

Base64 encoding is often used in the [OAuth 2.0 authorization](https://fusionauth.io/articles/oauth/modern-guide-to-oauth) framework, specifically in the process of issuing and handling tokens. Here are the key ways it is used:
Base64 encoding is often used in the [OAuth 2.0 authorization](/articles/oauth/modern-guide-to-oauth) framework, specifically in the process of issuing and handling tokens. Here are the key ways it is used:

* **JWT (JSON Web Tokens):** In OAuth 2.0, [JWTs](https://fusionauth.io/articles/tokens/jwt-components-explained) are often used as access tokens. A JWT is a compact, URL-safe means of representing claims to be transferred between two parties. The claims in a JWT are encoded as a JSON object. This JSON object is then used as the source of bytes when using JSON Web Signature (JWS) to ensure the JSON is not modified. It is also used as the plaintext source when using JSON Web Encryption (JWE) to protect the contents of the JSON object. Enabling the claims to be digitally signed or integrity protected with a Message Authentication Code (MAC) and/or encrypted ensures that the token cannot be modified or read by unauthorized parties. The JWT token is made up of three parts: Header, Payload, and Signature. Each of these parts is Base64 encoded.
* **JWT (JSON Web Tokens):** In OAuth 2.0, [JWTs](/articles/tokens/jwt-components-explained) are often used as access tokens. A JWT is a compact, URL-safe means of representing claims to be transferred between two parties. The claims in a JWT are encoded as a JSON object. This JSON object is then used as the source of bytes when using JSON Web Signature (JWS) to ensure the JSON is not modified. It is also used as the plaintext source when using JSON Web Encryption (JWE) to protect the contents of the JSON object. Enabling the claims to be digitally signed or integrity protected with a Message Authentication Code (MAC) and/or encrypted ensures that the token cannot be modified or read by unauthorized parties. The JWT token is made up of three parts: Header, Payload, and Signature. Each of these parts is Base64 encoded.
* **Basic Authentication:** In some flows of OAuth 2.0, such as the client credentials flow, the client ID and secret are concatenated with a colon (`:`) and then Base64 encoded. This encoded string is then sent in the Authorization header for basic authentication, as defined by the HTTP specification.
* **Encoding Binary Data:** In the context of OAuth and tokens, sometimes there is a need to send binary data. For example, a certificate or a document. Base64 is used to encode this binary data into text so it can be transmitted without loss or modification of the data.

Expand Down
4 changes: 2 additions & 2 deletions astro/src/content/dev-tools/jwt-decoder.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0ODUxNDA5ODQsImlhdCI6MTQ4NTEzNzM

## What is a JWT?

JSON Web Tokens (JWTs) are a widely adopted method for securely transmitting information between systems. They are compact, URL-safe tokens that consist of three parts: [a header, a payload, and a signature](https://fusionauth.io/articles/tokens/jwt-components-explained). JWTs play a crucial role in enabling stateless communication between systems by allowing the exchange of authenticated and trusted information.
JSON Web Tokens (JWTs) are a widely adopted method for securely transmitting information between systems. They are compact, URL-safe tokens that consist of three parts: [a header, a payload, and a signature](/articles/tokens/jwt-components-explained). JWTs play a crucial role in enabling stateless communication between systems by allowing the exchange of authenticated and trusted information.

One of the key benefits of JWTs is their ability to carry relevant user data in a self-contained format, eliminating the need for constant database or session checks. They are commonly used in modern web applications and APIs due to their simplicity, scalability, and compatibility with various programming languages and frameworks.

Expand All @@ -44,7 +44,7 @@ These are all Base64 URL encoded so the resulting string is safe to put in HTTP

In the encoding and decoding process of a JWT, the algorithm plays a crucial role in ensuring the integrity and authenticity of the token. JWTs utilize cryptographic algorithms to create and verify the signature, which is a critical component of the token.

When encoding a JWT, the algorithm is selected and specified in the header of the token. Common algorithms used for signature generation include [HMAC (Hash-based Message Authentication Code)](https://fusionauth.io/docs/v1/tech/reference/password-hashes#salted-hmac-sha-256) and [RSA (Rivest-Shamir-Adleman)](https://fusionauth.io/docs/v1/tech/reference/password-hashes#salted-hmac-sha-256). The algorithm takes the header and payload of the token, combines them, and applies a secret key or private key to generate a unique signature. This signature is appended to the JWT, creating a tamper-proof token.
When encoding a JWT, the algorithm is selected and specified in the header of the token. Common algorithms used for signature generation include [HMAC (Hash-based Message Authentication Code)](/docs/v1/tech/reference/password-hashes#salted-hmac-sha-256) and [RSA (Rivest-Shamir-Adleman)](/docs/v1/tech/reference/password-hashes#salted-hmac-sha-256). The algorithm takes the header and payload of the token, combines them, and applies a secret key or private key to generate a unique signature. This signature is appended to the JWT, creating a tamper-proof token.

During the decoding process, the algorithm specified in the JWT's header is used to verify the signature. The recipient of the token uses the corresponding secret key or public key associated with the algorithm to validate the signature. By re-computing the signature using the same algorithm, the recipient can compare it with the received signature. If they match, it indicates that the JWT has not been tampered with and that the data it contains can be trusted.

Expand Down
35 changes: 25 additions & 10 deletions astro/src/content/dev-tools/uuid-generator.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
title: Online UUID Generator
description: Ad-free online UUID generator tool. Create a universally unique identifier (UUID) for free!
description: Generate Version 4 UUIDs for various use cases like databases, distributed systems, web applications, and more with our online UUID Generator
author: Daniel DeGroff
icon: /img/icons/dt-uuid-generator.svg
faIcon: fa-id-badge
color: red
---
import { border } from "../../components/BaseInput.js";

## Generate a version 4 UUID
## UUID generator

Use our online UUID generator to generate version 4 UUIDs.
UUID (Universally Unique Identifier) is a 128-bit identifier that is used to uniquely identify information in computer systems. [Version 4 UUIDs](/docs/v1/tech/reference/data-types#uuids), also known as random UUIDs, are generated using random or pseudo-random numbers. Use this tool to generate random version 4 UUIDs online.

<div className="flex gap-x-6 items-start mt-8 no-prose">
<div class:list={[border(false, false, true), "flex items-center justify-between py-1 px-2"]}>
Expand All @@ -23,28 +23,43 @@ Use our online UUID generator to generate version 4 UUIDs.
</button>
</div>

--------
## Use cases for generating UUIDs

## UUID Frequently Asked Questions
Here are some common use cases for generating a version 4 UUID:

* **Database Records:** Version 4 UUIDs can be used as unique identifiers for records in databases. They ensure that each record has a unique identifier without relying on sequential numbers or other potentially conflicting identifiers.
* **Distributed Systems:** In distributed systems where multiple nodes or processes operate independently, version 4 UUIDs can be used to generate unique identifiers for events, transactions, or messages. This allows different components to operate autonomously and later correlate events based on their unique identifiers.
* **Web Applications:** Version 4 UUIDs can be used as unique identifiers for various entities in web applications. For example, they can be assigned to user accounts, session IDs, or resources like images, files, or documents. This helps avoid conflicts when multiple users or processes are creating or accessing resources simultaneously.
* **Message Queues:** When messages are passed between different components or services through a message queue system, version 4 UUIDs can be used as unique message IDs. This helps track and identify messages as they move through the system, enabling reliable message processing and tracking.
* **Testing and Development:** Version 4 UUIDs are often used in testing and development environments. They can be used as placeholder or mock identifiers when creating test data or simulating scenarios. Using UUIDs ensures that the test data is unique and avoids clashes with existing production data.
* **Security and [Authentication](/articles/authentication/common-authentication-implementation-risks):** Version 4 UUIDs can be used in security-related scenarios such as generating secure tokens, session IDs, or API keys. These identifiers can be used to validate and authorize access to resources, authenticate users, or secure communication channels.
* **Logging and Tracking:** Version 4 UUIDs can be used as unique identifiers for log entries, trace information, or audit trails. They enable efficient tracking and correlation of log messages across multiple systems or services, facilitating debugging and troubleshooting activities.

Below are some frequently asked questions regarding UUIDs.
## UUID Frequently Asked Questions

### What is a UUID?

A UUID (Universally Unique Identifier) is a string of characters that is used to uniquely identify an object. You may also see the term GUID (Globally Unique Identifier) which is also commonly used. Both UUIDs and GUIDs are generated according to a standard, using a combination of random numbers, timestamps and algorithms, all of which makes it extremely unlikely that two values will be equal.
[A UUID (Universally Unique Identifier)](/docs/v1/tech/reference/data-types#uuids) is a string of characters that is used to uniquely identify an object. You may also see the term GUID (Globally Unique Identifier) which is also commonly used. Both UUIDs and GUIDs are generated according to a standard, using a combination of random numbers, timestamps and algorithms, all of which makes it extremely unlikely that two values will be equal. It is based on the [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122) standard.

### Why version 4?
### What version UUID generator is this tool?

This UUID generator generates a version 4 universally unique identifier. A version 4 UUID is made up of 32 hexadecimal characters (128 bits), divided into five groups separated by hyphens in this format: `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`. You may also see this written as `8-4-4-4-12`.

### Why generate UUID version 4?

The main advantage of version 4 UUIDs is that they are generated using random numbers, which makes it extremely unlikely that two UUIDs will be the same.

How unlikely? To be specific, a UUID is 16 bytes or 128 bits. Out of these 128 bits, 4 are used to indicate the version, and another 2 indicate the variant. This leaves us with 122 bits, and as a result we have 2^122 possible combinations, or 5.3 undecillion. That is a lot. When we begin talking about numbers in this range - the probability that a duplicate value will be generated is essentially zero.
How unlikely? To be specific, a UUID is 16 bytes or 128 bits. Out of these 128 bits, 4 are used to indicate the version, and another 2 indicate the variant. This leaves us with 122 bits, and as a result we have `2^122` possible combinations, or 5.3 undecillion, or 5.31x10^36 (or a 5 with 36 zeros behind it). That is a lot. When we begin talking about numbers in this range - the probability that a duplicate value will be generated is essentially zero.

This makes UUIDs perfect for use as a unique object identifier in software programs, database records, and other situations where a unique identifier is needed.

One way to think about a version 4 UUID collision is like this:

> Only after generating 1 billion UUIDs every second for the next 100 years, the probability of creating just one duplicate would be about 50%. Or, to put it another way, the probability of one duplicate would be about 50% if every person on earth owned 600 million UUIDs.
### How does FusionAuth use UUIDs?

In FusionAuth, UUIDs are used to identify users, applications, and other objects such as roles and groups. For example, when a new user or role is created, a UUID is generated and assigned to that user or role. This UUID can then be used to uniquely identify the user within the system, grant them appropriate resources, and it is used as a primary key in the database to store and retrieve user information. For almost every resource, FusionAuth can either generate a UUID on creation or use one provided by the API call, allowing for easier migrations of existing users, roles and other entities.
In FusionAuth, UUIDs are used to identify [users](/docs/v1/tech/core-concepts/users), [applications](/docs/v1/tech/core-concepts/applications), and other objects such as [roles](/docs/v1/tech/core-concepts/roles) and [groups](/docs/v1/tech/core-concepts/groups). For example, when a new user or role is created, a UUID is generated and assigned to that user or role. This UUID can then be used to uniquely identify the user within the system, grant them appropriate resources, and it is used as a primary key in the database to store and retrieve user information. For almost every resource, FusionAuth can either generate a UUID on creation or use one supplied to the API, allowing for easier migrations of existing users, roles and other entities.


<script type="text/javascript" src="/js/UUIDGenerator-0.1.0.js" defer></script>

0 comments on commit fd000fc

Please sign in to comment.