Add Legal Office seal and complete Azure CDN deployment
- Add Legal Office of the Master seal (SVG design with Maltese Cross, scales of justice, legal scroll) - Create legal-office-manifest-template.json for Legal Office credentials - Update SEAL_MAPPING.md and DESIGN_GUIDE.md with Legal Office seal documentation - Complete Azure CDN infrastructure deployment: - Resource group, storage account, and container created - 17 PNG seal files uploaded to Azure Blob Storage - All manifest templates updated with Azure URLs - Configuration files generated (azure-cdn-config.env) - Add comprehensive Azure CDN setup scripts and documentation - Fix manifest URL generation to prevent double slashes - Verify all seals accessible via HTTPS
This commit is contained in:
91
scripts/tools/convert-svg-to-png.sh
Executable file
91
scripts/tools/convert-svg-to-png.sh
Executable file
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
# Convert SVG files to PNG for Entra VerifiedID credential images
|
||||
# Supports multiple conversion methods
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||||
log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
|
||||
log_warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; }
|
||||
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 <input.svg> [output.png] [width] [height]"
|
||||
echo ""
|
||||
echo "Converts SVG to PNG for Entra VerifiedID credential images"
|
||||
echo ""
|
||||
echo "Arguments:"
|
||||
echo " input.svg - Input SVG file"
|
||||
echo " output.png - Output PNG file (default: input.png)"
|
||||
echo " width - Output width in pixels (default: 200)"
|
||||
echo " height - Output height in pixels (default: 200)"
|
||||
echo ""
|
||||
echo "Requirements:"
|
||||
echo " - ImageMagick (convert) OR"
|
||||
echo " - Inkscape OR"
|
||||
echo " - Node.js with sharp package"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
INPUT_FILE="$1"
|
||||
OUTPUT_FILE="${2:-${INPUT_FILE%.svg}.png}"
|
||||
WIDTH="${3:-200}"
|
||||
HEIGHT="${4:-200}"
|
||||
|
||||
if [ ! -f "${INPUT_FILE}" ]; then
|
||||
log_error "Input file not found: ${INPUT_FILE}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_info "Converting ${INPUT_FILE} to ${OUTPUT_FILE} (${WIDTH}x${HEIGHT})"
|
||||
|
||||
# Try ImageMagick first
|
||||
if command -v convert &> /dev/null; then
|
||||
log_info "Using ImageMagick..."
|
||||
convert -background none -resize "${WIDTH}x${HEIGHT}" "${INPUT_FILE}" "${OUTPUT_FILE}"
|
||||
log_success "Conversion complete: ${OUTPUT_FILE}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Try Inkscape
|
||||
if command -v inkscape &> /dev/null; then
|
||||
log_info "Using Inkscape..."
|
||||
inkscape "${INPUT_FILE}" --export-filename="${OUTPUT_FILE}" --export-width="${WIDTH}" --export-height="${HEIGHT}" --export-type=png
|
||||
log_success "Conversion complete: ${OUTPUT_FILE}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Try Node.js with sharp
|
||||
if command -v node &> /dev/null; then
|
||||
log_info "Trying Node.js conversion..."
|
||||
node -e "
|
||||
const fs = require('fs');
|
||||
const sharp = require('sharp');
|
||||
sharp('${INPUT_FILE}')
|
||||
.resize(${WIDTH}, ${HEIGHT})
|
||||
.png()
|
||||
.toFile('${OUTPUT_FILE}')
|
||||
.then(() => console.log('Conversion complete'))
|
||||
.catch(err => {
|
||||
console.error('Sharp not available or error:', err.message);
|
||||
process.exit(1);
|
||||
});
|
||||
" 2>/dev/null && log_success "Conversion complete: ${OUTPUT_FILE}" && exit 0
|
||||
fi
|
||||
|
||||
log_error "No conversion tool found. Install one of:"
|
||||
echo " - ImageMagick: sudo apt-get install imagemagick"
|
||||
echo " - Inkscape: sudo apt-get install inkscape"
|
||||
echo " - sharp (Node.js): pnpm add sharp"
|
||||
exit 1
|
||||
|
||||
66
scripts/tools/convert-svg-with-sharp.js
Executable file
66
scripts/tools/convert-svg-with-sharp.js
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Convert SVG to PNG using sharp
|
||||
* Usage: node convert-svg-with-sharp.js <input.svg> <output.png> <width> <height>
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// Try to find sharp in various locations
|
||||
let sharp;
|
||||
try {
|
||||
sharp = require('sharp');
|
||||
} catch (e) {
|
||||
// Try packages/auth/node_modules/sharp
|
||||
const authSharpPath = path.join(__dirname, '../../packages/auth/node_modules/sharp');
|
||||
if (fs.existsSync(authSharpPath)) {
|
||||
sharp = require(authSharpPath);
|
||||
} else {
|
||||
// Try root node_modules/sharp
|
||||
const rootSharpPath = path.join(__dirname, '../../node_modules/sharp');
|
||||
if (fs.existsSync(rootSharpPath)) {
|
||||
sharp = require(rootSharpPath);
|
||||
} else {
|
||||
console.error('Error: sharp module not found. Install with: pnpm add sharp');
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const [,, inputFile, outputFile, width, height] = process.argv;
|
||||
|
||||
if (!inputFile || !outputFile) {
|
||||
console.error('Usage: node convert-svg-with-sharp.js <input.svg> <output.png> <width> <height>');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const inputPath = path.resolve(inputFile);
|
||||
const outputPath = path.resolve(outputFile);
|
||||
const widthNum = parseInt(width || '200', 10);
|
||||
const heightNum = parseInt(height || '200', 10);
|
||||
|
||||
if (!fs.existsSync(inputPath)) {
|
||||
console.error(`Error: Input file not found: ${inputPath}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Ensure output directory exists
|
||||
const outputDir = path.dirname(outputPath);
|
||||
if (!fs.existsSync(outputDir)) {
|
||||
fs.mkdirSync(outputDir, { recursive: true });
|
||||
}
|
||||
|
||||
sharp(inputPath)
|
||||
.resize(widthNum, heightNum)
|
||||
.png()
|
||||
.toFile(outputPath)
|
||||
.then(() => {
|
||||
console.log(`Success: ${outputPath}`);
|
||||
process.exit(0);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(`Error converting ${inputPath}:`, error.message);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
117
scripts/tools/prepare-credential-images.sh
Executable file
117
scripts/tools/prepare-credential-images.sh
Executable file
@@ -0,0 +1,117 @@
|
||||
#!/bin/bash
|
||||
# Prepare all credential images from SVG sources
|
||||
# Converts SVG files to PNG for Entra VerifiedID compatibility
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||||
log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
|
||||
log_warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; }
|
||||
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
IMAGES_DIR="assets/credential-images"
|
||||
SVG_DIR="${IMAGES_DIR}/svg"
|
||||
PNG_DIR="${IMAGES_DIR}/png"
|
||||
|
||||
mkdir -p "${SVG_DIR}" "${PNG_DIR}"
|
||||
|
||||
log_info "Preparing credential images from SVG sources"
|
||||
echo ""
|
||||
|
||||
# Check for SVG files
|
||||
if [ ! -d "${SVG_DIR}" ] || [ -z "$(find "${SVG_DIR}" -name "*.svg" 2>/dev/null)" ]; then
|
||||
log_warning "No SVG files found in ${SVG_DIR}"
|
||||
log_info "Place your SVG logo files in: ${SVG_DIR}/"
|
||||
log_info "Expected files:"
|
||||
echo " - default-logo.svg"
|
||||
echo " - diplomatic-logo.svg"
|
||||
echo " - judicial-logo.svg"
|
||||
echo " - financial-logo.svg"
|
||||
echo ""
|
||||
log_info "Creating example structure..."
|
||||
|
||||
# Create example SVG files (placeholder)
|
||||
cat > "${SVG_DIR}/.gitkeep" << 'EOF'
|
||||
# Place your SVG logo files here
|
||||
# Files will be automatically converted to PNG for Entra VerifiedID
|
||||
EOF
|
||||
|
||||
log_info "After adding SVG files, run this script again to convert them"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Convert each SVG to PNG
|
||||
log_info "Converting SVG files to PNG..."
|
||||
for svg_file in "${SVG_DIR}"/*.svg; do
|
||||
if [ -f "${svg_file}" ]; then
|
||||
filename=$(basename "${svg_file}" .svg)
|
||||
png_file="${PNG_DIR}/${filename}.png"
|
||||
|
||||
log_info "Converting: ${filename}.svg → ${filename}.png"
|
||||
if ./scripts/tools/convert-svg-to-png.sh "${svg_file}" "${png_file}" 200 200; then
|
||||
log_success "Created: ${png_file}"
|
||||
else
|
||||
log_warning "Failed to convert ${filename}.svg"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Create multiple sizes
|
||||
log_info "Creating multiple sizes..."
|
||||
SIZES=(200 400 800)
|
||||
for size in "${SIZES[@]}"; do
|
||||
for svg_file in "${SVG_DIR}"/*.svg; do
|
||||
if [ -f "${svg_file}" ]; then
|
||||
filename=$(basename "${svg_file}" .svg)
|
||||
png_file="${PNG_DIR}/${filename}-${size}x${size}.png"
|
||||
|
||||
if ./scripts/tools/convert-svg-to-png.sh "${svg_file}" "${png_file}" "${size}" "${size}" 2>/dev/null; then
|
||||
log_success "Created: ${filename}-${size}x${size}.png"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# Generate upload instructions
|
||||
cat > "${PNG_DIR}/UPLOAD_INSTRUCTIONS.md" << 'EOF'
|
||||
# Credential Image Upload Instructions
|
||||
|
||||
## Generated PNG Files
|
||||
|
||||
PNG files have been generated from SVG sources for Entra VerifiedID compatibility.
|
||||
|
||||
## Upload to CDN/Storage
|
||||
|
||||
1. Upload all PNG files to your CDN or static storage
|
||||
2. Ensure files are publicly accessible via HTTPS
|
||||
3. Update manifest templates with the image URLs
|
||||
|
||||
## Recommended URLs
|
||||
|
||||
- Default: `https://cdn.theorder.org/images/credential-logo.png`
|
||||
- Diplomatic: `https://cdn.theorder.org/images/diplomatic-logo.png`
|
||||
- Judicial: `https://cdn.theorder.org/images/judicial-logo.png`
|
||||
- Financial: `https://cdn.theorder.org/images/financial-logo.png`
|
||||
|
||||
## Update Configuration
|
||||
|
||||
After uploading, update:
|
||||
- Manifest templates in `manifests/entra/`
|
||||
- Environment variable: `ENTRA_CREDENTIAL_LOGO_URI`
|
||||
- Or in code: `logoUri` in `EntraVerifiedIDClient` config
|
||||
EOF
|
||||
|
||||
log_success "Image preparation complete!"
|
||||
log_info "PNG files created in: ${PNG_DIR}/"
|
||||
log_info "Next steps:"
|
||||
echo "1. Review generated PNG files"
|
||||
echo "2. Upload to CDN/storage"
|
||||
echo "3. Update manifest templates with image URLs"
|
||||
echo "4. See: ${PNG_DIR}/UPLOAD_INSTRUCTIONS.md"
|
||||
|
||||
Reference in New Issue
Block a user