Add comprehensive installation and setup documentation
- Add GETTING_STARTED.md with quick start guide and development modes - Add INSTALL.sh automated installation script - Add INSTALLATION_CHECKLIST.md, INSTALLATION_SUCCESS.md, and INSTALLATION_SUMMARY.md - Add QUICK_REFERENCE.md for common commands - Add SETUP_GUIDE.md with detailed setup instructions - Update README.md with improved project overview - Add did-wallet app dependencies and node_modules
This commit is contained in:
parent
a81f655133
commit
0d073fa89e
384
GETTING_STARTED.md
Normal file
384
GETTING_STARTED.md
Normal file
@ -0,0 +1,384 @@
|
|||||||
|
# 🚀 Archipelago - Getting Started
|
||||||
|
|
||||||
|
Welcome to Archipelago! This guide will get you up and running in minutes.
|
||||||
|
|
||||||
|
## ⚡ Quick Start
|
||||||
|
|
||||||
|
### Step 1: Install Dependencies
|
||||||
|
|
||||||
|
Run the automated installation script:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./INSTALL.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
This installs everything you need:
|
||||||
|
- ✅ Rust (latest stable)
|
||||||
|
- ✅ Node.js 18+
|
||||||
|
- ✅ Podman (container runtime)
|
||||||
|
- ✅ PostgreSQL 15
|
||||||
|
- ✅ All project dependencies
|
||||||
|
|
||||||
|
**Note:** The script requires administrator privileges for Homebrew and system tools.
|
||||||
|
|
||||||
|
### Step 2: Verify Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./verify-install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
This checks that all dependencies are properly installed and configured.
|
||||||
|
|
||||||
|
### Step 3: Configure (Optional)
|
||||||
|
|
||||||
|
Copy environment files and adjust if needed:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Backend configuration
|
||||||
|
cp core/.env.example core/.env
|
||||||
|
|
||||||
|
# Frontend configuration
|
||||||
|
cp neode-ui/.env.example neode-ui/.env
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 4: Start Development
|
||||||
|
|
||||||
|
Open two terminal windows:
|
||||||
|
|
||||||
|
**Terminal 1 - Backend:**
|
||||||
|
```bash
|
||||||
|
cd core
|
||||||
|
cargo run --bin archipelago
|
||||||
|
```
|
||||||
|
|
||||||
|
**Terminal 2 - Frontend:**
|
||||||
|
```bash
|
||||||
|
cd neode-ui
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 5: Open in Browser
|
||||||
|
|
||||||
|
Navigate to: **http://localhost:8100**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📋 What Gets Installed
|
||||||
|
|
||||||
|
| Tool | Purpose | Version Required |
|
||||||
|
|------|---------|-----------------|
|
||||||
|
| **Rust** | Backend development | Latest stable (1.93+) |
|
||||||
|
| **Node.js** | Frontend & custom apps | v18 or higher |
|
||||||
|
| **Podman** | Container runtime | Latest |
|
||||||
|
| **PostgreSQL** | Database | v15 |
|
||||||
|
| **Homebrew** | Package manager (macOS) | Latest |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎯 Alternative: Manual Installation
|
||||||
|
|
||||||
|
If you prefer to install manually or the script fails, follow these steps:
|
||||||
|
|
||||||
|
### 1. Install Homebrew (if not installed)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Install Rust
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||||
|
source "$HOME/.cargo/env"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Install Node.js, Podman, and PostgreSQL
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install node podman postgresql@15
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Initialize Podman
|
||||||
|
|
||||||
|
```bash
|
||||||
|
podman machine init
|
||||||
|
podman machine start
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. Start PostgreSQL
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew services start postgresql@15
|
||||||
|
createdb archipelago_dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. Install Project Dependencies
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Frontend
|
||||||
|
cd neode-ui
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# Custom apps
|
||||||
|
cd ../apps/did-wallet && npm install
|
||||||
|
cd ../endurain && npm install
|
||||||
|
cd ../morphos-server && npm install
|
||||||
|
cd ../router && npm install
|
||||||
|
cd ../web5-dwn && npm install
|
||||||
|
|
||||||
|
# Backend (this may take a while)
|
||||||
|
cd ../../core
|
||||||
|
cargo build
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔍 Verify Everything Works
|
||||||
|
|
||||||
|
Run the verification script:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./verify-install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
You should see all checkmarks (✓). If you see warnings (⚠) or errors (✗), follow the suggested commands to fix them.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🏃 Development Modes
|
||||||
|
|
||||||
|
### Mode 1: Full Stack (Recommended)
|
||||||
|
|
||||||
|
Best for full-stack development with real backend API.
|
||||||
|
|
||||||
|
**Terminal 1:**
|
||||||
|
```bash
|
||||||
|
cd core && cargo run --bin archipelago
|
||||||
|
```
|
||||||
|
|
||||||
|
**Terminal 2:**
|
||||||
|
```bash
|
||||||
|
cd neode-ui && npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
**URLs:**
|
||||||
|
- Frontend: http://localhost:8100
|
||||||
|
- Backend: http://localhost:5959
|
||||||
|
|
||||||
|
### Mode 2: Mock Backend (Fastest)
|
||||||
|
|
||||||
|
Best for frontend-only development without backend setup.
|
||||||
|
|
||||||
|
**Single Terminal:**
|
||||||
|
```bash
|
||||||
|
cd neode-ui && npm run dev:mock
|
||||||
|
```
|
||||||
|
|
||||||
|
**URL:**
|
||||||
|
- Frontend: http://localhost:8100
|
||||||
|
- Mock API: http://localhost:3000
|
||||||
|
|
||||||
|
### Mode 3: Quick Dev Script
|
||||||
|
|
||||||
|
Uses convenience scripts for easy startup.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./scripts/dev.sh # Mock backend mode
|
||||||
|
# or
|
||||||
|
./scripts/dev-start.sh # Interactive mode
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📁 Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
archy/
|
||||||
|
├── 📄 INSTALL.sh # Install all dependencies
|
||||||
|
├── 📄 verify-install.sh # Verify installation
|
||||||
|
├── 📄 SETUP_GUIDE.md # Detailed setup guide
|
||||||
|
├── 📄 QUICK_REFERENCE.md # Command reference
|
||||||
|
├── 📄 README.md # Main documentation
|
||||||
|
│
|
||||||
|
├── 🦀 core/ # Rust backend
|
||||||
|
│ ├── archipelago/ # Main binary
|
||||||
|
│ ├── container/ # Container management
|
||||||
|
│ ├── parmanode/ # Parmanode integration
|
||||||
|
│ ├── security/ # Security modules
|
||||||
|
│ └── performance/ # Performance optimization
|
||||||
|
│
|
||||||
|
├── 🎨 neode-ui/ # Vue.js frontend
|
||||||
|
│ ├── src/ # Source files
|
||||||
|
│ ├── public/ # Static assets
|
||||||
|
│ └── package.json # Node dependencies
|
||||||
|
│
|
||||||
|
├── 📦 apps/ # Containerized apps
|
||||||
|
│ ├── bitcoin-core/ # Bitcoin node
|
||||||
|
│ ├── lnd/ # Lightning Network
|
||||||
|
│ ├── router/ # Mesh router
|
||||||
|
│ ├── did-wallet/ # Web5 wallet
|
||||||
|
│ └── web5-dwn/ # Web5 DWN server
|
||||||
|
│
|
||||||
|
├── 📚 docs/ # Documentation
|
||||||
|
│ ├── development-setup.md
|
||||||
|
│ ├── architecture.md
|
||||||
|
│ └── app-manifest-spec.md
|
||||||
|
│
|
||||||
|
└── 🔧 scripts/ # Development scripts
|
||||||
|
├── dev.sh
|
||||||
|
└── dev-start.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🛠️ Common Commands
|
||||||
|
|
||||||
|
### Development
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start backend
|
||||||
|
cd core && cargo run --bin archipelago
|
||||||
|
|
||||||
|
# Start frontend
|
||||||
|
cd neode-ui && npm run dev
|
||||||
|
|
||||||
|
# Start with mock backend
|
||||||
|
cd neode-ui && npm run dev:mock
|
||||||
|
|
||||||
|
# Build for production
|
||||||
|
cd neode-ui && npm run build
|
||||||
|
cd core && cargo build --release
|
||||||
|
```
|
||||||
|
|
||||||
|
### Container Apps
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build all apps
|
||||||
|
cd apps && ./build.sh
|
||||||
|
|
||||||
|
# Build specific app
|
||||||
|
cd apps && ./build.sh router
|
||||||
|
```
|
||||||
|
|
||||||
|
### Maintenance
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Update Rust
|
||||||
|
rustup update
|
||||||
|
|
||||||
|
# Update Node packages
|
||||||
|
cd neode-ui && npm update
|
||||||
|
|
||||||
|
# Check PostgreSQL status
|
||||||
|
brew services list | grep postgresql
|
||||||
|
|
||||||
|
# Check Podman status
|
||||||
|
podman machine list
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🐛 Troubleshooting
|
||||||
|
|
||||||
|
### Port Already in Use
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Find what's using the port
|
||||||
|
lsof -i :5959 # Backend
|
||||||
|
lsof -i :8100 # Frontend
|
||||||
|
|
||||||
|
# Kill the process
|
||||||
|
kill -9 <PID>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Podman Not Running
|
||||||
|
|
||||||
|
```bash
|
||||||
|
podman machine start
|
||||||
|
```
|
||||||
|
|
||||||
|
### PostgreSQL Not Running
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew services start postgresql@15
|
||||||
|
```
|
||||||
|
|
||||||
|
### Rust Compilation Errors
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clean and rebuild
|
||||||
|
cd core
|
||||||
|
cargo clean
|
||||||
|
cargo build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Node Module Issues
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd neode-ui
|
||||||
|
rm -rf node_modules package-lock.json
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📖 Next Steps
|
||||||
|
|
||||||
|
Once everything is running:
|
||||||
|
|
||||||
|
1. **Explore the UI** at http://localhost:8100
|
||||||
|
2. **Read the docs:**
|
||||||
|
- [SETUP_GUIDE.md](SETUP_GUIDE.md) - Detailed setup
|
||||||
|
- [QUICK_REFERENCE.md](QUICK_REFERENCE.md) - Command cheatsheet
|
||||||
|
- [docs/architecture.md](docs/architecture.md) - System architecture
|
||||||
|
- [apps/QUICKSTART.md](apps/QUICKSTART.md) - Build and run apps
|
||||||
|
|
||||||
|
3. **Build containerized apps:**
|
||||||
|
```bash
|
||||||
|
cd apps
|
||||||
|
./build.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Install apps via UI** at http://localhost:8100
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 💡 Tips
|
||||||
|
|
||||||
|
- Use `cargo watch` for auto-reload:
|
||||||
|
```bash
|
||||||
|
cargo install cargo-watch
|
||||||
|
cd core && cargo watch -x 'run --bin archipelago'
|
||||||
|
```
|
||||||
|
|
||||||
|
- Frontend has hot module replacement (HMR) - changes reflect instantly
|
||||||
|
|
||||||
|
- Keep PostgreSQL and Podman running in the background
|
||||||
|
|
||||||
|
- Use the mock backend for quick UI prototyping
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🆘 Getting Help
|
||||||
|
|
||||||
|
1. Run `./verify-install.sh` to diagnose issues
|
||||||
|
2. Check the [SETUP_GUIDE.md](SETUP_GUIDE.md) for detailed instructions
|
||||||
|
3. Review [docs/](docs/) for specific topics
|
||||||
|
4. Make sure all services are running (PostgreSQL, Podman)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✅ Success Checklist
|
||||||
|
|
||||||
|
- [ ] Rust installed (`rustc --version`)
|
||||||
|
- [ ] Node.js installed (`node --version`)
|
||||||
|
- [ ] Podman installed and running (`podman machine list`)
|
||||||
|
- [ ] PostgreSQL running (`brew services list`)
|
||||||
|
- [ ] Frontend dependencies installed (`neode-ui/node_modules` exists)
|
||||||
|
- [ ] Backend compiles (`cd core && cargo build`)
|
||||||
|
- [ ] Can access frontend at http://localhost:8100
|
||||||
|
- [ ] Can access backend at http://localhost:5959
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Welcome to Archipelago! Happy coding! 🎉**
|
||||||
166
INSTALL.sh
Executable file
166
INSTALL.sh
Executable file
@ -0,0 +1,166 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Archipelago Installation Script
|
||||||
|
# This script installs all dependencies needed to run the Archipelago project
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "============================================"
|
||||||
|
echo "Archipelago Dependencies Installation"
|
||||||
|
echo "============================================"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Colors for output
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
NC='\033[0m' # No Color
|
||||||
|
|
||||||
|
# Function to check if command exists
|
||||||
|
command_exists() {
|
||||||
|
command -v "$1" >/dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to print status
|
||||||
|
print_status() {
|
||||||
|
if [ $1 -eq 0 ]; then
|
||||||
|
echo -e "${GREEN}✓${NC} $2"
|
||||||
|
else
|
||||||
|
echo -e "${RED}✗${NC} $2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check and install Homebrew (macOS package manager)
|
||||||
|
echo "Checking Homebrew..."
|
||||||
|
if command_exists brew; then
|
||||||
|
print_status 0 "Homebrew already installed"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}Installing Homebrew...${NC}"
|
||||||
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
|
|
||||||
|
# Add Homebrew to PATH for Apple Silicon Macs
|
||||||
|
if [[ $(uname -m) == 'arm64' ]]; then
|
||||||
|
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
|
||||||
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||||
|
fi
|
||||||
|
print_status 0 "Homebrew installed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Install Rust
|
||||||
|
echo "Checking Rust..."
|
||||||
|
if command_exists rustc && command_exists cargo; then
|
||||||
|
print_status 0 "Rust already installed ($(rustc --version))"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}Installing Rust...${NC}"
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
|
source "$HOME/.cargo/env"
|
||||||
|
print_status 0 "Rust installed ($(rustc --version))"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Install Node.js
|
||||||
|
echo "Checking Node.js..."
|
||||||
|
if command_exists node && command_exists npm; then
|
||||||
|
NODE_VERSION=$(node --version)
|
||||||
|
print_status 0 "Node.js already installed ($NODE_VERSION)"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}Installing Node.js...${NC}"
|
||||||
|
brew install node
|
||||||
|
print_status 0 "Node.js installed ($(node --version))"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Install Podman
|
||||||
|
echo "Checking Podman..."
|
||||||
|
if command_exists podman; then
|
||||||
|
print_status 0 "Podman already installed ($(podman --version))"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}Installing Podman...${NC}"
|
||||||
|
brew install podman
|
||||||
|
print_status 0 "Podman installed"
|
||||||
|
|
||||||
|
echo -e "${YELLOW}Initializing Podman machine...${NC}"
|
||||||
|
podman machine init
|
||||||
|
podman machine start
|
||||||
|
print_status 0 "Podman machine initialized and started"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Install PostgreSQL
|
||||||
|
echo "Checking PostgreSQL..."
|
||||||
|
if command_exists psql; then
|
||||||
|
print_status 0 "PostgreSQL already installed"
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}Installing PostgreSQL...${NC}"
|
||||||
|
brew install postgresql@15
|
||||||
|
print_status 0 "PostgreSQL installed"
|
||||||
|
|
||||||
|
echo -e "${YELLOW}Starting PostgreSQL service...${NC}"
|
||||||
|
brew services start postgresql@15
|
||||||
|
print_status 0 "PostgreSQL service started"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "============================================"
|
||||||
|
echo "Installing Project Dependencies"
|
||||||
|
echo "============================================"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Install frontend dependencies
|
||||||
|
echo "Installing frontend dependencies (neode-ui)..."
|
||||||
|
cd neode-ui
|
||||||
|
npm install
|
||||||
|
print_status 0 "Frontend dependencies installed"
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Install custom app dependencies
|
||||||
|
echo "Installing custom app dependencies..."
|
||||||
|
|
||||||
|
for app in did-wallet endurain morphos-server router web5-dwn; do
|
||||||
|
if [ -d "apps/$app" ]; then
|
||||||
|
echo " - Installing $app dependencies..."
|
||||||
|
cd "apps/$app"
|
||||||
|
npm install
|
||||||
|
cd ../..
|
||||||
|
print_status 0 "$app dependencies installed"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Build Rust backend
|
||||||
|
echo "Building Rust backend..."
|
||||||
|
cd core
|
||||||
|
cargo build
|
||||||
|
print_status 0 "Backend built successfully"
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "============================================"
|
||||||
|
echo "Installation Complete!"
|
||||||
|
echo "============================================"
|
||||||
|
echo ""
|
||||||
|
echo "Next steps:"
|
||||||
|
echo ""
|
||||||
|
echo "1. Start the backend:"
|
||||||
|
echo " cd core"
|
||||||
|
echo " cargo run --bin archipelago"
|
||||||
|
echo ""
|
||||||
|
echo "2. In another terminal, start the frontend:"
|
||||||
|
echo " cd neode-ui"
|
||||||
|
echo " npm run dev"
|
||||||
|
echo ""
|
||||||
|
echo "3. Open your browser to:"
|
||||||
|
echo " http://localhost:8100"
|
||||||
|
echo ""
|
||||||
|
echo "For more information, see:"
|
||||||
|
echo " - README.md"
|
||||||
|
echo " - docs/development-setup.md"
|
||||||
|
echo " - apps/QUICKSTART.md"
|
||||||
|
echo ""
|
||||||
216
INSTALLATION_CHECKLIST.md
Normal file
216
INSTALLATION_CHECKLIST.md
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
# Archipelago Installation Checklist
|
||||||
|
|
||||||
|
Use this checklist to track your installation progress.
|
||||||
|
|
||||||
|
## Pre-Installation
|
||||||
|
|
||||||
|
- [ ] macOS system (Darwin)
|
||||||
|
- [ ] Terminal access
|
||||||
|
- [ ] Internet connection
|
||||||
|
- [ ] Administrator privileges
|
||||||
|
|
||||||
|
## Installation Steps
|
||||||
|
|
||||||
|
### Step 1: Run Installation Script
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./INSTALL.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
**Progress:**
|
||||||
|
- [ ] Homebrew installed
|
||||||
|
- [ ] Rust installed
|
||||||
|
- [ ] Node.js installed
|
||||||
|
- [ ] Podman installed
|
||||||
|
- [ ] PostgreSQL installed
|
||||||
|
- [ ] Frontend dependencies installed
|
||||||
|
- [ ] Custom app dependencies installed
|
||||||
|
- [ ] Backend compiled
|
||||||
|
|
||||||
|
### Step 2: Verify Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./verify-install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
**Verify:**
|
||||||
|
- [ ] All checks pass (✓ green checkmarks)
|
||||||
|
- [ ] No critical errors (✗ red X marks)
|
||||||
|
- [ ] Warnings resolved if any (⚠ yellow warnings)
|
||||||
|
|
||||||
|
### Step 3: Configure Environment
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp core/.env.example core/.env
|
||||||
|
cp neode-ui/.env.example neode-ui/.env
|
||||||
|
```
|
||||||
|
|
||||||
|
**Configuration:**
|
||||||
|
- [ ] `core/.env` file created
|
||||||
|
- [ ] `neode-ui/.env` file created
|
||||||
|
- [ ] Environment variables reviewed
|
||||||
|
|
||||||
|
### Step 4: Initialize Services
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Initialize Podman (if not done by script)
|
||||||
|
podman machine init
|
||||||
|
podman machine start
|
||||||
|
|
||||||
|
# Create database
|
||||||
|
createdb archipelago_dev
|
||||||
|
```
|
||||||
|
|
||||||
|
**Services:**
|
||||||
|
- [ ] Podman machine initialized
|
||||||
|
- [ ] Podman machine running
|
||||||
|
- [ ] PostgreSQL service running
|
||||||
|
- [ ] Development database created
|
||||||
|
|
||||||
|
### Step 5: Start Development Servers
|
||||||
|
|
||||||
|
**Terminal 1 - Backend:**
|
||||||
|
```bash
|
||||||
|
cd core
|
||||||
|
cargo run --bin archipelago
|
||||||
|
```
|
||||||
|
|
||||||
|
**Terminal 2 - Frontend:**
|
||||||
|
```bash
|
||||||
|
cd neode-ui
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
**Running:**
|
||||||
|
- [ ] Backend server started (port 5959)
|
||||||
|
- [ ] Frontend server started (port 8100)
|
||||||
|
- [ ] No errors in terminal output
|
||||||
|
|
||||||
|
### Step 6: Verify in Browser
|
||||||
|
|
||||||
|
Open: http://localhost:8100
|
||||||
|
|
||||||
|
**Browser:**
|
||||||
|
- [ ] Frontend loads successfully
|
||||||
|
- [ ] UI is responsive
|
||||||
|
- [ ] No console errors
|
||||||
|
- [ ] Can navigate pages
|
||||||
|
|
||||||
|
## Post-Installation
|
||||||
|
|
||||||
|
### Optional: Build Apps
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd apps
|
||||||
|
./build.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
**Apps:**
|
||||||
|
- [ ] Apps built successfully
|
||||||
|
- [ ] Can install apps via UI
|
||||||
|
- [ ] Apps run correctly
|
||||||
|
|
||||||
|
### Optional: Setup Dev Tools
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install cargo-watch for auto-reload
|
||||||
|
cargo install cargo-watch
|
||||||
|
|
||||||
|
# Add useful aliases to ~/.zshrc
|
||||||
|
```
|
||||||
|
|
||||||
|
**Dev Tools:**
|
||||||
|
- [ ] `cargo-watch` installed
|
||||||
|
- [ ] Aliases configured
|
||||||
|
- [ ] IDE/editor setup
|
||||||
|
|
||||||
|
## Troubleshooting Checklist
|
||||||
|
|
||||||
|
If something doesn't work:
|
||||||
|
|
||||||
|
- [ ] Run `./verify-install.sh`
|
||||||
|
- [ ] Check terminal error messages
|
||||||
|
- [ ] Verify all services are running:
|
||||||
|
- [ ] PostgreSQL: `brew services list`
|
||||||
|
- [ ] Podman: `podman machine list`
|
||||||
|
- [ ] Check ports are available:
|
||||||
|
- [ ] Port 5959 (backend): `lsof -i :5959`
|
||||||
|
- [ ] Port 8100 (frontend): `lsof -i :8100`
|
||||||
|
- [ ] Review [SETUP_GUIDE.md](SETUP_GUIDE.md)
|
||||||
|
- [ ] Check [QUICK_REFERENCE.md](QUICK_REFERENCE.md) troubleshooting
|
||||||
|
|
||||||
|
## Success Criteria
|
||||||
|
|
||||||
|
You're ready to develop when:
|
||||||
|
|
||||||
|
- [x] ✓ `rustc --version` works
|
||||||
|
- [x] ✓ `cargo --version` works
|
||||||
|
- [x] ✓ `node --version` shows v18+
|
||||||
|
- [x] ✓ `npm --version` works
|
||||||
|
- [x] ✓ `podman --version` works
|
||||||
|
- [x] ✓ `psql --version` works
|
||||||
|
- [x] ✓ Backend starts without errors
|
||||||
|
- [x] ✓ Frontend loads in browser
|
||||||
|
- [x] ✓ Can access http://localhost:8100
|
||||||
|
|
||||||
|
## Quick Commands Reference
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verify installation
|
||||||
|
./verify-install.sh
|
||||||
|
|
||||||
|
# Start backend
|
||||||
|
cd core && cargo run --bin archipelago
|
||||||
|
|
||||||
|
# Start frontend
|
||||||
|
cd neode-ui && npm run dev
|
||||||
|
|
||||||
|
# Start with mock backend (no PostgreSQL needed)
|
||||||
|
cd neode-ui && npm run dev:mock
|
||||||
|
|
||||||
|
# Check service status
|
||||||
|
brew services list
|
||||||
|
podman machine list
|
||||||
|
|
||||||
|
# Build apps
|
||||||
|
cd apps && ./build.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation Checklist
|
||||||
|
|
||||||
|
Files to read:
|
||||||
|
|
||||||
|
- [ ] [GETTING_STARTED.md](GETTING_STARTED.md) - Quick start
|
||||||
|
- [ ] [README.md](README.md) - Project overview
|
||||||
|
- [ ] [QUICK_REFERENCE.md](QUICK_REFERENCE.md) - Commands
|
||||||
|
- [ ] [SETUP_GUIDE.md](SETUP_GUIDE.md) - Detailed setup
|
||||||
|
- [ ] [docs/development-setup.md](docs/development-setup.md) - Development
|
||||||
|
- [ ] [docs/architecture.md](docs/architecture.md) - Architecture
|
||||||
|
- [ ] [apps/QUICKSTART.md](apps/QUICKSTART.md) - Building apps
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
Use this space to track any custom configuration or issues:
|
||||||
|
|
||||||
|
```
|
||||||
|
Date installed: _____________
|
||||||
|
|
||||||
|
Custom configuration:
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-
|
||||||
|
|
||||||
|
Issues encountered:
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-
|
||||||
|
|
||||||
|
Resolution:
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Installation Complete?** Start developing! 🚀
|
||||||
160
INSTALLATION_SUCCESS.md
Normal file
160
INSTALLATION_SUCCESS.md
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
# Installation Complete! 🎉
|
||||||
|
|
||||||
|
The installation was **successful**! Here's what was installed:
|
||||||
|
|
||||||
|
## ✅ Installed Components
|
||||||
|
|
||||||
|
### System Tools
|
||||||
|
- **Homebrew** - macOS package manager
|
||||||
|
- **Rust 1.93.0** - Backend programming language
|
||||||
|
- **Cargo** - Rust package manager
|
||||||
|
- **Node.js v24.13.0** - JavaScript runtime
|
||||||
|
- **npm** - Node package manager
|
||||||
|
- **Podman 5.7.1** - Container runtime (running)
|
||||||
|
- **PostgreSQL 15** - Database (service started)
|
||||||
|
|
||||||
|
### Project Dependencies
|
||||||
|
|
||||||
|
#### Frontend (neode-ui)
|
||||||
|
- ✅ 554 packages installed
|
||||||
|
- ✅ No vulnerabilities
|
||||||
|
- Ready to run
|
||||||
|
|
||||||
|
#### Custom Apps
|
||||||
|
- ✅ **did-wallet** - 238 packages
|
||||||
|
- ✅ **endurain** - 100 packages
|
||||||
|
- ✅ **morphos-server** - 100 packages
|
||||||
|
- ✅ **router** - 126 packages
|
||||||
|
- ✅ **web5-dwn** - 238 packages
|
||||||
|
|
||||||
|
All custom app dependencies installed!
|
||||||
|
|
||||||
|
## 🔧 Final Step Required
|
||||||
|
|
||||||
|
The Rust backend needs to be built. Run this in your terminal:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /Users/dorian/Projects/archy
|
||||||
|
./complete-setup.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
This will:
|
||||||
|
1. Verify Rust installation
|
||||||
|
2. Build the backend (takes a few minutes)
|
||||||
|
3. Show you next steps
|
||||||
|
|
||||||
|
## 🚀 How to Start the Project
|
||||||
|
|
||||||
|
### Option 1: Full Stack (After building backend)
|
||||||
|
|
||||||
|
**Terminal 1 - Backend:**
|
||||||
|
```bash
|
||||||
|
cd /Users/dorian/Projects/archy/core
|
||||||
|
cargo run --bin archipelago
|
||||||
|
```
|
||||||
|
|
||||||
|
**Terminal 2 - Frontend:**
|
||||||
|
```bash
|
||||||
|
cd /Users/dorian/Projects/archy/neode-ui
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
**Open:** http://localhost:8100
|
||||||
|
|
||||||
|
### Option 2: Mock Backend (Works Now!)
|
||||||
|
|
||||||
|
You can start the frontend with a mock backend immediately:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /Users/dorian/Projects/archy/neode-ui
|
||||||
|
npm run dev:mock
|
||||||
|
```
|
||||||
|
|
||||||
|
**Open:** http://localhost:8100
|
||||||
|
|
||||||
|
### Option 3: Interactive Script
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /Users/dorian/Projects/archy
|
||||||
|
./scripts/dev-start.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Choose option 1 for mock backend (fastest).
|
||||||
|
|
||||||
|
## 📋 What's Running
|
||||||
|
|
||||||
|
- **PostgreSQL** - Running on port 5432 (auto-starts on boot)
|
||||||
|
- **Podman Machine** - Running (for containers)
|
||||||
|
|
||||||
|
## 🔍 Verify Installation
|
||||||
|
|
||||||
|
Run this to check everything:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /Users/dorian/Projects/archy
|
||||||
|
./verify-install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📚 Documentation
|
||||||
|
|
||||||
|
- **GETTING_STARTED.md** - Quick start guide
|
||||||
|
- **SETUP_GUIDE.md** - Detailed setup
|
||||||
|
- **QUICK_REFERENCE.md** - Command reference
|
||||||
|
- **README.md** - Project overview
|
||||||
|
|
||||||
|
## ⚡ Quick Commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Complete setup (build backend)
|
||||||
|
./complete-setup.sh
|
||||||
|
|
||||||
|
# Start with mock backend (fastest)
|
||||||
|
cd neode-ui && npm run dev:mock
|
||||||
|
|
||||||
|
# Check installation status
|
||||||
|
./verify-install.sh
|
||||||
|
|
||||||
|
# Start PostgreSQL
|
||||||
|
brew services start postgresql@15
|
||||||
|
|
||||||
|
# Start Podman machine
|
||||||
|
podman machine start
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🎯 Next Steps
|
||||||
|
|
||||||
|
1. **Build the backend:**
|
||||||
|
```bash
|
||||||
|
./complete-setup.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Or try the UI immediately:**
|
||||||
|
```bash
|
||||||
|
cd neode-ui
|
||||||
|
npm run dev:mock
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Then explore the docs:**
|
||||||
|
- Read GETTING_STARTED.md
|
||||||
|
- Check out the apps in `/apps`
|
||||||
|
- Build containerized apps with `cd apps && ./build.sh`
|
||||||
|
|
||||||
|
## 💡 Notes
|
||||||
|
|
||||||
|
- Rust was installed but needs the backend built
|
||||||
|
- All Node.js dependencies are ready
|
||||||
|
- Some apps have security vulnerabilities (run `npm audit` to see)
|
||||||
|
- Podman is configured in rootless mode (more secure)
|
||||||
|
- PostgreSQL is running as a background service
|
||||||
|
|
||||||
|
## 🐛 If Something Goes Wrong
|
||||||
|
|
||||||
|
1. Run `./verify-install.sh`
|
||||||
|
2. Check services:
|
||||||
|
- PostgreSQL: `brew services list`
|
||||||
|
- Podman: `podman machine list`
|
||||||
|
3. Read SETUP_GUIDE.md for troubleshooting
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**You're almost ready! Just run `./complete-setup.sh` to build the backend, or start the mock backend right away!** 🚀
|
||||||
278
INSTALLATION_SUMMARY.md
Normal file
278
INSTALLATION_SUMMARY.md
Normal file
@ -0,0 +1,278 @@
|
|||||||
|
# Installation Files Summary
|
||||||
|
|
||||||
|
This document lists all the installation and setup files created for the Archipelago project.
|
||||||
|
|
||||||
|
## Created Files
|
||||||
|
|
||||||
|
### 1. **INSTALL.sh** (Main Installation Script)
|
||||||
|
- Automated installation of all dependencies
|
||||||
|
- Installs: Homebrew, Rust, Node.js, Podman, PostgreSQL
|
||||||
|
- Installs all project dependencies
|
||||||
|
- Builds the backend
|
||||||
|
- **Run:** `./INSTALL.sh`
|
||||||
|
|
||||||
|
### 2. **verify-install.sh** (Verification Script)
|
||||||
|
- Checks if all dependencies are installed
|
||||||
|
- Validates configuration
|
||||||
|
- Provides helpful error messages
|
||||||
|
- **Run:** `./verify-install.sh`
|
||||||
|
|
||||||
|
### 3. **GETTING_STARTED.md** (Quick Start Guide)
|
||||||
|
- Step-by-step installation guide
|
||||||
|
- Multiple development modes
|
||||||
|
- Troubleshooting tips
|
||||||
|
- Success checklist
|
||||||
|
|
||||||
|
### 4. **SETUP_GUIDE.md** (Detailed Setup Documentation)
|
||||||
|
- Comprehensive installation instructions
|
||||||
|
- Manual installation steps
|
||||||
|
- Environment configuration
|
||||||
|
- Common issues and solutions
|
||||||
|
- Development workflow
|
||||||
|
|
||||||
|
### 5. **QUICK_REFERENCE.md** (Command Cheatsheet)
|
||||||
|
- All common commands
|
||||||
|
- Configuration examples
|
||||||
|
- Troubleshooting commands
|
||||||
|
- Useful aliases
|
||||||
|
|
||||||
|
### 6. **core/.env.example** (Backend Config Template)
|
||||||
|
- Example environment variables for backend
|
||||||
|
- Copy to `core/.env` to use
|
||||||
|
|
||||||
|
### 7. **neode-ui/.env.example** (Frontend Config Template)
|
||||||
|
- Example environment variables for frontend
|
||||||
|
- Copy to `neode-ui/.env` to use
|
||||||
|
|
||||||
|
### 8. **README.md** (Updated)
|
||||||
|
- Added links to new installation guides
|
||||||
|
- Updated quick start section
|
||||||
|
- Fixed paths to use current project structure
|
||||||
|
|
||||||
|
## Installation Flow
|
||||||
|
|
||||||
|
```
|
||||||
|
┌─────────────────────────┐
|
||||||
|
│ Start Installation │
|
||||||
|
└───────────┬─────────────┘
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
┌─────────────────────────┐
|
||||||
|
│ Run ./INSTALL.sh │
|
||||||
|
│ │
|
||||||
|
│ ├─ Install Homebrew │
|
||||||
|
│ ├─ Install Rust │
|
||||||
|
│ ├─ Install Node.js │
|
||||||
|
│ ├─ Install Podman │
|
||||||
|
│ ├─ Install PostgreSQL │
|
||||||
|
│ ├─ Install npm deps │
|
||||||
|
│ └─ Build backend │
|
||||||
|
└───────────┬─────────────┘
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
┌─────────────────────────┐
|
||||||
|
│ Run ./verify-install.sh │
|
||||||
|
│ │
|
||||||
|
│ Check all dependencies │
|
||||||
|
│ are properly installed │
|
||||||
|
└───────────┬─────────────┘
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
┌─────────────────────────┐
|
||||||
|
│ Configure (Optional) │
|
||||||
|
│ │
|
||||||
|
│ cp core/.env.example │
|
||||||
|
│ core/.env │
|
||||||
|
│ │
|
||||||
|
│ cp neode-ui/.env.ex... │
|
||||||
|
│ neode-ui/.env │
|
||||||
|
└───────────┬─────────────┘
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
┌─────────────────────────┐
|
||||||
|
│ Start Development │
|
||||||
|
│ │
|
||||||
|
│ Terminal 1: Backend │
|
||||||
|
│ cd core && cargo run │
|
||||||
|
│ │
|
||||||
|
│ Terminal 2: Frontend │
|
||||||
|
│ cd neode-ui && npm dev │
|
||||||
|
└───────────┬─────────────┘
|
||||||
|
│
|
||||||
|
▼
|
||||||
|
┌─────────────────────────┐
|
||||||
|
│ Open Browser │
|
||||||
|
│ http://localhost:8100 │
|
||||||
|
└─────────────────────────┘
|
||||||
|
```
|
||||||
|
|
||||||
|
## File Purposes
|
||||||
|
|
||||||
|
| File | Purpose | Run/Use |
|
||||||
|
|------|---------|---------|
|
||||||
|
| `INSTALL.sh` | Install all dependencies | `./INSTALL.sh` |
|
||||||
|
| `verify-install.sh` | Verify installation | `./verify-install.sh` |
|
||||||
|
| `GETTING_STARTED.md` | Quick start guide | Read first |
|
||||||
|
| `SETUP_GUIDE.md` | Detailed setup docs | Reference |
|
||||||
|
| `QUICK_REFERENCE.md` | Command cheatsheet | Reference |
|
||||||
|
| `core/.env.example` | Backend config template | Copy to `.env` |
|
||||||
|
| `neode-ui/.env.example` | Frontend config template | Copy to `.env` |
|
||||||
|
|
||||||
|
## What Each Script Does
|
||||||
|
|
||||||
|
### INSTALL.sh
|
||||||
|
```bash
|
||||||
|
✓ Checks if Homebrew is installed
|
||||||
|
✓ Installs Homebrew if needed
|
||||||
|
✓ Installs Rust via rustup
|
||||||
|
✓ Installs Node.js via Homebrew
|
||||||
|
✓ Installs Podman via Homebrew
|
||||||
|
✓ Initializes Podman machine
|
||||||
|
✓ Installs PostgreSQL via Homebrew
|
||||||
|
✓ Starts PostgreSQL service
|
||||||
|
✓ Installs frontend dependencies (neode-ui)
|
||||||
|
✓ Installs custom app dependencies
|
||||||
|
✓ Builds Rust backend
|
||||||
|
✓ Displays next steps
|
||||||
|
```
|
||||||
|
|
||||||
|
### verify-install.sh
|
||||||
|
```bash
|
||||||
|
✓ Checks Rust compiler and Cargo
|
||||||
|
✓ Checks Node.js and NPM
|
||||||
|
✓ Checks Podman installation
|
||||||
|
✓ Checks PostgreSQL installation
|
||||||
|
✓ Verifies frontend dependencies
|
||||||
|
✓ Verifies custom app dependencies
|
||||||
|
✓ Checks backend build status
|
||||||
|
✓ Checks Podman machine status
|
||||||
|
✓ Checks PostgreSQL service status
|
||||||
|
✓ Checks environment files
|
||||||
|
✓ Reports missing dependencies
|
||||||
|
✓ Provides fix suggestions
|
||||||
|
```
|
||||||
|
|
||||||
|
## Required vs Optional Dependencies
|
||||||
|
|
||||||
|
### Required (Must Install)
|
||||||
|
- ✅ **Rust** - Backend compilation
|
||||||
|
- ✅ **Node.js** - Frontend and custom apps
|
||||||
|
- ✅ **npm** - JavaScript package manager
|
||||||
|
|
||||||
|
### Recommended (For Full Features)
|
||||||
|
- ⚠️ **Podman** - Container runtime for apps
|
||||||
|
- ⚠️ **PostgreSQL** - Database for backend
|
||||||
|
|
||||||
|
### Optional (Can Install Later)
|
||||||
|
- 💡 **Homebrew** - Package manager (makes installation easier)
|
||||||
|
- 💡 **cargo-watch** - Auto-reload for backend development
|
||||||
|
|
||||||
|
## Minimum Requirements
|
||||||
|
|
||||||
|
To run the project with minimal setup:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install Rust
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||||
|
|
||||||
|
# Install Node.js (download from nodejs.org)
|
||||||
|
# Or use version manager like nvm
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
cd neode-ui && npm install
|
||||||
|
|
||||||
|
# Run with mock backend (no PostgreSQL needed)
|
||||||
|
npm run dev:mock
|
||||||
|
```
|
||||||
|
|
||||||
|
## Full Setup (All Features)
|
||||||
|
|
||||||
|
For full functionality including containers and database:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run the full installation
|
||||||
|
./INSTALL.sh
|
||||||
|
|
||||||
|
# Verify everything
|
||||||
|
./verify-install.sh
|
||||||
|
|
||||||
|
# Start development
|
||||||
|
cd core && cargo run --bin archipelago # Terminal 1
|
||||||
|
cd neode-ui && npm run dev # Terminal 2
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage Examples
|
||||||
|
|
||||||
|
### First Time Setup
|
||||||
|
```bash
|
||||||
|
# Clone the repository
|
||||||
|
cd ~/Projects/archy
|
||||||
|
|
||||||
|
# Install everything
|
||||||
|
./INSTALL.sh
|
||||||
|
|
||||||
|
# Verify installation
|
||||||
|
./verify-install.sh
|
||||||
|
|
||||||
|
# Copy environment files
|
||||||
|
cp core/.env.example core/.env
|
||||||
|
cp neode-ui/.env.example neode-ui/.env
|
||||||
|
|
||||||
|
# Start development
|
||||||
|
cd core && cargo run --bin archipelago
|
||||||
|
```
|
||||||
|
|
||||||
|
### Checking What's Installed
|
||||||
|
```bash
|
||||||
|
# Run verification
|
||||||
|
./verify-install.sh
|
||||||
|
|
||||||
|
# Output will show:
|
||||||
|
# ✓ Installed and working
|
||||||
|
# ⚠ Installed but needs configuration
|
||||||
|
# ✗ Not installed
|
||||||
|
```
|
||||||
|
|
||||||
|
### Quick Frontend Development
|
||||||
|
```bash
|
||||||
|
# No backend needed
|
||||||
|
cd neode-ui
|
||||||
|
npm run dev:mock
|
||||||
|
|
||||||
|
# Open http://localhost:8100
|
||||||
|
```
|
||||||
|
|
||||||
|
## Platform Support
|
||||||
|
|
||||||
|
Currently tested on:
|
||||||
|
- ✅ **macOS** (Darwin) - Intel and Apple Silicon
|
||||||
|
- 🚧 **Linux** - Coming soon
|
||||||
|
- 🚧 **Windows** - Coming soon (WSL recommended)
|
||||||
|
|
||||||
|
## Next Steps After Installation
|
||||||
|
|
||||||
|
1. **Read** [GETTING_STARTED.md](GETTING_STARTED.md)
|
||||||
|
2. **Run** `./verify-install.sh`
|
||||||
|
3. **Configure** environment files
|
||||||
|
4. **Start** development servers
|
||||||
|
5. **Open** http://localhost:8100
|
||||||
|
6. **Build** apps in `apps/` directory
|
||||||
|
7. **Read** documentation in `docs/`
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
If installation fails:
|
||||||
|
|
||||||
|
1. Check `./verify-install.sh` output
|
||||||
|
2. Read error messages carefully
|
||||||
|
3. Consult [SETUP_GUIDE.md](SETUP_GUIDE.md)
|
||||||
|
4. Check [QUICK_REFERENCE.md](QUICK_REFERENCE.md) troubleshooting section
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
- [GETTING_STARTED.md](GETTING_STARTED.md) - Start here
|
||||||
|
- [SETUP_GUIDE.md](SETUP_GUIDE.md) - Detailed guide
|
||||||
|
- [QUICK_REFERENCE.md](QUICK_REFERENCE.md) - Commands
|
||||||
|
- [README.md](README.md) - Project overview
|
||||||
|
- [docs/development-setup.md](docs/development-setup.md) - Development info
|
||||||
|
- [apps/QUICKSTART.md](apps/QUICKSTART.md) - Building apps
|
||||||
322
QUICK_REFERENCE.md
Normal file
322
QUICK_REFERENCE.md
Normal file
@ -0,0 +1,322 @@
|
|||||||
|
# Archipelago Quick Reference
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install all dependencies
|
||||||
|
./INSTALL.sh
|
||||||
|
|
||||||
|
# Verify installation
|
||||||
|
./verify-install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
### Start Development Servers
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Quick start (mock backend)
|
||||||
|
./scripts/dev.sh
|
||||||
|
|
||||||
|
# Interactive start
|
||||||
|
./scripts/dev-start.sh
|
||||||
|
|
||||||
|
# Manual start
|
||||||
|
# Terminal 1:
|
||||||
|
cd core && cargo run --bin archipelago
|
||||||
|
|
||||||
|
# Terminal 2:
|
||||||
|
cd neode-ui && npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### URLs
|
||||||
|
|
||||||
|
- Frontend: http://localhost:8100
|
||||||
|
- Backend API: http://localhost:5959
|
||||||
|
- Backend RPC: http://localhost:5959/rpc/v1
|
||||||
|
|
||||||
|
## Common Commands
|
||||||
|
|
||||||
|
### Rust Backend
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd core
|
||||||
|
|
||||||
|
# Run in development mode
|
||||||
|
cargo run --bin archipelago
|
||||||
|
|
||||||
|
# Run in release mode (faster)
|
||||||
|
cargo run --bin archipelago --release
|
||||||
|
|
||||||
|
# Build only
|
||||||
|
cargo build
|
||||||
|
|
||||||
|
# Run tests
|
||||||
|
cargo test
|
||||||
|
|
||||||
|
# Auto-reload on changes
|
||||||
|
cargo install cargo-watch
|
||||||
|
cargo watch -x 'run --bin archipelago'
|
||||||
|
|
||||||
|
# Check for errors without building
|
||||||
|
cargo check
|
||||||
|
```
|
||||||
|
|
||||||
|
### Frontend (Vue.js)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd neode-ui
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
npm install
|
||||||
|
|
||||||
|
# Development server
|
||||||
|
npm run dev
|
||||||
|
|
||||||
|
# With mock backend
|
||||||
|
npm run dev:mock
|
||||||
|
|
||||||
|
# Build for production
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
# Type checking
|
||||||
|
npm run type-check
|
||||||
|
|
||||||
|
# Preview production build
|
||||||
|
npm run preview
|
||||||
|
```
|
||||||
|
|
||||||
|
### Apps (Containerized)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd apps
|
||||||
|
|
||||||
|
# Build all apps
|
||||||
|
./build.sh
|
||||||
|
|
||||||
|
# Build specific app
|
||||||
|
./build.sh router
|
||||||
|
./build.sh bitcoin-core
|
||||||
|
./build.sh did-wallet
|
||||||
|
|
||||||
|
# Install app dependencies (for custom apps)
|
||||||
|
cd apps/router && npm install
|
||||||
|
cd apps/did-wallet && npm install
|
||||||
|
cd apps/web5-dwn && npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Container Management (Podman)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Check Podman status
|
||||||
|
podman --version
|
||||||
|
podman info
|
||||||
|
|
||||||
|
# Manage Podman machine
|
||||||
|
podman machine list
|
||||||
|
podman machine start
|
||||||
|
podman machine stop
|
||||||
|
podman machine ssh
|
||||||
|
|
||||||
|
# List containers
|
||||||
|
podman ps
|
||||||
|
podman ps -a
|
||||||
|
|
||||||
|
# List images
|
||||||
|
podman images
|
||||||
|
|
||||||
|
# Remove all stopped containers
|
||||||
|
podman container prune
|
||||||
|
|
||||||
|
# Remove unused images
|
||||||
|
podman image prune
|
||||||
|
```
|
||||||
|
|
||||||
|
### Database (PostgreSQL)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Start/stop PostgreSQL service
|
||||||
|
brew services start postgresql@15
|
||||||
|
brew services stop postgresql@15
|
||||||
|
brew services restart postgresql@15
|
||||||
|
|
||||||
|
# Check service status
|
||||||
|
brew services list | grep postgresql
|
||||||
|
|
||||||
|
# Create database
|
||||||
|
createdb archipelago_dev
|
||||||
|
|
||||||
|
# Drop database
|
||||||
|
dropdb archipelago_dev
|
||||||
|
|
||||||
|
# Connect to database
|
||||||
|
psql archipelago_dev
|
||||||
|
|
||||||
|
# List databases
|
||||||
|
psql -l
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
### Backend Configuration
|
||||||
|
|
||||||
|
File: `core/.env`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DATADIR=/tmp/archipelago-dev
|
||||||
|
RPC_BIND=127.0.0.1:5959
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
DATABASE_URL=postgresql://localhost/archipelago_dev
|
||||||
|
ARCHIPELAGO_DEV_MODE=true
|
||||||
|
```
|
||||||
|
|
||||||
|
### Frontend Configuration
|
||||||
|
|
||||||
|
File: `neode-ui/.env`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
VITE_BACKEND_URL=http://localhost:5959
|
||||||
|
VITE_API_BASE=/rpc/v1
|
||||||
|
VITE_DEV_MODE=true
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Ports Already in Use
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Find process using port
|
||||||
|
lsof -i :5959
|
||||||
|
lsof -i :8100
|
||||||
|
|
||||||
|
# Kill process
|
||||||
|
kill -9 <PID>
|
||||||
|
```
|
||||||
|
|
||||||
|
### PostgreSQL Issues
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Check if running
|
||||||
|
pg_isready
|
||||||
|
|
||||||
|
# View logs
|
||||||
|
tail -f /opt/homebrew/var/log/postgresql@15.log
|
||||||
|
|
||||||
|
# Restart service
|
||||||
|
brew services restart postgresql@15
|
||||||
|
```
|
||||||
|
|
||||||
|
### Podman Issues
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Restart machine
|
||||||
|
podman machine stop
|
||||||
|
podman machine start
|
||||||
|
|
||||||
|
# Reset machine (WARNING: destroys all containers/images)
|
||||||
|
podman machine rm
|
||||||
|
podman machine init
|
||||||
|
podman machine start
|
||||||
|
```
|
||||||
|
|
||||||
|
### Rust Compilation Issues
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Update Rust
|
||||||
|
rustup update
|
||||||
|
|
||||||
|
# Clean and rebuild
|
||||||
|
cd core
|
||||||
|
cargo clean
|
||||||
|
cargo build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Node/NPM Issues
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clear cache and reinstall
|
||||||
|
rm -rf node_modules package-lock.json
|
||||||
|
npm cache clean --force
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
archy/
|
||||||
|
├── INSTALL.sh # Installation script
|
||||||
|
├── verify-install.sh # Verify installation
|
||||||
|
├── SETUP_GUIDE.md # Detailed setup guide
|
||||||
|
├── README.md # Main documentation
|
||||||
|
├── core/ # Rust backend
|
||||||
|
│ ├── .env # Backend config (create from .env.example)
|
||||||
|
│ ├── archipelago/ # Main binary
|
||||||
|
│ ├── container/ # Container management
|
||||||
|
│ ├── parmanode/ # Parmanode integration
|
||||||
|
│ ├── security/ # Security modules
|
||||||
|
│ └── performance/ # Performance optimization
|
||||||
|
├── neode-ui/ # Vue.js frontend
|
||||||
|
│ ├── .env # Frontend config (create from .env.example)
|
||||||
|
│ └── src/ # Source files
|
||||||
|
├── apps/ # Containerized applications
|
||||||
|
│ ├── build.sh # Build apps
|
||||||
|
│ ├── bitcoin-core/ # Bitcoin node
|
||||||
|
│ ├── router/ # Custom router app
|
||||||
|
│ ├── did-wallet/ # Web5 DID wallet
|
||||||
|
│ └── web5-dwn/ # Web5 DWN server
|
||||||
|
├── docs/ # Documentation
|
||||||
|
├── scripts/ # Development scripts
|
||||||
|
└── image-recipe/ # OS image build files
|
||||||
|
```
|
||||||
|
|
||||||
|
## Useful Aliases
|
||||||
|
|
||||||
|
Add to your `~/.zshrc` or `~/.bashrc`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Archipelago aliases
|
||||||
|
alias archy-backend='cd ~/Projects/archy/core && cargo run --bin archipelago'
|
||||||
|
alias archy-frontend='cd ~/Projects/archy/neode-ui && npm run dev'
|
||||||
|
alias archy-verify='cd ~/Projects/archy && ./verify-install.sh'
|
||||||
|
alias archy-apps='cd ~/Projects/archy/apps'
|
||||||
|
alias archy-docs='cd ~/Projects/archy/docs'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development Workflow
|
||||||
|
|
||||||
|
1. **Start backend** (Terminal 1)
|
||||||
|
```bash
|
||||||
|
cd core && cargo run --bin archipelago
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Start frontend** (Terminal 2)
|
||||||
|
```bash
|
||||||
|
cd neode-ui && npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Make changes** to code
|
||||||
|
|
||||||
|
4. **See changes live:**
|
||||||
|
- Frontend: Auto-reloads with Vite HMR
|
||||||
|
- Backend: Restart cargo or use cargo-watch
|
||||||
|
|
||||||
|
5. **Build apps** when needed:
|
||||||
|
```bash
|
||||||
|
cd apps && ./build.sh <app-name>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
- [Development Setup Guide](docs/development-setup.md)
|
||||||
|
- [Architecture Documentation](docs/architecture.md)
|
||||||
|
- [App Manifest Specification](docs/app-manifest-spec.md)
|
||||||
|
- [Apps Quick Start](apps/QUICKSTART.md)
|
||||||
|
- [Apps Development Guide](apps/DEVELOPMENT.md)
|
||||||
|
|
||||||
|
## Getting Help
|
||||||
|
|
||||||
|
1. Check [SETUP_GUIDE.md](SETUP_GUIDE.md) for detailed instructions
|
||||||
|
2. Run `./verify-install.sh` to diagnose issues
|
||||||
|
3. Review error messages carefully
|
||||||
|
4. Check service status (PostgreSQL, Podman)
|
||||||
|
5. Look in `docs/` for specific topics
|
||||||
39
README.md
39
README.md
@ -2,13 +2,42 @@
|
|||||||
|
|
||||||
Next-generation Bitcoin Node OS built on Alpine Linux with Podman containerization.
|
Next-generation Bitcoin Node OS built on Alpine Linux with Podman containerization.
|
||||||
|
|
||||||
|
## 🚀 New to Archipelago?
|
||||||
|
|
||||||
|
**Get started in minutes:** [GETTING_STARTED.md](./GETTING_STARTED.md)
|
||||||
|
|
||||||
|
**Quick reference:** [QUICK_REFERENCE.md](./QUICK_REFERENCE.md)
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
First, install all required dependencies:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./INSTALL.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
This will install:
|
||||||
|
- Rust (latest stable)
|
||||||
|
- Node.js 18+
|
||||||
|
- Podman (container runtime)
|
||||||
|
- PostgreSQL 15
|
||||||
|
- All project dependencies
|
||||||
|
|
||||||
|
**Manual Installation:** See [SETUP_GUIDE.md](./SETUP_GUIDE.md) for detailed installation instructions.
|
||||||
|
|
||||||
|
**Verify Installation:**
|
||||||
|
```bash
|
||||||
|
./verify-install.sh
|
||||||
|
```
|
||||||
|
|
||||||
### Development Setup
|
### Development Setup
|
||||||
|
|
||||||
1. **Run setup script (optional):**
|
1. **Configure environment (optional):**
|
||||||
```bash
|
```bash
|
||||||
./scripts/dev-setup.sh
|
cp core/.env.example core/.env
|
||||||
|
cp neode-ui/.env.example neode-ui/.env
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Start development servers:**
|
2. **Start development servers:**
|
||||||
@ -26,11 +55,11 @@ Next-generation Bitcoin Node OS built on Alpine Linux with Podman containerizati
|
|||||||
**Or manually:**
|
**Or manually:**
|
||||||
```bash
|
```bash
|
||||||
# Terminal 1: Backend
|
# Terminal 1: Backend
|
||||||
cd /Users/tx1138/Code/Archipelago/core
|
cd core
|
||||||
cargo run --bin startbox
|
cargo run --bin archipelago
|
||||||
|
|
||||||
# Terminal 2: Frontend
|
# Terminal 2: Frontend
|
||||||
cd /Users/tx1138/Code/Archipelago/neode-ui
|
cd neode-ui
|
||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
326
SETUP_GUIDE.md
Normal file
326
SETUP_GUIDE.md
Normal file
@ -0,0 +1,326 @@
|
|||||||
|
# Archipelago Setup Guide
|
||||||
|
|
||||||
|
This guide will walk you through setting up your development environment for Archipelago.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- macOS (Darwin)
|
||||||
|
- Terminal access
|
||||||
|
- Administrator privileges (for some installations)
|
||||||
|
- Internet connection
|
||||||
|
|
||||||
|
## Quick Installation
|
||||||
|
|
||||||
|
Run the automated installation script:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./INSTALL.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
This script will install and configure:
|
||||||
|
- ✓ Homebrew (macOS package manager)
|
||||||
|
- ✓ Rust (latest stable)
|
||||||
|
- ✓ Node.js 18+
|
||||||
|
- ✓ Podman (container runtime)
|
||||||
|
- ✓ PostgreSQL 15
|
||||||
|
- ✓ All project dependencies
|
||||||
|
|
||||||
|
## Manual Installation
|
||||||
|
|
||||||
|
If you prefer to install components individually:
|
||||||
|
|
||||||
|
### 1. Install Homebrew
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
|
```
|
||||||
|
|
||||||
|
For Apple Silicon Macs, add to your shell profile:
|
||||||
|
```bash
|
||||||
|
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
|
||||||
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Install Rust
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||||
|
source "$HOME/.cargo/env"
|
||||||
|
```
|
||||||
|
|
||||||
|
Verify installation:
|
||||||
|
```bash
|
||||||
|
rustc --version
|
||||||
|
cargo --version
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Install Node.js
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install node
|
||||||
|
```
|
||||||
|
|
||||||
|
Verify installation:
|
||||||
|
```bash
|
||||||
|
node --version # Should be v18 or higher
|
||||||
|
npm --version
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Install Podman
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install podman
|
||||||
|
```
|
||||||
|
|
||||||
|
Initialize Podman machine:
|
||||||
|
```bash
|
||||||
|
podman machine init
|
||||||
|
podman machine start
|
||||||
|
```
|
||||||
|
|
||||||
|
Verify installation:
|
||||||
|
```bash
|
||||||
|
podman --version
|
||||||
|
podman info
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. Install PostgreSQL
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew install postgresql@15
|
||||||
|
brew services start postgresql@15
|
||||||
|
```
|
||||||
|
|
||||||
|
Create development database:
|
||||||
|
```bash
|
||||||
|
createdb archipelago_dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. Install Project Dependencies
|
||||||
|
|
||||||
|
#### Frontend Dependencies
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd neode-ui
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Custom App Dependencies
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd apps/did-wallet && npm install && cd ../..
|
||||||
|
cd apps/endurain && npm install && cd ../..
|
||||||
|
cd apps/morphos-server && npm install && cd ../..
|
||||||
|
cd apps/router && npm install && cd ../..
|
||||||
|
cd apps/web5-dwn && npm install && cd ../..
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Build Rust Backend
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd core
|
||||||
|
cargo build
|
||||||
|
```
|
||||||
|
|
||||||
|
## Environment Configuration
|
||||||
|
|
||||||
|
### Backend Configuration
|
||||||
|
|
||||||
|
Create `core/.env`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
DATADIR=/tmp/archipelago-dev
|
||||||
|
RPC_BIND=127.0.0.1:5959
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
DATABASE_URL=postgresql://localhost/archipelago_dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Frontend Configuration
|
||||||
|
|
||||||
|
Create `neode-ui/.env`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
VITE_BACKEND_URL=http://localhost:5959
|
||||||
|
VITE_API_BASE=/rpc/v1
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running the Project
|
||||||
|
|
||||||
|
### Option 1: Quick Start Scripts
|
||||||
|
|
||||||
|
Use the convenience scripts:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Full stack with interactive prompts
|
||||||
|
./scripts/dev-start.sh
|
||||||
|
|
||||||
|
# Or use the quick dev script (mock backend)
|
||||||
|
./scripts/dev.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Option 2: Manual Start
|
||||||
|
|
||||||
|
#### Terminal 1: Backend
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd core
|
||||||
|
cargo run --bin archipelago
|
||||||
|
```
|
||||||
|
|
||||||
|
Backend will be available at: http://localhost:5959
|
||||||
|
|
||||||
|
#### Terminal 2: Frontend
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd neode-ui
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Frontend will be available at: http://localhost:8100
|
||||||
|
|
||||||
|
### Option 3: Mock Backend (UI Development Only)
|
||||||
|
|
||||||
|
For frontend-only development:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd neode-ui
|
||||||
|
npm run dev:mock
|
||||||
|
```
|
||||||
|
|
||||||
|
This starts a mock backend server and Vite dev server together.
|
||||||
|
|
||||||
|
## Verifying Installation
|
||||||
|
|
||||||
|
Run these commands to verify everything is installed correctly:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Check Rust
|
||||||
|
rustc --version
|
||||||
|
cargo --version
|
||||||
|
|
||||||
|
# Check Node.js
|
||||||
|
node --version
|
||||||
|
npm --version
|
||||||
|
|
||||||
|
# Check Podman
|
||||||
|
podman --version
|
||||||
|
podman machine list
|
||||||
|
|
||||||
|
# Check PostgreSQL
|
||||||
|
psql --version
|
||||||
|
brew services list | grep postgresql
|
||||||
|
|
||||||
|
# Check project dependencies
|
||||||
|
cd neode-ui && npm list --depth=0
|
||||||
|
cd ../core && cargo tree --depth=0
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building Apps
|
||||||
|
|
||||||
|
To build the containerized apps:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd apps
|
||||||
|
./build.sh # Build all apps
|
||||||
|
./build.sh router # Build specific app
|
||||||
|
```
|
||||||
|
|
||||||
|
## Common Issues
|
||||||
|
|
||||||
|
### Podman Machine Not Running
|
||||||
|
|
||||||
|
```bash
|
||||||
|
podman machine start
|
||||||
|
```
|
||||||
|
|
||||||
|
### PostgreSQL Not Running
|
||||||
|
|
||||||
|
```bash
|
||||||
|
brew services start postgresql@15
|
||||||
|
```
|
||||||
|
|
||||||
|
### Port Already in Use
|
||||||
|
|
||||||
|
If ports 5959 or 8100 are in use, you can change them:
|
||||||
|
|
||||||
|
Backend (in `core/.env`):
|
||||||
|
```bash
|
||||||
|
RPC_BIND=127.0.0.1:5958
|
||||||
|
```
|
||||||
|
|
||||||
|
Frontend (in `neode-ui/vite.config.ts`):
|
||||||
|
```typescript
|
||||||
|
server: { port: 8101 }
|
||||||
|
```
|
||||||
|
|
||||||
|
### Rust Compilation Issues
|
||||||
|
|
||||||
|
Make sure you have the latest stable Rust:
|
||||||
|
```bash
|
||||||
|
rustup update
|
||||||
|
```
|
||||||
|
|
||||||
|
### Node Module Issues
|
||||||
|
|
||||||
|
Clear node modules and reinstall:
|
||||||
|
```bash
|
||||||
|
rm -rf node_modules package-lock.json
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development Workflow
|
||||||
|
|
||||||
|
1. **Make code changes** in `core/` or `neode-ui/`
|
||||||
|
2. **Backend**: Cargo will auto-rebuild on `cargo run`
|
||||||
|
3. **Frontend**: Vite provides hot module replacement (HMR)
|
||||||
|
4. **Test changes** in browser at http://localhost:8100
|
||||||
|
|
||||||
|
For backend auto-reload, install cargo-watch:
|
||||||
|
```bash
|
||||||
|
cargo install cargo-watch
|
||||||
|
cd core
|
||||||
|
cargo watch -x 'run --bin archipelago'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
archy/
|
||||||
|
├── core/ # Rust backend
|
||||||
|
│ ├── archipelago/ # Main binary
|
||||||
|
│ ├── container/ # Container management
|
||||||
|
│ ├── parmanode/ # Parmanode integration
|
||||||
|
│ ├── security/ # Security modules
|
||||||
|
│ └── performance/ # Performance optimization
|
||||||
|
├── neode-ui/ # Vue.js frontend
|
||||||
|
├── apps/ # Containerized applications
|
||||||
|
├── docs/ # Documentation
|
||||||
|
└── scripts/ # Development scripts
|
||||||
|
```
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
- Read [docs/development-setup.md](docs/development-setup.md) for detailed development info
|
||||||
|
- Check [docs/architecture.md](docs/architecture.md) for system architecture
|
||||||
|
- See [apps/QUICKSTART.md](apps/QUICKSTART.md) for building and running apps
|
||||||
|
- Review [docs/app-manifest-spec.md](docs/app-manifest-spec.md) for creating apps
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
- [Rust Documentation](https://doc.rust-lang.org/)
|
||||||
|
- [Vue.js 3 Documentation](https://vuejs.org/)
|
||||||
|
- [Podman Documentation](https://docs.podman.io/)
|
||||||
|
- [PostgreSQL Documentation](https://www.postgresql.org/docs/)
|
||||||
|
|
||||||
|
## Getting Help
|
||||||
|
|
||||||
|
If you encounter issues:
|
||||||
|
|
||||||
|
1. Check the [docs/](docs/) directory for detailed documentation
|
||||||
|
2. Review error messages carefully
|
||||||
|
3. Check that all services are running (PostgreSQL, Podman)
|
||||||
|
4. Verify all dependencies are installed correctly
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
||||||
1
apps/did-wallet/node_modules/.bin/acorn
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/acorn
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../acorn/bin/acorn
|
||||||
1
apps/did-wallet/node_modules/.bin/canonicalize
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/canonicalize
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../canonicalize/bin/canonicalize.js
|
||||||
1
apps/did-wallet/node_modules/.bin/cborg
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/cborg
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../cborg/cli.js
|
||||||
1
apps/did-wallet/node_modules/.bin/mime
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/mime
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../mime/cli.js
|
||||||
1
apps/did-wallet/node_modules/.bin/node-gyp-build
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/node-gyp-build
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../node-gyp-build/bin.js
|
||||||
1
apps/did-wallet/node_modules/.bin/node-gyp-build-optional
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/node-gyp-build-optional
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../node-gyp-build/optional.js
|
||||||
1
apps/did-wallet/node_modules/.bin/node-gyp-build-test
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/node-gyp-build-test
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../node-gyp-build/build-test.js
|
||||||
1
apps/did-wallet/node_modules/.bin/rabin-wasm
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/rabin-wasm
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../rabin-wasm/cli/bin.js
|
||||||
1
apps/did-wallet/node_modules/.bin/ts-node
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/ts-node
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../ts-node/dist/bin.js
|
||||||
1
apps/did-wallet/node_modules/.bin/ts-node-cwd
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/ts-node-cwd
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../ts-node/dist/bin-cwd.js
|
||||||
1
apps/did-wallet/node_modules/.bin/ts-node-esm
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/ts-node-esm
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../ts-node/dist/bin-esm.js
|
||||||
1
apps/did-wallet/node_modules/.bin/ts-node-script
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/ts-node-script
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../ts-node/dist/bin-script.js
|
||||||
1
apps/did-wallet/node_modules/.bin/ts-node-transpile-only
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/ts-node-transpile-only
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../ts-node/dist/bin-transpile.js
|
||||||
1
apps/did-wallet/node_modules/.bin/ts-script
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/ts-script
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../ts-node/dist/bin-script-deprecated.js
|
||||||
1
apps/did-wallet/node_modules/.bin/tsc
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/tsc
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../typescript/bin/tsc
|
||||||
1
apps/did-wallet/node_modules/.bin/tsserver
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/tsserver
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../typescript/bin/tsserver
|
||||||
1
apps/did-wallet/node_modules/.bin/uuid
generated
vendored
Symbolic link
1
apps/did-wallet/node_modules/.bin/uuid
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../uuid/dist/bin/uuid
|
||||||
2733
apps/did-wallet/node_modules/.package-lock.json
generated
vendored
Normal file
2733
apps/did-wallet/node_modules/.package-lock.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
191
apps/did-wallet/node_modules/@assemblyscript/loader/README.md
generated
vendored
Normal file
191
apps/did-wallet/node_modules/@assemblyscript/loader/README.md
generated
vendored
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
 AssemblyScript Loader
|
||||||
|
======================
|
||||||
|
|
||||||
|
A convenient loader for AssemblyScript modules. Demangles module exports to a friendly object structure compatible with WebIDL and TypeScript definitions and provides some useful utility to read/write data from/to memory.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
-----
|
||||||
|
|
||||||
|
```js
|
||||||
|
const loader = require("@assemblyscript/loader");
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
API
|
||||||
|
---
|
||||||
|
|
||||||
|
* **instantiate**<`T`>(moduleOrBuffer: `WebAssembly.Module | BufferSource | Response | PromiseLike<WebAssembly.Module | BufferSource | Response>`, imports?: `WasmImports`): `Promise<ASUtil & T>`<br />
|
||||||
|
Asynchronously instantiates an AssemblyScript module from anything that can be instantiated.
|
||||||
|
|
||||||
|
* **instantiateSync**<`T`>(moduleOrBuffer: `WebAssembly.Module | BufferSource`, imports?: `WasmImports`): `ASUtil & T`<br />
|
||||||
|
Synchronously instantiates an AssemblyScript module from a WebAssembly.Module or binary buffer.
|
||||||
|
|
||||||
|
* **instantiateStreaming**<`T`>(response: `Response | PromiseLike<Response>`, imports?: `WasmImports`): `Promise<ASUtil & T>`<br />
|
||||||
|
Asynchronously instantiates an AssemblyScript module from a response, i.e. as obtained by `fetch`.
|
||||||
|
|
||||||
|
* **demangle**<`T`>(exports: `WasmExports`, baseModule?: `Object`): `T`<br />
|
||||||
|
Demangles an AssemblyScript module's exports to a friendly object structure. You usually don't have to call this manually as instantiation does this implicitly.
|
||||||
|
|
||||||
|
**Note** that `T` above can either be omitted if the structure of the module is unknown, or can reference a `.d.ts` (i.e. `typeof MyModule`) as produced by the compiler with the `-d` option.
|
||||||
|
|
||||||
|
Besides demangling classes exported from your entry file to a handy object structure one can use like JS objects, instances are automatically populated with useful utility:
|
||||||
|
|
||||||
|
* **_start**(): `void`<br />
|
||||||
|
Explicit start function if the `--explicitStart` option is used. Must be called before any other exports if present.
|
||||||
|
|
||||||
|
* **__allocString**(str: `string`): `number`<br />
|
||||||
|
Allocates a new string in the module's memory and returns a reference (pointer) to it.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
var ptr = module.__retain(module.__allocString("hello world"));
|
||||||
|
...
|
||||||
|
module.__release(ptr);
|
||||||
|
```
|
||||||
|
|
||||||
|
* **__getString**(ptr: `number`): `string`<br />
|
||||||
|
Copies a string's value from the module's memory.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
var str = module.__getString(ptr);
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
* **__getArrayBuffer**(ptr: `number`): `ArrayBuffer`<br />
|
||||||
|
Copies an ArrayBuffer's value from the module's memory.
|
||||||
|
|
||||||
|
* **__getArray**(ptr: `number`): `number[]`<br />
|
||||||
|
Copies an array's values from the module's memory. Infers the array type from RTTI.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
var arr = module.__getArray(ptr);
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
If the type of the array is known beforehand, the following slightly faster helpers that don't infer the type can be used:
|
||||||
|
|
||||||
|
**__getInt8Array**(ptr: `number`): `Int8Array`<br />
|
||||||
|
**__getUint8Array**(ptr: `number`): `Uint8Array`<br />
|
||||||
|
**__getUint8ClampedArray**(ptr: `number`): `Uint8ClampedArray`<br />
|
||||||
|
**__getInt16Array**(ptr: `number`): `Int16Array`<br />
|
||||||
|
**__getUint16Array**(ptr: `number`): `Uint16Array`<br />
|
||||||
|
**__getInt32Array**(ptr: `number`): `Int32Array`<br />
|
||||||
|
**__getUint32Array**(ptr: `number`): `Uint32Array`<br />
|
||||||
|
**__getInt64Array**(ptr: `number`): `BigInt64Array`<br />
|
||||||
|
**__getUint64Array**(ptr: `number`): `BigUint64Array`<br />
|
||||||
|
**__getFloat32Array**(ptr: `number`): `Float32Array`<br />
|
||||||
|
**__getFloat64Array**(ptr: `number`): `Float64Array`
|
||||||
|
|
||||||
|
* **__getArrayView**(ptr: `number`): `TypedArray`<br />
|
||||||
|
Gets a live view on the values of an array in the module's memory. Infers the array type from RTTI.
|
||||||
|
|
||||||
|
This differs from `__getArray` in that the data isn't copied but remains *live* in both directions. That's faster but also unsafe because if the array grows or becomes released, the view will no longer represent the correct memory region and modifying its values in this state will most likely corrupt memory. Use, but use with care.
|
||||||
|
|
||||||
|
If the type of the array is known beforehand, the following slightly faster helpers that don't infer the type can be used:
|
||||||
|
|
||||||
|
**__getInt8ArrayView**(ptr: `number`): `Int8Array`<br />
|
||||||
|
**__getUint8ArrayView**(ptr: `number`): `Uint8Array`<br />
|
||||||
|
**__getUint8ClampedArrayView**(ptr: `number`): `Uint8ClampedArray`<br />
|
||||||
|
**__getInt16ArrayView**(ptr: `number`): `Int16Array`<br />
|
||||||
|
**__getUint16ArrayView**(ptr: `number`): `Uint16Array`<br />
|
||||||
|
**__getInt32ArrayView**(ptr: `number`): `Int32Array`<br />
|
||||||
|
**__getUint32ArrayView**(ptr: `number`): `Uint32Array`<br />
|
||||||
|
**__getInt64ArrayView**(ptr: `number`): `BigInt64Array`<br />
|
||||||
|
**__getUint64ArrayView**(ptr: `number`): `BigUint64Array`<br />
|
||||||
|
**__getFloat32ArrayView**(ptr: `number`): `Float32Array`<br />
|
||||||
|
**__getFloat64ArrayView**(ptr: `number`): `Float64Array`
|
||||||
|
|
||||||
|
* **__retain**(ptr: `number`): `number`<br />
|
||||||
|
Retains a reference to a managed object externally, making sure that it doesn't become collected prematurely. Returns the pointer.
|
||||||
|
|
||||||
|
* **__release**(ptr: `number`): `void`<br />
|
||||||
|
Releases a previously retained reference to a managed object, allowing the runtime to collect it once its reference count reaches zero.
|
||||||
|
|
||||||
|
* **__alloc**(size: `number`, id: `number`): `number`<br />
|
||||||
|
Allocates an instance of the class represented by the specified id. If you are using `MyClass` for example, the best way to know the id and the necessary size is an `export const MYCLASS_ID = idof<MyClass>()` and an `export const MYCLASS_SIZE = offsetof<MyClass>()`. Afterwards, use the respective views to assign values to the class's memory while making sure to retain interior references to other managed objects once. When done with the class, make sure to release it, which will automatically release any interior references once the class becomes collected.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
var ptr = module.__retain(module.__alloc(module.MYCLASS_SIZE, module.MYCLASS_ID));
|
||||||
|
const F32 = new Float32Array(module.memory.buffer);
|
||||||
|
F32[ptr + MYCLASS_BASICFIELD1_OFFSET >>> 2] = field1_value_f32;
|
||||||
|
const U32 = new Uint32Array(module.memory.buffer);
|
||||||
|
U32[ptr + MYCLASS_MANAGEDFIELD2_OFFSET >>> 2] = module.__retain(field2_value_ptr);
|
||||||
|
...
|
||||||
|
module.__release(ptr);
|
||||||
|
```
|
||||||
|
|
||||||
|
* **__allocArray**(id: `number`, values: `number[]`): `number`<br />
|
||||||
|
Allocates a new array in the module's memory and returns a reference (pointer) to it.
|
||||||
|
Automatically retains interior pointers. The `id` is the unique runtime id of the respective array class. If you are using `Int32Array` for example, the best way to know the id is an `export const INT32ARRAY_ID = idof<Int32Array>()`. When done with the array, make sure to release it.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
var ptr = module.__retain(module.__allocArray(module.INT32ARRAY, [1, 2, 3]));
|
||||||
|
...
|
||||||
|
module.__release(ptr);
|
||||||
|
```
|
||||||
|
|
||||||
|
* **__instanceof**(ptr: `number`, baseId: `number`): `boolean`<br />
|
||||||
|
Tests whether an object is an instance of the class represented by the specified base id.
|
||||||
|
|
||||||
|
```ts
|
||||||
|
if (module.__instanceof(ptr, module.MYCLASS_ID)) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
* **__collect**(): `void`<br />
|
||||||
|
Forces a cycle collection. Only relevant if objects potentially forming reference cycles are used.
|
||||||
|
|
||||||
|
**Note** that the views like `I32` above will automatically be updated when the module's memory grows. Don't cache these if this can happen.
|
||||||
|
|
||||||
|
**Note** that the allocation and ownership features above require the `full` (this is the default) or the `stub` runtime to be present in your module. Other runtime variations do not export this functionality without further ado (so the compiler can eliminate what's dead code).
|
||||||
|
|
||||||
|
**Note** that references returned from exported functions have already been retained for you and the runtime expects that you release them once not needed anymore. This is also true for constructors and getters.
|
||||||
|
|
||||||
|
**Beware that your module is likely going to explode with seemingly random errors when using the allocation and ownership features incorrectly!**
|
||||||
|
|
||||||
|
* Use the correct ids, sizes and layouts (C-style non-packed, export `offsetof<MyClass>("myField")` in case of doubt)
|
||||||
|
* Clear unused memory to zero
|
||||||
|
* Retain what you allocate
|
||||||
|
* Retain interior pointers (except in `__allocArray`)
|
||||||
|
* Don't retain what's returned (is already retained for you)
|
||||||
|
* Release when you're done with something and don't ever use it again
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
### Instantiating a module
|
||||||
|
|
||||||
|
The **asynchronous API** is analogous to [WebAssembly.instantiate](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate) and [WebAssembly.instantiateStreaming](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming)
|
||||||
|
|
||||||
|
```js
|
||||||
|
const myModule = await loader.instantiate(myModuleBuffer, myImports);
|
||||||
|
const myModule = await loader.instantiateStreaming(fetch("myModule.wasm"), myImports);
|
||||||
|
```
|
||||||
|
|
||||||
|
with `loader.instantiate` actually accepting anything that can be instantiated for convenience:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const myModule = await loader.instantiate(fs.promises.readFile("myModule.wasm"), myImports);
|
||||||
|
const myModule = await loader.instantiate(fetch("myModule.wasm"), myImports);
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
If `WebAssembly.instantiateStreaming` is not supported by the environment a fallback is applied.
|
||||||
|
|
||||||
|
The **synchronous API** utilizes [new WebAssembly.Instance](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance#Constructor_Syntax) and [new WebAssembly.Module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module#Constructor_Syntax), which is useful if the goal is to immediately re-export as a node module for example:
|
||||||
|
|
||||||
|
```js
|
||||||
|
module.exports = loader.instantiateSync(fs.readFileSync("myModule.wasm"), myImports);
|
||||||
|
```
|
||||||
|
|
||||||
|
Note, though, that browsers have relatively tight limits for synchronous compilation and instantiation because these block the main thread, hence it is recommended to use the asynchronous API in browsers.
|
||||||
|
|
||||||
|
### Usage with TypeScript definitions produced by the compiler
|
||||||
|
|
||||||
|
The compiler is able to emit definitions using the `-d` command line option that are compatible with modules demangled by the loader, and these can be used for proper typings in development:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import MyModule from "myModule"; // pointing at the d.ts
|
||||||
|
|
||||||
|
const myModule = await loader.instatiate<typeof MyModule>(fs.promises.readFile("myModule.wasm"), myImports);
|
||||||
|
```
|
||||||
104
apps/did-wallet/node_modules/@assemblyscript/loader/index.d.ts
generated
vendored
Normal file
104
apps/did-wallet/node_modules/@assemblyscript/loader/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
/// <reference lib="esnext.bigint" />
|
||||||
|
|
||||||
|
/** WebAssembly imports with two levels of nesting. */
|
||||||
|
interface ImportsObject extends Record<string, any> {
|
||||||
|
env?: {
|
||||||
|
memory?: WebAssembly.Memory,
|
||||||
|
table?: WebAssembly.Table,
|
||||||
|
abort?(msg: number, file: number, line: number, column: number): void,
|
||||||
|
trace?(msg: number, numArgs?: number, ...args: number[]): void
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Utility mixed in by the loader. */
|
||||||
|
interface ASUtil {
|
||||||
|
memory?: WebAssembly.Memory;
|
||||||
|
table?: WebAssembly.Table;
|
||||||
|
|
||||||
|
/** Explicit start function, if requested. */
|
||||||
|
_start(): void;
|
||||||
|
/** Allocates a new string in the module's memory and returns a reference (pointer) to it. */
|
||||||
|
__allocString(str: string): number;
|
||||||
|
/** Allocates a new array in the module's memory and returns a reference (pointer) to it. */
|
||||||
|
__allocArray(id: number, values: ArrayLike<number>): number;
|
||||||
|
|
||||||
|
/** Copies a string's value from the module's memory. */
|
||||||
|
__getString(ptr: number): string;
|
||||||
|
/** Copies an ArrayBuffer's value from the module's memory. */
|
||||||
|
__getArrayBuffer(ptr: number): ArrayBuffer;
|
||||||
|
|
||||||
|
/** Copies an array's values from the module's memory. Infers the array type from RTTI. */
|
||||||
|
__getArray(ptr: number): number[];
|
||||||
|
/** Copies an Int8Array's values from the module's memory. */
|
||||||
|
__getInt8Array(ptr: number): Int8Array;
|
||||||
|
/** Copies an Uint8Array's values from the module's memory. */
|
||||||
|
__getUint8Array(ptr: number): Uint8Array;
|
||||||
|
/** Copies an Uint8ClampedArray's values from the module's memory. */
|
||||||
|
__getUint8ClampedArray(ptr: number): Uint8ClampedArray;
|
||||||
|
/** Copies an Int16Array's values from the module's memory. */
|
||||||
|
__getInt16Array(ptr: number): Int16Array;
|
||||||
|
/** Copies an Uint16Array's values from the module's memory. */
|
||||||
|
__getUint16Array(ptr: number): Uint16Array;
|
||||||
|
/** Copies an Int32Array's values from the module's memory. */
|
||||||
|
__getInt32Array(ptr: number): Int32Array;
|
||||||
|
/** Copies an Uint32Array's values from the module's memory. */
|
||||||
|
__getUint32Array(ptr: number): Uint32Array;
|
||||||
|
/** Copies an Int32Array's values from the module's memory. */
|
||||||
|
__getInt64Array?(ptr: number): BigInt64Array;
|
||||||
|
/** Copies an Uint32Array's values from the module's memory. */
|
||||||
|
__getUint64Array?(ptr: number): BigUint64Array;
|
||||||
|
/** Copies a Float32Array's values from the module's memory. */
|
||||||
|
__getFloat32Array(ptr: number): Float32Array;
|
||||||
|
/** Copies a Float64Array's values from the module's memory. */
|
||||||
|
__getFloat64Array(ptr: number): Float64Array;
|
||||||
|
|
||||||
|
/** Gets a live view on an array's values in the module's memory. Infers the array type from RTTI. */
|
||||||
|
__getArrayView(ptr: number): ArrayBufferView;
|
||||||
|
/** Gets a live view on an Int8Array's values in the module's memory. */
|
||||||
|
__getInt8ArrayView(ptr: number): Int8Array;
|
||||||
|
/** Gets a live view on an Uint8Array's values in the module's memory. */
|
||||||
|
__getUint8ArrayView(ptr: number): Uint8Array;
|
||||||
|
/** Gets a live view on an Uint8ClampedArray's values in the module's memory. */
|
||||||
|
__getUint8ClampedArrayView(ptr: number): Uint8ClampedArray;
|
||||||
|
/** Gets a live view on an Int16Array's values in the module's memory. */
|
||||||
|
__getInt16ArrayView(ptr: number): Int16Array;
|
||||||
|
/** Gets a live view on an Uint16Array's values in the module's memory. */
|
||||||
|
__getUint16ArrayView(ptr: number): Uint16Array;
|
||||||
|
/** Gets a live view on an Int32Array's values in the module's memory. */
|
||||||
|
__getInt32ArrayView(ptr: number): Int32Array;
|
||||||
|
/** Gets a live view on an Uint32Array's values in the module's memory. */
|
||||||
|
__getUint32ArrayView(ptr: number): Uint32Array;
|
||||||
|
/** Gets a live view on an Int32Array's values in the module's memory. */
|
||||||
|
__getInt64ArrayView?(ptr: number): BigInt64Array;
|
||||||
|
/** Gets a live view on an Uint32Array's values in the module's memory. */
|
||||||
|
__getUint64ArrayView?(ptr: number): BigUint64Array;
|
||||||
|
/** Gets a live view on a Float32Array's values in the module's memory. */
|
||||||
|
__getFloat32ArrayView(ptr: number): Float32Array;
|
||||||
|
/** Gets a live view on a Float64Array's values in the module's memory. */
|
||||||
|
__getFloat64ArrayView(ptr: number): Float64Array;
|
||||||
|
|
||||||
|
/** Retains a reference to a managed object externally, making sure that it doesn't become collected prematurely. Returns the pointer. */
|
||||||
|
__retain(ptr: number): number;
|
||||||
|
/** Releases a previously retained reference to a managed object, allowing the runtime to collect it once its reference count reaches zero. */
|
||||||
|
__release(ptr: number): void;
|
||||||
|
/** Forcefully resets the heap to its initial offset, effectively clearing dynamic memory. Stub runtime only. */
|
||||||
|
__reset?(): void;
|
||||||
|
/** Allocates an instance of the class represented by the specified id. */
|
||||||
|
__alloc(size: number, id: number): number;
|
||||||
|
/** Tests whether a managed object is an instance of the class represented by the specified base id. */
|
||||||
|
__instanceof(ptr: number, baseId: number): boolean;
|
||||||
|
/** Forces a cycle collection. Only relevant if objects potentially forming reference cycles are used. */
|
||||||
|
__collect(): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Asynchronously instantiates an AssemblyScript module from anything that can be instantiated. */
|
||||||
|
export declare function instantiate<T extends {}>(source: WebAssembly.Module | BufferSource | Response | PromiseLike<WebAssembly.Module | BufferSource | Response>, imports?: ImportsObject): Promise<ASUtil & T>;
|
||||||
|
|
||||||
|
/** Synchronously instantiates an AssemblyScript module from a WebAssembly.Module or binary buffer. */
|
||||||
|
export declare function instantiateSync<T extends {}>(source: WebAssembly.Module | BufferSource, imports?: ImportsObject): ASUtil & T;
|
||||||
|
|
||||||
|
/** Asynchronously instantiates an AssemblyScript module from a response, i.e. as obtained by `fetch`. */
|
||||||
|
export declare function instantiateStreaming<T extends {}>(source: Response | PromiseLike<Response>, imports?: ImportsObject): Promise<ASUtil & T>;
|
||||||
|
|
||||||
|
/** Demangles an AssemblyScript module's exports to a friendly object structure. */
|
||||||
|
export declare function demangle<T extends {}>(exports: {}, baseModule?: {}): T;
|
||||||
417
apps/did-wallet/node_modules/@assemblyscript/loader/index.js
generated
vendored
Normal file
417
apps/did-wallet/node_modules/@assemblyscript/loader/index.js
generated
vendored
Normal file
@ -0,0 +1,417 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Runtime header offsets
|
||||||
|
const ID_OFFSET = -8;
|
||||||
|
const SIZE_OFFSET = -4;
|
||||||
|
|
||||||
|
// Runtime ids
|
||||||
|
const ARRAYBUFFER_ID = 0;
|
||||||
|
const STRING_ID = 1;
|
||||||
|
const ARRAYBUFFERVIEW_ID = 2;
|
||||||
|
|
||||||
|
// Runtime type information
|
||||||
|
const ARRAYBUFFERVIEW = 1 << 0;
|
||||||
|
const ARRAY = 1 << 1;
|
||||||
|
const SET = 1 << 2;
|
||||||
|
const MAP = 1 << 3;
|
||||||
|
const VAL_ALIGN_OFFSET = 5;
|
||||||
|
const VAL_ALIGN = 1 << VAL_ALIGN_OFFSET;
|
||||||
|
const VAL_SIGNED = 1 << 10;
|
||||||
|
const VAL_FLOAT = 1 << 11;
|
||||||
|
const VAL_NULLABLE = 1 << 12;
|
||||||
|
const VAL_MANAGED = 1 << 13;
|
||||||
|
const KEY_ALIGN_OFFSET = 14;
|
||||||
|
const KEY_ALIGN = 1 << KEY_ALIGN_OFFSET;
|
||||||
|
const KEY_SIGNED = 1 << 19;
|
||||||
|
const KEY_FLOAT = 1 << 20;
|
||||||
|
const KEY_NULLABLE = 1 << 21;
|
||||||
|
const KEY_MANAGED = 1 << 22;
|
||||||
|
|
||||||
|
// Array(BufferView) layout
|
||||||
|
const ARRAYBUFFERVIEW_BUFFER_OFFSET = 0;
|
||||||
|
const ARRAYBUFFERVIEW_DATASTART_OFFSET = 4;
|
||||||
|
const ARRAYBUFFERVIEW_DATALENGTH_OFFSET = 8;
|
||||||
|
const ARRAYBUFFERVIEW_SIZE = 12;
|
||||||
|
const ARRAY_LENGTH_OFFSET = 12;
|
||||||
|
const ARRAY_SIZE = 16;
|
||||||
|
|
||||||
|
const BIGINT = typeof BigUint64Array !== "undefined";
|
||||||
|
const THIS = Symbol();
|
||||||
|
const CHUNKSIZE = 1024;
|
||||||
|
|
||||||
|
/** Gets a string from an U32 and an U16 view on a memory. */
|
||||||
|
function getStringImpl(buffer, ptr) {
|
||||||
|
const U32 = new Uint32Array(buffer);
|
||||||
|
const U16 = new Uint16Array(buffer);
|
||||||
|
var length = U32[(ptr + SIZE_OFFSET) >>> 2] >>> 1;
|
||||||
|
var offset = ptr >>> 1;
|
||||||
|
if (length <= CHUNKSIZE) return String.fromCharCode.apply(String, U16.subarray(offset, offset + length));
|
||||||
|
const parts = [];
|
||||||
|
do {
|
||||||
|
const last = U16[offset + CHUNKSIZE - 1];
|
||||||
|
const size = last >= 0xD800 && last < 0xDC00 ? CHUNKSIZE - 1 : CHUNKSIZE;
|
||||||
|
parts.push(String.fromCharCode.apply(String, U16.subarray(offset, offset += size)));
|
||||||
|
length -= size;
|
||||||
|
} while (length > CHUNKSIZE);
|
||||||
|
return parts.join("") + String.fromCharCode.apply(String, U16.subarray(offset, offset + length));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Prepares the base module prior to instantiation. */
|
||||||
|
function preInstantiate(imports) {
|
||||||
|
const baseModule = {};
|
||||||
|
|
||||||
|
function getString(memory, ptr) {
|
||||||
|
if (!memory) return "<yet unknown>";
|
||||||
|
return getStringImpl(memory.buffer, ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add common imports used by stdlib for convenience
|
||||||
|
const env = (imports.env = imports.env || {});
|
||||||
|
env.abort = env.abort || function abort(mesg, file, line, colm) {
|
||||||
|
const memory = baseModule.memory || env.memory; // prefer exported, otherwise try imported
|
||||||
|
throw Error("abort: " + getString(memory, mesg) + " at " + getString(memory, file) + ":" + line + ":" + colm);
|
||||||
|
}
|
||||||
|
env.trace = env.trace || function trace(mesg, n) {
|
||||||
|
const memory = baseModule.memory || env.memory;
|
||||||
|
console.log("trace: " + getString(memory, mesg) + (n ? " " : "") + Array.prototype.slice.call(arguments, 2, 2 + n).join(", "));
|
||||||
|
}
|
||||||
|
imports.Math = imports.Math || Math;
|
||||||
|
imports.Date = imports.Date || Date;
|
||||||
|
|
||||||
|
return baseModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Prepares the final module once instantiation is complete. */
|
||||||
|
function postInstantiate(baseModule, instance) {
|
||||||
|
const rawExports = instance.exports;
|
||||||
|
const memory = rawExports.memory;
|
||||||
|
const table = rawExports.table;
|
||||||
|
const alloc = rawExports["__alloc"];
|
||||||
|
const retain = rawExports["__retain"];
|
||||||
|
const rttiBase = rawExports["__rtti_base"] || ~0; // oob if not present
|
||||||
|
|
||||||
|
/** Gets the runtime type info for the given id. */
|
||||||
|
function getInfo(id) {
|
||||||
|
const U32 = new Uint32Array(memory.buffer);
|
||||||
|
const count = U32[rttiBase >>> 2];
|
||||||
|
if ((id >>>= 0) >= count) throw Error("invalid id: " + id);
|
||||||
|
return U32[(rttiBase + 4 >>> 2) + id * 2];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets the runtime base id for the given id. */
|
||||||
|
function getBase(id) {
|
||||||
|
const U32 = new Uint32Array(memory.buffer);
|
||||||
|
const count = U32[rttiBase >>> 2];
|
||||||
|
if ((id >>>= 0) >= count) throw Error("invalid id: " + id);
|
||||||
|
return U32[(rttiBase + 4 >>> 2) + id * 2 + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets the runtime alignment of a collection's values. */
|
||||||
|
function getValueAlign(info) {
|
||||||
|
return 31 - Math.clz32((info >>> VAL_ALIGN_OFFSET) & 31); // -1 if none
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets the runtime alignment of a collection's keys. */
|
||||||
|
function getKeyAlign(info) {
|
||||||
|
return 31 - Math.clz32((info >>> KEY_ALIGN_OFFSET) & 31); // -1 if none
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Allocates a new string in the module's memory and returns its retained pointer. */
|
||||||
|
function __allocString(str) {
|
||||||
|
const length = str.length;
|
||||||
|
const ptr = alloc(length << 1, STRING_ID);
|
||||||
|
const U16 = new Uint16Array(memory.buffer);
|
||||||
|
for (var i = 0, p = ptr >>> 1; i < length; ++i) U16[p + i] = str.charCodeAt(i);
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
baseModule.__allocString = __allocString;
|
||||||
|
|
||||||
|
/** Reads a string from the module's memory by its pointer. */
|
||||||
|
function __getString(ptr) {
|
||||||
|
const buffer = memory.buffer;
|
||||||
|
const id = new Uint32Array(buffer)[ptr + ID_OFFSET >>> 2];
|
||||||
|
if (id !== STRING_ID) throw Error("not a string: " + ptr);
|
||||||
|
return getStringImpl(buffer, ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
baseModule.__getString = __getString;
|
||||||
|
|
||||||
|
/** Gets the view matching the specified alignment, signedness and floatness. */
|
||||||
|
function getView(alignLog2, signed, float) {
|
||||||
|
const buffer = memory.buffer;
|
||||||
|
if (float) {
|
||||||
|
switch (alignLog2) {
|
||||||
|
case 2: return new Float32Array(buffer);
|
||||||
|
case 3: return new Float64Array(buffer);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (alignLog2) {
|
||||||
|
case 0: return new (signed ? Int8Array : Uint8Array)(buffer);
|
||||||
|
case 1: return new (signed ? Int16Array : Uint16Array)(buffer);
|
||||||
|
case 2: return new (signed ? Int32Array : Uint32Array)(buffer);
|
||||||
|
case 3: return new (signed ? BigInt64Array : BigUint64Array)(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw Error("unsupported align: " + alignLog2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Allocates a new array in the module's memory and returns its retained pointer. */
|
||||||
|
function __allocArray(id, values) {
|
||||||
|
const info = getInfo(id);
|
||||||
|
if (!(info & (ARRAYBUFFERVIEW | ARRAY))) throw Error("not an array: " + id + " @ " + info);
|
||||||
|
const align = getValueAlign(info);
|
||||||
|
const length = values.length;
|
||||||
|
const buf = alloc(length << align, ARRAYBUFFER_ID);
|
||||||
|
const arr = alloc(info & ARRAY ? ARRAY_SIZE : ARRAYBUFFERVIEW_SIZE, id);
|
||||||
|
const U32 = new Uint32Array(memory.buffer);
|
||||||
|
U32[arr + ARRAYBUFFERVIEW_BUFFER_OFFSET >>> 2] = retain(buf);
|
||||||
|
U32[arr + ARRAYBUFFERVIEW_DATASTART_OFFSET >>> 2] = buf;
|
||||||
|
U32[arr + ARRAYBUFFERVIEW_DATALENGTH_OFFSET >>> 2] = length << align;
|
||||||
|
if (info & ARRAY) U32[arr + ARRAY_LENGTH_OFFSET >>> 2] = length;
|
||||||
|
const view = getView(align, info & VAL_SIGNED, info & VAL_FLOAT);
|
||||||
|
if (info & VAL_MANAGED) {
|
||||||
|
for (let i = 0; i < length; ++i) view[(buf >>> align) + i] = retain(values[i]);
|
||||||
|
} else {
|
||||||
|
view.set(values, buf >>> align);
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
baseModule.__allocArray = __allocArray;
|
||||||
|
|
||||||
|
/** Gets a live view on an array's values in the module's memory. Infers the array type from RTTI. */
|
||||||
|
function __getArrayView(arr) {
|
||||||
|
const U32 = new Uint32Array(memory.buffer);
|
||||||
|
const id = U32[arr + ID_OFFSET >>> 2];
|
||||||
|
const info = getInfo(id);
|
||||||
|
if (!(info & ARRAYBUFFERVIEW)) throw Error("not an array: " + id);
|
||||||
|
const align = getValueAlign(info);
|
||||||
|
var buf = U32[arr + ARRAYBUFFERVIEW_DATASTART_OFFSET >>> 2];
|
||||||
|
const length = info & ARRAY
|
||||||
|
? U32[arr + ARRAY_LENGTH_OFFSET >>> 2]
|
||||||
|
: U32[buf + SIZE_OFFSET >>> 2] >>> align;
|
||||||
|
return getView(align, info & VAL_SIGNED, info & VAL_FLOAT)
|
||||||
|
.subarray(buf >>>= align, buf + length);
|
||||||
|
}
|
||||||
|
|
||||||
|
baseModule.__getArrayView = __getArrayView;
|
||||||
|
|
||||||
|
/** Copies an array's values from the module's memory. Infers the array type from RTTI. */
|
||||||
|
function __getArray(arr) {
|
||||||
|
const input = __getArrayView(arr);
|
||||||
|
const len = input.length;
|
||||||
|
const out = new Array(len);
|
||||||
|
for (let i = 0; i < len; i++) out[i] = input[i];
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
baseModule.__getArray = __getArray;
|
||||||
|
|
||||||
|
/** Copies an ArrayBuffer's value from the module's memory. */
|
||||||
|
function __getArrayBuffer(ptr) {
|
||||||
|
const buffer = memory.buffer;
|
||||||
|
const length = new Uint32Array(buffer)[ptr + SIZE_OFFSET >>> 2];
|
||||||
|
return buffer.slice(ptr, ptr + length);
|
||||||
|
}
|
||||||
|
|
||||||
|
baseModule.__getArrayBuffer = __getArrayBuffer;
|
||||||
|
|
||||||
|
/** Copies a typed array's values from the module's memory. */
|
||||||
|
function getTypedArray(Type, alignLog2, ptr) {
|
||||||
|
return new Type(getTypedArrayView(Type, alignLog2, ptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets a live view on a typed array's values in the module's memory. */
|
||||||
|
function getTypedArrayView(Type, alignLog2, ptr) {
|
||||||
|
const buffer = memory.buffer;
|
||||||
|
const U32 = new Uint32Array(buffer);
|
||||||
|
const bufPtr = U32[ptr + ARRAYBUFFERVIEW_DATASTART_OFFSET >>> 2];
|
||||||
|
return new Type(buffer, bufPtr, U32[bufPtr + SIZE_OFFSET >>> 2] >>> alignLog2);
|
||||||
|
}
|
||||||
|
|
||||||
|
baseModule.__getInt8Array = getTypedArray.bind(null, Int8Array, 0);
|
||||||
|
baseModule.__getInt8ArrayView = getTypedArrayView.bind(null, Int8Array, 0);
|
||||||
|
baseModule.__getUint8Array = getTypedArray.bind(null, Uint8Array, 0);
|
||||||
|
baseModule.__getUint8ArrayView = getTypedArrayView.bind(null, Uint8Array, 0);
|
||||||
|
baseModule.__getUint8ClampedArray = getTypedArray.bind(null, Uint8ClampedArray, 0);
|
||||||
|
baseModule.__getUint8ClampedArrayView = getTypedArrayView.bind(null, Uint8ClampedArray, 0);
|
||||||
|
baseModule.__getInt16Array = getTypedArray.bind(null, Int16Array, 1);
|
||||||
|
baseModule.__getInt16ArrayView = getTypedArrayView.bind(null, Int16Array, 1);
|
||||||
|
baseModule.__getUint16Array = getTypedArray.bind(null, Uint16Array, 1);
|
||||||
|
baseModule.__getUint16ArrayView = getTypedArrayView.bind(null, Uint16Array, 1);
|
||||||
|
baseModule.__getInt32Array = getTypedArray.bind(null, Int32Array, 2);
|
||||||
|
baseModule.__getInt32ArrayView = getTypedArrayView.bind(null, Int32Array, 2);
|
||||||
|
baseModule.__getUint32Array = getTypedArray.bind(null, Uint32Array, 2);
|
||||||
|
baseModule.__getUint32ArrayView = getTypedArrayView.bind(null, Uint32Array, 2);
|
||||||
|
if (BIGINT) {
|
||||||
|
baseModule.__getInt64Array = getTypedArray.bind(null, BigInt64Array, 3);
|
||||||
|
baseModule.__getInt64ArrayView = getTypedArrayView.bind(null, BigInt64Array, 3);
|
||||||
|
baseModule.__getUint64Array = getTypedArray.bind(null, BigUint64Array, 3);
|
||||||
|
baseModule.__getUint64ArrayView = getTypedArrayView.bind(null, BigUint64Array, 3);
|
||||||
|
}
|
||||||
|
baseModule.__getFloat32Array = getTypedArray.bind(null, Float32Array, 2);
|
||||||
|
baseModule.__getFloat32ArrayView = getTypedArrayView.bind(null, Float32Array, 2);
|
||||||
|
baseModule.__getFloat64Array = getTypedArray.bind(null, Float64Array, 3);
|
||||||
|
baseModule.__getFloat64ArrayView = getTypedArrayView.bind(null, Float64Array, 3);
|
||||||
|
|
||||||
|
/** Tests whether an object is an instance of the class represented by the specified base id. */
|
||||||
|
function __instanceof(ptr, baseId) {
|
||||||
|
const U32 = new Uint32Array(memory.buffer);
|
||||||
|
var id = U32[(ptr + ID_OFFSET) >>> 2];
|
||||||
|
if (id <= U32[rttiBase >>> 2]) {
|
||||||
|
do if (id == baseId) return true;
|
||||||
|
while (id = getBase(id));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
baseModule.__instanceof = __instanceof;
|
||||||
|
|
||||||
|
// Pull basic exports to baseModule so code in preInstantiate can use them
|
||||||
|
baseModule.memory = baseModule.memory || memory;
|
||||||
|
baseModule.table = baseModule.table || table;
|
||||||
|
|
||||||
|
// Demangle exports and provide the usual utility on the prototype
|
||||||
|
return demangle(rawExports, baseModule);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isResponse(o) {
|
||||||
|
return typeof Response !== "undefined" && o instanceof Response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Asynchronously instantiates an AssemblyScript module from anything that can be instantiated. */
|
||||||
|
async function instantiate(source, imports) {
|
||||||
|
if (isResponse(source = await source)) return instantiateStreaming(source, imports);
|
||||||
|
return postInstantiate(
|
||||||
|
preInstantiate(imports || (imports = {})),
|
||||||
|
await WebAssembly.instantiate(
|
||||||
|
source instanceof WebAssembly.Module
|
||||||
|
? source
|
||||||
|
: await WebAssembly.compile(source),
|
||||||
|
imports
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.instantiate = instantiate;
|
||||||
|
|
||||||
|
/** Synchronously instantiates an AssemblyScript module from a WebAssembly.Module or binary buffer. */
|
||||||
|
function instantiateSync(source, imports) {
|
||||||
|
return postInstantiate(
|
||||||
|
preInstantiate(imports || (imports = {})),
|
||||||
|
new WebAssembly.Instance(
|
||||||
|
source instanceof WebAssembly.Module
|
||||||
|
? source
|
||||||
|
: new WebAssembly.Module(source),
|
||||||
|
imports
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.instantiateSync = instantiateSync;
|
||||||
|
|
||||||
|
/** Asynchronously instantiates an AssemblyScript module from a response, i.e. as obtained by `fetch`. */
|
||||||
|
async function instantiateStreaming(source, imports) {
|
||||||
|
if (!WebAssembly.instantiateStreaming) {
|
||||||
|
return instantiate(
|
||||||
|
isResponse(source = await source)
|
||||||
|
? source.arrayBuffer()
|
||||||
|
: source,
|
||||||
|
imports
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return postInstantiate(
|
||||||
|
preInstantiate(imports || (imports = {})),
|
||||||
|
(await WebAssembly.instantiateStreaming(source, imports)).instance
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.instantiateStreaming = instantiateStreaming;
|
||||||
|
|
||||||
|
/** Demangles an AssemblyScript module's exports to a friendly object structure. */
|
||||||
|
function demangle(exports, baseModule) {
|
||||||
|
var module = baseModule ? Object.create(baseModule) : {};
|
||||||
|
var setArgumentsLength = exports["__argumentsLength"]
|
||||||
|
? function(length) { exports["__argumentsLength"].value = length; }
|
||||||
|
: exports["__setArgumentsLength"] || exports["__setargc"] || function() {};
|
||||||
|
for (let internalName in exports) {
|
||||||
|
if (!Object.prototype.hasOwnProperty.call(exports, internalName)) continue;
|
||||||
|
const elem = exports[internalName];
|
||||||
|
let parts = internalName.split(".");
|
||||||
|
let curr = module;
|
||||||
|
while (parts.length > 1) {
|
||||||
|
let part = parts.shift();
|
||||||
|
if (!Object.prototype.hasOwnProperty.call(curr, part)) curr[part] = {};
|
||||||
|
curr = curr[part];
|
||||||
|
}
|
||||||
|
let name = parts[0];
|
||||||
|
let hash = name.indexOf("#");
|
||||||
|
if (hash >= 0) {
|
||||||
|
let className = name.substring(0, hash);
|
||||||
|
let classElem = curr[className];
|
||||||
|
if (typeof classElem === "undefined" || !classElem.prototype) {
|
||||||
|
let ctor = function(...args) {
|
||||||
|
return ctor.wrap(ctor.prototype.constructor(0, ...args));
|
||||||
|
};
|
||||||
|
ctor.prototype = {
|
||||||
|
valueOf: function valueOf() {
|
||||||
|
return this[THIS];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ctor.wrap = function(thisValue) {
|
||||||
|
return Object.create(ctor.prototype, { [THIS]: { value: thisValue, writable: false } });
|
||||||
|
};
|
||||||
|
if (classElem) Object.getOwnPropertyNames(classElem).forEach(name =>
|
||||||
|
Object.defineProperty(ctor, name, Object.getOwnPropertyDescriptor(classElem, name))
|
||||||
|
);
|
||||||
|
curr[className] = ctor;
|
||||||
|
}
|
||||||
|
name = name.substring(hash + 1);
|
||||||
|
curr = curr[className].prototype;
|
||||||
|
if (/^(get|set):/.test(name)) {
|
||||||
|
if (!Object.prototype.hasOwnProperty.call(curr, name = name.substring(4))) {
|
||||||
|
let getter = exports[internalName.replace("set:", "get:")];
|
||||||
|
let setter = exports[internalName.replace("get:", "set:")];
|
||||||
|
Object.defineProperty(curr, name, {
|
||||||
|
get: function() { return getter(this[THIS]); },
|
||||||
|
set: function(value) { setter(this[THIS], value); },
|
||||||
|
enumerable: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (name === 'constructor') {
|
||||||
|
(curr[name] = (...args) => {
|
||||||
|
setArgumentsLength(args.length);
|
||||||
|
return elem(...args);
|
||||||
|
}).original = elem;
|
||||||
|
} else { // instance method
|
||||||
|
(curr[name] = function(...args) { // !
|
||||||
|
setArgumentsLength(args.length);
|
||||||
|
return elem(this[THIS], ...args);
|
||||||
|
}).original = elem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (/^(get|set):/.test(name)) {
|
||||||
|
if (!Object.prototype.hasOwnProperty.call(curr, name = name.substring(4))) {
|
||||||
|
Object.defineProperty(curr, name, {
|
||||||
|
get: exports[internalName.replace("set:", "get:")],
|
||||||
|
set: exports[internalName.replace("get:", "set:")],
|
||||||
|
enumerable: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (typeof elem === "function" && elem !== setArgumentsLength) {
|
||||||
|
(curr[name] = (...args) => {
|
||||||
|
setArgumentsLength(args.length);
|
||||||
|
return elem(...args);
|
||||||
|
}).original = elem;
|
||||||
|
} else {
|
||||||
|
curr[name] = elem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return module;
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.demangle = demangle;
|
||||||
38
apps/did-wallet/node_modules/@assemblyscript/loader/package.json
generated
vendored
Normal file
38
apps/did-wallet/node_modules/@assemblyscript/loader/package.json
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"name": "@assemblyscript/loader",
|
||||||
|
"description": "A convenient loader for AssemblyScript modules.",
|
||||||
|
"keywords": [
|
||||||
|
"assemblyscript",
|
||||||
|
"loader",
|
||||||
|
"glue",
|
||||||
|
"interop",
|
||||||
|
"webassembly",
|
||||||
|
"wasm"
|
||||||
|
],
|
||||||
|
"version": "0.9.4",
|
||||||
|
"author": "Daniel Wirtz <dcode+assemblyscript@dcode.io>",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"homepage": "https://assemblyscript.org",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/AssemblyScript/assemblyscript.git",
|
||||||
|
"directory": "lib/loader"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/AssemblyScript/assemblyscript/issues"
|
||||||
|
},
|
||||||
|
"main": "index.js",
|
||||||
|
"types": "index.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"asbuild": "npm run asbuild:default && npm run asbuild:legacy",
|
||||||
|
"asbuild:default": "node ../../bin/asc tests/assembly/index.ts -b tests/build/default.wasm",
|
||||||
|
"asbuild:legacy": "node ../../bin/asc tests/assembly/index.ts --disable mutable-globals -b tests/build/legacy.wasm",
|
||||||
|
"test": "node tests"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.d.ts",
|
||||||
|
"index.js",
|
||||||
|
"package.json",
|
||||||
|
"README.md"
|
||||||
|
]
|
||||||
|
}
|
||||||
21
apps/did-wallet/node_modules/@cspotcode/source-map-support/LICENSE.md
generated
vendored
Normal file
21
apps/did-wallet/node_modules/@cspotcode/source-map-support/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Evan Wallace
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
289
apps/did-wallet/node_modules/@cspotcode/source-map-support/README.md
generated
vendored
Normal file
289
apps/did-wallet/node_modules/@cspotcode/source-map-support/README.md
generated
vendored
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
# Source Map Support
|
||||||
|
|
||||||
|
[](https://npmjs.org/package/@cspotcode/source-map-support)
|
||||||
|
[](https://npmjs.org/package/@cspotcode/source-map-support)
|
||||||
|
[](https://github.com/cspotcode/node-source-map-support/actions?query=workflow%3A%22Continuous+Integration%22)
|
||||||
|
|
||||||
|
This module provides source map support for stack traces in node via the [V8 stack trace API](https://github.com/v8/v8/wiki/Stack-Trace-API). It uses the [source-map](https://github.com/mozilla/source-map) module to replace the paths and line numbers of source-mapped files with their original paths and line numbers. The output mimics node's stack trace format with the goal of making every compile-to-JS language more of a first-class citizen. Source maps are completely general (not specific to any one language) so you can use source maps with multiple compile-to-JS languages in the same node process.
|
||||||
|
|
||||||
|
## Installation and Usage
|
||||||
|
|
||||||
|
#### Node support
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install @cspotcode/source-map-support
|
||||||
|
```
|
||||||
|
|
||||||
|
Source maps can be generated using libraries such as [source-map-index-generator](https://github.com/twolfson/source-map-index-generator). Once you have a valid source map, place a source mapping comment somewhere in the file (usually done automatically or with an option by your transpiler):
|
||||||
|
|
||||||
|
```
|
||||||
|
//# sourceMappingURL=path/to/source.map
|
||||||
|
```
|
||||||
|
|
||||||
|
If multiple sourceMappingURL comments exist in one file, the last sourceMappingURL comment will be
|
||||||
|
respected (e.g. if a file mentions the comment in code, or went through multiple transpilers).
|
||||||
|
The path should either be absolute or relative to the compiled file.
|
||||||
|
|
||||||
|
From here you have two options.
|
||||||
|
|
||||||
|
##### CLI Usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
node -r @cspotcode/source-map-support/register compiled.js
|
||||||
|
# Or to enable hookRequire
|
||||||
|
node -r @cspotcode/source-map-support/register-hook-require compiled.js
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Programmatic Usage
|
||||||
|
|
||||||
|
Put the following line at the top of the compiled file.
|
||||||
|
|
||||||
|
```js
|
||||||
|
require('@cspotcode/source-map-support').install();
|
||||||
|
```
|
||||||
|
|
||||||
|
It is also possible to install the source map support directly by
|
||||||
|
requiring the `register` module which can be handy with ES6:
|
||||||
|
|
||||||
|
```js
|
||||||
|
import '@cspotcode/source-map-support/register'
|
||||||
|
|
||||||
|
// Instead of:
|
||||||
|
import sourceMapSupport from '@cspotcode/source-map-support'
|
||||||
|
sourceMapSupport.install()
|
||||||
|
```
|
||||||
|
Note: if you're using babel-register, it includes source-map-support already.
|
||||||
|
|
||||||
|
It is also very useful with Mocha:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ mocha --require @cspotcode/source-map-support/register tests/
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Browser support
|
||||||
|
|
||||||
|
This library also works in Chrome. While the DevTools console already supports source maps, the V8 engine doesn't and `Error.prototype.stack` will be incorrect without this library. Everything will just work if you deploy your source files using [browserify](http://browserify.org/). Just make sure to pass the `--debug` flag to the browserify command so your source maps are included in the bundled code.
|
||||||
|
|
||||||
|
This library also works if you use another build process or just include the source files directly. In this case, include the file `browser-source-map-support.js` in your page and call `sourceMapSupport.install()`. It contains the whole library already bundled for the browser using browserify.
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script src="browser-source-map-support.js"></script>
|
||||||
|
<script>sourceMapSupport.install();</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
This library also works if you use AMD (Asynchronous Module Definition), which is used in tools like [RequireJS](http://requirejs.org/). Just list `browser-source-map-support` as a dependency:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<script>
|
||||||
|
define(['browser-source-map-support'], function(sourceMapSupport) {
|
||||||
|
sourceMapSupport.install();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
This module installs two things: a change to the `stack` property on `Error` objects and a handler for uncaught exceptions that mimics node's default exception handler (the handler can be seen in the demos below). You may want to disable the handler if you have your own uncaught exception handler. This can be done by passing an argument to the installer:
|
||||||
|
|
||||||
|
```js
|
||||||
|
require('@cspotcode/source-map-support').install({
|
||||||
|
handleUncaughtExceptions: false
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
This module loads source maps from the filesystem by default. You can provide alternate loading behavior through a callback as shown below. For example, [Meteor](https://github.com/meteor) keeps all source maps cached in memory to avoid disk access.
|
||||||
|
|
||||||
|
```js
|
||||||
|
require('@cspotcode/source-map-support').install({
|
||||||
|
retrieveSourceMap: function(source) {
|
||||||
|
if (source === 'compiled.js') {
|
||||||
|
return {
|
||||||
|
url: 'original.js',
|
||||||
|
map: fs.readFileSync('compiled.js.map', 'utf8')
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
The module will by default assume a browser environment if XMLHttpRequest and window are defined. If either of these do not exist it will instead assume a node environment.
|
||||||
|
In some rare cases, e.g. when running a browser emulation and where both variables are also set, you can explictly specify the environment to be either 'browser' or 'node'.
|
||||||
|
|
||||||
|
```js
|
||||||
|
require('@cspotcode/source-map-support').install({
|
||||||
|
environment: 'node'
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
To support files with inline source maps, the `hookRequire` options can be specified, which will monitor all source files for inline source maps.
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
require('@cspotcode/source-map-support').install({
|
||||||
|
hookRequire: true
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
This monkey patches the `require` module loading chain, so is not enabled by default and is not recommended for any sort of production usage.
|
||||||
|
|
||||||
|
## Demos
|
||||||
|
|
||||||
|
#### Basic Demo
|
||||||
|
|
||||||
|
original.js:
|
||||||
|
|
||||||
|
```js
|
||||||
|
throw new Error('test'); // This is the original code
|
||||||
|
```
|
||||||
|
|
||||||
|
compiled.js:
|
||||||
|
|
||||||
|
```js
|
||||||
|
require('@cspotcode/source-map-support').install();
|
||||||
|
|
||||||
|
throw new Error('test'); // This is the compiled code
|
||||||
|
// The next line defines the sourceMapping.
|
||||||
|
//# sourceMappingURL=compiled.js.map
|
||||||
|
```
|
||||||
|
|
||||||
|
compiled.js.map:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"file": "compiled.js",
|
||||||
|
"sources": ["original.js"],
|
||||||
|
"names": [],
|
||||||
|
"mappings": ";;AAAA,MAAM,IAAI"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Run compiled.js using node (notice how the stack trace uses original.js instead of compiled.js):
|
||||||
|
|
||||||
|
```
|
||||||
|
$ node compiled.js
|
||||||
|
|
||||||
|
original.js:1
|
||||||
|
throw new Error('test'); // This is the original code
|
||||||
|
^
|
||||||
|
Error: test
|
||||||
|
at Object.<anonymous> (original.js:1:7)
|
||||||
|
at Module._compile (module.js:456:26)
|
||||||
|
at Object.Module._extensions..js (module.js:474:10)
|
||||||
|
at Module.load (module.js:356:32)
|
||||||
|
at Function.Module._load (module.js:312:12)
|
||||||
|
at Function.Module.runMain (module.js:497:10)
|
||||||
|
at startup (node.js:119:16)
|
||||||
|
at node.js:901:3
|
||||||
|
```
|
||||||
|
|
||||||
|
#### TypeScript Demo
|
||||||
|
|
||||||
|
demo.ts:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
declare function require(name: string);
|
||||||
|
require('@cspotcode/source-map-support').install();
|
||||||
|
class Foo {
|
||||||
|
constructor() { this.bar(); }
|
||||||
|
bar() { throw new Error('this is a demo'); }
|
||||||
|
}
|
||||||
|
new Foo();
|
||||||
|
```
|
||||||
|
|
||||||
|
Compile and run the file using the TypeScript compiler from the terminal:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install source-map-support typescript
|
||||||
|
$ node_modules/typescript/bin/tsc -sourcemap demo.ts
|
||||||
|
$ node demo.js
|
||||||
|
|
||||||
|
demo.ts:5
|
||||||
|
bar() { throw new Error('this is a demo'); }
|
||||||
|
^
|
||||||
|
Error: this is a demo
|
||||||
|
at Foo.bar (demo.ts:5:17)
|
||||||
|
at new Foo (demo.ts:4:24)
|
||||||
|
at Object.<anonymous> (demo.ts:7:1)
|
||||||
|
at Module._compile (module.js:456:26)
|
||||||
|
at Object.Module._extensions..js (module.js:474:10)
|
||||||
|
at Module.load (module.js:356:32)
|
||||||
|
at Function.Module._load (module.js:312:12)
|
||||||
|
at Function.Module.runMain (module.js:497:10)
|
||||||
|
at startup (node.js:119:16)
|
||||||
|
at node.js:901:3
|
||||||
|
```
|
||||||
|
|
||||||
|
There is also the option to use `-r source-map-support/register` with typescript, without the need add the `require('@cspotcode/source-map-support').install()` in the code base:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ npm install source-map-support typescript
|
||||||
|
$ node_modules/typescript/bin/tsc -sourcemap demo.ts
|
||||||
|
$ node -r source-map-support/register demo.js
|
||||||
|
|
||||||
|
demo.ts:5
|
||||||
|
bar() { throw new Error('this is a demo'); }
|
||||||
|
^
|
||||||
|
Error: this is a demo
|
||||||
|
at Foo.bar (demo.ts:5:17)
|
||||||
|
at new Foo (demo.ts:4:24)
|
||||||
|
at Object.<anonymous> (demo.ts:7:1)
|
||||||
|
at Module._compile (module.js:456:26)
|
||||||
|
at Object.Module._extensions..js (module.js:474:10)
|
||||||
|
at Module.load (module.js:356:32)
|
||||||
|
at Function.Module._load (module.js:312:12)
|
||||||
|
at Function.Module.runMain (module.js:497:10)
|
||||||
|
at startup (node.js:119:16)
|
||||||
|
at node.js:901:3
|
||||||
|
```
|
||||||
|
|
||||||
|
#### CoffeeScript Demo
|
||||||
|
|
||||||
|
demo.coffee:
|
||||||
|
|
||||||
|
```coffee
|
||||||
|
require('@cspotcode/source-map-support').install()
|
||||||
|
foo = ->
|
||||||
|
bar = -> throw new Error 'this is a demo'
|
||||||
|
bar()
|
||||||
|
foo()
|
||||||
|
```
|
||||||
|
|
||||||
|
Compile and run the file using the CoffeeScript compiler from the terminal:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ npm install @cspotcode/source-map-support coffeescript
|
||||||
|
$ node_modules/.bin/coffee --map --compile demo.coffee
|
||||||
|
$ node demo.js
|
||||||
|
|
||||||
|
demo.coffee:3
|
||||||
|
bar = -> throw new Error 'this is a demo'
|
||||||
|
^
|
||||||
|
Error: this is a demo
|
||||||
|
at bar (demo.coffee:3:22)
|
||||||
|
at foo (demo.coffee:4:3)
|
||||||
|
at Object.<anonymous> (demo.coffee:5:1)
|
||||||
|
at Object.<anonymous> (demo.coffee:1:1)
|
||||||
|
at Module._compile (module.js:456:26)
|
||||||
|
at Object.Module._extensions..js (module.js:474:10)
|
||||||
|
at Module.load (module.js:356:32)
|
||||||
|
at Function.Module._load (module.js:312:12)
|
||||||
|
at Function.Module.runMain (module.js:497:10)
|
||||||
|
at startup (node.js:119:16)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
This repo contains both automated tests for node and manual tests for the browser. The automated tests can be run using mocha (type `mocha` in the root directory). To run the manual tests:
|
||||||
|
|
||||||
|
* Build the tests using `build.js`
|
||||||
|
* Launch the HTTP server (`npm run serve-tests`) and visit
|
||||||
|
* http://127.0.0.1:1336/amd-test
|
||||||
|
* http://127.0.0.1:1336/browser-test
|
||||||
|
* http://127.0.0.1:1336/browserify-test - **Currently not working** due to a bug with browserify (see [pull request #66](https://github.com/evanw/node-source-map-support/pull/66) for details).
|
||||||
|
* For `header-test`, run `server.js` inside that directory and visit http://127.0.0.1:1337/
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This code is available under the [MIT license](http://opensource.org/licenses/MIT).
|
||||||
114
apps/did-wallet/node_modules/@cspotcode/source-map-support/browser-source-map-support.js
generated
vendored
Normal file
114
apps/did-wallet/node_modules/@cspotcode/source-map-support/browser-source-map-support.js
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* Support for source maps in V8 stack traces
|
||||||
|
* https://github.com/evanw/node-source-map-support
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
The buffer module from node.js, for the browser.
|
||||||
|
|
||||||
|
@author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
||||||
|
license MIT
|
||||||
|
*/
|
||||||
|
(this.define||function(R,U){this.sourceMapSupport=U()})("browser-source-map-support",function(R){(function e(C,J,A){function p(f,c){if(!J[f]){if(!C[f]){var l="function"==typeof require&&require;if(!c&&l)return l(f,!0);if(t)return t(f,!0);throw Error("Cannot find module '"+f+"'");}l=J[f]={exports:{}};C[f][0].call(l.exports,function(q){var r=C[f][1][q];return p(r?r:q)},l,l.exports,e,C,J,A)}return J[f].exports}for(var t="function"==typeof require&&require,m=0;m<A.length;m++)p(A[m]);return p})({1:[function(C,
|
||||||
|
J,A){R=C("./source-map-support")},{"./source-map-support":21}],2:[function(C,J,A){(function(e){function p(m){m=m.charCodeAt(0);if(43===m)return 62;if(47===m)return 63;if(48>m)return-1;if(58>m)return m-48+52;if(91>m)return m-65;if(123>m)return m-97+26}var t="undefined"!==typeof Uint8Array?Uint8Array:Array;e.toByteArray=function(m){function f(d){q[k++]=d}if(0<m.length%4)throw Error("Invalid string. Length must be a multiple of 4");var c=m.length;var l="="===m.charAt(c-2)?2:"="===m.charAt(c-1)?1:0;var q=
|
||||||
|
new t(3*m.length/4-l);var r=0<l?m.length-4:m.length;var k=0;for(c=0;c<r;c+=4){var u=p(m.charAt(c))<<18|p(m.charAt(c+1))<<12|p(m.charAt(c+2))<<6|p(m.charAt(c+3));f((u&16711680)>>16);f((u&65280)>>8);f(u&255)}2===l?(u=p(m.charAt(c))<<2|p(m.charAt(c+1))>>4,f(u&255)):1===l&&(u=p(m.charAt(c))<<10|p(m.charAt(c+1))<<4|p(m.charAt(c+2))>>2,f(u>>8&255),f(u&255));return q};e.fromByteArray=function(m){var f=m.length%3,c="",l;var q=0;for(l=m.length-f;q<l;q+=3){var r=(m[q]<<16)+(m[q+1]<<8)+m[q+2];r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>
|
||||||
|
18&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>12&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>6&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r&63);c+=r}switch(f){case 1:r=m[m.length-1];c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r<<4&63);c+="==";break;case 2:r=(m[m.length-2]<<8)+
|
||||||
|
m[m.length-1],c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>10),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>4&63),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r<<2&63),c+="="}return c}})("undefined"===typeof A?this.base64js={}:A)},{}],3:[function(C,J,A){},{}],4:[function(C,J,A){(function(e){var p=Object.prototype.toString,t="function"===typeof e.alloc&&"function"===typeof e.allocUnsafe&&"function"===
|
||||||
|
typeof e.from;J.exports=function(m,f,c){if("number"===typeof m)throw new TypeError('"value" argument must not be a number');if("ArrayBuffer"===p.call(m).slice(8,-1)){f>>>=0;var l=m.byteLength-f;if(0>l)throw new RangeError("'offset' is out of bounds");if(void 0===c)c=l;else if(c>>>=0,c>l)throw new RangeError("'length' is out of bounds");return t?e.from(m.slice(f,f+c)):new e(new Uint8Array(m.slice(f,f+c)))}if("string"===typeof m){c=f;if("string"!==typeof c||""===c)c="utf8";if(!e.isEncoding(c))throw new TypeError('"encoding" must be a valid string encoding');
|
||||||
|
return t?e.from(m,c):new e(m,c)}return t?e.from(m):new e(m)}}).call(this,C("buffer").Buffer)},{buffer:5}],5:[function(C,J,A){function e(a,b,h){if(!(this instanceof e))return new e(a,b,h);var w=typeof a;if("number"===w)var y=0<a?a>>>0:0;else if("string"===w){if("base64"===b)for(a=(a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")).replace(L,"");0!==a.length%4;)a+="=";y=e.byteLength(a,b)}else if("object"===w&&null!==a)"Buffer"===a.type&&z(a.data)&&(a=a.data),y=0<+a.length?Math.floor(+a.length):0;else throw new TypeError("must start with number, buffer, array or string");
|
||||||
|
if(this.length>G)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G.toString(16)+" bytes");if(e.TYPED_ARRAY_SUPPORT)var I=e._augment(new Uint8Array(y));else I=this,I.length=y,I._isBuffer=!0;if(e.TYPED_ARRAY_SUPPORT&&"number"===typeof a.byteLength)I._set(a);else{var K=a;if(z(K)||e.isBuffer(K)||K&&"object"===typeof K&&"number"===typeof K.length)if(e.isBuffer(a))for(b=0;b<y;b++)I[b]=a.readUInt8(b);else for(b=0;b<y;b++)I[b]=(a[b]%256+256)%256;else if("string"===w)I.write(a,
|
||||||
|
0,b);else if("number"===w&&!e.TYPED_ARRAY_SUPPORT&&!h)for(b=0;b<y;b++)I[b]=0}return I}function p(a,b,h){var w="";for(h=Math.min(a.length,h);b<h;b++)w+=String.fromCharCode(a[b]);return w}function t(a,b,h){if(0!==a%1||0>a)throw new RangeError("offset is not uint");if(a+b>h)throw new RangeError("Trying to access beyond buffer length");}function m(a,b,h,w,y,I){if(!e.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(b>y||b<I)throw new TypeError("value is out of bounds");if(h+w>a.length)throw new TypeError("index out of range");
|
||||||
|
}function f(a,b,h,w){0>b&&(b=65535+b+1);for(var y=0,I=Math.min(a.length-h,2);y<I;y++)a[h+y]=(b&255<<8*(w?y:1-y))>>>8*(w?y:1-y)}function c(a,b,h,w){0>b&&(b=4294967295+b+1);for(var y=0,I=Math.min(a.length-h,4);y<I;y++)a[h+y]=b>>>8*(w?y:3-y)&255}function l(a,b,h,w,y,I){if(b>y||b<I)throw new TypeError("value is out of bounds");if(h+w>a.length)throw new TypeError("index out of range");}function q(a,b,h,w,y){y||l(a,b,h,4,3.4028234663852886E38,-3.4028234663852886E38);v.write(a,b,h,w,23,4);return h+4}function r(a,
|
||||||
|
b,h,w,y){y||l(a,b,h,8,1.7976931348623157E308,-1.7976931348623157E308);v.write(a,b,h,w,52,8);return h+8}function k(a){for(var b=[],h=0;h<a.length;h++){var w=a.charCodeAt(h);if(127>=w)b.push(w);else{var y=h;55296<=w&&57343>=w&&h++;w=encodeURIComponent(a.slice(y,h+1)).substr(1).split("%");for(y=0;y<w.length;y++)b.push(parseInt(w[y],16))}}return b}function u(a){for(var b=[],h=0;h<a.length;h++)b.push(a.charCodeAt(h)&255);return b}function d(a,b,h,w,y){y&&(w-=w%y);for(y=0;y<w&&!(y+h>=b.length||y>=a.length);y++)b[y+
|
||||||
|
h]=a[y];return y}function g(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}var n=C("base64-js"),v=C("ieee754"),z=C("is-array");A.Buffer=e;A.SlowBuffer=e;A.INSPECT_MAX_BYTES=50;e.poolSize=8192;var G=1073741823;e.TYPED_ARRAY_SUPPORT=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);b.foo=function(){return 42};return 42===b.foo()&&"function"===typeof b.subarray&&0===(new Uint8Array(1)).subarray(1,1).byteLength}catch(h){return!1}}();e.isBuffer=function(a){return!(null==
|
||||||
|
a||!a._isBuffer)};e.compare=function(a,b){if(!e.isBuffer(a)||!e.isBuffer(b))throw new TypeError("Arguments must be Buffers");for(var h=a.length,w=b.length,y=0,I=Math.min(h,w);y<I&&a[y]===b[y];y++);y!==I&&(h=a[y],w=b[y]);return h<w?-1:w<h?1:0};e.isEncoding=function(a){switch(String(a).toLowerCase()){case "hex":case "utf8":case "utf-8":case "ascii":case "binary":case "base64":case "raw":case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":return!0;default:return!1}};e.concat=function(a,b){if(!z(a))throw new TypeError("Usage: Buffer.concat(list[, length])");
|
||||||
|
if(0===a.length)return new e(0);if(1===a.length)return a[0];var h;if(void 0===b)for(h=b=0;h<a.length;h++)b+=a[h].length;var w=new e(b),y=0;for(h=0;h<a.length;h++){var I=a[h];I.copy(w,y);y+=I.length}return w};e.byteLength=function(a,b){a+="";switch(b||"utf8"){case "ascii":case "binary":case "raw":var h=a.length;break;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":h=2*a.length;break;case "hex":h=a.length>>>1;break;case "utf8":case "utf-8":h=k(a).length;break;case "base64":h=n.toByteArray(a).length;
|
||||||
|
break;default:h=a.length}return h};e.prototype.length=void 0;e.prototype.parent=void 0;e.prototype.toString=function(a,b,h){var w=!1;b>>>=0;h=void 0===h||Infinity===h?this.length:h>>>0;a||(a="utf8");0>b&&(b=0);h>this.length&&(h=this.length);if(h<=b)return"";for(;;)switch(a){case "hex":a=b;b=h;h=this.length;if(!a||0>a)a=0;if(!b||0>b||b>h)b=h;w="";for(h=a;h<b;h++)a=w,w=this[h],w=16>w?"0"+w.toString(16):w.toString(16),w=a+w;return w;case "utf8":case "utf-8":w=a="";for(h=Math.min(this.length,h);b<h;b++)127>=
|
||||||
|
this[b]?(a+=g(w)+String.fromCharCode(this[b]),w=""):w+="%"+this[b].toString(16);return a+g(w);case "ascii":return p(this,b,h);case "binary":return p(this,b,h);case "base64":return b=0===b&&h===this.length?n.fromByteArray(this):n.fromByteArray(this.slice(b,h)),b;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":b=this.slice(b,h);h="";for(a=0;a<b.length;a+=2)h+=String.fromCharCode(b[a]+256*b[a+1]);return h;default:if(w)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase();w=!0}};
|
||||||
|
e.prototype.equals=function(a){if(!e.isBuffer(a))throw new TypeError("Argument must be a Buffer");return 0===e.compare(this,a)};e.prototype.inspect=function(){var a="",b=A.INSPECT_MAX_BYTES;0<this.length&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... "));return"<Buffer "+a+">"};e.prototype.compare=function(a){if(!e.isBuffer(a))throw new TypeError("Argument must be a Buffer");return e.compare(this,a)};e.prototype.get=function(a){console.log(".get() is deprecated. Access using array indexes instead.");
|
||||||
|
return this.readUInt8(a)};e.prototype.set=function(a,b){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(a,b)};e.prototype.write=function(a,b,h,w){if(isFinite(b))isFinite(h)||(w=h,h=void 0);else{var y=w;w=b;b=h;h=y}b=Number(b)||0;y=this.length-b;h?(h=Number(h),h>y&&(h=y)):h=y;w=String(w||"utf8").toLowerCase();switch(w){case "hex":b=Number(b)||0;w=this.length-b;h?(h=Number(h),h>w&&(h=w)):h=w;w=a.length;if(0!==w%2)throw Error("Invalid hex string");h>w/
|
||||||
|
2&&(h=w/2);for(w=0;w<h;w++){y=parseInt(a.substr(2*w,2),16);if(isNaN(y))throw Error("Invalid hex string");this[b+w]=y}a=w;break;case "utf8":case "utf-8":a=d(k(a),this,b,h);break;case "ascii":a=d(u(a),this,b,h);break;case "binary":a=d(u(a),this,b,h);break;case "base64":a=d(n.toByteArray(a),this,b,h);break;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":y=[];for(var I=0;I<a.length;I++){var K=a.charCodeAt(I);w=K>>8;K%=256;y.push(K);y.push(w)}a=d(y,this,b,h,2);break;default:throw new TypeError("Unknown encoding: "+
|
||||||
|
w);}return a};e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};e.prototype.slice=function(a,b){var h=this.length;a=~~a;b=void 0===b?h:~~b;0>a?(a+=h,0>a&&(a=0)):a>h&&(a=h);0>b?(b+=h,0>b&&(b=0)):b>h&&(b=h);b<a&&(b=a);if(e.TYPED_ARRAY_SUPPORT)return e._augment(this.subarray(a,b));h=b-a;for(var w=new e(h,void 0,!0),y=0;y<h;y++)w[y]=this[y+a];return w};e.prototype.readUInt8=function(a,b){b||t(a,1,this.length);return this[a]};e.prototype.readUInt16LE=
|
||||||
|
function(a,b){b||t(a,2,this.length);return this[a]|this[a+1]<<8};e.prototype.readUInt16BE=function(a,b){b||t(a,2,this.length);return this[a]<<8|this[a+1]};e.prototype.readUInt32LE=function(a,b){b||t(a,4,this.length);return(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]};e.prototype.readUInt32BE=function(a,b){b||t(a,4,this.length);return 16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])};e.prototype.readInt8=function(a,b){b||t(a,1,this.length);return this[a]&128?-1*(255-this[a]+1):this[a]};
|
||||||
|
e.prototype.readInt16LE=function(a,b){b||t(a,2,this.length);var h=this[a]|this[a+1]<<8;return h&32768?h|4294901760:h};e.prototype.readInt16BE=function(a,b){b||t(a,2,this.length);var h=this[a+1]|this[a]<<8;return h&32768?h|4294901760:h};e.prototype.readInt32LE=function(a,b){b||t(a,4,this.length);return this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24};e.prototype.readInt32BE=function(a,b){b||t(a,4,this.length);return this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]};e.prototype.readFloatLE=function(a,
|
||||||
|
b){b||t(a,4,this.length);return v.read(this,a,!0,23,4)};e.prototype.readFloatBE=function(a,b){b||t(a,4,this.length);return v.read(this,a,!1,23,4)};e.prototype.readDoubleLE=function(a,b){b||t(a,8,this.length);return v.read(this,a,!0,52,8)};e.prototype.readDoubleBE=function(a,b){b||t(a,8,this.length);return v.read(this,a,!1,52,8)};e.prototype.writeUInt8=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,1,255,0);e.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));this[b]=a;return b+1};e.prototype.writeUInt16LE=function(a,
|
||||||
|
b,h){a=+a;b>>>=0;h||m(this,a,b,2,65535,0);e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8):f(this,a,b,!0);return b+2};e.prototype.writeUInt16BE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,2,65535,0);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a):f(this,a,b,!1);return b+2};e.prototype.writeUInt32LE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,4,4294967295,0);e.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=a):c(this,a,b,!0);return b+4};e.prototype.writeUInt32BE=function(a,
|
||||||
|
b,h){a=+a;b>>>=0;h||m(this,a,b,4,4294967295,0);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a):c(this,a,b,!1);return b+4};e.prototype.writeInt8=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,1,127,-128);e.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));0>a&&(a=255+a+1);this[b]=a;return b+1};e.prototype.writeInt16LE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,2,32767,-32768);e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8):f(this,a,b,!0);return b+2};e.prototype.writeInt16BE=function(a,
|
||||||
|
b,h){a=+a;b>>>=0;h||m(this,a,b,2,32767,-32768);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a):f(this,a,b,!1);return b+2};e.prototype.writeInt32LE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,4,2147483647,-2147483648);e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):c(this,a,b,!0);return b+4};e.prototype.writeInt32BE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,4,2147483647,-2147483648);0>a&&(a=4294967295+a+1);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+
|
||||||
|
2]=a>>>8,this[b+3]=a):c(this,a,b,!1);return b+4};e.prototype.writeFloatLE=function(a,b,h){return q(this,a,b,!0,h)};e.prototype.writeFloatBE=function(a,b,h){return q(this,a,b,!1,h)};e.prototype.writeDoubleLE=function(a,b,h){return r(this,a,b,!0,h)};e.prototype.writeDoubleBE=function(a,b,h){return r(this,a,b,!1,h)};e.prototype.copy=function(a,b,h,w){h||(h=0);w||0===w||(w=this.length);b||(b=0);if(w!==h&&0!==a.length&&0!==this.length){if(w<h)throw new TypeError("sourceEnd < sourceStart");if(0>b||b>=a.length)throw new TypeError("targetStart out of bounds");
|
||||||
|
if(0>h||h>=this.length)throw new TypeError("sourceStart out of bounds");if(0>w||w>this.length)throw new TypeError("sourceEnd out of bounds");w>this.length&&(w=this.length);a.length-b<w-h&&(w=a.length-b+h);w-=h;if(1E3>w||!e.TYPED_ARRAY_SUPPORT)for(var y=0;y<w;y++)a[y+b]=this[y+h];else a._set(this.subarray(h,h+w),b)}};e.prototype.fill=function(a,b,h){a||(a=0);b||(b=0);h||(h=this.length);if(h<b)throw new TypeError("end < start");if(h!==b&&0!==this.length){if(0>b||b>=this.length)throw new TypeError("start out of bounds");
|
||||||
|
if(0>h||h>this.length)throw new TypeError("end out of bounds");if("number"===typeof a)for(;b<h;b++)this[b]=a;else{a=k(a.toString());for(var w=a.length;b<h;b++)this[b]=a[b%w]}return this}};e.prototype.toArrayBuffer=function(){if("undefined"!==typeof Uint8Array){if(e.TYPED_ARRAY_SUPPORT)return(new e(this)).buffer;for(var a=new Uint8Array(this.length),b=0,h=a.length;b<h;b+=1)a[b]=this[b];return a.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser");};var D=e.prototype;e._augment=
|
||||||
|
function(a){a.constructor=e;a._isBuffer=!0;a._get=a.get;a._set=a.set;a.get=D.get;a.set=D.set;a.write=D.write;a.toString=D.toString;a.toLocaleString=D.toString;a.toJSON=D.toJSON;a.equals=D.equals;a.compare=D.compare;a.copy=D.copy;a.slice=D.slice;a.readUInt8=D.readUInt8;a.readUInt16LE=D.readUInt16LE;a.readUInt16BE=D.readUInt16BE;a.readUInt32LE=D.readUInt32LE;a.readUInt32BE=D.readUInt32BE;a.readInt8=D.readInt8;a.readInt16LE=D.readInt16LE;a.readInt16BE=D.readInt16BE;a.readInt32LE=D.readInt32LE;a.readInt32BE=
|
||||||
|
D.readInt32BE;a.readFloatLE=D.readFloatLE;a.readFloatBE=D.readFloatBE;a.readDoubleLE=D.readDoubleLE;a.readDoubleBE=D.readDoubleBE;a.writeUInt8=D.writeUInt8;a.writeUInt16LE=D.writeUInt16LE;a.writeUInt16BE=D.writeUInt16BE;a.writeUInt32LE=D.writeUInt32LE;a.writeUInt32BE=D.writeUInt32BE;a.writeInt8=D.writeInt8;a.writeInt16LE=D.writeInt16LE;a.writeInt16BE=D.writeInt16BE;a.writeInt32LE=D.writeInt32LE;a.writeInt32BE=D.writeInt32BE;a.writeFloatLE=D.writeFloatLE;a.writeFloatBE=D.writeFloatBE;a.writeDoubleLE=
|
||||||
|
D.writeDoubleLE;a.writeDoubleBE=D.writeDoubleBE;a.fill=D.fill;a.inspect=D.inspect;a.toArrayBuffer=D.toArrayBuffer;return a};var L=/[^+\/0-9A-z]/g},{"base64-js":2,ieee754:6,"is-array":7}],6:[function(C,J,A){A.read=function(e,p,t,m,f){var c=8*f-m-1;var l=(1<<c)-1,q=l>>1,r=-7;f=t?f-1:0;var k=t?-1:1,u=e[p+f];f+=k;t=u&(1<<-r)-1;u>>=-r;for(r+=c;0<r;t=256*t+e[p+f],f+=k,r-=8);c=t&(1<<-r)-1;t>>=-r;for(r+=m;0<r;c=256*c+e[p+f],f+=k,r-=8);if(0===t)t=1-q;else{if(t===l)return c?NaN:Infinity*(u?-1:1);c+=Math.pow(2,
|
||||||
|
m);t-=q}return(u?-1:1)*c*Math.pow(2,t-m)};A.write=function(e,p,t,m,f,c){var l,q=8*c-f-1,r=(1<<q)-1,k=r>>1,u=23===f?Math.pow(2,-24)-Math.pow(2,-77):0;c=m?0:c-1;var d=m?1:-1,g=0>p||0===p&&0>1/p?1:0;p=Math.abs(p);isNaN(p)||Infinity===p?(p=isNaN(p)?1:0,m=r):(m=Math.floor(Math.log(p)/Math.LN2),1>p*(l=Math.pow(2,-m))&&(m--,l*=2),p=1<=m+k?p+u/l:p+u*Math.pow(2,1-k),2<=p*l&&(m++,l/=2),m+k>=r?(p=0,m=r):1<=m+k?(p=(p*l-1)*Math.pow(2,f),m+=k):(p=p*Math.pow(2,k-1)*Math.pow(2,f),m=0));for(;8<=f;e[t+c]=p&255,c+=
|
||||||
|
d,p/=256,f-=8);m=m<<f|p;for(q+=f;0<q;e[t+c]=m&255,c+=d,m/=256,q-=8);e[t+c-d]|=128*g}},{}],7:[function(C,J,A){var e=Object.prototype.toString;J.exports=Array.isArray||function(p){return!!p&&"[object Array]"==e.call(p)}},{}],8:[function(C,J,A){(function(e){function p(c,l){for(var q=0,r=c.length-1;0<=r;r--){var k=c[r];"."===k?c.splice(r,1):".."===k?(c.splice(r,1),q++):q&&(c.splice(r,1),q--)}if(l)for(;q--;q)c.unshift("..");return c}function t(c,l){if(c.filter)return c.filter(l);for(var q=[],r=0;r<c.length;r++)l(c[r],
|
||||||
|
r,c)&&q.push(c[r]);return q}var m=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;A.resolve=function(){for(var c="",l=!1,q=arguments.length-1;-1<=q&&!l;q--){var r=0<=q?arguments[q]:e.cwd();if("string"!==typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(c=r+"/"+c,l="/"===r.charAt(0))}c=p(t(c.split("/"),function(k){return!!k}),!l).join("/");return(l?"/":"")+c||"."};A.normalize=function(c){var l=A.isAbsolute(c),q="/"===f(c,-1);(c=p(t(c.split("/"),function(r){return!!r}),
|
||||||
|
!l).join("/"))||l||(c=".");c&&q&&(c+="/");return(l?"/":"")+c};A.isAbsolute=function(c){return"/"===c.charAt(0)};A.join=function(){var c=Array.prototype.slice.call(arguments,0);return A.normalize(t(c,function(l,q){if("string"!==typeof l)throw new TypeError("Arguments to path.join must be strings");return l}).join("/"))};A.relative=function(c,l){function q(n){for(var v=0;v<n.length&&""===n[v];v++);for(var z=n.length-1;0<=z&&""===n[z];z--);return v>z?[]:n.slice(v,z-v+1)}c=A.resolve(c).substr(1);l=A.resolve(l).substr(1);
|
||||||
|
for(var r=q(c.split("/")),k=q(l.split("/")),u=Math.min(r.length,k.length),d=u,g=0;g<u;g++)if(r[g]!==k[g]){d=g;break}u=[];for(g=d;g<r.length;g++)u.push("..");u=u.concat(k.slice(d));return u.join("/")};A.sep="/";A.delimiter=":";A.dirname=function(c){var l=m.exec(c).slice(1);c=l[0];l=l[1];if(!c&&!l)return".";l&&(l=l.substr(0,l.length-1));return c+l};A.basename=function(c,l){var q=m.exec(c).slice(1)[2];l&&q.substr(-1*l.length)===l&&(q=q.substr(0,q.length-l.length));return q};A.extname=function(c){return m.exec(c).slice(1)[3]};
|
||||||
|
var f="b"==="ab".substr(-1)?function(c,l,q){return c.substr(l,q)}:function(c,l,q){0>l&&(l=c.length+l);return c.substr(l,q)}}).call(this,C("g5I+bs"))},{"g5I+bs":9}],9:[function(C,J,A){function e(){}C=J.exports={};C.nextTick=function(){if("undefined"!==typeof window&&window.setImmediate)return function(t){return window.setImmediate(t)};if("undefined"!==typeof window&&window.postMessage&&window.addEventListener){var p=[];window.addEventListener("message",function(t){var m=t.source;m!==window&&null!==
|
||||||
|
m||"process-tick"!==t.data||(t.stopPropagation(),0<p.length&&p.shift()())},!0);return function(t){p.push(t);window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}();C.title="browser";C.browser=!0;C.env={};C.argv=[];C.on=e;C.addListener=e;C.once=e;C.off=e;C.removeListener=e;C.removeAllListeners=e;C.emit=e;C.binding=function(p){throw Error("process.binding is not supported");};C.cwd=function(){return"/"};C.chdir=function(p){throw Error("process.chdir is not supported");}},{}],
|
||||||
|
10:[function(C,J,A){function e(){this._array=[];this._set=m?new Map:Object.create(null)}var p=C("./util"),t=Object.prototype.hasOwnProperty,m="undefined"!==typeof Map;e.fromArray=function(f,c){for(var l=new e,q=0,r=f.length;q<r;q++)l.add(f[q],c);return l};e.prototype.size=function(){return m?this._set.size:Object.getOwnPropertyNames(this._set).length};e.prototype.add=function(f,c){var l=m?f:p.toSetString(f),q=m?this.has(f):t.call(this._set,l),r=this._array.length;q&&!c||this._array.push(f);q||(m?
|
||||||
|
this._set.set(f,r):this._set[l]=r)};e.prototype.has=function(f){if(m)return this._set.has(f);f=p.toSetString(f);return t.call(this._set,f)};e.prototype.indexOf=function(f){if(m){var c=this._set.get(f);if(0<=c)return c}else if(c=p.toSetString(f),t.call(this._set,c))return this._set[c];throw Error('"'+f+'" is not in the set.');};e.prototype.at=function(f){if(0<=f&&f<this._array.length)return this._array[f];throw Error("No element indexed by "+f);};e.prototype.toArray=function(){return this._array.slice()};
|
||||||
|
A.ArraySet=e},{"./util":19}],11:[function(C,J,A){var e=C("./base64");A.encode=function(p){var t="",m=0>p?(-p<<1)+1:p<<1;do p=m&31,m>>>=5,0<m&&(p|=32),t+=e.encode(p);while(0<m);return t};A.decode=function(p,t,m){var f=p.length,c=0,l=0;do{if(t>=f)throw Error("Expected more digits in base 64 VLQ value.");var q=e.decode(p.charCodeAt(t++));if(-1===q)throw Error("Invalid base64 digit: "+p.charAt(t-1));var r=!!(q&32);q&=31;c+=q<<l;l+=5}while(r);p=c>>1;m.value=1===(c&1)?-p:p;m.rest=t}},{"./base64":12}],12:[function(C,
|
||||||
|
J,A){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");A.encode=function(p){if(0<=p&&p<e.length)return e[p];throw new TypeError("Must be between 0 and 63: "+p);};A.decode=function(p){return 65<=p&&90>=p?p-65:97<=p&&122>=p?p-97+26:48<=p&&57>=p?p-48+52:43==p?62:47==p?63:-1}},{}],13:[function(C,J,A){function e(p,t,m,f,c,l){var q=Math.floor((t-p)/2)+p,r=c(m,f[q],!0);return 0===r?q:0<r?1<t-q?e(q,t,m,f,c,l):l==A.LEAST_UPPER_BOUND?t<f.length?t:-1:q:1<q-p?e(p,q,m,f,c,l):l==
|
||||||
|
A.LEAST_UPPER_BOUND?q:0>p?-1:p}A.GREATEST_LOWER_BOUND=1;A.LEAST_UPPER_BOUND=2;A.search=function(p,t,m,f){if(0===t.length)return-1;p=e(-1,t.length,p,t,m,f||A.GREATEST_LOWER_BOUND);if(0>p)return-1;for(;0<=p-1&&0===m(t[p],t[p-1],!0);)--p;return p}},{}],14:[function(C,J,A){function e(){this._array=[];this._sorted=!0;this._last={generatedLine:-1,generatedColumn:0}}var p=C("./util");e.prototype.unsortedForEach=function(t,m){this._array.forEach(t,m)};e.prototype.add=function(t){var m=this._last,f=m.generatedLine,
|
||||||
|
c=t.generatedLine,l=m.generatedColumn,q=t.generatedColumn;c>f||c==f&&q>=l||0>=p.compareByGeneratedPositionsInflated(m,t)?this._last=t:this._sorted=!1;this._array.push(t)};e.prototype.toArray=function(){this._sorted||(this._array.sort(p.compareByGeneratedPositionsInflated),this._sorted=!0);return this._array};A.MappingList=e},{"./util":19}],15:[function(C,J,A){function e(t,m,f){var c=t[m];t[m]=t[f];t[f]=c}function p(t,m,f,c){if(f<c){var l=f-1;e(t,Math.round(f+Math.random()*(c-f)),c);for(var q=t[c],
|
||||||
|
r=f;r<c;r++)0>=m(t[r],q)&&(l+=1,e(t,l,r));e(t,l+1,r);l+=1;p(t,m,f,l-1);p(t,m,l+1,c)}}A.quickSort=function(t,m){p(t,m,0,t.length-1)}},{}],16:[function(C,J,A){function e(k,u){var d=k;"string"===typeof k&&(d=f.parseSourceMapInput(k));return null!=d.sections?new m(d,u):new p(d,u)}function p(k,u){var d=k;"string"===typeof k&&(d=f.parseSourceMapInput(k));var g=f.getArg(d,"version"),n=f.getArg(d,"sources"),v=f.getArg(d,"names",[]),z=f.getArg(d,"sourceRoot",null),G=f.getArg(d,"sourcesContent",null),D=f.getArg(d,
|
||||||
|
"mappings");d=f.getArg(d,"file",null);if(g!=this._version)throw Error("Unsupported version: "+g);z&&(z=f.normalize(z));n=n.map(String).map(f.normalize).map(function(L){return z&&f.isAbsolute(z)&&f.isAbsolute(L)?f.relative(z,L):L});this._names=l.fromArray(v.map(String),!0);this._sources=l.fromArray(n,!0);this.sourceRoot=z;this.sourcesContent=G;this._mappings=D;this._sourceMapURL=u;this.file=d}function t(){this.generatedColumn=this.generatedLine=0;this.name=this.originalColumn=this.originalLine=this.source=
|
||||||
|
null}function m(k,u){var d=k;"string"===typeof k&&(d=f.parseSourceMapInput(k));var g=f.getArg(d,"version");d=f.getArg(d,"sections");if(g!=this._version)throw Error("Unsupported version: "+g);this._sources=new l;this._names=new l;var n={line:-1,column:0};this._sections=d.map(function(v){if(v.url)throw Error("Support for url field in sections not implemented.");var z=f.getArg(v,"offset"),G=f.getArg(z,"line"),D=f.getArg(z,"column");if(G<n.line||G===n.line&&D<n.column)throw Error("Section offsets must be ordered and non-overlapping.");
|
||||||
|
n=z;return{generatedOffset:{generatedLine:G+1,generatedColumn:D+1},consumer:new e(f.getArg(v,"map"),u)}})}var f=C("./util"),c=C("./binary-search"),l=C("./array-set").ArraySet,q=C("./base64-vlq"),r=C("./quick-sort").quickSort;e.fromSourceMap=function(k){return p.fromSourceMap(k)};e.prototype._version=3;e.prototype.__generatedMappings=null;Object.defineProperty(e.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){this.__generatedMappings||this._parseMappings(this._mappings,
|
||||||
|
this.sourceRoot);return this.__generatedMappings}});e.prototype.__originalMappings=null;Object.defineProperty(e.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot);return this.__originalMappings}});e.prototype._charIsMappingSeparator=function(k,u){var d=k.charAt(u);return";"===d||","===d};e.prototype._parseMappings=function(k,u){throw Error("Subclasses must implement _parseMappings");};e.GENERATED_ORDER=
|
||||||
|
1;e.ORIGINAL_ORDER=2;e.GREATEST_LOWER_BOUND=1;e.LEAST_UPPER_BOUND=2;e.prototype.eachMapping=function(k,u,d){u=u||null;switch(d||e.GENERATED_ORDER){case e.GENERATED_ORDER:d=this._generatedMappings;break;case e.ORIGINAL_ORDER:d=this._originalMappings;break;default:throw Error("Unknown order of iteration.");}var g=this.sourceRoot;d.map(function(n){var v=null===n.source?null:this._sources.at(n.source);v=f.computeSourceURL(g,v,this._sourceMapURL);return{source:v,generatedLine:n.generatedLine,generatedColumn:n.generatedColumn,
|
||||||
|
originalLine:n.originalLine,originalColumn:n.originalColumn,name:null===n.name?null:this._names.at(n.name)}},this).forEach(k,u)};e.prototype.allGeneratedPositionsFor=function(k){var u=f.getArg(k,"line"),d={source:f.getArg(k,"source"),originalLine:u,originalColumn:f.getArg(k,"column",0)};null!=this.sourceRoot&&(d.source=f.relative(this.sourceRoot,d.source));if(!this._sources.has(d.source))return[];d.source=this._sources.indexOf(d.source);var g=[];d=this._findMapping(d,this._originalMappings,"originalLine",
|
||||||
|
"originalColumn",f.compareByOriginalPositions,c.LEAST_UPPER_BOUND);if(0<=d){var n=this._originalMappings[d];if(void 0===k.column)for(u=n.originalLine;n&&n.originalLine===u;)g.push({line:f.getArg(n,"generatedLine",null),column:f.getArg(n,"generatedColumn",null),lastColumn:f.getArg(n,"lastGeneratedColumn",null)}),n=this._originalMappings[++d];else for(k=n.originalColumn;n&&n.originalLine===u&&n.originalColumn==k;)g.push({line:f.getArg(n,"generatedLine",null),column:f.getArg(n,"generatedColumn",null),
|
||||||
|
lastColumn:f.getArg(n,"lastGeneratedColumn",null)}),n=this._originalMappings[++d]}return g};A.SourceMapConsumer=e;p.prototype=Object.create(e.prototype);p.prototype.consumer=e;p.fromSourceMap=function(k,u){var d=Object.create(p.prototype),g=d._names=l.fromArray(k._names.toArray(),!0),n=d._sources=l.fromArray(k._sources.toArray(),!0);d.sourceRoot=k._sourceRoot;d.sourcesContent=k._generateSourcesContent(d._sources.toArray(),d.sourceRoot);d.file=k._file;d._sourceMapURL=u;for(var v=k._mappings.toArray().slice(),
|
||||||
|
z=d.__generatedMappings=[],G=d.__originalMappings=[],D=0,L=v.length;D<L;D++){var a=v[D],b=new t;b.generatedLine=a.generatedLine;b.generatedColumn=a.generatedColumn;a.source&&(b.source=n.indexOf(a.source),b.originalLine=a.originalLine,b.originalColumn=a.originalColumn,a.name&&(b.name=g.indexOf(a.name)),G.push(b));z.push(b)}r(d.__originalMappings,f.compareByOriginalPositions);return d};p.prototype._version=3;Object.defineProperty(p.prototype,"sources",{get:function(){return this._sources.toArray().map(function(k){return f.computeSourceURL(this.sourceRoot,
|
||||||
|
k,this._sourceMapURL)},this)}});p.prototype._parseMappings=function(k,u){for(var d=1,g=0,n=0,v=0,z=0,G=0,D=k.length,L=0,a={},b={},h=[],w=[],y,I,K,N,P;L<D;)if(";"===k.charAt(L))d++,L++,g=0;else if(","===k.charAt(L))L++;else{y=new t;y.generatedLine=d;for(N=L;N<D&&!this._charIsMappingSeparator(k,N);N++);I=k.slice(L,N);if(K=a[I])L+=I.length;else{for(K=[];L<N;)q.decode(k,L,b),P=b.value,L=b.rest,K.push(P);if(2===K.length)throw Error("Found a source, but no line and column");if(3===K.length)throw Error("Found a source and line, but no column");
|
||||||
|
a[I]=K}y.generatedColumn=g+K[0];g=y.generatedColumn;1<K.length&&(y.source=z+K[1],z+=K[1],y.originalLine=n+K[2],n=y.originalLine,y.originalLine+=1,y.originalColumn=v+K[3],v=y.originalColumn,4<K.length&&(y.name=G+K[4],G+=K[4]));w.push(y);"number"===typeof y.originalLine&&h.push(y)}r(w,f.compareByGeneratedPositionsDeflated);this.__generatedMappings=w;r(h,f.compareByOriginalPositions);this.__originalMappings=h};p.prototype._findMapping=function(k,u,d,g,n,v){if(0>=k[d])throw new TypeError("Line must be greater than or equal to 1, got "+
|
||||||
|
k[d]);if(0>k[g])throw new TypeError("Column must be greater than or equal to 0, got "+k[g]);return c.search(k,u,n,v)};p.prototype.computeColumnSpans=function(){for(var k=0;k<this._generatedMappings.length;++k){var u=this._generatedMappings[k];if(k+1<this._generatedMappings.length){var d=this._generatedMappings[k+1];if(u.generatedLine===d.generatedLine){u.lastGeneratedColumn=d.generatedColumn-1;continue}}u.lastGeneratedColumn=Infinity}};p.prototype.originalPositionFor=function(k){var u={generatedLine:f.getArg(k,
|
||||||
|
"line"),generatedColumn:f.getArg(k,"column")};k=this._findMapping(u,this._generatedMappings,"generatedLine","generatedColumn",f.compareByGeneratedPositionsDeflated,f.getArg(k,"bias",e.GREATEST_LOWER_BOUND));if(0<=k&&(k=this._generatedMappings[k],k.generatedLine===u.generatedLine)){u=f.getArg(k,"source",null);null!==u&&(u=this._sources.at(u),u=f.computeSourceURL(this.sourceRoot,u,this._sourceMapURL));var d=f.getArg(k,"name",null);null!==d&&(d=this._names.at(d));return{source:u,line:f.getArg(k,"originalLine",
|
||||||
|
null),column:f.getArg(k,"originalColumn",null),name:d}}return{source:null,line:null,column:null,name:null}};p.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(k){return null==k}):!1};p.prototype.sourceContentFor=function(k,u){if(!this.sourcesContent)return null;var d=k;null!=this.sourceRoot&&(d=f.relative(this.sourceRoot,d));if(this._sources.has(d))return this.sourcesContent[this._sources.indexOf(d)];
|
||||||
|
var g=this.sources,n;for(n=0;n<g.length;++n)if(g[n]==k)return this.sourcesContent[n];var v;if(null!=this.sourceRoot&&(v=f.urlParse(this.sourceRoot))){g=d.replace(/^file:\/\//,"");if("file"==v.scheme&&this._sources.has(g))return this.sourcesContent[this._sources.indexOf(g)];if((!v.path||"/"==v.path)&&this._sources.has("/"+d))return this.sourcesContent[this._sources.indexOf("/"+d)]}if(u)return null;throw Error('"'+d+'" is not in the SourceMap.');};p.prototype.generatedPositionFor=function(k){var u=
|
||||||
|
f.getArg(k,"source");null!=this.sourceRoot&&(u=f.relative(this.sourceRoot,u));if(!this._sources.has(u))return{line:null,column:null,lastColumn:null};u=this._sources.indexOf(u);u={source:u,originalLine:f.getArg(k,"line"),originalColumn:f.getArg(k,"column")};k=this._findMapping(u,this._originalMappings,"originalLine","originalColumn",f.compareByOriginalPositions,f.getArg(k,"bias",e.GREATEST_LOWER_BOUND));return 0<=k&&(k=this._originalMappings[k],k.source===u.source)?{line:f.getArg(k,"generatedLine",
|
||||||
|
null),column:f.getArg(k,"generatedColumn",null),lastColumn:f.getArg(k,"lastGeneratedColumn",null)}:{line:null,column:null,lastColumn:null}};A.BasicSourceMapConsumer=p;m.prototype=Object.create(e.prototype);m.prototype.constructor=e;m.prototype._version=3;Object.defineProperty(m.prototype,"sources",{get:function(){for(var k=[],u=0;u<this._sections.length;u++)for(var d=0;d<this._sections[u].consumer.sources.length;d++)k.push(this._sections[u].consumer.sources[d]);return k}});m.prototype.originalPositionFor=
|
||||||
|
function(k){var u={generatedLine:f.getArg(k,"line"),generatedColumn:f.getArg(k,"column")},d=c.search(u,this._sections,function(g,n){var v=g.generatedLine-n.generatedOffset.generatedLine;return v?v:g.generatedColumn-n.generatedOffset.generatedColumn});return(d=this._sections[d])?d.consumer.originalPositionFor({line:u.generatedLine-(d.generatedOffset.generatedLine-1),column:u.generatedColumn-(d.generatedOffset.generatedLine===u.generatedLine?d.generatedOffset.generatedColumn-1:0),bias:k.bias}):{source:null,
|
||||||
|
line:null,column:null,name:null}};m.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(k){return k.consumer.hasContentsOfAllSources()})};m.prototype.sourceContentFor=function(k,u){for(var d=0;d<this._sections.length;d++){var g=this._sections[d].consumer.sourceContentFor(k,!0);if(g)return g}if(u)return null;throw Error('"'+k+'" is not in the SourceMap.');};m.prototype.generatedPositionFor=function(k){for(var u=0;u<this._sections.length;u++){var d=this._sections[u];if(-1!==
|
||||||
|
d.consumer.sources.indexOf(f.getArg(k,"source"))){var g=d.consumer.generatedPositionFor(k);if(g)return{line:g.line+(d.generatedOffset.generatedLine-1),column:g.column+(d.generatedOffset.generatedLine===g.line?d.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}};m.prototype._parseMappings=function(k,u){this.__generatedMappings=[];this.__originalMappings=[];for(var d=0;d<this._sections.length;d++)for(var g=this._sections[d],n=g.consumer._generatedMappings,v=0;v<n.length;v++){var z=
|
||||||
|
n[v],G=g.consumer._sources.at(z.source);G=f.computeSourceURL(g.consumer.sourceRoot,G,this._sourceMapURL);this._sources.add(G);G=this._sources.indexOf(G);var D=null;z.name&&(D=g.consumer._names.at(z.name),this._names.add(D),D=this._names.indexOf(D));z={source:G,generatedLine:z.generatedLine+(g.generatedOffset.generatedLine-1),generatedColumn:z.generatedColumn+(g.generatedOffset.generatedLine===z.generatedLine?g.generatedOffset.generatedColumn-1:0),originalLine:z.originalLine,originalColumn:z.originalColumn,
|
||||||
|
name:D};this.__generatedMappings.push(z);"number"===typeof z.originalLine&&this.__originalMappings.push(z)}r(this.__generatedMappings,f.compareByGeneratedPositionsDeflated);r(this.__originalMappings,f.compareByOriginalPositions)};A.IndexedSourceMapConsumer=m},{"./array-set":10,"./base64-vlq":11,"./binary-search":13,"./quick-sort":15,"./util":19}],17:[function(C,J,A){function e(c){c||(c={});this._file=t.getArg(c,"file",null);this._sourceRoot=t.getArg(c,"sourceRoot",null);this._skipValidation=t.getArg(c,
|
||||||
|
"skipValidation",!1);this._sources=new m;this._names=new m;this._mappings=new f;this._sourcesContents=null}var p=C("./base64-vlq"),t=C("./util"),m=C("./array-set").ArraySet,f=C("./mapping-list").MappingList;e.prototype._version=3;e.fromSourceMap=function(c){var l=c.sourceRoot,q=new e({file:c.file,sourceRoot:l});c.eachMapping(function(r){var k={generated:{line:r.generatedLine,column:r.generatedColumn}};null!=r.source&&(k.source=r.source,null!=l&&(k.source=t.relative(l,k.source)),k.original={line:r.originalLine,
|
||||||
|
column:r.originalColumn},null!=r.name&&(k.name=r.name));q.addMapping(k)});c.sources.forEach(function(r){var k=r;null!==l&&(k=t.relative(l,r));q._sources.has(k)||q._sources.add(k);k=c.sourceContentFor(r);null!=k&&q.setSourceContent(r,k)});return q};e.prototype.addMapping=function(c){var l=t.getArg(c,"generated"),q=t.getArg(c,"original",null),r=t.getArg(c,"source",null);c=t.getArg(c,"name",null);this._skipValidation||this._validateMapping(l,q,r,c);null!=r&&(r=String(r),this._sources.has(r)||this._sources.add(r));
|
||||||
|
null!=c&&(c=String(c),this._names.has(c)||this._names.add(c));this._mappings.add({generatedLine:l.line,generatedColumn:l.column,originalLine:null!=q&&q.line,originalColumn:null!=q&&q.column,source:r,name:c})};e.prototype.setSourceContent=function(c,l){var q=c;null!=this._sourceRoot&&(q=t.relative(this._sourceRoot,q));null!=l?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[t.toSetString(q)]=l):this._sourcesContents&&(delete this._sourcesContents[t.toSetString(q)],
|
||||||
|
0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))};e.prototype.applySourceMap=function(c,l,q){var r=l;if(null==l){if(null==c.file)throw Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');r=c.file}var k=this._sourceRoot;null!=k&&(r=t.relative(k,r));var u=new m,d=new m;this._mappings.unsortedForEach(function(g){if(g.source===r&&null!=g.originalLine){var n=c.originalPositionFor({line:g.originalLine,
|
||||||
|
column:g.originalColumn});null!=n.source&&(g.source=n.source,null!=q&&(g.source=t.join(q,g.source)),null!=k&&(g.source=t.relative(k,g.source)),g.originalLine=n.line,g.originalColumn=n.column,null!=n.name&&(g.name=n.name))}n=g.source;null==n||u.has(n)||u.add(n);g=g.name;null==g||d.has(g)||d.add(g)},this);this._sources=u;this._names=d;c.sources.forEach(function(g){var n=c.sourceContentFor(g);null!=n&&(null!=q&&(g=t.join(q,g)),null!=k&&(g=t.relative(k,g)),this.setSourceContent(g,n))},this)};e.prototype._validateMapping=
|
||||||
|
function(c,l,q,r){if(l&&"number"!==typeof l.line&&"number"!==typeof l.column)throw Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(c&&"line"in c&&"column"in c&&0<c.line&&0<=c.column&&!l&&!q&&!r||c&&"line"in c&&"column"in c&&l&&"line"in l&&"column"in l&&0<c.line&&0<=c.column&&0<l.line&&0<=l.column&&
|
||||||
|
q))throw Error("Invalid mapping: "+JSON.stringify({generated:c,source:q,original:l,name:r}));};e.prototype._serializeMappings=function(){for(var c=0,l=1,q=0,r=0,k=0,u=0,d="",g,n,v,z=this._mappings.toArray(),G=0,D=z.length;G<D;G++){n=z[G];g="";if(n.generatedLine!==l)for(c=0;n.generatedLine!==l;)g+=";",l++;else if(0<G){if(!t.compareByGeneratedPositionsInflated(n,z[G-1]))continue;g+=","}g+=p.encode(n.generatedColumn-c);c=n.generatedColumn;null!=n.source&&(v=this._sources.indexOf(n.source),g+=p.encode(v-
|
||||||
|
u),u=v,g+=p.encode(n.originalLine-1-r),r=n.originalLine-1,g+=p.encode(n.originalColumn-q),q=n.originalColumn,null!=n.name&&(n=this._names.indexOf(n.name),g+=p.encode(n-k),k=n));d+=g}return d};e.prototype._generateSourcesContent=function(c,l){return c.map(function(q){if(!this._sourcesContents)return null;null!=l&&(q=t.relative(l,q));q=t.toSetString(q);return Object.prototype.hasOwnProperty.call(this._sourcesContents,q)?this._sourcesContents[q]:null},this)};e.prototype.toJSON=function(){var c={version:this._version,
|
||||||
|
sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};null!=this._file&&(c.file=this._file);null!=this._sourceRoot&&(c.sourceRoot=this._sourceRoot);this._sourcesContents&&(c.sourcesContent=this._generateSourcesContent(c.sources,c.sourceRoot));return c};e.prototype.toString=function(){return JSON.stringify(this.toJSON())};A.SourceMapGenerator=e},{"./array-set":10,"./base64-vlq":11,"./mapping-list":14,"./util":19}],18:[function(C,J,A){function e(f,c,l,q,r){this.children=
|
||||||
|
[];this.sourceContents={};this.line=null==f?null:f;this.column=null==c?null:c;this.source=null==l?null:l;this.name=null==r?null:r;this.$$$isSourceNode$$$=!0;null!=q&&this.add(q)}var p=C("./source-map-generator").SourceMapGenerator,t=C("./util"),m=/(\r?\n)/;e.fromStringWithSourceMap=function(f,c,l){function q(z,G){if(null===z||void 0===z.source)r.add(G);else{var D=l?t.join(l,z.source):z.source;r.add(new e(z.originalLine,z.originalColumn,D,G,z.name))}}var r=new e,k=f.split(m),u=0,d=function(){var z=
|
||||||
|
u<k.length?k[u++]:void 0,G=(u<k.length?k[u++]:void 0)||"";return z+G},g=1,n=0,v=null;c.eachMapping(function(z){if(null!==v)if(g<z.generatedLine)q(v,d()),g++,n=0;else{var G=k[u]||"",D=G.substr(0,z.generatedColumn-n);k[u]=G.substr(z.generatedColumn-n);n=z.generatedColumn;q(v,D);v=z;return}for(;g<z.generatedLine;)r.add(d()),g++;n<z.generatedColumn&&(G=k[u]||"",r.add(G.substr(0,z.generatedColumn)),k[u]=G.substr(z.generatedColumn),n=z.generatedColumn);v=z},this);u<k.length&&(v&&q(v,d()),r.add(k.splice(u).join("")));
|
||||||
|
c.sources.forEach(function(z){var G=c.sourceContentFor(z);null!=G&&(null!=l&&(z=t.join(l,z)),r.setSourceContent(z,G))});return r};e.prototype.add=function(f){if(Array.isArray(f))f.forEach(function(c){this.add(c)},this);else if(f.$$$isSourceNode$$$||"string"===typeof f)f&&this.children.push(f);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+f);return this};e.prototype.prepend=function(f){if(Array.isArray(f))for(var c=f.length-1;0<=c;c--)this.prepend(f[c]);
|
||||||
|
else if(f.$$$isSourceNode$$$||"string"===typeof f)this.children.unshift(f);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+f);return this};e.prototype.walk=function(f){for(var c,l=0,q=this.children.length;l<q;l++)c=this.children[l],c.$$$isSourceNode$$$?c.walk(f):""!==c&&f(c,{source:this.source,line:this.line,column:this.column,name:this.name})};e.prototype.join=function(f){var c,l=this.children.length;if(0<l){var q=[];for(c=0;c<l-1;c++)q.push(this.children[c]),
|
||||||
|
q.push(f);q.push(this.children[c]);this.children=q}return this};e.prototype.replaceRight=function(f,c){var l=this.children[this.children.length-1];l.$$$isSourceNode$$$?l.replaceRight(f,c):"string"===typeof l?this.children[this.children.length-1]=l.replace(f,c):this.children.push("".replace(f,c));return this};e.prototype.setSourceContent=function(f,c){this.sourceContents[t.toSetString(f)]=c};e.prototype.walkSourceContents=function(f){for(var c=0,l=this.children.length;c<l;c++)this.children[c].$$$isSourceNode$$$&&
|
||||||
|
this.children[c].walkSourceContents(f);var q=Object.keys(this.sourceContents);c=0;for(l=q.length;c<l;c++)f(t.fromSetString(q[c]),this.sourceContents[q[c]])};e.prototype.toString=function(){var f="";this.walk(function(c){f+=c});return f};e.prototype.toStringWithSourceMap=function(f){var c="",l=1,q=0,r=new p(f),k=!1,u=null,d=null,g=null,n=null;this.walk(function(v,z){c+=v;null!==z.source&&null!==z.line&&null!==z.column?(u===z.source&&d===z.line&&g===z.column&&n===z.name||r.addMapping({source:z.source,
|
||||||
|
original:{line:z.line,column:z.column},generated:{line:l,column:q},name:z.name}),u=z.source,d=z.line,g=z.column,n=z.name,k=!0):k&&(r.addMapping({generated:{line:l,column:q}}),u=null,k=!1);for(var G=0,D=v.length;G<D;G++)10===v.charCodeAt(G)?(l++,q=0,G+1===D?(u=null,k=!1):k&&r.addMapping({source:z.source,original:{line:z.line,column:z.column},generated:{line:l,column:q},name:z.name})):q++});this.walkSourceContents(function(v,z){r.setSourceContent(v,z)});return{code:c,map:r}};A.SourceNode=e},{"./source-map-generator":17,
|
||||||
|
"./util":19}],19:[function(C,J,A){function e(d){return(d=d.match(k))?{scheme:d[1],auth:d[2],host:d[3],port:d[4],path:d[5]}:null}function p(d){var g="";d.scheme&&(g+=d.scheme+":");g+="//";d.auth&&(g+=d.auth+"@");d.host&&(g+=d.host);d.port&&(g+=":"+d.port);d.path&&(g+=d.path);return g}function t(d){var g=d,n=e(d);if(n){if(!n.path)return d;g=n.path}d=A.isAbsolute(g);g=g.split(/\/+/);for(var v,z=0,G=g.length-1;0<=G;G--)v=g[G],"."===v?g.splice(G,1):".."===v?z++:0<z&&(""===v?(g.splice(G+1,z),z=0):(g.splice(G,
|
||||||
|
2),z--));g=g.join("/");""===g&&(g=d?"/":".");return n?(n.path=g,p(n)):g}function m(d,g){""===d&&(d=".");""===g&&(g=".");var n=e(g),v=e(d);v&&(d=v.path||"/");if(n&&!n.scheme)return v&&(n.scheme=v.scheme),p(n);if(n||g.match(u))return g;if(v&&!v.host&&!v.path)return v.host=g,p(v);n="/"===g.charAt(0)?g:t(d.replace(/\/+$/,"")+"/"+g);return v?(v.path=n,p(v)):n}function f(d){return d}function c(d){return q(d)?"$"+d:d}function l(d){return q(d)?d.slice(1):d}function q(d){if(!d)return!1;var g=d.length;if(9>
|
||||||
|
g||95!==d.charCodeAt(g-1)||95!==d.charCodeAt(g-2)||111!==d.charCodeAt(g-3)||116!==d.charCodeAt(g-4)||111!==d.charCodeAt(g-5)||114!==d.charCodeAt(g-6)||112!==d.charCodeAt(g-7)||95!==d.charCodeAt(g-8)||95!==d.charCodeAt(g-9))return!1;for(g-=10;0<=g;g--)if(36!==d.charCodeAt(g))return!1;return!0}function r(d,g){return d===g?0:null===d?1:null===g?-1:d>g?1:-1}A.getArg=function(d,g,n){if(g in d)return d[g];if(3===arguments.length)return n;throw Error('"'+g+'" is a required argument.');};var k=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,
|
||||||
|
u=/^data:.+,.+$/;A.urlParse=e;A.urlGenerate=p;A.normalize=t;A.join=m;A.isAbsolute=function(d){return"/"===d.charAt(0)||k.test(d)};A.relative=function(d,g){""===d&&(d=".");d=d.replace(/\/$/,"");for(var n=0;0!==g.indexOf(d+"/");){var v=d.lastIndexOf("/");if(0>v)return g;d=d.slice(0,v);if(d.match(/^([^\/]+:\/)?\/*$/))return g;++n}return Array(n+1).join("../")+g.substr(d.length+1)};C=!("__proto__"in Object.create(null));A.toSetString=C?f:c;A.fromSetString=C?f:l;A.compareByOriginalPositions=function(d,
|
||||||
|
g,n){var v=r(d.source,g.source);if(0!==v)return v;v=d.originalLine-g.originalLine;if(0!==v)return v;v=d.originalColumn-g.originalColumn;if(0!==v||n)return v;v=d.generatedColumn-g.generatedColumn;if(0!==v)return v;v=d.generatedLine-g.generatedLine;return 0!==v?v:r(d.name,g.name)};A.compareByGeneratedPositionsDeflated=function(d,g,n){var v=d.generatedLine-g.generatedLine;if(0!==v)return v;v=d.generatedColumn-g.generatedColumn;if(0!==v||n)return v;v=r(d.source,g.source);if(0!==v)return v;v=d.originalLine-
|
||||||
|
g.originalLine;if(0!==v)return v;v=d.originalColumn-g.originalColumn;return 0!==v?v:r(d.name,g.name)};A.compareByGeneratedPositionsInflated=function(d,g){var n=d.generatedLine-g.generatedLine;if(0!==n)return n;n=d.generatedColumn-g.generatedColumn;if(0!==n)return n;n=r(d.source,g.source);if(0!==n)return n;n=d.originalLine-g.originalLine;if(0!==n)return n;n=d.originalColumn-g.originalColumn;return 0!==n?n:r(d.name,g.name)};A.parseSourceMapInput=function(d){return JSON.parse(d.replace(/^\)]}'[^\n]*\n/,
|
||||||
|
""))};A.computeSourceURL=function(d,g,n){g=g||"";d&&("/"!==d[d.length-1]&&"/"!==g[0]&&(d+="/"),g=d+g);if(n){d=e(n);if(!d)throw Error("sourceMapURL could not be parsed");d.path&&(n=d.path.lastIndexOf("/"),0<=n&&(d.path=d.path.substring(0,n+1)));g=m(p(d),g)}return t(g)}},{}],20:[function(C,J,A){A.SourceMapGenerator=C("./lib/source-map-generator").SourceMapGenerator;A.SourceMapConsumer=C("./lib/source-map-consumer").SourceMapConsumer;A.SourceNode=C("./lib/source-node").SourceNode},{"./lib/source-map-consumer":16,
|
||||||
|
"./lib/source-map-generator":17,"./lib/source-node":18}],21:[function(C,J,A){(function(e){function p(){return"browser"===a?!0:"node"===a?!1:"undefined"!==typeof window&&"function"===typeof XMLHttpRequest&&!(window.require&&window.module&&window.process&&"renderer"===window.process.type)}function t(x){return function(B){for(var F=0;F<x.length;F++){var E=x[F](B);if(E)return E}return null}}function m(x,B){if(!x)return B;var F=n.dirname(x),E=/^\w+:\/\/[^\/]*/.exec(F);E=E?E[0]:"";var H=F.slice(E.length);
|
||||||
|
return E&&/^\/\w:/.test(H)?(E+="/",E+n.resolve(F.slice(E.length),B).replace(/\\/g,"/")):E+n.resolve(F.slice(E.length),B)}function f(x){var B=h[x.source];if(!B){var F=N(x.source);F?(B=h[x.source]={url:F.url,map:new g(F.map)},B.map.sourcesContent&&B.map.sources.forEach(function(E,H){var M=B.map.sourcesContent[H];if(M){var S=m(B.url,E);b[S]=M}})):B=h[x.source]={url:null,map:null}}return B&&B.map&&"function"===typeof B.map.originalPositionFor&&(F=B.map.originalPositionFor(x),null!==F.source)?(F.source=
|
||||||
|
m(B.url,F.source),F):x}function c(x){var B=/^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(x);return B?(x=f({source:B[2],line:+B[3],column:B[4]-1}),"eval at "+B[1]+" ("+x.source+":"+x.line+":"+(x.column+1)+")"):(B=/^eval at ([^(]+) \((.+)\)$/.exec(x))?"eval at "+B[1]+" ("+c(B[2])+")":x}function l(){var x="";if(this.isNative())x="native";else{var B=this.getScriptNameOrSourceURL();!B&&this.isEval()&&(x=this.getEvalOrigin(),x+=", ");x=B?x+B:x+"<anonymous>";B=this.getLineNumber();null!=B&&(x+=":"+B,(B=
|
||||||
|
this.getColumnNumber())&&(x+=":"+B))}B="";var F=this.getFunctionName(),E=!0,H=this.isConstructor();if(this.isToplevel()||H)H?B+="new "+(F||"<anonymous>"):F?B+=F:(B+=x,E=!1);else{H=this.getTypeName();"[object Object]"===H&&(H="null");var M=this.getMethodName();F?(H&&0!=F.indexOf(H)&&(B+=H+"."),B+=F,M&&F.indexOf("."+M)!=F.length-M.length-1&&(B+=" [as "+M+"]")):B+=H+"."+(M||"<anonymous>")}E&&(B+=" ("+x+")");return B}function q(x){var B={};Object.getOwnPropertyNames(Object.getPrototypeOf(x)).forEach(function(F){B[F]=
|
||||||
|
/^(?:is|get)/.test(F)?function(){return x[F].call(x)}:x[F]});B.toString=l;return B}function r(x,B){void 0===B&&(B={nextPosition:null,curPosition:null});if(x.isNative())return B.curPosition=null,x;var F=x.getFileName()||x.getScriptNameOrSourceURL();if(F){var E=x.getLineNumber(),H=x.getColumnNumber()-1,M=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,S=M.test;var V="object"===typeof e&&null!==e?e.version:"";M=S.call(M,V)?0:62;1===E&&H>M&&!p()&&!x.isEval()&&(H-=M);var O=
|
||||||
|
f({source:F,line:E,column:H});B.curPosition=O;x=q(x);var T=x.getFunctionName;x.getFunctionName=function(){return null==B.nextPosition?T():B.nextPosition.name||T()};x.getFileName=function(){return O.source};x.getLineNumber=function(){return O.line};x.getColumnNumber=function(){return O.column+1};x.getScriptNameOrSourceURL=function(){return O.source};return x}var Q=x.isEval()&&x.getEvalOrigin();Q&&(Q=c(Q),x=q(x),x.getEvalOrigin=function(){return Q});return x}function k(x,B){L&&(b={},h={});for(var F=
|
||||||
|
(x.name||"Error")+": "+(x.message||""),E={nextPosition:null,curPosition:null},H=[],M=B.length-1;0<=M;M--)H.push("\n at "+r(B[M],E)),E.nextPosition=E.curPosition;E.curPosition=E.nextPosition=null;return F+H.reverse().join("")}function u(x){var B=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(x.stack);if(B){x=B[1];var F=+B[2];B=+B[3];var E=b[x];if(!E&&v&&v.existsSync(x))try{E=v.readFileSync(x,"utf8")}catch(H){E=""}if(E&&(E=E.split(/(?:\r\n|\r|\n)/)[F-1]))return x+":"+F+"\n"+E+"\n"+Array(B).join(" ")+
|
||||||
|
"^"}return null}function d(){var x=e.emit;e.emit=function(B){if("uncaughtException"===B){var F=arguments[1]&&arguments[1].stack,E=0<this.listeners(B).length;if(F&&!E){F=arguments[1];E=u(F);var H="object"===typeof e&&null!==e?e.stderr:void 0;H&&H._handle&&H._handle.setBlocking&&H._handle.setBlocking(!0);E&&(console.error(),console.error(E));console.error(F.stack);"object"===typeof e&&null!==e&&"function"===typeof e.exit&&e.exit(1);return}}return x.apply(this,arguments)}}var g=C("source-map").SourceMapConsumer,
|
||||||
|
n=C("path");try{var v=C("fs");v.existsSync&&v.readFileSync||(v=null)}catch(x){}var z=C("buffer-from"),G=!1,D=!1,L=!1,a="auto",b={},h={},w=/^data:application\/json[^,]+base64,/,y=[],I=[],K=t(y);y.push(function(x){x=x.trim();/^file:/.test(x)&&(x=x.replace(/file:\/\/\/(\w:)?/,function(E,H){return H?"":"/"}));if(x in b)return b[x];var B="";try{if(v)v.existsSync(x)&&(B=v.readFileSync(x,"utf8"));else{var F=new XMLHttpRequest;F.open("GET",x,!1);F.send(null);4===F.readyState&&200===F.status&&(B=F.responseText)}}catch(E){}return b[x]=
|
||||||
|
B});var N=t(I);I.push(function(x){a:{if(p())try{var B=new XMLHttpRequest;B.open("GET",x,!1);B.send(null);var F=B.getResponseHeader("SourceMap")||B.getResponseHeader("X-SourceMap");if(F){var E=F;break a}}catch(M){}E=K(x);B=/(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg;for(var H;F=B.exec(E);)H=F;E=H?H[1]:null}if(!E)return null;w.test(E)?(H=E.slice(E.indexOf(",")+1),H=z(H,"base64").toString(),E=x):(E=m(x,E),H=K(E));return H?{url:E,
|
||||||
|
map:H}:null});var P=y.slice(0),W=I.slice(0);A.wrapCallSite=r;A.getErrorSource=u;A.mapSourcePosition=f;A.retrieveSourceMap=N;A.install=function(x){x=x||{};if(x.environment&&(a=x.environment,-1===["node","browser","auto"].indexOf(a)))throw Error("environment "+a+" was unknown. Available options are {auto, browser, node}");x.retrieveFile&&(x.overrideRetrieveFile&&(y.length=0),y.unshift(x.retrieveFile));x.retrieveSourceMap&&(x.overrideRetrieveSourceMap&&(I.length=0),I.unshift(x.retrieveSourceMap));if(x.hookRequire&&
|
||||||
|
!p()){var B=J.require("module"),F=B.prototype._compile;F.__sourceMapSupport||(B.prototype._compile=function(E,H){b[H]=E;h[H]=void 0;return F.call(this,E,H)},B.prototype._compile.__sourceMapSupport=!0)}L||(L="emptyCacheBetweenOperations"in x?x.emptyCacheBetweenOperations:!1);G||(G=!0,Error.prepareStackTrace=k);if(!D){x="handleUncaughtExceptions"in x?x.handleUncaughtExceptions:!0;try{!1===J.require("worker_threads").isMainThread&&(x=!1)}catch(E){}x&&"object"===typeof e&&null!==e&&"function"===typeof e.on&&
|
||||||
|
(D=!0,d())}};A.resetRetrieveHandlers=function(){y.length=0;I.length=0;y=P.slice(0);I=W.slice(0);N=t(I);K=t(y)}}).call(this,C("g5I+bs"))},{"buffer-from":4,fs:3,"g5I+bs":9,path:8,"source-map":20}]},{},[1]);return R});
|
||||||
50
apps/did-wallet/node_modules/@cspotcode/source-map-support/package.json
generated
vendored
Normal file
50
apps/did-wallet/node_modules/@cspotcode/source-map-support/package.json
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"name": "@cspotcode/source-map-support",
|
||||||
|
"description": "Fixes stack traces for files with source maps",
|
||||||
|
"version": "0.8.1",
|
||||||
|
"main": "./source-map-support.js",
|
||||||
|
"types": "./source-map-support.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"build": "node build.js",
|
||||||
|
"serve-tests": "http-server -p 1336",
|
||||||
|
"test": "mocha"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"/register.d.ts",
|
||||||
|
"/register.js",
|
||||||
|
"/register-hook-require.d.ts",
|
||||||
|
"/register-hook-require.js",
|
||||||
|
"/source-map-support.d.ts",
|
||||||
|
"/source-map-support.js",
|
||||||
|
"/browser-source-map-support.js"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"@jridgewell/trace-mapping": "0.3.9"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/lodash": "^4.14.182",
|
||||||
|
"browserify": "^4.2.3",
|
||||||
|
"coffeescript": "^1.12.7",
|
||||||
|
"http-server": "^0.11.1",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"mocha": "^3.5.3",
|
||||||
|
"semver": "^7.3.7",
|
||||||
|
"source-map": "0.6.1",
|
||||||
|
"webpack": "^1.15.0"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/cspotcode/node-source-map-support"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/cspotcode/node-source-map-support/issues"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"volta": {
|
||||||
|
"node": "16.11.0",
|
||||||
|
"npm": "7.24.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
7
apps/did-wallet/node_modules/@cspotcode/source-map-support/register-hook-require.d.ts
generated
vendored
Executable file
7
apps/did-wallet/node_modules/@cspotcode/source-map-support/register-hook-require.d.ts
generated
vendored
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
// tslint:disable:no-useless-files
|
||||||
|
|
||||||
|
// For following usage:
|
||||||
|
// import '@cspotcode/source-map-support/register-hook-require'
|
||||||
|
// Instead of:
|
||||||
|
// import sourceMapSupport from '@cspotcode/source-map-support'
|
||||||
|
// sourceMapSupport.install({hookRequire: true})
|
||||||
3
apps/did-wallet/node_modules/@cspotcode/source-map-support/register-hook-require.js
generated
vendored
Normal file
3
apps/did-wallet/node_modules/@cspotcode/source-map-support/register-hook-require.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
require('./').install({
|
||||||
|
hookRequire: true
|
||||||
|
});
|
||||||
7
apps/did-wallet/node_modules/@cspotcode/source-map-support/register.d.ts
generated
vendored
Executable file
7
apps/did-wallet/node_modules/@cspotcode/source-map-support/register.d.ts
generated
vendored
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
// tslint:disable:no-useless-files
|
||||||
|
|
||||||
|
// For following usage:
|
||||||
|
// import '@cspotcode/source-map-support/register'
|
||||||
|
// Instead of:
|
||||||
|
// import sourceMapSupport from '@cspotcode/source-map-support'
|
||||||
|
// sourceMapSupport.install()
|
||||||
1
apps/did-wallet/node_modules/@cspotcode/source-map-support/register.js
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@cspotcode/source-map-support/register.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
require('./').install();
|
||||||
76
apps/did-wallet/node_modules/@cspotcode/source-map-support/source-map-support.d.ts
generated
vendored
Executable file
76
apps/did-wallet/node_modules/@cspotcode/source-map-support/source-map-support.d.ts
generated
vendored
Executable file
@ -0,0 +1,76 @@
|
|||||||
|
// Type definitions for source-map-support 0.5
|
||||||
|
// Project: https://github.com/evanw/node-source-map-support
|
||||||
|
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||||
|
// Jason Cheatham <https://github.com/jason0x43>
|
||||||
|
// Alcedo Nathaniel De Guzman Jr <https://github.com/natealcedo>
|
||||||
|
// Griffin Yourick <https://github.com/tough-griff>
|
||||||
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||||
|
|
||||||
|
export interface RawSourceMap {
|
||||||
|
version: 3;
|
||||||
|
sources: string[];
|
||||||
|
names: string[];
|
||||||
|
sourceRoot?: string;
|
||||||
|
sourcesContent?: string[];
|
||||||
|
mappings: string;
|
||||||
|
file: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output of retrieveSourceMap().
|
||||||
|
* From source-map-support:
|
||||||
|
* The map field may be either a string or the parsed JSON object (i.e.,
|
||||||
|
* it must be a valid argument to the SourceMapConsumer constructor).
|
||||||
|
*/
|
||||||
|
export interface UrlAndMap {
|
||||||
|
url: string;
|
||||||
|
map: string | RawSourceMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options to install().
|
||||||
|
*/
|
||||||
|
export interface Options {
|
||||||
|
handleUncaughtExceptions?: boolean | undefined;
|
||||||
|
hookRequire?: boolean | undefined;
|
||||||
|
emptyCacheBetweenOperations?: boolean | undefined;
|
||||||
|
environment?: 'auto' | 'browser' | 'node' | undefined;
|
||||||
|
overrideRetrieveFile?: boolean | undefined;
|
||||||
|
overrideRetrieveSourceMap?: boolean | undefined;
|
||||||
|
retrieveFile?(path: string): string;
|
||||||
|
retrieveSourceMap?(source: string): UrlAndMap | null;
|
||||||
|
/**
|
||||||
|
* Set false to disable redirection of require / import `source-map-support` to `@cspotcode/source-map-support`
|
||||||
|
*/
|
||||||
|
redirectConflictingLibrary?: boolean;
|
||||||
|
/**
|
||||||
|
* Callback will be called every time we redirect due to `redirectConflictingLibrary`
|
||||||
|
* This allows consumers to log helpful warnings if they choose.
|
||||||
|
* @param parent NodeJS.Module which made the require() or require.resolve() call
|
||||||
|
* @param options options object internally passed to node's `_resolveFilename` hook
|
||||||
|
*/
|
||||||
|
onConflictingLibraryRedirect?: (request: string, parent: any, isMain: boolean, options: any, redirectedRequest: string) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Position {
|
||||||
|
source: string;
|
||||||
|
line: number;
|
||||||
|
column: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function wrapCallSite(frame: any /* StackFrame */): any /* StackFrame */;
|
||||||
|
export function getErrorSource(error: Error): string | null;
|
||||||
|
export function mapSourcePosition(position: Position): Position;
|
||||||
|
export function retrieveSourceMap(source: string): UrlAndMap | null;
|
||||||
|
export function resetRetrieveHandlers(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install SourceMap support.
|
||||||
|
* @param options Can be used to e.g. disable uncaughtException handler.
|
||||||
|
*/
|
||||||
|
export function install(options?: Options): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uninstall SourceMap support.
|
||||||
|
*/
|
||||||
|
export function uninstall(): void;
|
||||||
938
apps/did-wallet/node_modules/@cspotcode/source-map-support/source-map-support.js
generated
vendored
Normal file
938
apps/did-wallet/node_modules/@cspotcode/source-map-support/source-map-support.js
generated
vendored
Normal file
@ -0,0 +1,938 @@
|
|||||||
|
const { TraceMap, originalPositionFor, AnyMap } = require('@jridgewell/trace-mapping');
|
||||||
|
var path = require('path');
|
||||||
|
const { fileURLToPath, pathToFileURL } = require('url');
|
||||||
|
var util = require('util');
|
||||||
|
|
||||||
|
var fs;
|
||||||
|
try {
|
||||||
|
fs = require('fs');
|
||||||
|
if (!fs.existsSync || !fs.readFileSync) {
|
||||||
|
// fs doesn't have all methods we need
|
||||||
|
fs = null;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
/* nop */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requires a module which is protected against bundler minification.
|
||||||
|
*
|
||||||
|
* @param {NodeModule} mod
|
||||||
|
* @param {string} request
|
||||||
|
*/
|
||||||
|
function dynamicRequire(mod, request) {
|
||||||
|
return mod.require(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {{
|
||||||
|
* enabled: boolean;
|
||||||
|
* originalValue: any;
|
||||||
|
* installedValue: any;
|
||||||
|
* }} HookState
|
||||||
|
* Used for installing and uninstalling hooks
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Increment this if the format of sharedData changes in a breaking way.
|
||||||
|
var sharedDataVersion = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @template T
|
||||||
|
* @param {T} defaults
|
||||||
|
* @returns {T}
|
||||||
|
*/
|
||||||
|
function initializeSharedData(defaults) {
|
||||||
|
var sharedDataKey = 'source-map-support/sharedData';
|
||||||
|
if (typeof Symbol !== 'undefined') {
|
||||||
|
sharedDataKey = Symbol.for(sharedDataKey);
|
||||||
|
}
|
||||||
|
var sharedData = this[sharedDataKey];
|
||||||
|
if (!sharedData) {
|
||||||
|
sharedData = { version: sharedDataVersion };
|
||||||
|
if (Object.defineProperty) {
|
||||||
|
Object.defineProperty(this, sharedDataKey, { value: sharedData });
|
||||||
|
} else {
|
||||||
|
this[sharedDataKey] = sharedData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sharedDataVersion !== sharedData.version) {
|
||||||
|
throw new Error("Multiple incompatible instances of source-map-support were loaded");
|
||||||
|
}
|
||||||
|
for (var key in defaults) {
|
||||||
|
if (!(key in sharedData)) {
|
||||||
|
sharedData[key] = defaults[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sharedData;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If multiple instances of source-map-support are loaded into the same
|
||||||
|
// context, they shouldn't overwrite each other. By storing handlers, caches,
|
||||||
|
// and other state on a shared object, different instances of
|
||||||
|
// source-map-support can work together in a limited way. This does require
|
||||||
|
// that future versions of source-map-support continue to support the fields on
|
||||||
|
// this object. If this internal contract ever needs to be broken, increment
|
||||||
|
// sharedDataVersion. (This version number is not the same as any of the
|
||||||
|
// package's version numbers, which should reflect the *external* API of
|
||||||
|
// source-map-support.)
|
||||||
|
var sharedData = initializeSharedData({
|
||||||
|
|
||||||
|
// Only install once if called multiple times
|
||||||
|
// Remember how the environment looked before installation so we can restore if able
|
||||||
|
/** @type {HookState} */
|
||||||
|
errorPrepareStackTraceHook: undefined,
|
||||||
|
/** @type {HookState} */
|
||||||
|
processEmitHook: undefined,
|
||||||
|
/** @type {HookState} */
|
||||||
|
moduleResolveFilenameHook: undefined,
|
||||||
|
|
||||||
|
/** @type {Array<(request: string, parent: any, isMain: boolean, options: any, redirectedRequest: string) => void>} */
|
||||||
|
onConflictingLibraryRedirectArr: [],
|
||||||
|
|
||||||
|
// If true, the caches are reset before a stack trace formatting operation
|
||||||
|
emptyCacheBetweenOperations: false,
|
||||||
|
|
||||||
|
// Maps a file path to a string containing the file contents
|
||||||
|
fileContentsCache: Object.create(null),
|
||||||
|
|
||||||
|
// Maps a file path to a source map for that file
|
||||||
|
/** @type {Record<string, {url: string, map: TraceMap}} */
|
||||||
|
sourceMapCache: Object.create(null),
|
||||||
|
|
||||||
|
// Priority list of retrieve handlers
|
||||||
|
retrieveFileHandlers: [],
|
||||||
|
retrieveMapHandlers: [],
|
||||||
|
|
||||||
|
// Priority list of internally-implemented handlers.
|
||||||
|
// When resetting state, we must keep these.
|
||||||
|
internalRetrieveFileHandlers: [],
|
||||||
|
internalRetrieveMapHandlers: [],
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Supports {browser, node, auto}
|
||||||
|
var environment = "auto";
|
||||||
|
|
||||||
|
// Regex for detecting source maps
|
||||||
|
var reSourceMap = /^data:application\/json[^,]+base64,/;
|
||||||
|
|
||||||
|
function isInBrowser() {
|
||||||
|
if (environment === "browser")
|
||||||
|
return true;
|
||||||
|
if (environment === "node")
|
||||||
|
return false;
|
||||||
|
return ((typeof window !== 'undefined') && (typeof XMLHttpRequest === 'function') && !(window.require && window.module && window.process && window.process.type === "renderer"));
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasGlobalProcessEventEmitter() {
|
||||||
|
return ((typeof process === 'object') && (process !== null) && (typeof process.on === 'function'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function tryFileURLToPath(v) {
|
||||||
|
if(isFileUrl(v)) {
|
||||||
|
return fileURLToPath(v);
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO un-copy these from resolve-uri; see if they can be exported from that lib
|
||||||
|
function isFileUrl(input) {
|
||||||
|
return input.startsWith('file:');
|
||||||
|
}
|
||||||
|
function isAbsoluteUrl(input) {
|
||||||
|
return schemeRegex.test(input);
|
||||||
|
}
|
||||||
|
// Matches the scheme of a URL, eg "http://"
|
||||||
|
const schemeRegex = /^[\w+.-]+:\/\//;
|
||||||
|
function isSchemeRelativeUrl(input) {
|
||||||
|
return input.startsWith('//');
|
||||||
|
}
|
||||||
|
|
||||||
|
// #region Caches
|
||||||
|
/** @param {string} pathOrFileUrl */
|
||||||
|
function getCacheKey(pathOrFileUrl) {
|
||||||
|
if(pathOrFileUrl.startsWith('node:')) return pathOrFileUrl;
|
||||||
|
if(isFileUrl(pathOrFileUrl)) {
|
||||||
|
// Must normalize spaces to %20, stuff like that
|
||||||
|
return new URL(pathOrFileUrl).toString();
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
return pathToFileURL(pathOrFileUrl).toString();
|
||||||
|
} catch {
|
||||||
|
return pathOrFileUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function getFileContentsCache(key) {
|
||||||
|
return sharedData.fileContentsCache[getCacheKey(key)];
|
||||||
|
}
|
||||||
|
function hasFileContentsCacheFromKey(key) {
|
||||||
|
return Object.prototype.hasOwnProperty.call(sharedData.fileContentsCache, key);
|
||||||
|
}
|
||||||
|
function getFileContentsCacheFromKey(key) {
|
||||||
|
return sharedData.fileContentsCache[key];
|
||||||
|
}
|
||||||
|
function setFileContentsCache(key, value) {
|
||||||
|
return sharedData.fileContentsCache[getCacheKey(key)] = value;
|
||||||
|
}
|
||||||
|
function getSourceMapCache(key) {
|
||||||
|
return sharedData.sourceMapCache[getCacheKey(key)];
|
||||||
|
}
|
||||||
|
function setSourceMapCache(key, value) {
|
||||||
|
return sharedData.sourceMapCache[getCacheKey(key)] = value;
|
||||||
|
}
|
||||||
|
function clearCaches() {
|
||||||
|
sharedData.fileContentsCache = Object.create(null);
|
||||||
|
sharedData.sourceMapCache = Object.create(null);
|
||||||
|
}
|
||||||
|
// #endregion Caches
|
||||||
|
|
||||||
|
function handlerExec(list, internalList) {
|
||||||
|
return function(arg) {
|
||||||
|
for (var i = 0; i < list.length; i++) {
|
||||||
|
var ret = list[i](arg);
|
||||||
|
if (ret) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var i = 0; i < internalList.length; i++) {
|
||||||
|
var ret = internalList[i](arg);
|
||||||
|
if (ret) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var retrieveFile = handlerExec(sharedData.retrieveFileHandlers, sharedData.internalRetrieveFileHandlers);
|
||||||
|
|
||||||
|
sharedData.internalRetrieveFileHandlers.push(function(path) {
|
||||||
|
// Trim the path to make sure there is no extra whitespace.
|
||||||
|
path = path.trim();
|
||||||
|
if (/^file:/.test(path)) {
|
||||||
|
// existsSync/readFileSync can't handle file protocol, but once stripped, it works
|
||||||
|
path = path.replace(/file:\/\/\/(\w:)?/, function(protocol, drive) {
|
||||||
|
return drive ?
|
||||||
|
'' : // file:///C:/dir/file -> C:/dir/file
|
||||||
|
'/'; // file:///root-dir/file -> /root-dir/file
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const key = getCacheKey(path);
|
||||||
|
if(hasFileContentsCacheFromKey(key)) {
|
||||||
|
return getFileContentsCacheFromKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
var contents = '';
|
||||||
|
try {
|
||||||
|
if (!fs) {
|
||||||
|
// Use SJAX if we are in the browser
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', path, /** async */ false);
|
||||||
|
xhr.send(null);
|
||||||
|
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||||
|
contents = xhr.responseText;
|
||||||
|
}
|
||||||
|
} else if (fs.existsSync(path)) {
|
||||||
|
// Otherwise, use the filesystem
|
||||||
|
contents = fs.readFileSync(path, 'utf8');
|
||||||
|
}
|
||||||
|
} catch (er) {
|
||||||
|
/* ignore any errors */
|
||||||
|
}
|
||||||
|
|
||||||
|
return setFileContentsCache(path, contents);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Support URLs relative to a directory, but be careful about a protocol prefix
|
||||||
|
// in case we are in the browser (i.e. directories may start with "http://" or "file:///")
|
||||||
|
function supportRelativeURL(file, url) {
|
||||||
|
if(!file) return url;
|
||||||
|
// given that this happens within error formatting codepath, probably best to
|
||||||
|
// fallback instead of throwing if anything goes wrong
|
||||||
|
try {
|
||||||
|
// if should output a URL
|
||||||
|
if(isAbsoluteUrl(file) || isSchemeRelativeUrl(file)) {
|
||||||
|
if(isAbsoluteUrl(url) || isSchemeRelativeUrl(url)) {
|
||||||
|
return new URL(url, file).toString();
|
||||||
|
}
|
||||||
|
if(path.isAbsolute(url)) {
|
||||||
|
return new URL(pathToFileURL(url), file).toString();
|
||||||
|
}
|
||||||
|
// url is relative path or URL
|
||||||
|
return new URL(url.replace(/\\/g, '/'), file).toString();
|
||||||
|
}
|
||||||
|
// if should output a path (unless URL is something like https://)
|
||||||
|
if(path.isAbsolute(file)) {
|
||||||
|
if(isFileUrl(url)) {
|
||||||
|
return fileURLToPath(url);
|
||||||
|
}
|
||||||
|
if(isSchemeRelativeUrl(url)) {
|
||||||
|
return fileURLToPath(new URL(url, 'file://'));
|
||||||
|
}
|
||||||
|
if(isAbsoluteUrl(url)) {
|
||||||
|
// url is a non-file URL
|
||||||
|
// Go with the URL
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
if(path.isAbsolute(url)) {
|
||||||
|
// Normalize at all? decodeURI or normalize slashes?
|
||||||
|
return path.normalize(url);
|
||||||
|
}
|
||||||
|
// url is relative path or URL
|
||||||
|
return path.join(file, '..', decodeURI(url));
|
||||||
|
}
|
||||||
|
// If we get here, file is relative.
|
||||||
|
// Shouldn't happen since node identifies modules with absolute paths or URLs.
|
||||||
|
// But we can take a stab at returning something meaningful anyway.
|
||||||
|
if(isAbsoluteUrl(url) || isSchemeRelativeUrl(url)) {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
return path.join(file, '..', url);
|
||||||
|
} catch(e) {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return pathOrUrl in the same style as matchStyleOf: either a file URL or a native path
|
||||||
|
function matchStyleOfPathOrUrl(matchStyleOf, pathOrUrl) {
|
||||||
|
try {
|
||||||
|
if(isAbsoluteUrl(matchStyleOf) || isSchemeRelativeUrl(matchStyleOf)) {
|
||||||
|
if(isAbsoluteUrl(pathOrUrl) || isSchemeRelativeUrl(pathOrUrl)) return pathOrUrl;
|
||||||
|
if(path.isAbsolute(pathOrUrl)) return pathToFileURL(pathOrUrl).toString();
|
||||||
|
} else if(path.isAbsolute(matchStyleOf)) {
|
||||||
|
if(isAbsoluteUrl(pathOrUrl) || isSchemeRelativeUrl(pathOrUrl)) {
|
||||||
|
return fileURLToPath(new URL(pathOrUrl, 'file://'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pathOrUrl;
|
||||||
|
} catch(e) {
|
||||||
|
return pathOrUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function retrieveSourceMapURL(source) {
|
||||||
|
var fileData;
|
||||||
|
|
||||||
|
if (isInBrowser()) {
|
||||||
|
try {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', source, false);
|
||||||
|
xhr.send(null);
|
||||||
|
fileData = xhr.readyState === 4 ? xhr.responseText : null;
|
||||||
|
|
||||||
|
// Support providing a sourceMappingURL via the SourceMap header
|
||||||
|
var sourceMapHeader = xhr.getResponseHeader("SourceMap") ||
|
||||||
|
xhr.getResponseHeader("X-SourceMap");
|
||||||
|
if (sourceMapHeader) {
|
||||||
|
return sourceMapHeader;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the URL of the source map
|
||||||
|
fileData = retrieveFile(tryFileURLToPath(source));
|
||||||
|
var re = /(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg;
|
||||||
|
// Keep executing the search to find the *last* sourceMappingURL to avoid
|
||||||
|
// picking up sourceMappingURLs from comments, strings, etc.
|
||||||
|
var lastMatch, match;
|
||||||
|
while (match = re.exec(fileData)) lastMatch = match;
|
||||||
|
if (!lastMatch) return null;
|
||||||
|
return lastMatch[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Can be overridden by the retrieveSourceMap option to install. Takes a
|
||||||
|
// generated source filename; returns a {map, optional url} object, or null if
|
||||||
|
// there is no source map. The map field may be either a string or the parsed
|
||||||
|
// JSON object (ie, it must be a valid argument to the SourceMapConsumer
|
||||||
|
// constructor).
|
||||||
|
/** @type {(source: string) => import('./source-map-support').UrlAndMap | null} */
|
||||||
|
var retrieveSourceMap = handlerExec(sharedData.retrieveMapHandlers, sharedData.internalRetrieveMapHandlers);
|
||||||
|
sharedData.internalRetrieveMapHandlers.push(function(source) {
|
||||||
|
var sourceMappingURL = retrieveSourceMapURL(source);
|
||||||
|
if (!sourceMappingURL) return null;
|
||||||
|
|
||||||
|
// Read the contents of the source map
|
||||||
|
var sourceMapData;
|
||||||
|
if (reSourceMap.test(sourceMappingURL)) {
|
||||||
|
// Support source map URL as a data url
|
||||||
|
var rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(',') + 1);
|
||||||
|
sourceMapData = Buffer.from(rawData, "base64").toString();
|
||||||
|
sourceMappingURL = source;
|
||||||
|
} else {
|
||||||
|
// Support source map URLs relative to the source URL
|
||||||
|
sourceMappingURL = supportRelativeURL(source, sourceMappingURL);
|
||||||
|
sourceMapData = retrieveFile(tryFileURLToPath(sourceMappingURL));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sourceMapData) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
url: sourceMappingURL,
|
||||||
|
map: sourceMapData
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
function mapSourcePosition(position) {
|
||||||
|
var sourceMap = getSourceMapCache(position.source);
|
||||||
|
if (!sourceMap) {
|
||||||
|
// Call the (overrideable) retrieveSourceMap function to get the source map.
|
||||||
|
var urlAndMap = retrieveSourceMap(position.source);
|
||||||
|
if (urlAndMap) {
|
||||||
|
sourceMap = setSourceMapCache(position.source, {
|
||||||
|
url: urlAndMap.url,
|
||||||
|
map: new AnyMap(urlAndMap.map, urlAndMap.url)
|
||||||
|
});
|
||||||
|
|
||||||
|
// Overwrite trace-mapping's resolutions, because they do not handle
|
||||||
|
// Windows paths the way we want.
|
||||||
|
// TODO Remove now that windows path support was added to resolve-uri and thus trace-mapping?
|
||||||
|
sourceMap.map.resolvedSources = sourceMap.map.sources.map(s => supportRelativeURL(sourceMap.url, s));
|
||||||
|
|
||||||
|
// Load all sources stored inline with the source map into the file cache
|
||||||
|
// to pretend like they are already loaded. They may not exist on disk.
|
||||||
|
if (sourceMap.map.sourcesContent) {
|
||||||
|
sourceMap.map.resolvedSources.forEach(function(resolvedSource, i) {
|
||||||
|
var contents = sourceMap.map.sourcesContent[i];
|
||||||
|
if (contents) {
|
||||||
|
setFileContentsCache(resolvedSource, contents);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sourceMap = setSourceMapCache(position.source, {
|
||||||
|
url: null,
|
||||||
|
map: null
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resolve the source URL relative to the URL of the source map
|
||||||
|
if (sourceMap && sourceMap.map) {
|
||||||
|
var originalPosition = originalPositionFor(sourceMap.map, position);
|
||||||
|
|
||||||
|
// Only return the original position if a matching line was found. If no
|
||||||
|
// matching line is found then we return position instead, which will cause
|
||||||
|
// the stack trace to print the path and line for the compiled file. It is
|
||||||
|
// better to give a precise location in the compiled file than a vague
|
||||||
|
// location in the original file.
|
||||||
|
if (originalPosition.source !== null) {
|
||||||
|
// originalPosition.source has *already* been resolved against sourceMap.url
|
||||||
|
// so is *already* as absolute as possible.
|
||||||
|
// However, we want to ensure we output in same format as input: URL or native path
|
||||||
|
originalPosition.source = matchStyleOfPathOrUrl(
|
||||||
|
position.source, originalPosition.source);
|
||||||
|
return originalPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parses code generated by FormatEvalOrigin(), a function inside V8:
|
||||||
|
// https://code.google.com/p/v8/source/browse/trunk/src/messages.js
|
||||||
|
function mapEvalOrigin(origin) {
|
||||||
|
// Most eval() calls are in this format
|
||||||
|
var match = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin);
|
||||||
|
if (match) {
|
||||||
|
var position = mapSourcePosition({
|
||||||
|
source: match[2],
|
||||||
|
line: +match[3],
|
||||||
|
column: match[4] - 1
|
||||||
|
});
|
||||||
|
return 'eval at ' + match[1] + ' (' + position.source + ':' +
|
||||||
|
position.line + ':' + (position.column + 1) + ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse nested eval() calls using recursion
|
||||||
|
match = /^eval at ([^(]+) \((.+)\)$/.exec(origin);
|
||||||
|
if (match) {
|
||||||
|
return 'eval at ' + match[1] + ' (' + mapEvalOrigin(match[2]) + ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure we still return useful information if we didn't find anything
|
||||||
|
return origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is copied almost verbatim from the V8 source code at
|
||||||
|
// https://code.google.com/p/v8/source/browse/trunk/src/messages.js
|
||||||
|
// Update 2022-04-29:
|
||||||
|
// https://github.com/v8/v8/blob/98f6f100c5ab8e390e51422747c4ef644d5ac6f2/src/builtins/builtins-callsite.cc#L175-L179
|
||||||
|
// https://github.com/v8/v8/blob/98f6f100c5ab8e390e51422747c4ef644d5ac6f2/src/objects/call-site-info.cc#L795-L804
|
||||||
|
// https://github.com/v8/v8/blob/98f6f100c5ab8e390e51422747c4ef644d5ac6f2/src/objects/call-site-info.cc#L717-L750
|
||||||
|
// The implementation of wrapCallSite() used to just forward to the actual source
|
||||||
|
// code of CallSite.prototype.toString but unfortunately a new release of V8
|
||||||
|
// did something to the prototype chain and broke the shim. The only fix I
|
||||||
|
// could find was copy/paste.
|
||||||
|
function CallSiteToString() {
|
||||||
|
var fileName;
|
||||||
|
var fileLocation = "";
|
||||||
|
if (this.isNative()) {
|
||||||
|
fileLocation = "native";
|
||||||
|
} else {
|
||||||
|
fileName = this.getScriptNameOrSourceURL();
|
||||||
|
if (!fileName && this.isEval()) {
|
||||||
|
fileLocation = this.getEvalOrigin();
|
||||||
|
fileLocation += ", "; // Expecting source position to follow.
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fileName) {
|
||||||
|
fileLocation += fileName;
|
||||||
|
} else {
|
||||||
|
// Source code does not originate from a file and is not native, but we
|
||||||
|
// can still get the source position inside the source string, e.g. in
|
||||||
|
// an eval string.
|
||||||
|
fileLocation += "<anonymous>";
|
||||||
|
}
|
||||||
|
var lineNumber = this.getLineNumber();
|
||||||
|
if (lineNumber != null) {
|
||||||
|
fileLocation += ":" + lineNumber;
|
||||||
|
var columnNumber = this.getColumnNumber();
|
||||||
|
if (columnNumber) {
|
||||||
|
fileLocation += ":" + columnNumber;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var line = "";
|
||||||
|
var isAsync = this.isAsync ? this.isAsync() : false;
|
||||||
|
if(isAsync) {
|
||||||
|
line += 'async ';
|
||||||
|
var isPromiseAll = this.isPromiseAll ? this.isPromiseAll() : false;
|
||||||
|
var isPromiseAny = this.isPromiseAny ? this.isPromiseAny() : false;
|
||||||
|
if(isPromiseAny || isPromiseAll) {
|
||||||
|
line += isPromiseAll ? 'Promise.all (index ' : 'Promise.any (index ';
|
||||||
|
var promiseIndex = this.getPromiseIndex();
|
||||||
|
line += promiseIndex + ')';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var functionName = this.getFunctionName();
|
||||||
|
var addSuffix = true;
|
||||||
|
var isConstructor = this.isConstructor();
|
||||||
|
var isMethodCall = !(this.isToplevel() || isConstructor);
|
||||||
|
if (isMethodCall) {
|
||||||
|
var typeName = this.getTypeName();
|
||||||
|
// Fixes shim to be backward compatable with Node v0 to v4
|
||||||
|
if (typeName === "[object Object]") {
|
||||||
|
typeName = "null";
|
||||||
|
}
|
||||||
|
var methodName = this.getMethodName();
|
||||||
|
if (functionName) {
|
||||||
|
if (typeName && functionName.indexOf(typeName) != 0) {
|
||||||
|
line += typeName + ".";
|
||||||
|
}
|
||||||
|
line += functionName;
|
||||||
|
if (methodName && functionName.indexOf("." + methodName) != functionName.length - methodName.length - 1) {
|
||||||
|
line += " [as " + methodName + "]";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
line += typeName + "." + (methodName || "<anonymous>");
|
||||||
|
}
|
||||||
|
} else if (isConstructor) {
|
||||||
|
line += "new " + (functionName || "<anonymous>");
|
||||||
|
} else if (functionName) {
|
||||||
|
line += functionName;
|
||||||
|
} else {
|
||||||
|
line += fileLocation;
|
||||||
|
addSuffix = false;
|
||||||
|
}
|
||||||
|
if (addSuffix) {
|
||||||
|
line += " (" + fileLocation + ")";
|
||||||
|
}
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cloneCallSite(frame) {
|
||||||
|
var object = {};
|
||||||
|
Object.getOwnPropertyNames(Object.getPrototypeOf(frame)).forEach(function(name) {
|
||||||
|
object[name] = /^(?:is|get)/.test(name) ? function() { return frame[name].call(frame); } : frame[name];
|
||||||
|
});
|
||||||
|
object.toString = CallSiteToString;
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
function wrapCallSite(frame, state) {
|
||||||
|
// provides interface backward compatibility
|
||||||
|
if (state === undefined) {
|
||||||
|
state = { nextPosition: null, curPosition: null }
|
||||||
|
}
|
||||||
|
if(frame.isNative()) {
|
||||||
|
state.curPosition = null;
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Most call sites will return the source file from getFileName(), but code
|
||||||
|
// passed to eval() ending in "//# sourceURL=..." will return the source file
|
||||||
|
// from getScriptNameOrSourceURL() instead
|
||||||
|
var source = frame.getFileName() || frame.getScriptNameOrSourceURL();
|
||||||
|
if (source) {
|
||||||
|
// v8 does not expose its internal isWasm, etc methods, so we do this instead.
|
||||||
|
if(source.startsWith('wasm://')) {
|
||||||
|
state.curPosition = null;
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
var line = frame.getLineNumber();
|
||||||
|
var column = frame.getColumnNumber() - 1;
|
||||||
|
|
||||||
|
// Fix position in Node where some (internal) code is prepended.
|
||||||
|
// See https://github.com/evanw/node-source-map-support/issues/36
|
||||||
|
// Header removed in node at ^10.16 || >=11.11.0
|
||||||
|
// v11 is not an LTS candidate, we can just test the one version with it.
|
||||||
|
// Test node versions for: 10.16-19, 10.20+, 12-19, 20-99, 100+, or 11.11
|
||||||
|
var noHeader = /^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;
|
||||||
|
var headerLength = noHeader.test(process.version) ? 0 : 62;
|
||||||
|
if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) {
|
||||||
|
column -= headerLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
var position = mapSourcePosition({
|
||||||
|
source: source,
|
||||||
|
line: line,
|
||||||
|
column: column
|
||||||
|
});
|
||||||
|
state.curPosition = position;
|
||||||
|
frame = cloneCallSite(frame);
|
||||||
|
var originalFunctionName = frame.getFunctionName;
|
||||||
|
frame.getFunctionName = function() {
|
||||||
|
if (state.nextPosition == null) {
|
||||||
|
return originalFunctionName();
|
||||||
|
}
|
||||||
|
return state.nextPosition.name || originalFunctionName();
|
||||||
|
};
|
||||||
|
frame.getFileName = function() { return position.source; };
|
||||||
|
frame.getLineNumber = function() { return position.line; };
|
||||||
|
frame.getColumnNumber = function() { return position.column + 1; };
|
||||||
|
frame.getScriptNameOrSourceURL = function() { return position.source; };
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Code called using eval() needs special handling
|
||||||
|
var origin = frame.isEval() && frame.getEvalOrigin();
|
||||||
|
if (origin) {
|
||||||
|
origin = mapEvalOrigin(origin);
|
||||||
|
frame = cloneCallSite(frame);
|
||||||
|
frame.getEvalOrigin = function() { return origin; };
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we get here then we were unable to change the source position
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
var kIsNodeError = undefined;
|
||||||
|
try {
|
||||||
|
// Get a deliberate ERR_INVALID_ARG_TYPE
|
||||||
|
// TODO is there a better way to reliably get an instance of NodeError?
|
||||||
|
path.resolve(123);
|
||||||
|
} catch(e) {
|
||||||
|
const symbols = Object.getOwnPropertySymbols(e);
|
||||||
|
const symbol = symbols.find(function (s) {return s.toString().indexOf('kIsNodeError') >= 0});
|
||||||
|
if(symbol) kIsNodeError = symbol;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ErrorPrototypeToString = (err) =>Error.prototype.toString.call(err);
|
||||||
|
|
||||||
|
/** @param {HookState} hookState */
|
||||||
|
function createPrepareStackTrace(hookState) {
|
||||||
|
return prepareStackTrace;
|
||||||
|
|
||||||
|
// This function is part of the V8 stack trace API, for more info see:
|
||||||
|
// https://v8.dev/docs/stack-trace-api
|
||||||
|
function prepareStackTrace(error, stack) {
|
||||||
|
if(!hookState.enabled) return hookState.originalValue.apply(this, arguments);
|
||||||
|
|
||||||
|
if (sharedData.emptyCacheBetweenOperations) {
|
||||||
|
clearCaches();
|
||||||
|
}
|
||||||
|
|
||||||
|
// node gives its own errors special treatment. Mimic that behavior
|
||||||
|
// https://github.com/nodejs/node/blob/3cbaabc4622df1b4009b9d026a1a970bdbae6e89/lib/internal/errors.js#L118-L128
|
||||||
|
// https://github.com/nodejs/node/pull/39182
|
||||||
|
var errorString;
|
||||||
|
if (kIsNodeError) {
|
||||||
|
if(kIsNodeError in error) {
|
||||||
|
errorString = `${error.name} [${error.code}]: ${error.message}`;
|
||||||
|
} else {
|
||||||
|
errorString = ErrorPrototypeToString(error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var name = error.name || 'Error';
|
||||||
|
var message = error.message || '';
|
||||||
|
errorString = message ? name + ": " + message : name;
|
||||||
|
}
|
||||||
|
|
||||||
|
var state = { nextPosition: null, curPosition: null };
|
||||||
|
var processedStack = [];
|
||||||
|
for (var i = stack.length - 1; i >= 0; i--) {
|
||||||
|
processedStack.push('\n at ' + wrapCallSite(stack[i], state));
|
||||||
|
state.nextPosition = state.curPosition;
|
||||||
|
}
|
||||||
|
state.curPosition = state.nextPosition = null;
|
||||||
|
return errorString + processedStack.reverse().join('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate position and snippet of original source with pointer
|
||||||
|
function getErrorSource(error) {
|
||||||
|
var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
|
||||||
|
if (match) {
|
||||||
|
var source = match[1];
|
||||||
|
var line = +match[2];
|
||||||
|
var column = +match[3];
|
||||||
|
|
||||||
|
// Support the inline sourceContents inside the source map
|
||||||
|
var contents = getFileContentsCache(source);
|
||||||
|
|
||||||
|
const sourceAsPath = tryFileURLToPath(source);
|
||||||
|
|
||||||
|
// Support files on disk
|
||||||
|
if (!contents && fs && fs.existsSync(sourceAsPath)) {
|
||||||
|
try {
|
||||||
|
contents = fs.readFileSync(sourceAsPath, 'utf8');
|
||||||
|
} catch (er) {
|
||||||
|
contents = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format the line from the original source code like node does
|
||||||
|
if (contents) {
|
||||||
|
var code = contents.split(/(?:\r\n|\r|\n)/)[line - 1];
|
||||||
|
if (code) {
|
||||||
|
return source + ':' + line + '\n' + code + '\n' +
|
||||||
|
new Array(column).join(' ') + '^';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function printFatalErrorUponExit (error) {
|
||||||
|
var source = getErrorSource(error);
|
||||||
|
|
||||||
|
// Ensure error is printed synchronously and not truncated
|
||||||
|
if (process.stderr._handle && process.stderr._handle.setBlocking) {
|
||||||
|
process.stderr._handle.setBlocking(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (source) {
|
||||||
|
console.error(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Matches node's behavior for colorized output
|
||||||
|
console.error(
|
||||||
|
util.inspect(error, {
|
||||||
|
customInspect: false,
|
||||||
|
colors: process.stderr.isTTY
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function shimEmitUncaughtException () {
|
||||||
|
const originalValue = process.emit;
|
||||||
|
var hook = sharedData.processEmitHook = {
|
||||||
|
enabled: true,
|
||||||
|
originalValue,
|
||||||
|
installedValue: undefined
|
||||||
|
};
|
||||||
|
var isTerminatingDueToFatalException = false;
|
||||||
|
var fatalException;
|
||||||
|
|
||||||
|
process.emit = sharedData.processEmitHook.installedValue = function (type) {
|
||||||
|
const hadListeners = originalValue.apply(this, arguments);
|
||||||
|
if(hook.enabled) {
|
||||||
|
if (type === 'uncaughtException' && !hadListeners) {
|
||||||
|
isTerminatingDueToFatalException = true;
|
||||||
|
fatalException = arguments[1];
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
if (type === 'exit' && isTerminatingDueToFatalException) {
|
||||||
|
printFatalErrorUponExit(fatalException);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hadListeners;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var originalRetrieveFileHandlers = sharedData.retrieveFileHandlers.slice(0);
|
||||||
|
var originalRetrieveMapHandlers = sharedData.retrieveMapHandlers.slice(0);
|
||||||
|
|
||||||
|
exports.wrapCallSite = wrapCallSite;
|
||||||
|
exports.getErrorSource = getErrorSource;
|
||||||
|
exports.mapSourcePosition = mapSourcePosition;
|
||||||
|
exports.retrieveSourceMap = retrieveSourceMap;
|
||||||
|
|
||||||
|
exports.install = function(options) {
|
||||||
|
options = options || {};
|
||||||
|
|
||||||
|
if (options.environment) {
|
||||||
|
environment = options.environment;
|
||||||
|
if (["node", "browser", "auto"].indexOf(environment) === -1) {
|
||||||
|
throw new Error("environment " + environment + " was unknown. Available options are {auto, browser, node}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use dynamicRequire to avoid including in browser bundles
|
||||||
|
var Module = dynamicRequire(module, 'module');
|
||||||
|
|
||||||
|
// Redirect subsequent imports of "source-map-support"
|
||||||
|
// to this package
|
||||||
|
const {redirectConflictingLibrary = true, onConflictingLibraryRedirect} = options;
|
||||||
|
if(redirectConflictingLibrary) {
|
||||||
|
if (!sharedData.moduleResolveFilenameHook) {
|
||||||
|
const originalValue = Module._resolveFilename;
|
||||||
|
const moduleResolveFilenameHook = sharedData.moduleResolveFilenameHook = {
|
||||||
|
enabled: true,
|
||||||
|
originalValue,
|
||||||
|
installedValue: undefined,
|
||||||
|
}
|
||||||
|
Module._resolveFilename = sharedData.moduleResolveFilenameHook.installedValue = function (request, parent, isMain, options) {
|
||||||
|
if (moduleResolveFilenameHook.enabled) {
|
||||||
|
// Match all source-map-support entrypoints: source-map-support, source-map-support/register
|
||||||
|
let requestRedirect;
|
||||||
|
if (request === 'source-map-support') {
|
||||||
|
requestRedirect = './';
|
||||||
|
} else if (request === 'source-map-support/register') {
|
||||||
|
requestRedirect = './register';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (requestRedirect !== undefined) {
|
||||||
|
const newRequest = require.resolve(requestRedirect);
|
||||||
|
for (const cb of sharedData.onConflictingLibraryRedirectArr) {
|
||||||
|
cb(request, parent, isMain, options, newRequest);
|
||||||
|
}
|
||||||
|
request = newRequest;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return originalValue.call(this, request, parent, isMain, options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (onConflictingLibraryRedirect) {
|
||||||
|
sharedData.onConflictingLibraryRedirectArr.push(onConflictingLibraryRedirect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow sources to be found by methods other than reading the files
|
||||||
|
// directly from disk.
|
||||||
|
if (options.retrieveFile) {
|
||||||
|
if (options.overrideRetrieveFile) {
|
||||||
|
sharedData.retrieveFileHandlers.length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sharedData.retrieveFileHandlers.unshift(options.retrieveFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow source maps to be found by methods other than reading the files
|
||||||
|
// directly from disk.
|
||||||
|
if (options.retrieveSourceMap) {
|
||||||
|
if (options.overrideRetrieveSourceMap) {
|
||||||
|
sharedData.retrieveMapHandlers.length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
sharedData.retrieveMapHandlers.unshift(options.retrieveSourceMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Support runtime transpilers that include inline source maps
|
||||||
|
if (options.hookRequire && !isInBrowser()) {
|
||||||
|
var $compile = Module.prototype._compile;
|
||||||
|
|
||||||
|
if (!$compile.__sourceMapSupport) {
|
||||||
|
Module.prototype._compile = function(content, filename) {
|
||||||
|
setFileContentsCache(filename, content);
|
||||||
|
setSourceMapCache(filename, undefined);
|
||||||
|
return $compile.call(this, content, filename);
|
||||||
|
};
|
||||||
|
|
||||||
|
Module.prototype._compile.__sourceMapSupport = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configure options
|
||||||
|
if (!sharedData.emptyCacheBetweenOperations) {
|
||||||
|
sharedData.emptyCacheBetweenOperations = 'emptyCacheBetweenOperations' in options ?
|
||||||
|
options.emptyCacheBetweenOperations : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Install the error reformatter
|
||||||
|
if (!sharedData.errorPrepareStackTraceHook) {
|
||||||
|
const originalValue = Error.prepareStackTrace;
|
||||||
|
sharedData.errorPrepareStackTraceHook = {
|
||||||
|
enabled: true,
|
||||||
|
originalValue,
|
||||||
|
installedValue: undefined
|
||||||
|
};
|
||||||
|
Error.prepareStackTrace = sharedData.errorPrepareStackTraceHook.installedValue = createPrepareStackTrace(sharedData.errorPrepareStackTraceHook);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sharedData.processEmitHook) {
|
||||||
|
var installHandler = 'handleUncaughtExceptions' in options ?
|
||||||
|
options.handleUncaughtExceptions : true;
|
||||||
|
|
||||||
|
// Do not override 'uncaughtException' with our own handler in Node.js
|
||||||
|
// Worker threads. Workers pass the error to the main thread as an event,
|
||||||
|
// rather than printing something to stderr and exiting.
|
||||||
|
try {
|
||||||
|
// We need to use `dynamicRequire` because `require` on it's own will be optimized by WebPack/Browserify.
|
||||||
|
var worker_threads = dynamicRequire(module, 'worker_threads');
|
||||||
|
if (worker_threads.isMainThread === false) {
|
||||||
|
installHandler = false;
|
||||||
|
}
|
||||||
|
} catch(e) {}
|
||||||
|
|
||||||
|
// Provide the option to not install the uncaught exception handler. This is
|
||||||
|
// to support other uncaught exception handlers (in test frameworks, for
|
||||||
|
// example). If this handler is not installed and there are no other uncaught
|
||||||
|
// exception handlers, uncaught exceptions will be caught by node's built-in
|
||||||
|
// exception handler and the process will still be terminated. However, the
|
||||||
|
// generated JavaScript code will be shown above the stack trace instead of
|
||||||
|
// the original source code.
|
||||||
|
if (installHandler && hasGlobalProcessEventEmitter()) {
|
||||||
|
shimEmitUncaughtException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.uninstall = function() {
|
||||||
|
if(sharedData.processEmitHook) {
|
||||||
|
// Disable behavior
|
||||||
|
sharedData.processEmitHook.enabled = false;
|
||||||
|
// If possible, remove our hook function. May not be possible if subsequent third-party hooks have wrapped around us.
|
||||||
|
if(process.emit === sharedData.processEmitHook.installedValue) {
|
||||||
|
process.emit = sharedData.processEmitHook.originalValue;
|
||||||
|
}
|
||||||
|
sharedData.processEmitHook = undefined;
|
||||||
|
}
|
||||||
|
if(sharedData.errorPrepareStackTraceHook) {
|
||||||
|
// Disable behavior
|
||||||
|
sharedData.errorPrepareStackTraceHook.enabled = false;
|
||||||
|
// If possible or necessary, remove our hook function.
|
||||||
|
// In vanilla environments, prepareStackTrace is `undefined`.
|
||||||
|
// We cannot delegate to `undefined` the way we can to a function w/`.apply()`; our only option is to remove the function.
|
||||||
|
// If we are the *first* hook installed, and another was installed on top of us, we have no choice but to remove both.
|
||||||
|
if(Error.prepareStackTrace === sharedData.errorPrepareStackTraceHook.installedValue || typeof sharedData.errorPrepareStackTraceHook.originalValue !== 'function') {
|
||||||
|
Error.prepareStackTrace = sharedData.errorPrepareStackTraceHook.originalValue;
|
||||||
|
}
|
||||||
|
sharedData.errorPrepareStackTraceHook = undefined;
|
||||||
|
}
|
||||||
|
if (sharedData.moduleResolveFilenameHook) {
|
||||||
|
// Disable behavior
|
||||||
|
sharedData.moduleResolveFilenameHook.enabled = false;
|
||||||
|
// If possible, remove our hook function. May not be possible if subsequent third-party hooks have wrapped around us.
|
||||||
|
var Module = dynamicRequire(module, 'module');
|
||||||
|
if(Module._resolveFilename === sharedData.moduleResolveFilenameHook.installedValue) {
|
||||||
|
Module._resolveFilename = sharedData.moduleResolveFilenameHook.originalValue;
|
||||||
|
}
|
||||||
|
sharedData.moduleResolveFilenameHook = undefined;
|
||||||
|
}
|
||||||
|
sharedData.onConflictingLibraryRedirectArr.length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.resetRetrieveHandlers = function() {
|
||||||
|
sharedData.retrieveFileHandlers.length = 0;
|
||||||
|
sharedData.retrieveMapHandlers.length = 0;
|
||||||
|
}
|
||||||
201
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/LICENSE
generated
vendored
Normal file
201
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/LICENSE
generated
vendored
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
35
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/README.md
generated
vendored
Normal file
35
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/README.md
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# TypeScript/JavaScript SDK for `did:ion`
|
||||||
|
- This SDK allows you to create `did:ion` operations that are ready to be submitted to an ION node.
|
||||||
|
- You can also use the SDK to create long-form ION DIDs.
|
||||||
|
- This SDK is compatible with both node.js and browser.
|
||||||
|
|
||||||
|
Code Coverage
|
||||||
|
|
||||||
|
   
|
||||||
|
|
||||||
|
```
|
||||||
|
npm i @decentralized-identity/ion-sdk --save
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional Setup
|
||||||
|
This package depends on the [`@noble/ed25519`](https://github.com/paulmillr/noble-ed25519#usage) and [`@noble/secp256k1`](https://github.com/paulmillr/noble-secp256k1#usage) v2, thus additional steps are needed for some environments:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// node.js 18 and earlier, needs globalThis.crypto polyfill
|
||||||
|
import { webcrypto } from 'node:crypto';
|
||||||
|
// @ts-ignore
|
||||||
|
if (!globalThis.crypto) globalThis.crypto = webcrypto;
|
||||||
|
|
||||||
|
// React Native needs crypto.getRandomValues polyfill and sha256 for `@noble/secp256k1`
|
||||||
|
import 'react-native-get-random-values';
|
||||||
|
import { hmac } from '@noble/hashes/hmac';
|
||||||
|
import { sha256 } from '@noble/hashes/sha256';
|
||||||
|
secp.etc.hmacSha256Sync = (k, ...m) => hmac(sha256, k, secp.etc.concatBytes(...m));
|
||||||
|
secp.etc.hmacSha256Async = (k, ...m) => Promise.resolve(secp.etc.hmacSha256Sync(k, ...m));
|
||||||
|
|
||||||
|
// React Native needs crypto.getRandomValues polyfill and sha512 for `@noble/ed25519`
|
||||||
|
import 'react-native-get-random-values';
|
||||||
|
import { sha512 } from '@noble/hashes/sha512';
|
||||||
|
ed.etc.sha512Sync = (...m) => sha512(ed.etc.concatBytes(...m));
|
||||||
|
ed.etc.sha512Async = (...m) => Promise.resolve(ed.etc.sha512Sync(...m));
|
||||||
|
```
|
||||||
31
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Encoder.d.ts
generated
vendored
Normal file
31
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Encoder.d.ts
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* Class that encodes binary blobs into strings.
|
||||||
|
* Note that the encode/decode methods may change underlying encoding scheme.
|
||||||
|
*/
|
||||||
|
export default class Encoder {
|
||||||
|
/**
|
||||||
|
* Encodes given bytes into a Base64URL string.
|
||||||
|
*/
|
||||||
|
static encode(content: Uint8Array): string;
|
||||||
|
/**
|
||||||
|
* Decodes the given Base64URL string into bytes.
|
||||||
|
*/
|
||||||
|
static decodeAsBytes(encodedContent: string, inputContextForErrorLogging: string): Uint8Array;
|
||||||
|
/**
|
||||||
|
* Decodes the given Base64URL string into the original string.
|
||||||
|
*/
|
||||||
|
static decodeAsString(encodedContent: string, inputContextForErrorLogging: string): string;
|
||||||
|
/**
|
||||||
|
* Tests if the given string is a Base64URL string.
|
||||||
|
*/
|
||||||
|
static isBase64UrlString(input: string): boolean;
|
||||||
|
/**
|
||||||
|
* Converts input string to bytes.
|
||||||
|
*/
|
||||||
|
static stringToBytes(input: string): Uint8Array;
|
||||||
|
/**
|
||||||
|
* Converts bytes to string.
|
||||||
|
*/
|
||||||
|
static bytesToString(input: Uint8Array): string;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=Encoder.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Encoder.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Encoder.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Encoder.d.ts","sourceRoot":"","sources":["../../lib/Encoder.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B;;OAEG;WACW,MAAM,CAAE,OAAO,EAAE,UAAU,GAAG,MAAM;IAKlD;;OAEG;WACW,aAAa,CAAE,cAAc,EAAE,MAAM,EAAE,2BAA2B,EAAE,MAAM,GAAG,UAAU;IAQrG;;OAEG;WACW,cAAc,CAAE,cAAc,EAAE,MAAM,EAAE,2BAA2B,EAAE,MAAM,GAAG,MAAM;IAMlG;;OAEG;WACW,iBAAiB,CAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAUxD;;OAEG;WACW,aAAa,CAAE,KAAK,EAAE,MAAM,GAAG,UAAU;IAKvD;;OAEG;WACW,aAAa,CAAE,KAAK,EAAE,UAAU,GAAG,MAAM;CAIxD"}
|
||||||
59
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Encoder.js
generated
vendored
Normal file
59
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Encoder.js
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
import ErrorCode from './ErrorCode.js';
|
||||||
|
import IonError from './IonError.js';
|
||||||
|
import { base64url } from 'multiformats/bases/base64';
|
||||||
|
/**
|
||||||
|
* Class that encodes binary blobs into strings.
|
||||||
|
* Note that the encode/decode methods may change underlying encoding scheme.
|
||||||
|
*/
|
||||||
|
export default class Encoder {
|
||||||
|
/**
|
||||||
|
* Encodes given bytes into a Base64URL string.
|
||||||
|
*/
|
||||||
|
static encode(content) {
|
||||||
|
const encodedContent = base64url.baseEncode(content);
|
||||||
|
return encodedContent;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Decodes the given Base64URL string into bytes.
|
||||||
|
*/
|
||||||
|
static decodeAsBytes(encodedContent, inputContextForErrorLogging) {
|
||||||
|
if (!Encoder.isBase64UrlString(encodedContent)) {
|
||||||
|
throw new IonError(ErrorCode.EncodedStringIncorrectEncoding, `Given ${inputContextForErrorLogging} must be base64url string.`);
|
||||||
|
}
|
||||||
|
return base64url.baseDecode(encodedContent);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Decodes the given Base64URL string into the original string.
|
||||||
|
*/
|
||||||
|
static decodeAsString(encodedContent, inputContextForErrorLogging) {
|
||||||
|
const rawBytes = Encoder.decodeAsBytes(encodedContent, inputContextForErrorLogging);
|
||||||
|
return Encoder.bytesToString(rawBytes);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Tests if the given string is a Base64URL string.
|
||||||
|
*/
|
||||||
|
static isBase64UrlString(input) {
|
||||||
|
// NOTE:
|
||||||
|
// /<expression>/ denotes regex.
|
||||||
|
// ^ denotes beginning of string.
|
||||||
|
// $ denotes end of string.
|
||||||
|
// + denotes one or more characters.
|
||||||
|
const isBase64UrlString = /^[A-Za-z0-9_-]+$/.test(input);
|
||||||
|
return isBase64UrlString;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Converts input string to bytes.
|
||||||
|
*/
|
||||||
|
static stringToBytes(input) {
|
||||||
|
const bytes = new TextEncoder().encode(input);
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Converts bytes to string.
|
||||||
|
*/
|
||||||
|
static bytesToString(input) {
|
||||||
|
const output = new TextDecoder().decode(input);
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=Encoder.js.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Encoder.js.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Encoder.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Encoder.js","sourceRoot":"","sources":["../../lib/Encoder.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,OAAO;IAC1B;;OAEG;IACI,MAAM,CAAC,MAAM,CAAE,OAAmB;QACvC,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACrD,OAAO,cAAc,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,aAAa,CAAE,cAAsB,EAAE,2BAAmC;QACtF,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,CAAC;YAC/C,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,8BAA8B,EAAE,SAAS,2BAA2B,4BAA4B,CAAC,CAAC;QACjI,CAAC;QAED,OAAO,SAAS,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,cAAc,CAAE,cAAsB,EAAE,2BAAmC;QACvF,MAAM,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,cAAc,EAAE,2BAA2B,CAAC,CAAC;QAEpF,OAAO,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,iBAAiB,CAAE,KAAa;QAC5C,QAAQ;QACR,gCAAgC;QAChC,iCAAiC;QACjC,2BAA2B;QAC3B,oCAAoC;QACpC,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzD,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,aAAa,CAAE,KAAa;QACxC,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC9C,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,aAAa,CAAE,KAAiB;QAC5C,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/C,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
||||||
27
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/ErrorCode.d.ts
generated
vendored
Normal file
27
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/ErrorCode.d.ts
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
* ION SDK error codes.
|
||||||
|
*/
|
||||||
|
declare const _default: {
|
||||||
|
DeltaExceedsMaximumSize: string;
|
||||||
|
DidDocumentPublicKeyIdDuplicated: string;
|
||||||
|
DidDocumentPublicKeyMissingOrIncorrectType: string;
|
||||||
|
DidDocumentServiceIdDuplicated: string;
|
||||||
|
DidSuffixIncorrectLength: string;
|
||||||
|
EncodedStringIncorrectEncoding: string;
|
||||||
|
IdNotUsingBase64UrlCharacterSet: string;
|
||||||
|
IdTooLong: string;
|
||||||
|
JwkEs256kMissingOrInvalidCrv: string;
|
||||||
|
JwkEs256kMissingOrInvalidKty: string;
|
||||||
|
JwkEs256kHasIncorrectLengthOfX: string;
|
||||||
|
JwkEs256kHasIncorrectLengthOfY: string;
|
||||||
|
JwkEs256kHasIncorrectLengthOfD: string;
|
||||||
|
MultihashStringNotAMultihash: string;
|
||||||
|
MultihashUnsupportedHashAlgorithm: string;
|
||||||
|
PublicKeyJwkEs256kHasUnexpectedProperty: string;
|
||||||
|
PublicKeyPurposeDuplicated: string;
|
||||||
|
ServiceEndpointCannotBeAnArray: string;
|
||||||
|
ServiceEndpointStringNotValidUri: string;
|
||||||
|
ServiceTypeTooLong: string;
|
||||||
|
};
|
||||||
|
export default _default;
|
||||||
|
//# sourceMappingURL=ErrorCode.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/ErrorCode.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/ErrorCode.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"ErrorCode.d.ts","sourceRoot":"","sources":["../../lib/ErrorCode.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;AACH,wBAqBE"}
|
||||||
26
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/ErrorCode.js
generated
vendored
Normal file
26
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/ErrorCode.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* ION SDK error codes.
|
||||||
|
*/
|
||||||
|
export default {
|
||||||
|
DeltaExceedsMaximumSize: 'DeltaExceedsMaximumSize',
|
||||||
|
DidDocumentPublicKeyIdDuplicated: 'DidDocumentPublicKeyIdDuplicated',
|
||||||
|
DidDocumentPublicKeyMissingOrIncorrectType: 'DidDocumentPublicKeyMissingOrIncorrectType',
|
||||||
|
DidDocumentServiceIdDuplicated: 'DidDocumentServiceIdDuplicated',
|
||||||
|
DidSuffixIncorrectLength: 'DidSuffixIncorrectLength',
|
||||||
|
EncodedStringIncorrectEncoding: 'EncodedStringIncorrectEncoding',
|
||||||
|
IdNotUsingBase64UrlCharacterSet: 'IdNotUsingBase64UrlCharacterSet',
|
||||||
|
IdTooLong: 'IdTooLong',
|
||||||
|
JwkEs256kMissingOrInvalidCrv: 'JwkEs256kMissingOrInvalidCrv',
|
||||||
|
JwkEs256kMissingOrInvalidKty: 'JwkEs256kMissingOrInvalidKty',
|
||||||
|
JwkEs256kHasIncorrectLengthOfX: 'JwkEs256kHasIncorrectLengthOfX',
|
||||||
|
JwkEs256kHasIncorrectLengthOfY: 'JwkEs256kHasIncorrectLengthOfY',
|
||||||
|
JwkEs256kHasIncorrectLengthOfD: 'JwkEs256kHasIncorrectLengthOfD',
|
||||||
|
MultihashStringNotAMultihash: 'MultihashStringNotAMultihash',
|
||||||
|
MultihashUnsupportedHashAlgorithm: 'MultihashUnsupportedHashAlgorithm',
|
||||||
|
PublicKeyJwkEs256kHasUnexpectedProperty: 'PublicKeyJwkEs256kHasUnexpectedProperty',
|
||||||
|
PublicKeyPurposeDuplicated: 'PublicKeyPurposeDuplicated',
|
||||||
|
ServiceEndpointCannotBeAnArray: 'ServiceEndpointCannotBeAnArray',
|
||||||
|
ServiceEndpointStringNotValidUri: 'ServiceEndpointStringNotValidUri',
|
||||||
|
ServiceTypeTooLong: 'ServiceTypeTooLong'
|
||||||
|
};
|
||||||
|
//# sourceMappingURL=ErrorCode.js.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/ErrorCode.js.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/ErrorCode.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"ErrorCode.js","sourceRoot":"","sources":["../../lib/ErrorCode.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAe;IACb,uBAAuB,EAAE,yBAAyB;IAClD,gCAAgC,EAAE,kCAAkC;IACpE,0CAA0C,EAAE,4CAA4C;IACxF,8BAA8B,EAAE,gCAAgC;IAChE,wBAAwB,EAAE,0BAA0B;IACpD,8BAA8B,EAAE,gCAAgC;IAChE,+BAA+B,EAAE,iCAAiC;IAClE,SAAS,EAAE,WAAW;IACtB,4BAA4B,EAAE,8BAA8B;IAC5D,4BAA4B,EAAE,8BAA8B;IAC5D,8BAA8B,EAAE,gCAAgC;IAChE,8BAA8B,EAAE,gCAAgC;IAChE,8BAA8B,EAAE,gCAAgC;IAChE,4BAA4B,EAAE,8BAA8B;IAC5D,iCAAiC,EAAE,mCAAmC;IACtE,uCAAuC,EAAE,yCAAyC;IAClF,0BAA0B,EAAE,4BAA4B;IACxD,8BAA8B,EAAE,gCAAgC;IAChE,gCAAgC,EAAE,kCAAkC;IACpE,kBAAkB,EAAE,oBAAoB;CACzC,CAAC"}
|
||||||
21
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/InputValidator.d.ts
generated
vendored
Normal file
21
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/InputValidator.d.ts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import IonPublicKeyPurpose from './enums/IonPublicKeyPurpose.js';
|
||||||
|
import JwkEs256k from './models/JwkEs256k.js';
|
||||||
|
import OperationKeyType from './enums/OperationKeyType.js';
|
||||||
|
/**
|
||||||
|
* Class containing input validation methods.
|
||||||
|
*/
|
||||||
|
export default class InputValidator {
|
||||||
|
/**
|
||||||
|
* Validates the schema of a ES256K JWK key.
|
||||||
|
*/
|
||||||
|
static validateEs256kOperationKey(operationKeyJwk: JwkEs256k, operationKeyType: OperationKeyType): void;
|
||||||
|
/**
|
||||||
|
* Validates an `id` property (in `IonPublicKeyModel` and `IonServiceModel`).
|
||||||
|
*/
|
||||||
|
static validateId(id: string): void;
|
||||||
|
/**
|
||||||
|
* Validates the given public key purposes.
|
||||||
|
*/
|
||||||
|
static validatePublicKeyPurposes(purposes?: IonPublicKeyPurpose[]): void;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=InputValidator.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/InputValidator.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/InputValidator.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"InputValidator.d.ts","sourceRoot":"","sources":["../../lib/InputValidator.ts"],"names":[],"mappings":"AAGA,OAAO,mBAAmB,MAAM,gCAAgC,CAAC;AACjE,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAC9C,OAAO,gBAAgB,MAAM,6BAA6B,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC;;OAEG;WACW,0BAA0B,CAAE,eAAe,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB;IAiCxG;;OAEG;WACW,UAAU,CAAE,EAAE,EAAE,MAAM;IAWpC;;OAEG;WACW,yBAAyB,CAAE,QAAQ,CAAC,EAAE,mBAAmB,EAAE;CAe1E"}
|
||||||
69
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/InputValidator.js
generated
vendored
Normal file
69
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/InputValidator.js
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
import Encoder from './Encoder.js';
|
||||||
|
import ErrorCode from './ErrorCode.js';
|
||||||
|
import IonError from './IonError.js';
|
||||||
|
import OperationKeyType from './enums/OperationKeyType.js';
|
||||||
|
/**
|
||||||
|
* Class containing input validation methods.
|
||||||
|
*/
|
||||||
|
export default class InputValidator {
|
||||||
|
/**
|
||||||
|
* Validates the schema of a ES256K JWK key.
|
||||||
|
*/
|
||||||
|
static validateEs256kOperationKey(operationKeyJwk, operationKeyType) {
|
||||||
|
const allowedProperties = new Set(['kty', 'crv', 'x', 'y']);
|
||||||
|
if (operationKeyType === OperationKeyType.Private) {
|
||||||
|
allowedProperties.add('d');
|
||||||
|
}
|
||||||
|
for (const property in operationKeyJwk) {
|
||||||
|
if (!allowedProperties.has(property)) {
|
||||||
|
throw new IonError(ErrorCode.PublicKeyJwkEs256kHasUnexpectedProperty, `SECP256K1 JWK key has unexpected property '${property}'.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (operationKeyJwk.crv !== 'secp256k1') {
|
||||||
|
throw new IonError(ErrorCode.JwkEs256kMissingOrInvalidCrv, `SECP256K1 JWK 'crv' property must be 'secp256k1' but got '${operationKeyJwk.crv}.'`);
|
||||||
|
}
|
||||||
|
if (operationKeyJwk.kty !== 'EC') {
|
||||||
|
throw new IonError(ErrorCode.JwkEs256kMissingOrInvalidKty, `SECP256K1 JWK 'kty' property must be 'EC' but got '${operationKeyJwk.kty}.'`);
|
||||||
|
}
|
||||||
|
// `x` and `y` need 43 Base64URL encoded bytes to contain 256 bits.
|
||||||
|
if (operationKeyJwk.x.length !== 43) {
|
||||||
|
throw new IonError(ErrorCode.JwkEs256kHasIncorrectLengthOfX, `SECP256K1 JWK 'x' property must be 43 bytes.`);
|
||||||
|
}
|
||||||
|
if (operationKeyJwk.y.length !== 43) {
|
||||||
|
throw new IonError(ErrorCode.JwkEs256kHasIncorrectLengthOfY, `SECP256K1 JWK 'y' property must be 43 bytes.`);
|
||||||
|
}
|
||||||
|
if (operationKeyType === OperationKeyType.Private && (operationKeyJwk.d === undefined || operationKeyJwk.d.length !== 43)) {
|
||||||
|
throw new IonError(ErrorCode.JwkEs256kHasIncorrectLengthOfD, `SECP256K1 JWK 'd' property must be 43 bytes.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Validates an `id` property (in `IonPublicKeyModel` and `IonServiceModel`).
|
||||||
|
*/
|
||||||
|
static validateId(id) {
|
||||||
|
const maxIdLength = 50;
|
||||||
|
if (id.length > maxIdLength) {
|
||||||
|
throw new IonError(ErrorCode.IdTooLong, `Key ID length ${id.length} exceed max allowed length of ${maxIdLength}.`);
|
||||||
|
}
|
||||||
|
if (!Encoder.isBase64UrlString(id)) {
|
||||||
|
throw new IonError(ErrorCode.IdNotUsingBase64UrlCharacterSet, `Key ID '${id}' is not a Base64URL string.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Validates the given public key purposes.
|
||||||
|
*/
|
||||||
|
static validatePublicKeyPurposes(purposes) {
|
||||||
|
// Nothing to validate if `purposes` is undefined.
|
||||||
|
if (purposes === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Validate that all purposes are be unique.
|
||||||
|
const processedPurposes = new Set();
|
||||||
|
for (const purpose of purposes) {
|
||||||
|
if (processedPurposes.has(purpose)) {
|
||||||
|
throw new IonError(ErrorCode.PublicKeyPurposeDuplicated, `Public key purpose '${purpose}' already specified.`);
|
||||||
|
}
|
||||||
|
processedPurposes.add(purpose);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=InputValidator.js.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/InputValidator.js.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/InputValidator.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"InputValidator.js","sourceRoot":"","sources":["../../lib/InputValidator.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,QAAQ,MAAM,eAAe,CAAC;AAGrC,OAAO,gBAAgB,MAAM,6BAA6B,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC;;OAEG;IACI,MAAM,CAAC,0BAA0B,CAAE,eAA0B,EAAE,gBAAkC;QACtG,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QAC5D,IAAI,gBAAgB,KAAK,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAClD,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QACD,KAAK,MAAM,QAAQ,IAAI,eAAe,EAAE,CAAC;YACvC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACrC,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,uCAAuC,EAAE,8CAA8C,QAAQ,IAAI,CAAC,CAAC;YACpI,CAAC;QACH,CAAC;QAED,IAAI,eAAe,CAAC,GAAG,KAAK,WAAW,EAAE,CAAC;YACxC,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,4BAA4B,EAAE,6DAA6D,eAAe,CAAC,GAAG,IAAI,CAAC,CAAC;QACnJ,CAAC;QAED,IAAI,eAAe,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;YACjC,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,4BAA4B,EAAE,sDAAsD,eAAe,CAAC,GAAG,IAAI,CAAC,CAAC;QAC5I,CAAC;QAED,mEAAmE;QACnE,IAAI,eAAe,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YACpC,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,8BAA8B,EAAE,8CAA8C,CAAC,CAAC;QAC/G,CAAC;QAED,IAAI,eAAe,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YACpC,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,8BAA8B,EAAE,8CAA8C,CAAC,CAAC;QAC/G,CAAC;QAED,IAAI,gBAAgB,KAAK,gBAAgB,CAAC,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC,KAAK,SAAS,IAAI,eAAe,CAAC,CAAC,CAAC,MAAM,KAAK,EAAE,CAAC,EAAE,CAAC;YAC1H,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,8BAA8B,EAAE,8CAA8C,CAAC,CAAC;QAC/G,CAAC;IACH,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,UAAU,CAAE,EAAU;QAClC,MAAM,WAAW,GAAG,EAAE,CAAC;QACvB,IAAI,EAAE,CAAC,MAAM,GAAG,WAAW,EAAE,CAAC;YAC5B,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,iBAAiB,EAAE,CAAC,MAAM,iCAAiC,WAAW,GAAG,CAAC,CAAC;QACrH,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,+BAA+B,EAAE,WAAW,EAAE,8BAA8B,CAAC,CAAC;QAC7G,CAAC;IACH,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,yBAAyB,CAAE,QAAgC;QACvE,kDAAkD;QAClD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO;QACT,CAAC;QAED,4CAA4C;QAC5C,MAAM,iBAAiB,GAA6B,IAAI,GAAG,EAAE,CAAC;QAC9D,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,IAAI,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;gBACnC,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,0BAA0B,EAAE,uBAAuB,OAAO,sBAAsB,CAAC,CAAC;YACjH,CAAC;YACD,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;CACF"}
|
||||||
21
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonDid.d.ts
generated
vendored
Normal file
21
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonDid.d.ts
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import IonDocumentModel from './models/IonDocumentModel.js';
|
||||||
|
import JwkEs256k from './models/JwkEs256k.js';
|
||||||
|
/**
|
||||||
|
* Class containing DID related operations.
|
||||||
|
*/
|
||||||
|
export default class IonDid {
|
||||||
|
/**
|
||||||
|
* Creates a long-form DID.
|
||||||
|
* @param input.document The initial state to be associate with the ION DID to be created using a `replace` document patch action.
|
||||||
|
*/
|
||||||
|
static createLongFormDid(input: {
|
||||||
|
recoveryKey: JwkEs256k;
|
||||||
|
updateKey: JwkEs256k;
|
||||||
|
document: IonDocumentModel;
|
||||||
|
}): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Computes the DID unique suffix given the encoded suffix data string.
|
||||||
|
*/
|
||||||
|
private static computeDidUniqueSuffix;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=IonDid.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonDid.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonDid.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"IonDid.d.ts","sourceRoot":"","sources":["../../lib/IonDid.ts"],"names":[],"mappings":"AAEA,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAI5D,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAG9C;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB;;;OAGG;WACiB,iBAAiB,CAAE,KAAK,EAAE;QAC5C,WAAW,EAAE,SAAS,CAAC;QACvB,SAAS,EAAE,SAAS,CAAC;QACrB,QAAQ,EAAE,gBAAgB,CAAC;KAC5B,GAAG,OAAO,CAAC,MAAM,CAAC;IA0BnB;;OAEG;mBACkB,sBAAsB;CAM5C"}
|
||||||
58
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonDid.js
generated
vendored
Normal file
58
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonDid.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
import Encoder from './Encoder.js';
|
||||||
|
import IonRequest from './IonRequest.js';
|
||||||
|
import IonSdkConfig from './IonSdkConfig.js';
|
||||||
|
import JsonCanonicalizer from './JsonCanonicalizer.js';
|
||||||
|
import Multihash from './Multihash.js';
|
||||||
|
/**
|
||||||
|
* Class containing DID related operations.
|
||||||
|
*/
|
||||||
|
export default class IonDid {
|
||||||
|
/**
|
||||||
|
* Creates a long-form DID.
|
||||||
|
* @param input.document The initial state to be associate with the ION DID to be created using a `replace` document patch action.
|
||||||
|
*/
|
||||||
|
static createLongFormDid(input) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const createRequest = yield IonRequest.createCreateRequest(input);
|
||||||
|
const didUniqueSuffix = yield IonDid.computeDidUniqueSuffix(createRequest.suffixData);
|
||||||
|
// Add the network portion if not configured for mainnet.
|
||||||
|
let shortFormDid;
|
||||||
|
if (IonSdkConfig.network === undefined || IonSdkConfig.network === 'mainnet') {
|
||||||
|
shortFormDid = `did:ion:${didUniqueSuffix}`;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
shortFormDid = `did:ion:${IonSdkConfig.network}:${didUniqueSuffix}`;
|
||||||
|
}
|
||||||
|
const initialState = {
|
||||||
|
suffixData: createRequest.suffixData,
|
||||||
|
delta: createRequest.delta
|
||||||
|
};
|
||||||
|
// Initial state must be canonicalized as per spec.
|
||||||
|
const canonicalizedInitialStateBytes = JsonCanonicalizer.canonicalizeAsBytes(initialState);
|
||||||
|
const encodedCanonicalizedInitialStateString = Encoder.encode(canonicalizedInitialStateBytes);
|
||||||
|
const longFormDid = `${shortFormDid}:${encodedCanonicalizedInitialStateString}`;
|
||||||
|
return longFormDid;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Computes the DID unique suffix given the encoded suffix data string.
|
||||||
|
*/
|
||||||
|
static computeDidUniqueSuffix(suffixData) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const canonicalizedStringBytes = JsonCanonicalizer.canonicalizeAsBytes(suffixData);
|
||||||
|
const multihash = yield Multihash.hash(canonicalizedStringBytes, IonSdkConfig.hashAlgorithmInMultihashCode);
|
||||||
|
const encodedMultihash = Encoder.encode(multihash);
|
||||||
|
return encodedMultihash;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=IonDid.js.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonDid.js.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonDid.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"IonDid.js","sourceRoot":"","sources":["../../lib/IonDid.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AAGnC,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAEvD,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAEvC;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB;;;OAGG;IACI,MAAM,CAAO,iBAAiB,CAAE,KAItC;;YACC,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;YAElE,MAAM,eAAe,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAEtF,yDAAyD;YACzD,IAAI,YAAY,CAAC;YACjB,IAAI,YAAY,CAAC,OAAO,KAAK,SAAS,IAAI,YAAY,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC7E,YAAY,GAAG,WAAW,eAAe,EAAE,CAAC;YAC9C,CAAC;iBAAM,CAAC;gBACN,YAAY,GAAG,WAAW,YAAY,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC;YACtE,CAAC;YAED,MAAM,YAAY,GAAG;gBACnB,UAAU,EAAE,aAAa,CAAC,UAAU;gBACpC,KAAK,EAAE,aAAa,CAAC,KAAK;aAC3B,CAAC;YAEF,mDAAmD;YACnD,MAAM,8BAA8B,GAAG,iBAAiB,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;YAC3F,MAAM,sCAAsC,GAAG,OAAO,CAAC,MAAM,CAAC,8BAA8B,CAAC,CAAC;YAE9F,MAAM,WAAW,GAAG,GAAG,YAAY,IAAI,sCAAsC,EAAE,CAAC;YAChF,OAAO,WAAW,CAAC;QACrB,CAAC;KAAA;IAED;;OAEG;IACK,MAAM,CAAO,sBAAsB,CAAE,UAA+C;;YAC1F,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;YACnF,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,wBAAwB,EAAE,YAAY,CAAC,4BAA4B,CAAC,CAAC;YAC5G,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACnD,OAAO,gBAAgB,CAAC;QAC1B,CAAC;KAAA;CACF"}
|
||||||
8
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonError.d.ts
generated
vendored
Normal file
8
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonError.d.ts
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* A class that represents an ION error.
|
||||||
|
*/
|
||||||
|
export default class IonError extends Error {
|
||||||
|
code: string;
|
||||||
|
constructor(code: string, message: string);
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=IonError.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonError.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonError.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"IonError.d.ts","sourceRoot":"","sources":["../../lib/IonError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,KAAK;IACrB,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAOlD"}
|
||||||
13
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonError.js
generated
vendored
Normal file
13
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonError.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* A class that represents an ION error.
|
||||||
|
*/
|
||||||
|
export default class IonError extends Error {
|
||||||
|
constructor(code, message) {
|
||||||
|
super(`${code}: ${message}`);
|
||||||
|
this.code = code;
|
||||||
|
// NOTE: Extending 'Error' breaks prototype chain since TypeScript 2.1.
|
||||||
|
// The following line restores prototype chain.
|
||||||
|
Object.setPrototypeOf(this, new.target.prototype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=IonError.js.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonError.js.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonError.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"IonError.js","sourceRoot":"","sources":["../../lib/IonError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,KAAK;IACzC,YAAoB,IAAY,EAAE,OAAe;QAC/C,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QADX,SAAI,GAAJ,IAAI,CAAQ;QAG9B,uEAAuE;QACvE,+CAA+C;QAC/C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF"}
|
||||||
42
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonKey.d.ts
generated
vendored
Normal file
42
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonKey.d.ts
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import IonPublicKeyModel from './models/IonPublicKeyModel.js';
|
||||||
|
import IonPublicKeyPurpose from './enums/IonPublicKeyPurpose.js';
|
||||||
|
import JwkEd25519 from './models/JwkEd25519.js';
|
||||||
|
import JwkEs256k from './models/JwkEs256k.js';
|
||||||
|
/**
|
||||||
|
* Class containing operations related to keys used in ION.
|
||||||
|
*/
|
||||||
|
export default class IonKey {
|
||||||
|
/**
|
||||||
|
* Generates SECP256K1 key pair to be used in an operation.
|
||||||
|
* Mainly used for testing.
|
||||||
|
* @returns [publicKey, privateKey]
|
||||||
|
*/
|
||||||
|
static generateEs256kDidDocumentKeyPair(input: {
|
||||||
|
id: string;
|
||||||
|
purposes?: IonPublicKeyPurpose[];
|
||||||
|
}): Promise<[IonPublicKeyModel, JwkEs256k]>;
|
||||||
|
/**
|
||||||
|
* Generates SECP256K1 key pair for ION operation use.
|
||||||
|
* @returns [publicKey, privateKey]
|
||||||
|
*/
|
||||||
|
static generateEs256kOperationKeyPair(): Promise<[JwkEs256k, JwkEs256k]>;
|
||||||
|
private static generateEs256kKeyPair;
|
||||||
|
/**
|
||||||
|
* Generates Ed25519 key pair to be used in an operation.
|
||||||
|
* Mainly used for testing.
|
||||||
|
* @returns [publicKey, privateKey]
|
||||||
|
*/
|
||||||
|
static generateEd25519DidDocumentKeyPair(input: {
|
||||||
|
id: string;
|
||||||
|
purposes?: IonPublicKeyPurpose[];
|
||||||
|
}): Promise<[IonPublicKeyModel, JwkEd25519]>;
|
||||||
|
/**
|
||||||
|
* Generates Ed25519 key pair for ION operation use.
|
||||||
|
* @returns [publicKey, privateKey]
|
||||||
|
*/
|
||||||
|
static generateEd25519OperationKeyPair(): Promise<[JwkEd25519, JwkEd25519]>;
|
||||||
|
private static generateEd25519KeyPair;
|
||||||
|
static isJwkEs256k(key: JwkEs256k | JwkEd25519): key is JwkEs256k;
|
||||||
|
static isJwkEd25519(key: JwkEs256k | JwkEd25519): key is JwkEd25519;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=IonKey.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonKey.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonKey.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"IonKey.d.ts","sourceRoot":"","sources":["../../lib/IonKey.ts"],"names":[],"mappings":"AAGA,OAAO,iBAAiB,MAAM,+BAA+B,CAAC;AAC9D,OAAO,mBAAmB,MAAM,gCAAgC,CAAC;AACjE,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAG9C;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB;;;;OAIG;WACiB,gCAAgC,CAAE,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,mBAAmB,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;IAsBvJ;;;OAGG;WACiB,8BAA8B,IAAK,OAAO,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;mBAKjE,qBAAqB;IA6B1C;;;;OAIG;WACiB,iCAAiC,CAAE,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,mBAAmB,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;IAsBzJ;;;OAGG;WACiB,+BAA+B,IAAK,OAAO,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;mBAKpE,sBAAsB;WAmB7B,WAAW,CAAE,GAAG,EAAE,SAAS,GAAG,UAAU,GAAG,GAAG,IAAI,SAAS;WAI3D,YAAY,CAAE,GAAG,EAAE,SAAS,GAAG,UAAU,GAAG,GAAG,IAAI,UAAU;CAG5E"}
|
||||||
138
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonKey.js
generated
vendored
Normal file
138
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonKey.js
generated
vendored
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
import * as Ed25519 from '@noble/ed25519';
|
||||||
|
import * as Secp256k1 from '@noble/secp256k1';
|
||||||
|
import InputValidator from './InputValidator.js';
|
||||||
|
import { base64url } from 'multiformats/bases/base64';
|
||||||
|
/**
|
||||||
|
* Class containing operations related to keys used in ION.
|
||||||
|
*/
|
||||||
|
export default class IonKey {
|
||||||
|
/**
|
||||||
|
* Generates SECP256K1 key pair to be used in an operation.
|
||||||
|
* Mainly used for testing.
|
||||||
|
* @returns [publicKey, privateKey]
|
||||||
|
*/
|
||||||
|
static generateEs256kDidDocumentKeyPair(input) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const id = input.id;
|
||||||
|
const purposes = input.purposes;
|
||||||
|
InputValidator.validateId(id);
|
||||||
|
InputValidator.validatePublicKeyPurposes(purposes);
|
||||||
|
const [publicKey, privateKey] = yield IonKey.generateEs256kKeyPair();
|
||||||
|
const publicKeyModel = {
|
||||||
|
id,
|
||||||
|
type: 'EcdsaSecp256k1VerificationKey2019',
|
||||||
|
publicKeyJwk: publicKey
|
||||||
|
};
|
||||||
|
// Only add the `purposes` property If given `purposes` array has at least an entry.
|
||||||
|
if (purposes !== undefined && purposes.length > 0) {
|
||||||
|
publicKeyModel.purposes = purposes;
|
||||||
|
}
|
||||||
|
return [publicKeyModel, privateKey];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Generates SECP256K1 key pair for ION operation use.
|
||||||
|
* @returns [publicKey, privateKey]
|
||||||
|
*/
|
||||||
|
static generateEs256kOperationKeyPair() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const keyPair = yield IonKey.generateEs256kKeyPair();
|
||||||
|
return keyPair;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
static generateEs256kKeyPair() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const privateKeyBytes = Secp256k1.utils.randomPrivateKey();
|
||||||
|
const compressedPublicKeyBytes = Secp256k1.getPublicKey(privateKeyBytes);
|
||||||
|
const compressedPublicKeyHex = Secp256k1.etc.bytesToHex(compressedPublicKeyBytes);
|
||||||
|
const curvePoints = Secp256k1.ProjectivePoint.fromHex(compressedPublicKeyHex);
|
||||||
|
const uncompressedPublicKeyBytes = curvePoints.toRawBytes(false); // false = uncompressed
|
||||||
|
// we need uncompressed public key so that it contains both the x and y values for the JWK format:
|
||||||
|
// the first byte is a header that indicates whether the key is uncompressed (0x04 if uncompressed).
|
||||||
|
// bytes 1 - 32 represent X
|
||||||
|
// bytes 33 - 64 represent Y
|
||||||
|
const d = base64url.baseEncode(privateKeyBytes);
|
||||||
|
// skip the first byte because it's used as a header to indicate whether the key is uncompressed
|
||||||
|
const x = base64url.baseEncode(uncompressedPublicKeyBytes.subarray(1, 33));
|
||||||
|
const y = base64url.baseEncode(uncompressedPublicKeyBytes.subarray(33, 65));
|
||||||
|
const publicJwk = {
|
||||||
|
// alg: 'ES256K',
|
||||||
|
kty: 'EC',
|
||||||
|
crv: 'secp256k1',
|
||||||
|
x,
|
||||||
|
y
|
||||||
|
};
|
||||||
|
const privateJwk = Object.assign(Object.assign({}, publicJwk), { d });
|
||||||
|
return [publicJwk, privateJwk];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Generates Ed25519 key pair to be used in an operation.
|
||||||
|
* Mainly used for testing.
|
||||||
|
* @returns [publicKey, privateKey]
|
||||||
|
*/
|
||||||
|
static generateEd25519DidDocumentKeyPair(input) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const id = input.id;
|
||||||
|
const purposes = input.purposes;
|
||||||
|
InputValidator.validateId(id);
|
||||||
|
InputValidator.validatePublicKeyPurposes(purposes);
|
||||||
|
const [publicKey, privateKey] = yield IonKey.generateEd25519KeyPair();
|
||||||
|
const publicKeyModel = {
|
||||||
|
id,
|
||||||
|
type: 'JsonWebKey2020',
|
||||||
|
publicKeyJwk: publicKey
|
||||||
|
};
|
||||||
|
// Only add the `purposes` property If given `purposes` array has at least an entry.
|
||||||
|
if (purposes !== undefined && purposes.length > 0) {
|
||||||
|
publicKeyModel.purposes = purposes;
|
||||||
|
}
|
||||||
|
return [publicKeyModel, privateKey];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Generates Ed25519 key pair for ION operation use.
|
||||||
|
* @returns [publicKey, privateKey]
|
||||||
|
*/
|
||||||
|
static generateEd25519OperationKeyPair() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const keyPair = yield IonKey.generateEd25519KeyPair();
|
||||||
|
return keyPair;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
static generateEd25519KeyPair() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const privateKeyBytes = Ed25519.utils.randomPrivateKey();
|
||||||
|
const privateKeyHex = Ed25519.etc.bytesToHex(privateKeyBytes);
|
||||||
|
const publicKeyBytes = yield Ed25519.getPublicKeyAsync(privateKeyHex);
|
||||||
|
const d = base64url.baseEncode(privateKeyBytes);
|
||||||
|
const x = base64url.baseEncode(publicKeyBytes);
|
||||||
|
const publicJwk = {
|
||||||
|
// alg: 'EdDSA',
|
||||||
|
kty: 'OKP',
|
||||||
|
crv: 'Ed25519',
|
||||||
|
x
|
||||||
|
};
|
||||||
|
const privateJwk = Object.assign(Object.assign({}, publicJwk), { d });
|
||||||
|
return [publicJwk, privateJwk];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
static isJwkEs256k(key) {
|
||||||
|
return key.crv === 'secp256k1' && key.kty === 'EC';
|
||||||
|
}
|
||||||
|
;
|
||||||
|
static isJwkEd25519(key) {
|
||||||
|
return key.crv === 'Ed25519' && key.kty === 'OKP';
|
||||||
|
}
|
||||||
|
;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=IonKey.js.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonKey.js.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonKey.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"IonKey.js","sourceRoot":"","sources":["../../lib/IonKey.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAC9C,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAKjD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB;;;;OAIG;IACI,MAAM,CAAO,gCAAgC,CAAE,KAAuD;;YAC3G,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;YACpB,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;YAEhC,cAAc,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YAC9B,cAAc,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC;YAEnD,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,MAAM,MAAM,CAAC,qBAAqB,EAAE,CAAC;YACrE,MAAM,cAAc,GAAsB;gBACxC,EAAE;gBACF,IAAI,EAAE,mCAAmC;gBACzC,YAAY,EAAE,SAAS;aACxB,CAAC;YAEF,oFAAoF;YACpF,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAClD,cAAc,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACrC,CAAC;YAED,OAAO,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QACtC,CAAC;KAAA;IAED;;;OAGG;IACI,MAAM,CAAO,8BAA8B;;YAChD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,qBAAqB,EAAE,CAAC;YACrD,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;IAEO,MAAM,CAAO,qBAAqB;;YACxC,MAAM,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;YAC3D,MAAM,wBAAwB,GAAG,SAAS,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;YACzE,MAAM,sBAAsB,GAAG,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC;YAClF,MAAM,WAAW,GAAG,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;YAC9E,MAAM,0BAA0B,GAAG,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,uBAAuB;YAEzF,kGAAkG;YAClG,oGAAoG;YACpG,2BAA2B;YAC3B,4BAA4B;YAE5B,MAAM,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;YAChD,gGAAgG;YAChG,MAAM,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,0BAA0B,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YAC3E,MAAM,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,0BAA0B,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;YAE5E,MAAM,SAAS,GAAG;gBAChB,iBAAiB;gBACjB,GAAG,EAAE,IAAI;gBACT,GAAG,EAAE,WAAW;gBAChB,CAAC;gBACD,CAAC;aACF,CAAC;YACF,MAAM,UAAU,mCAAQ,SAAS,KAAE,CAAC,GAAE,CAAC;YAEvC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACjC,CAAC;KAAA;IAED;;;;OAIG;IACI,MAAM,CAAO,iCAAiC,CAAE,KAAuD;;YAC5G,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;YACpB,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;YAEhC,cAAc,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YAC9B,cAAc,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC;YAEnD,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,MAAM,MAAM,CAAC,sBAAsB,EAAE,CAAC;YACtE,MAAM,cAAc,GAAsB;gBACxC,EAAE;gBACF,IAAI,EAAE,gBAAgB;gBACtB,YAAY,EAAE,SAAS;aACxB,CAAC;YAEF,oFAAoF;YACpF,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAClD,cAAc,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACrC,CAAC;YAED,OAAO,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QACtC,CAAC;KAAA;IAED;;;OAGG;IACI,MAAM,CAAO,+BAA+B;;YACjD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,sBAAsB,EAAE,CAAC;YACtD,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;IAEO,MAAM,CAAO,sBAAsB;;YACzC,MAAM,eAAe,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC;YACzD,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;YAC9D,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;YAEtE,MAAM,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;YAChD,MAAM,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;YAE/C,MAAM,SAAS,GAAG;gBAChB,gBAAgB;gBAChB,GAAG,EAAE,KAAK;gBACV,GAAG,EAAE,SAAS;gBACd,CAAC;aACF,CAAC;YACF,MAAM,UAAU,mCAAQ,SAAS,KAAE,CAAC,GAAE,CAAC;YAEvC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACjC,CAAC;KAAA;IAEM,MAAM,CAAC,WAAW,CAAE,GAA2B;QACpD,OAAO,GAAG,CAAC,GAAG,KAAK,WAAW,IAAI,GAAG,CAAC,GAAG,KAAK,IAAI,CAAC;IACrD,CAAC;IAAA,CAAC;IAEK,MAAM,CAAC,YAAY,CAAE,GAA2B;QACrD,OAAO,GAAG,CAAC,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK,KAAK,CAAC;IACpD,CAAC;IAAA,CAAC;CACH"}
|
||||||
52
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonRequest.d.ts
generated
vendored
Normal file
52
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonRequest.d.ts
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import ISigner from './interfaces/ISigner.js';
|
||||||
|
import IonCreateRequestModel from './models/IonCreateRequestModel.js';
|
||||||
|
import IonDeactivateRequestModel from './models/IonDeactivateRequestModel.js';
|
||||||
|
import IonDocumentModel from './models/IonDocumentModel.js';
|
||||||
|
import IonPublicKeyModel from './models/IonPublicKeyModel.js';
|
||||||
|
import IonRecoverRequestModel from './models/IonRecoverRequestModel.js';
|
||||||
|
import IonServiceModel from './models/IonServiceModel.js';
|
||||||
|
import IonUpdateRequestModel from './models/IonUpdateRequestModel.js';
|
||||||
|
import JwkEs256k from './models/JwkEs256k.js';
|
||||||
|
/**
|
||||||
|
* Class containing operations related to ION requests.
|
||||||
|
*/
|
||||||
|
export default class IonRequest {
|
||||||
|
/**
|
||||||
|
* Creates an ION DID create request.
|
||||||
|
* @param input.document The initial state to be associate with the ION DID to be created using a `replace` document patch action.
|
||||||
|
*/
|
||||||
|
static createCreateRequest(input: {
|
||||||
|
recoveryKey: JwkEs256k;
|
||||||
|
updateKey: JwkEs256k;
|
||||||
|
document: IonDocumentModel;
|
||||||
|
}): Promise<IonCreateRequestModel>;
|
||||||
|
static createDeactivateRequest(input: {
|
||||||
|
didSuffix: string;
|
||||||
|
recoveryPublicKey: JwkEs256k;
|
||||||
|
signer: ISigner;
|
||||||
|
}): Promise<IonDeactivateRequestModel>;
|
||||||
|
static createRecoverRequest(input: {
|
||||||
|
didSuffix: string;
|
||||||
|
recoveryPublicKey: JwkEs256k;
|
||||||
|
nextRecoveryPublicKey: JwkEs256k;
|
||||||
|
nextUpdatePublicKey: JwkEs256k;
|
||||||
|
document: IonDocumentModel;
|
||||||
|
signer: ISigner;
|
||||||
|
}): Promise<IonRecoverRequestModel>;
|
||||||
|
static createUpdateRequest(input: {
|
||||||
|
didSuffix: string;
|
||||||
|
updatePublicKey: JwkEs256k;
|
||||||
|
nextUpdatePublicKey: JwkEs256k;
|
||||||
|
signer: ISigner;
|
||||||
|
servicesToAdd?: IonServiceModel[];
|
||||||
|
idsOfServicesToRemove?: string[];
|
||||||
|
publicKeysToAdd?: IonPublicKeyModel[];
|
||||||
|
idsOfPublicKeysToRemove?: string[];
|
||||||
|
}): Promise<IonUpdateRequestModel>;
|
||||||
|
private static validateDidSuffix;
|
||||||
|
private static validateDidDocumentKeys;
|
||||||
|
private static validateServices;
|
||||||
|
private static validateService;
|
||||||
|
private static validateDeltaSize;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=IonRequest.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonRequest.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonRequest.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"IonRequest.d.ts","sourceRoot":"","sources":["../../lib/IonRequest.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAE9C,OAAO,qBAAqB,MAAM,mCAAmC,CAAC;AACtE,OAAO,yBAAyB,MAAM,uCAAuC,CAAC;AAC9E,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAE5D,OAAO,iBAAiB,MAAM,+BAA+B,CAAC;AAC9D,OAAO,sBAAsB,MAAM,oCAAoC,CAAC;AAExE,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAC1D,OAAO,qBAAqB,MAAM,mCAAmC,CAAC;AAEtE,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAM9C;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B;;;OAGG;WACiB,mBAAmB,CAAE,KAAK,EAAE;QAC9C,WAAW,EAAE,SAAS,CAAC;QACvB,SAAS,EAAE,SAAS,CAAC;QACrB,QAAQ,EAAE,gBAAgB,CAAC;KAC5B,GAAG,OAAO,CAAC,qBAAqB,CAAC;WA8Cd,uBAAuB,CAAE,KAAK,EAAE;QAClD,SAAS,EAAE,MAAM,CAAC;QAClB,iBAAiB,EAAE,SAAS,CAAC;QAC7B,MAAM,EAAE,OAAO,CAAA;KAChB,GAAG,OAAO,CAAC,yBAAyB,CAAC;WAyBlB,oBAAoB,CAAE,KAAK,EAAE;QAC/C,SAAS,EAAE,MAAM,CAAC;QAClB,iBAAiB,EAAE,SAAS,CAAC;QAC7B,qBAAqB,EAAE,SAAS,CAAC;QACjC,mBAAmB,EAAE,SAAS,CAAC;QAC/B,QAAQ,EAAE,gBAAgB,CAAC;QAC3B,MAAM,EAAE,OAAO,CAAA;KAChB,GAAG,OAAO,CAAC,sBAAsB,CAAC;WAqDf,mBAAmB,CAAE,KAAK,EAAE;QAC9C,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,SAAS,CAAC;QAC3B,mBAAmB,EAAE,SAAS,CAAC;QAC/B,MAAM,EAAE,OAAO,CAAC;QAChB,aAAa,CAAC,EAAE,eAAe,EAAE,CAAC;QAClC,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;QACjC,eAAe,CAAC,EAAE,iBAAiB,EAAE,CAAC;QACtC,uBAAuB,CAAC,EAAE,MAAM,EAAE,CAAC;KACpC,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAqGlC,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAIhC,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAwBtC,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAa/B,OAAO,CAAC,MAAM,CAAC,eAAe;IAuB9B,OAAO,CAAC,MAAM,CAAC,iBAAiB;CAOjC"}
|
||||||
271
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonRequest.js
generated
vendored
Normal file
271
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonRequest.js
generated
vendored
Normal file
@ -0,0 +1,271 @@
|
|||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
import * as URI from 'uri-js';
|
||||||
|
import ErrorCode from './ErrorCode.js';
|
||||||
|
import InputValidator from './InputValidator.js';
|
||||||
|
import IonError from './IonError.js';
|
||||||
|
import IonSdkConfig from './IonSdkConfig.js';
|
||||||
|
import JsonCanonicalizer from './JsonCanonicalizer.js';
|
||||||
|
import Multihash from './Multihash.js';
|
||||||
|
import OperationKeyType from './enums/OperationKeyType.js';
|
||||||
|
import OperationType from './enums/OperationType.js';
|
||||||
|
import PatchAction from './enums/PatchAction.js';
|
||||||
|
/**
|
||||||
|
* Class containing operations related to ION requests.
|
||||||
|
*/
|
||||||
|
export default class IonRequest {
|
||||||
|
/**
|
||||||
|
* Creates an ION DID create request.
|
||||||
|
* @param input.document The initial state to be associate with the ION DID to be created using a `replace` document patch action.
|
||||||
|
*/
|
||||||
|
static createCreateRequest(input) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const recoveryKey = input.recoveryKey;
|
||||||
|
const updateKey = input.updateKey;
|
||||||
|
const didDocumentKeys = input.document.publicKeys;
|
||||||
|
const services = input.document.services;
|
||||||
|
// Validate recovery and update public keys.
|
||||||
|
InputValidator.validateEs256kOperationKey(recoveryKey, OperationKeyType.Public);
|
||||||
|
InputValidator.validateEs256kOperationKey(updateKey, OperationKeyType.Public);
|
||||||
|
// Validate all given DID Document keys.
|
||||||
|
IonRequest.validateDidDocumentKeys(didDocumentKeys);
|
||||||
|
// Validate all given service.
|
||||||
|
IonRequest.validateServices(services);
|
||||||
|
const hashAlgorithmInMultihashCode = IonSdkConfig.hashAlgorithmInMultihashCode;
|
||||||
|
const patches = [{
|
||||||
|
action: PatchAction.Replace,
|
||||||
|
document: input.document
|
||||||
|
}];
|
||||||
|
const delta = {
|
||||||
|
updateCommitment: yield Multihash.canonicalizeThenDoubleHashThenEncode(updateKey, hashAlgorithmInMultihashCode),
|
||||||
|
patches
|
||||||
|
};
|
||||||
|
IonRequest.validateDeltaSize(delta);
|
||||||
|
const deltaHash = yield Multihash.canonicalizeThenHashThenEncode(delta, hashAlgorithmInMultihashCode);
|
||||||
|
const suffixData = {
|
||||||
|
deltaHash,
|
||||||
|
recoveryCommitment: yield Multihash.canonicalizeThenDoubleHashThenEncode(recoveryKey, hashAlgorithmInMultihashCode)
|
||||||
|
};
|
||||||
|
const operationRequest = {
|
||||||
|
type: OperationType.Create,
|
||||||
|
suffixData: suffixData,
|
||||||
|
delta: delta
|
||||||
|
};
|
||||||
|
return operationRequest;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
static createDeactivateRequest(input) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// Validate DID suffix
|
||||||
|
IonRequest.validateDidSuffix(input.didSuffix);
|
||||||
|
// Validates recovery public key
|
||||||
|
InputValidator.validateEs256kOperationKey(input.recoveryPublicKey, OperationKeyType.Public);
|
||||||
|
const hashAlgorithmInMultihashCode = IonSdkConfig.hashAlgorithmInMultihashCode;
|
||||||
|
const revealValue = yield Multihash.canonicalizeThenHashThenEncode(input.recoveryPublicKey, hashAlgorithmInMultihashCode);
|
||||||
|
const dataToBeSigned = {
|
||||||
|
didSuffix: input.didSuffix,
|
||||||
|
recoveryKey: input.recoveryPublicKey
|
||||||
|
};
|
||||||
|
const compactJws = yield input.signer.sign({ alg: 'ES256K' }, dataToBeSigned);
|
||||||
|
return {
|
||||||
|
type: OperationType.Deactivate,
|
||||||
|
didSuffix: input.didSuffix,
|
||||||
|
revealValue: revealValue,
|
||||||
|
signedData: compactJws
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
static createRecoverRequest(input) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// Validate DID suffix
|
||||||
|
IonRequest.validateDidSuffix(input.didSuffix);
|
||||||
|
// Validate recovery public key
|
||||||
|
InputValidator.validateEs256kOperationKey(input.recoveryPublicKey, OperationKeyType.Public);
|
||||||
|
// Validate next recovery public key
|
||||||
|
InputValidator.validateEs256kOperationKey(input.nextRecoveryPublicKey, OperationKeyType.Public);
|
||||||
|
// Validate next update public key
|
||||||
|
InputValidator.validateEs256kOperationKey(input.nextUpdatePublicKey, OperationKeyType.Public);
|
||||||
|
// Validate all given DID Document keys.
|
||||||
|
IonRequest.validateDidDocumentKeys(input.document.publicKeys);
|
||||||
|
// Validate all given service.
|
||||||
|
IonRequest.validateServices(input.document.services);
|
||||||
|
const hashAlgorithmInMultihashCode = IonSdkConfig.hashAlgorithmInMultihashCode;
|
||||||
|
const revealValue = yield Multihash.canonicalizeThenHashThenEncode(input.recoveryPublicKey, hashAlgorithmInMultihashCode);
|
||||||
|
const patches = [{
|
||||||
|
action: PatchAction.Replace,
|
||||||
|
document: input.document
|
||||||
|
}];
|
||||||
|
const nextUpdateCommitmentHash = yield Multihash.canonicalizeThenDoubleHashThenEncode(input.nextUpdatePublicKey, hashAlgorithmInMultihashCode);
|
||||||
|
const delta = {
|
||||||
|
patches,
|
||||||
|
updateCommitment: nextUpdateCommitmentHash
|
||||||
|
};
|
||||||
|
const deltaHash = yield Multihash.canonicalizeThenHashThenEncode(delta, hashAlgorithmInMultihashCode);
|
||||||
|
const nextRecoveryCommitmentHash = yield Multihash.canonicalizeThenDoubleHashThenEncode(input.nextRecoveryPublicKey, hashAlgorithmInMultihashCode);
|
||||||
|
const dataToBeSigned = {
|
||||||
|
recoveryCommitment: nextRecoveryCommitmentHash,
|
||||||
|
recoveryKey: input.recoveryPublicKey,
|
||||||
|
deltaHash: deltaHash
|
||||||
|
};
|
||||||
|
const compactJws = yield input.signer.sign({ alg: 'ES256K' }, dataToBeSigned);
|
||||||
|
return {
|
||||||
|
type: OperationType.Recover,
|
||||||
|
didSuffix: input.didSuffix,
|
||||||
|
revealValue: revealValue,
|
||||||
|
delta: delta,
|
||||||
|
signedData: compactJws
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
static createUpdateRequest(input) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// Validate DID suffix
|
||||||
|
IonRequest.validateDidSuffix(input.didSuffix);
|
||||||
|
// Validate update public key
|
||||||
|
InputValidator.validateEs256kOperationKey(input.updatePublicKey, OperationKeyType.Public);
|
||||||
|
// Validate next update public key
|
||||||
|
InputValidator.validateEs256kOperationKey(input.nextUpdatePublicKey, OperationKeyType.Public);
|
||||||
|
// Validate all given service.
|
||||||
|
IonRequest.validateServices(input.servicesToAdd);
|
||||||
|
// Validate all given DID Document keys.
|
||||||
|
IonRequest.validateDidDocumentKeys(input.publicKeysToAdd);
|
||||||
|
// Validate all given service id to remove.
|
||||||
|
if (input.idsOfServicesToRemove !== undefined) {
|
||||||
|
for (const id of input.idsOfServicesToRemove) {
|
||||||
|
InputValidator.validateId(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Validate all given public key id to remove.
|
||||||
|
if (input.idsOfPublicKeysToRemove !== undefined) {
|
||||||
|
for (const id of input.idsOfPublicKeysToRemove) {
|
||||||
|
InputValidator.validateId(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const patches = [];
|
||||||
|
// Create patches for add services
|
||||||
|
const servicesToAdd = input.servicesToAdd;
|
||||||
|
if (servicesToAdd !== undefined && servicesToAdd.length > 0) {
|
||||||
|
const patch = {
|
||||||
|
action: PatchAction.AddServices,
|
||||||
|
services: servicesToAdd
|
||||||
|
};
|
||||||
|
patches.push(patch);
|
||||||
|
}
|
||||||
|
// Create patches for remove services
|
||||||
|
const idsOfServicesToRemove = input.idsOfServicesToRemove;
|
||||||
|
if (idsOfServicesToRemove !== undefined && idsOfServicesToRemove.length > 0) {
|
||||||
|
const patch = {
|
||||||
|
action: PatchAction.RemoveServices,
|
||||||
|
ids: idsOfServicesToRemove
|
||||||
|
};
|
||||||
|
patches.push(patch);
|
||||||
|
}
|
||||||
|
// Create patches for adding public keys
|
||||||
|
const publicKeysToAdd = input.publicKeysToAdd;
|
||||||
|
if (publicKeysToAdd !== undefined && publicKeysToAdd.length > 0) {
|
||||||
|
const patch = {
|
||||||
|
action: PatchAction.AddPublicKeys,
|
||||||
|
publicKeys: publicKeysToAdd
|
||||||
|
};
|
||||||
|
patches.push(patch);
|
||||||
|
}
|
||||||
|
// Create patch for removing public keys
|
||||||
|
const idsOfPublicKeysToRemove = input.idsOfPublicKeysToRemove;
|
||||||
|
if (idsOfPublicKeysToRemove !== undefined && idsOfPublicKeysToRemove.length > 0) {
|
||||||
|
const patch = {
|
||||||
|
action: PatchAction.RemovePublicKeys,
|
||||||
|
ids: idsOfPublicKeysToRemove
|
||||||
|
};
|
||||||
|
patches.push(patch);
|
||||||
|
}
|
||||||
|
const hashAlgorithmInMultihashCode = IonSdkConfig.hashAlgorithmInMultihashCode;
|
||||||
|
const revealValue = yield Multihash.canonicalizeThenHashThenEncode(input.updatePublicKey, hashAlgorithmInMultihashCode);
|
||||||
|
const nextUpdateCommitmentHash = yield Multihash.canonicalizeThenDoubleHashThenEncode(input.nextUpdatePublicKey, hashAlgorithmInMultihashCode);
|
||||||
|
const delta = {
|
||||||
|
patches,
|
||||||
|
updateCommitment: nextUpdateCommitmentHash
|
||||||
|
};
|
||||||
|
const deltaHash = yield Multihash.canonicalizeThenHashThenEncode(delta, hashAlgorithmInMultihashCode);
|
||||||
|
const dataToBeSigned = {
|
||||||
|
updateKey: input.updatePublicKey,
|
||||||
|
deltaHash
|
||||||
|
};
|
||||||
|
const compactJws = yield input.signer.sign({ alg: 'ES256K' }, dataToBeSigned);
|
||||||
|
return {
|
||||||
|
type: OperationType.Update,
|
||||||
|
didSuffix: input.didSuffix,
|
||||||
|
revealValue,
|
||||||
|
delta,
|
||||||
|
signedData: compactJws
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
static validateDidSuffix(didSuffix) {
|
||||||
|
Multihash.validateEncodedHashComputedUsingSupportedHashAlgorithm(didSuffix, 'didSuffix');
|
||||||
|
}
|
||||||
|
static validateDidDocumentKeys(publicKeys) {
|
||||||
|
if (publicKeys === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Validate each public key.
|
||||||
|
const publicKeyIdSet = new Set();
|
||||||
|
for (const publicKey of publicKeys) {
|
||||||
|
if (Array.isArray(publicKey.publicKeyJwk)) {
|
||||||
|
throw new IonError(ErrorCode.DidDocumentPublicKeyMissingOrIncorrectType, `DID Document key 'publicKeyJwk' property is not a non-array object.`);
|
||||||
|
}
|
||||||
|
InputValidator.validateId(publicKey.id);
|
||||||
|
// 'id' must be unique across all given keys.
|
||||||
|
if (publicKeyIdSet.has(publicKey.id)) {
|
||||||
|
throw new IonError(ErrorCode.DidDocumentPublicKeyIdDuplicated, `DID Document key with ID '${publicKey.id}' already exists.`);
|
||||||
|
}
|
||||||
|
publicKeyIdSet.add(publicKey.id);
|
||||||
|
InputValidator.validatePublicKeyPurposes(publicKey.purposes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static validateServices(services) {
|
||||||
|
if (services !== undefined && services.length !== 0) {
|
||||||
|
const serviceIdSet = new Set();
|
||||||
|
for (const service of services) {
|
||||||
|
IonRequest.validateService(service);
|
||||||
|
if (serviceIdSet.has(service.id)) {
|
||||||
|
throw new IonError(ErrorCode.DidDocumentServiceIdDuplicated, 'Service id has to be unique');
|
||||||
|
}
|
||||||
|
serviceIdSet.add(service.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static validateService(service) {
|
||||||
|
InputValidator.validateId(service.id);
|
||||||
|
const maxTypeLength = 30;
|
||||||
|
if (service.type.length > maxTypeLength) {
|
||||||
|
const errorMessage = `Service endpoint type length ${service.type.length} exceeds max allowed length of ${maxTypeLength}.`;
|
||||||
|
throw new IonError(ErrorCode.ServiceTypeTooLong, errorMessage);
|
||||||
|
}
|
||||||
|
// Throw error if `serviceEndpoint` is an array.
|
||||||
|
if (Array.isArray(service.serviceEndpoint)) {
|
||||||
|
const errorMessage = 'Service endpoint value cannot be an array.';
|
||||||
|
throw new IonError(ErrorCode.ServiceEndpointCannotBeAnArray, errorMessage);
|
||||||
|
}
|
||||||
|
if (typeof service.serviceEndpoint === 'string') {
|
||||||
|
const uri = URI.parse(service.serviceEndpoint);
|
||||||
|
if (uri.error !== undefined) {
|
||||||
|
throw new IonError(ErrorCode.ServiceEndpointStringNotValidUri, `Service endpoint string '${service.serviceEndpoint}' is not a URI.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static validateDeltaSize(delta) {
|
||||||
|
const deltaBytes = JsonCanonicalizer.canonicalizeAsBytes(delta);
|
||||||
|
if (deltaBytes.length > IonSdkConfig.maxCanonicalizedDeltaSizeInBytes) {
|
||||||
|
const errorMessage = `Delta of ${deltaBytes.length} bytes exceeded limit of ${IonSdkConfig.maxCanonicalizedDeltaSizeInBytes} bytes.`;
|
||||||
|
throw new IonError(ErrorCode.DeltaExceedsMaximumSize, errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=IonRequest.js.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonRequest.js.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonRequest.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
19
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonSdkConfig.d.ts
generated
vendored
Normal file
19
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonSdkConfig.d.ts
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import IonNetwork from './enums/IonNetwork.js';
|
||||||
|
/**
|
||||||
|
* Global configuration of the SDK.
|
||||||
|
*/
|
||||||
|
export default class IonSdkConfig {
|
||||||
|
/**
|
||||||
|
* Default hash algorithm used when hashing is performed.
|
||||||
|
*/
|
||||||
|
static hashAlgorithmInMultihashCode: number;
|
||||||
|
/**
|
||||||
|
* Maximum bytes for canonicalized delta.
|
||||||
|
*/
|
||||||
|
static maxCanonicalizedDeltaSizeInBytes: number;
|
||||||
|
/**
|
||||||
|
* Network name in ION DID, okay to leave as `undefined` if mainnet.
|
||||||
|
*/
|
||||||
|
static network: IonNetwork | undefined;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=IonSdkConfig.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonSdkConfig.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonSdkConfig.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"IonSdkConfig.d.ts","sourceRoot":"","sources":["../../lib/IonSdkConfig.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,YAAY;IAC/B;;OAEG;IACH,OAAc,4BAA4B,SAAM;IAEhD;;OAEG;IACH,OAAc,gCAAgC,EAAE,MAAM,CAAQ;IAE9D;;OAEG;IACH,OAAc,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC;CAC/C"}
|
||||||
15
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonSdkConfig.js
generated
vendored
Normal file
15
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonSdkConfig.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Global configuration of the SDK.
|
||||||
|
*/
|
||||||
|
class IonSdkConfig {
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Default hash algorithm used when hashing is performed.
|
||||||
|
*/
|
||||||
|
IonSdkConfig.hashAlgorithmInMultihashCode = 18; // 0x12 or SHA256
|
||||||
|
/**
|
||||||
|
* Maximum bytes for canonicalized delta.
|
||||||
|
*/
|
||||||
|
IonSdkConfig.maxCanonicalizedDeltaSizeInBytes = 1000;
|
||||||
|
export default IonSdkConfig;
|
||||||
|
//# sourceMappingURL=IonSdkConfig.js.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonSdkConfig.js.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/IonSdkConfig.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"IonSdkConfig.js","sourceRoot":"","sources":["../../lib/IonSdkConfig.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAqB,YAAY;;AAC/B;;GAEG;AACW,yCAA4B,GAAG,EAAE,CAAC,CAAC,iBAAiB;AAElE;;GAEG;AACW,6CAAgC,GAAW,IAAI,CAAC;eAT3C,YAAY"}
|
||||||
14
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/JsonCanonicalizer.d.ts
generated
vendored
Normal file
14
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/JsonCanonicalizer.d.ts
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* Class containing reusable JSON canonicalization operations using JSON Canonicalization Scheme (JCS).
|
||||||
|
*/
|
||||||
|
export default class JsonCanonicalizer {
|
||||||
|
/**
|
||||||
|
* Canonicalizes the given content as bytes.
|
||||||
|
*/
|
||||||
|
static canonicalizeAsBytes(content: object): Uint8Array;
|
||||||
|
/**
|
||||||
|
* Removes all properties within the given object with `undefined` as value.
|
||||||
|
*/
|
||||||
|
private static removeAllUndefinedProperties;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=JsonCanonicalizer.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/JsonCanonicalizer.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/JsonCanonicalizer.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"JsonCanonicalizer.d.ts","sourceRoot":"","sources":["../../lib/JsonCanonicalizer.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;OAEG;WACW,mBAAmB,CAAE,OAAO,EAAE,MAAM,GAAG,UAAU;IAS/D;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,4BAA4B;CAW5C"}
|
||||||
33
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/JsonCanonicalizer.js
generated
vendored
Normal file
33
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/JsonCanonicalizer.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import * as canonicalize from 'canonicalize';
|
||||||
|
import Encoder from './Encoder.js';
|
||||||
|
/**
|
||||||
|
* Class containing reusable JSON canonicalization operations using JSON Canonicalization Scheme (JCS).
|
||||||
|
*/
|
||||||
|
export default class JsonCanonicalizer {
|
||||||
|
/**
|
||||||
|
* Canonicalizes the given content as bytes.
|
||||||
|
*/
|
||||||
|
static canonicalizeAsBytes(content) {
|
||||||
|
// We need to remove all properties with `undefined` as value so that JCS canonicalization will not produce invalid JSON.
|
||||||
|
const contentWithoutUndefinedProperties = JsonCanonicalizer.removeAllUndefinedProperties(content);
|
||||||
|
// @ts-expect-error because its a cjs package
|
||||||
|
const canonicalizedString = canonicalize.default(contentWithoutUndefinedProperties);
|
||||||
|
const contentBytes = Encoder.stringToBytes(canonicalizedString);
|
||||||
|
return contentBytes;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Removes all properties within the given object with `undefined` as value.
|
||||||
|
*/
|
||||||
|
static removeAllUndefinedProperties(content) {
|
||||||
|
for (const key in content) {
|
||||||
|
if (typeof content[key] === 'object') {
|
||||||
|
JsonCanonicalizer.removeAllUndefinedProperties(content[key]);
|
||||||
|
}
|
||||||
|
else if (content[key] === undefined) {
|
||||||
|
delete content[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=JsonCanonicalizer.js.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/JsonCanonicalizer.js.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/JsonCanonicalizer.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"JsonCanonicalizer.js","sourceRoot":"","sources":["../../lib/JsonCanonicalizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,cAAc,CAAC;AAC7C,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;OAEG;IACI,MAAM,CAAC,mBAAmB,CAAE,OAAe;QAChD,yHAAyH;QACzH,MAAM,iCAAiC,GAAG,iBAAiB,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;QAClG,6CAA6C;QAC7C,MAAM,mBAAmB,GAAW,YAAY,CAAC,OAAO,CAAC,iCAAiC,CAAE,CAAC;QAC7F,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;QAChE,OAAO,YAAY,CAAC;IACtB,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,4BAA4B,CAAE,OAAY;QACvD,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;YAC1B,IAAI,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACrC,iBAAiB,CAAC,4BAA4B,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/D,CAAC;iBAAM,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;gBACtC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;YACtB,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
||||||
15
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/LocalSigner.d.ts
generated
vendored
Normal file
15
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/LocalSigner.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import ISigner from './interfaces/ISigner.js';
|
||||||
|
import JwkEs256k from './models/JwkEs256k.js';
|
||||||
|
/**
|
||||||
|
* An ISigner implementation that uses a given local private key.
|
||||||
|
*/
|
||||||
|
export default class LocalSigner implements ISigner {
|
||||||
|
private privateKey;
|
||||||
|
/**
|
||||||
|
* Creates a new local signer using the given private key.
|
||||||
|
*/
|
||||||
|
static create(privateKey: JwkEs256k): ISigner;
|
||||||
|
private constructor();
|
||||||
|
sign(header: object, content: object): Promise<string>;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=LocalSigner.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/LocalSigner.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/LocalSigner.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"LocalSigner.d.ts","sourceRoot":"","sources":["../../lib/LocalSigner.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAE9C,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAK9C;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,YAAW,OAAO;IAQ5B,OAAO,CAAC,UAAU;IAPvC;;OAEG;WACW,MAAM,CAAE,UAAU,EAAE,SAAS,GAAG,OAAO;IAIrD,OAAO;IAIM,IAAI,CAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAsBrE"}
|
||||||
50
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/LocalSigner.js
generated
vendored
Normal file
50
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/LocalSigner.js
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
import * as Secp256k1 from '@noble/secp256k1';
|
||||||
|
import Encoder from './Encoder.js';
|
||||||
|
import InputValidator from './InputValidator.js';
|
||||||
|
import OperationKeyType from './enums/OperationKeyType.js';
|
||||||
|
import { base64url } from 'multiformats/bases/base64';
|
||||||
|
import { sha256 } from 'multiformats/hashes/sha2';
|
||||||
|
/**
|
||||||
|
* An ISigner implementation that uses a given local private key.
|
||||||
|
*/
|
||||||
|
export default class LocalSigner {
|
||||||
|
/**
|
||||||
|
* Creates a new local signer using the given private key.
|
||||||
|
*/
|
||||||
|
static create(privateKey) {
|
||||||
|
return new LocalSigner(privateKey);
|
||||||
|
}
|
||||||
|
constructor(privateKey) {
|
||||||
|
this.privateKey = privateKey;
|
||||||
|
InputValidator.validateEs256kOperationKey(privateKey, OperationKeyType.Private);
|
||||||
|
}
|
||||||
|
sign(header, content) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const headerString = JSON.stringify(header);
|
||||||
|
const headerBytes = Encoder.stringToBytes(headerString);
|
||||||
|
const encodedHeader = base64url.baseEncode(headerBytes);
|
||||||
|
const payloadString = JSON.stringify(content);
|
||||||
|
const payloadBytes = Encoder.stringToBytes(payloadString);
|
||||||
|
const encodedPayload = base64url.baseEncode(payloadBytes);
|
||||||
|
const signingContentString = `${encodedHeader}.${encodedPayload}`;
|
||||||
|
const signingContentBytes = Encoder.stringToBytes(signingContentString);
|
||||||
|
const contentHash = yield sha256.encode(signingContentBytes);
|
||||||
|
const privateKeyBytes = base64url.baseDecode(this.privateKey.d);
|
||||||
|
const signature = yield Secp256k1.signAsync(contentHash, privateKeyBytes);
|
||||||
|
const signatureBytes = signature.toCompactRawBytes();
|
||||||
|
const encodedSignature = base64url.baseEncode(signatureBytes);
|
||||||
|
const compactJws = `${encodedHeader}.${encodedPayload}.${encodedSignature}`;
|
||||||
|
return compactJws;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=LocalSigner.js.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/LocalSigner.js.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/LocalSigner.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"LocalSigner.js","sourceRoot":"","sources":["../../lib/LocalSigner.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAC;AAC9C,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,cAAc,MAAM,qBAAqB,CAAC;AAEjD,OAAO,gBAAgB,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B;;OAEG;IACI,MAAM,CAAC,MAAM,CAAE,UAAqB;QACzC,OAAO,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC;IACrC,CAAC;IAED,YAA6B,UAAqB;QAArB,eAAU,GAAV,UAAU,CAAW;QAChD,cAAc,CAAC,0BAA0B,CAAC,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClF,CAAC;IAEY,IAAI,CAAE,MAAc,EAAE,OAAe;;YAChD,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAC5C,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;YACxD,MAAM,aAAa,GAAG,SAAS,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;YAExD,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YAC9C,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;YAC1D,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;YAE1D,MAAM,oBAAoB,GAAG,GAAG,aAAa,IAAI,cAAc,EAAE,CAAC;YAClE,MAAM,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC,oBAAoB,CAAC,CAAC;YACxE,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;YAE7D,MAAM,eAAe,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAE,CAAC,CAAC;YACjE,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;YAC1E,MAAM,cAAc,GAAG,SAAS,CAAC,iBAAiB,EAAE,CAAC;YAErD,MAAM,gBAAgB,GAAG,SAAS,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;YAE9D,MAAM,UAAU,GAAG,GAAG,aAAa,IAAI,cAAc,IAAI,gBAAgB,EAAE,CAAC;YAC5E,OAAO,UAAU,CAAC;QACpB,CAAC;KAAA;CACF"}
|
||||||
38
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Multihash.d.ts
generated
vendored
Normal file
38
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Multihash.d.ts
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* Class that performs hashing operations using the multihash format.
|
||||||
|
*/
|
||||||
|
export default class Multihash {
|
||||||
|
/**
|
||||||
|
* Multihashes the content using the hashing algorithm specified.
|
||||||
|
* @param hashAlgorithmInMultihashCode The hashing algorithm to use.
|
||||||
|
* @returns A multihash of the content.
|
||||||
|
*/
|
||||||
|
static hash(content: Uint8Array, hashAlgorithmInMultihashCode: number): Promise<Uint8Array>;
|
||||||
|
/**
|
||||||
|
* Hashes the content using the hashing algorithm specified as a generic (non-multihash) hash.
|
||||||
|
* @param hashAlgorithmInMultihashCode The hashing algorithm to use.
|
||||||
|
* @returns A multihash bytes.
|
||||||
|
*/
|
||||||
|
static hashAsNonMultihashBytes(content: Uint8Array, hashAlgorithmInMultihashCode: number): Promise<Uint8Array>;
|
||||||
|
/**
|
||||||
|
* Canonicalize the given content, then double hashes the result using the latest supported hash algorithm, then encodes the multihash.
|
||||||
|
* Mainly used for testing purposes.
|
||||||
|
*/
|
||||||
|
static canonicalizeThenHashThenEncode(content: object, hashAlgorithmInMultihashCode: number): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Canonicalize the given content, then double hashes the result using the latest supported hash algorithm, then encodes the multihash.
|
||||||
|
* Mainly used for testing purposes.
|
||||||
|
*/
|
||||||
|
static canonicalizeThenDoubleHashThenEncode(content: object, hashAlgorithmInMultihashCode: number): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Hashes the content using the hashing algorithm specified then encodes the multihash bytes as string.
|
||||||
|
* @param hashAlgorithmInMultihashCode The hashing algorithm to use.
|
||||||
|
*/
|
||||||
|
static hashThenEncode(content: Uint8Array, hashAlgorithmInMultihashCode: number): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Checks if the given encoded hash is a multihash computed using the configured hashing algorithm.
|
||||||
|
*/
|
||||||
|
static validateEncodedHashComputedUsingSupportedHashAlgorithm(encodedMultihash: string, // didSuffix
|
||||||
|
inputContextForErrorLogging: string): void;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=Multihash.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Multihash.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Multihash.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Multihash.d.ts","sourceRoot":"","sources":["../../lib/Multihash.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B;;;;OAIG;WACiB,IAAI,CAAE,OAAO,EAAE,UAAU,EAAE,4BAA4B,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAiBzG;;;;OAIG;WACiB,uBAAuB,CAAE,OAAO,EAAE,UAAU,EAAE,4BAA4B,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAgB5H;;;OAGG;WACiB,8BAA8B,CAAE,OAAO,EAAE,MAAM,EAAE,4BAA4B,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAO3H;;;OAGG;WACiB,oCAAoC,CAAE,OAAO,EAAE,MAAM,EAAE,4BAA4B,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IASjI;;;OAGG;WACiB,cAAc,CAAE,OAAO,EAAE,UAAU,EAAE,4BAA4B,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAM/G;;OAEG;WACW,sDAAsD,CAClE,gBAAgB,EAAE,MAAM,EAAE,YAAY;IACtC,2BAA2B,EAAE,MAAM;CAsBtC"}
|
||||||
113
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Multihash.js
generated
vendored
Normal file
113
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Multihash.js
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
import Encoder from './Encoder.js';
|
||||||
|
import ErrorCode from './ErrorCode.js';
|
||||||
|
import IonError from './IonError.js';
|
||||||
|
import IonSdkConfig from './IonSdkConfig.js';
|
||||||
|
import JsonCanonicalizer from './JsonCanonicalizer.js';
|
||||||
|
import { decode } from 'multiformats/hashes/digest';
|
||||||
|
import { sha256 } from 'multiformats/hashes/sha2';
|
||||||
|
/**
|
||||||
|
* Class that performs hashing operations using the multihash format.
|
||||||
|
*/
|
||||||
|
export default class Multihash {
|
||||||
|
/**
|
||||||
|
* Multihashes the content using the hashing algorithm specified.
|
||||||
|
* @param hashAlgorithmInMultihashCode The hashing algorithm to use.
|
||||||
|
* @returns A multihash of the content.
|
||||||
|
*/
|
||||||
|
static hash(content, hashAlgorithmInMultihashCode) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let multihash;
|
||||||
|
switch (hashAlgorithmInMultihashCode) {
|
||||||
|
case 18: // SHA256
|
||||||
|
let hasher = yield sha256.digest(content);
|
||||||
|
multihash = hasher.bytes;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IonError(ErrorCode.MultihashUnsupportedHashAlgorithm, `Hash algorithm defined in multihash code ${hashAlgorithmInMultihashCode} is not supported.`);
|
||||||
|
}
|
||||||
|
return multihash;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Hashes the content using the hashing algorithm specified as a generic (non-multihash) hash.
|
||||||
|
* @param hashAlgorithmInMultihashCode The hashing algorithm to use.
|
||||||
|
* @returns A multihash bytes.
|
||||||
|
*/
|
||||||
|
static hashAsNonMultihashBytes(content, hashAlgorithmInMultihashCode) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let hash;
|
||||||
|
switch (hashAlgorithmInMultihashCode) {
|
||||||
|
case 18: // SHA256
|
||||||
|
hash = yield sha256.encode(content);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new IonError(ErrorCode.MultihashUnsupportedHashAlgorithm, `Hash algorithm defined in multihash code ${hashAlgorithmInMultihashCode} is not supported.`);
|
||||||
|
}
|
||||||
|
return hash;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Canonicalize the given content, then double hashes the result using the latest supported hash algorithm, then encodes the multihash.
|
||||||
|
* Mainly used for testing purposes.
|
||||||
|
*/
|
||||||
|
static canonicalizeThenHashThenEncode(content, hashAlgorithmInMultihashCode) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const canonicalizedStringBytes = JsonCanonicalizer.canonicalizeAsBytes(content);
|
||||||
|
const multihashEncodedString = yield Multihash.hashThenEncode(canonicalizedStringBytes, hashAlgorithmInMultihashCode);
|
||||||
|
return multihashEncodedString;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Canonicalize the given content, then double hashes the result using the latest supported hash algorithm, then encodes the multihash.
|
||||||
|
* Mainly used for testing purposes.
|
||||||
|
*/
|
||||||
|
static canonicalizeThenDoubleHashThenEncode(content, hashAlgorithmInMultihashCode) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const contentBytes = JsonCanonicalizer.canonicalizeAsBytes(content);
|
||||||
|
// Double hash.
|
||||||
|
const intermediateHashBytes = yield Multihash.hashAsNonMultihashBytes(contentBytes, hashAlgorithmInMultihashCode);
|
||||||
|
const multihashEncodedString = yield Multihash.hashThenEncode(intermediateHashBytes, hashAlgorithmInMultihashCode);
|
||||||
|
return multihashEncodedString;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Hashes the content using the hashing algorithm specified then encodes the multihash bytes as string.
|
||||||
|
* @param hashAlgorithmInMultihashCode The hashing algorithm to use.
|
||||||
|
*/
|
||||||
|
static hashThenEncode(content, hashAlgorithmInMultihashCode) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const multihashBytes = yield Multihash.hash(content, hashAlgorithmInMultihashCode);
|
||||||
|
const multihashEncodedString = Encoder.encode(multihashBytes);
|
||||||
|
return multihashEncodedString;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Checks if the given encoded hash is a multihash computed using the configured hashing algorithm.
|
||||||
|
*/
|
||||||
|
static validateEncodedHashComputedUsingSupportedHashAlgorithm(encodedMultihash, // didSuffix
|
||||||
|
inputContextForErrorLogging) {
|
||||||
|
let multihash;
|
||||||
|
const multihashBytes = Encoder.decodeAsBytes(encodedMultihash, inputContextForErrorLogging);
|
||||||
|
try {
|
||||||
|
multihash = decode(multihashBytes);
|
||||||
|
}
|
||||||
|
catch (_a) {
|
||||||
|
throw new IonError(ErrorCode.MultihashStringNotAMultihash, `Given ${inputContextForErrorLogging} string '${encodedMultihash}' is not a multihash after decoding.`);
|
||||||
|
}
|
||||||
|
const hashAlgorithmInMultihashCode = IonSdkConfig.hashAlgorithmInMultihashCode;
|
||||||
|
if (hashAlgorithmInMultihashCode !== multihash.code) {
|
||||||
|
throw new IonError(ErrorCode.MultihashUnsupportedHashAlgorithm, `Given ${inputContextForErrorLogging} uses unsupported multihash algorithm with code ${multihash.code}, ` +
|
||||||
|
`should use ${hashAlgorithmInMultihashCode} or change IonSdkConfig to desired hashing algorithm.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=Multihash.js.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Multihash.js.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/Multihash.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"Multihash.js","sourceRoot":"","sources":["../../lib/Multihash.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B;;;;OAIG;IACI,MAAM,CAAO,IAAI,CAAE,OAAmB,EAAE,4BAAoC;;YACjF,IAAI,SAAqB,CAAC;YAC1B,QAAQ,4BAA4B,EAAE,CAAC;gBACrC,KAAK,EAAE,EAAE,SAAS;oBAChB,IAAI,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;oBAC1C,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC;oBACzB,MAAM;gBACR;oBACE,MAAM,IAAI,QAAQ,CAChB,SAAS,CAAC,iCAAiC,EAC3C,4CAA4C,4BAA4B,oBAAoB,CAC7F,CAAC;YACN,CAAC;YAED,OAAO,SAAS,CAAC;QACnB,CAAC;KAAA;IAED;;;;OAIG;IACI,MAAM,CAAO,uBAAuB,CAAE,OAAmB,EAAE,4BAAoC;;YACpG,IAAI,IAAI,CAAC;YACT,QAAQ,4BAA4B,EAAE,CAAC;gBACrC,KAAK,EAAE,EAAE,SAAS;oBAChB,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;oBACpC,MAAM;gBACR;oBACE,MAAM,IAAI,QAAQ,CAChB,SAAS,CAAC,iCAAiC,EAC3C,4CAA4C,4BAA4B,oBAAoB,CAC7F,CAAC;YACN,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAED;;;OAGG;IACI,MAAM,CAAO,8BAA8B,CAAE,OAAe,EAAE,4BAAoC;;YACvG,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;YAEhF,MAAM,sBAAsB,GAAG,MAAM,SAAS,CAAC,cAAc,CAAC,wBAAwB,EAAE,4BAA4B,CAAC,CAAC;YACtH,OAAO,sBAAsB,CAAC;QAChC,CAAC;KAAA;IAED;;;OAGG;IACI,MAAM,CAAO,oCAAoC,CAAE,OAAe,EAAE,4BAAoC;;YAC7G,MAAM,YAAY,GAAG,iBAAiB,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;YAEpE,eAAe;YACf,MAAM,qBAAqB,GAAG,MAAM,SAAS,CAAC,uBAAuB,CAAC,YAAY,EAAE,4BAA4B,CAAC,CAAC;YAClH,MAAM,sBAAsB,GAAG,MAAM,SAAS,CAAC,cAAc,CAAC,qBAAqB,EAAE,4BAA4B,CAAC,CAAC;YACnH,OAAO,sBAAsB,CAAC;QAChC,CAAC;KAAA;IAED;;;OAGG;IACI,MAAM,CAAO,cAAc,CAAE,OAAmB,EAAE,4BAAoC;;YAC3F,MAAM,cAAc,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,4BAA4B,CAAC,CAAC;YACnF,MAAM,sBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;YAC9D,OAAO,sBAAsB,CAAC;QAChC,CAAC;KAAA;IAED;;OAEG;IACI,MAAM,CAAC,sDAAsD,CAClE,gBAAwB,EAAE,YAAY;IACtC,2BAAmC;QAEnC,IAAI,SAAS,CAAC;QACd,MAAM,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,gBAAgB,EAAE,2BAA2B,CAAC,CAAC;QAC5F,IAAI,CAAC;YACH,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;QACrC,CAAC;QAAC,WAAM,CAAC;YACP,MAAM,IAAI,QAAQ,CAChB,SAAS,CAAC,4BAA4B,EACtC,SAAS,2BAA2B,YAAY,gBAAgB,sCAAsC,CAAC,CAAC;QAC5G,CAAC;QAED,MAAM,4BAA4B,GAAG,YAAY,CAAC,4BAA4B,CAAC;QAE/E,IAAI,4BAA4B,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC;YACpD,MAAM,IAAI,QAAQ,CAChB,SAAS,CAAC,iCAAiC,EAC3C,SAAS,2BAA2B,mDAAmD,SAAS,CAAC,IAAI,IAAI;gBACzG,cAAc,4BAA4B,uDAAuD,CAClG,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
||||||
9
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonNetwork.d.ts
generated
vendored
Normal file
9
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonNetwork.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Supported ION networks.
|
||||||
|
*/
|
||||||
|
declare enum IonNetwork {
|
||||||
|
Mainnet = "mainnet",
|
||||||
|
Testnet = "test"
|
||||||
|
}
|
||||||
|
export default IonNetwork;
|
||||||
|
//# sourceMappingURL=IonNetwork.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonNetwork.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonNetwork.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"IonNetwork.d.ts","sourceRoot":"","sources":["../../../lib/enums/IonNetwork.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,aAAK,UAAU;IACb,OAAO,YAAY;IACnB,OAAO,SAAS;CACjB;AAED,eAAe,UAAU,CAAC"}
|
||||||
10
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonNetwork.js
generated
vendored
Normal file
10
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonNetwork.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* Supported ION networks.
|
||||||
|
*/
|
||||||
|
var IonNetwork;
|
||||||
|
(function (IonNetwork) {
|
||||||
|
IonNetwork["Mainnet"] = "mainnet";
|
||||||
|
IonNetwork["Testnet"] = "test";
|
||||||
|
})(IonNetwork || (IonNetwork = {}));
|
||||||
|
export default IonNetwork;
|
||||||
|
//# sourceMappingURL=IonNetwork.js.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonNetwork.js.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonNetwork.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"IonNetwork.js","sourceRoot":"","sources":["../../../lib/enums/IonNetwork.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,IAAK,UAGJ;AAHD,WAAK,UAAU;IACb,iCAAmB,CAAA;IACnB,8BAAgB,CAAA;AAClB,CAAC,EAHI,UAAU,KAAV,UAAU,QAGd;AAED,eAAe,UAAU,CAAC"}
|
||||||
12
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonPublicKeyPurpose.d.ts
generated
vendored
Normal file
12
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonPublicKeyPurpose.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* DID Document key purpose.
|
||||||
|
*/
|
||||||
|
declare enum IonPublicKeyPurpose {
|
||||||
|
Authentication = "authentication",
|
||||||
|
AssertionMethod = "assertionMethod",
|
||||||
|
CapabilityInvocation = "capabilityInvocation",
|
||||||
|
CapabilityDelegation = "capabilityDelegation",
|
||||||
|
KeyAgreement = "keyAgreement"
|
||||||
|
}
|
||||||
|
export default IonPublicKeyPurpose;
|
||||||
|
//# sourceMappingURL=IonPublicKeyPurpose.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonPublicKeyPurpose.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonPublicKeyPurpose.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"IonPublicKeyPurpose.d.ts","sourceRoot":"","sources":["../../../lib/enums/IonPublicKeyPurpose.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,aAAK,mBAAmB;IACtB,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,oBAAoB,yBAAyB;IAC7C,oBAAoB,yBAAyB;IAC7C,YAAY,iBAAiB;CAC9B;AAED,eAAe,mBAAmB,CAAC"}
|
||||||
13
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonPublicKeyPurpose.js
generated
vendored
Normal file
13
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonPublicKeyPurpose.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* DID Document key purpose.
|
||||||
|
*/
|
||||||
|
var IonPublicKeyPurpose;
|
||||||
|
(function (IonPublicKeyPurpose) {
|
||||||
|
IonPublicKeyPurpose["Authentication"] = "authentication";
|
||||||
|
IonPublicKeyPurpose["AssertionMethod"] = "assertionMethod";
|
||||||
|
IonPublicKeyPurpose["CapabilityInvocation"] = "capabilityInvocation";
|
||||||
|
IonPublicKeyPurpose["CapabilityDelegation"] = "capabilityDelegation";
|
||||||
|
IonPublicKeyPurpose["KeyAgreement"] = "keyAgreement";
|
||||||
|
})(IonPublicKeyPurpose || (IonPublicKeyPurpose = {}));
|
||||||
|
export default IonPublicKeyPurpose;
|
||||||
|
//# sourceMappingURL=IonPublicKeyPurpose.js.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonPublicKeyPurpose.js.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/IonPublicKeyPurpose.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"IonPublicKeyPurpose.js","sourceRoot":"","sources":["../../../lib/enums/IonPublicKeyPurpose.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,IAAK,mBAMJ;AAND,WAAK,mBAAmB;IACtB,wDAAiC,CAAA;IACjC,0DAAmC,CAAA;IACnC,oEAA6C,CAAA;IAC7C,oEAA6C,CAAA;IAC7C,oDAA6B,CAAA;AAC/B,CAAC,EANI,mBAAmB,KAAnB,mBAAmB,QAMvB;AAED,eAAe,mBAAmB,CAAC"}
|
||||||
9
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/OperationKeyType.d.ts
generated
vendored
Normal file
9
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/OperationKeyType.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/**
|
||||||
|
* Operation key type, indicates if a key is a public or private key.
|
||||||
|
*/
|
||||||
|
declare enum OperationKeyType {
|
||||||
|
Public = "public",
|
||||||
|
Private = "private"
|
||||||
|
}
|
||||||
|
export default OperationKeyType;
|
||||||
|
//# sourceMappingURL=OperationKeyType.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/OperationKeyType.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/OperationKeyType.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"OperationKeyType.d.ts","sourceRoot":"","sources":["../../../lib/enums/OperationKeyType.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,aAAK,gBAAgB;IACjB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAEH,eAAe,gBAAgB,CAAC"}
|
||||||
10
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/OperationKeyType.js
generated
vendored
Normal file
10
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/OperationKeyType.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* Operation key type, indicates if a key is a public or private key.
|
||||||
|
*/
|
||||||
|
var OperationKeyType;
|
||||||
|
(function (OperationKeyType) {
|
||||||
|
OperationKeyType["Public"] = "public";
|
||||||
|
OperationKeyType["Private"] = "private";
|
||||||
|
})(OperationKeyType || (OperationKeyType = {}));
|
||||||
|
export default OperationKeyType;
|
||||||
|
//# sourceMappingURL=OperationKeyType.js.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/OperationKeyType.js.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/OperationKeyType.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"OperationKeyType.js","sourceRoot":"","sources":["../../../lib/enums/OperationKeyType.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,IAAK,gBAGF;AAHH,WAAK,gBAAgB;IACjB,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;AACrB,CAAC,EAHE,gBAAgB,KAAhB,gBAAgB,QAGlB;AAEH,eAAe,gBAAgB,CAAC"}
|
||||||
11
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/OperationType.d.ts
generated
vendored
Normal file
11
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/OperationType.d.ts
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* ION operation types.
|
||||||
|
*/
|
||||||
|
declare enum OperationType {
|
||||||
|
Create = "create",
|
||||||
|
Update = "update",
|
||||||
|
Deactivate = "deactivate",
|
||||||
|
Recover = "recover"
|
||||||
|
}
|
||||||
|
export default OperationType;
|
||||||
|
//# sourceMappingURL=OperationType.d.ts.map
|
||||||
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/OperationType.d.ts.map
generated
vendored
Normal file
1
apps/did-wallet/node_modules/@decentralized-identity/ion-sdk/dist/lib/enums/OperationType.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"OperationType.d.ts","sourceRoot":"","sources":["../../../lib/enums/OperationType.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,aAAK,aAAa;IAChB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,OAAO,YAAY;CACpB;AAED,eAAe,aAAa,CAAC"}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user