Skip to content

Instantly share code, notes, and snippets.

@PlugFox
PlugFox / jwt.dart
Last active November 21, 2023 14:24
Centrifugo JWT
import 'dart:convert';
import 'package:crypto/crypto.dart';
import 'package:meta/meta.dart';
/// {@template jwt}
/// A JWT token consists of three parts: the header,
/// the payload, and the signature or encryption data.
/// The first two elements are JSON objects of a specific structure.
/// The third element is calculated based on the first two
/// Dependencies
abstract interface class Dependencies {
/// The state from the closest instance of this class.
factory Dependencies.of(BuildContext context) => InheritedDependencies.of(context);
/// App metadata
abstract final AppMetadata appMetadata;
/// Database
abstract final Database database;
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active June 30, 2025 12:55
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096