---
# System prepended metadata

title: Building as Auth Server
tags: [112-2]

---

# Building as Auth Server
::: info
講師：Maxx
時間：2024.05.08
地點：B1 多功能教室
[上課簡報傳送門]()
:::

# Concept
```
          RSA(Hello)
    [a] <--------------------> [b]
b' public key               a' public
a' privary key              b' priv
```

# SQL
```sql=
-- create database
CREATE DATABASE example;

-- create table
CREATE TABLE Users (
    UserId NUMERIC PRIMARY KEY,
    Email TEXT UNIQUE NOT NULL,
    Password TEXT NOT NULL,
);

-- CRUD

-- create
INSERT INTO Users (UserId, Email, Password) VALUES (1, "test@gmail.com", "123");

-- read
SELECT * FROM Users WHERE UserId < 10;
--- Returns 1 record

-- Update
UPDATE Users SET Password = "456" WHERE UserId = 1;

-- Delete
DELETE FROM Users WHERE UserId = 1;
```

# Install
- golang
- air
- sqlite
- sqlc

# Coding
- Hello world
```go=
package main

import (
    "fmt"
    
)
func main() {
    fmt.Print("Hello world air work")    
}
```

```go=
package main

import (
    "io"
    
    "html/template"
    "github.com/labstack/echo/v4"
)
type Templates struct {
    tempates
}
func main() {
    e := echo.New()
    
}
```

- index.html
```html=

```