---
# System prepended metadata

title: Reference Project - Shopping Cart
tags: [front-end]

---

---
title: Reference Project - Shopping Cart
image: https://hackmd.io/_uploads/Syx4ZC-ua.png
---

# Outh

- Encryption and Decryption
  - Keys
  - Public key & Private Key
  - Authentication
  - Outh2.0
  - Access Token & Refresh Token

--- 

## What is Cryptography
  - Cryptography is used to secure and protect data during communication.
  - It is helpful to prevent unauthorized person or group of users from accessing any confidential data.
  - **Encryption** and **Decryption** are the two essential functionalities of cryptography.

--- 

## Encryption and Decryption
 - Encryption is a process of converting normal data into an unreadable form whereas Decryption is a method of converting the unreadable/coded data into its original form.
 - Encryption is done by the person who is sending the data to the destination, but the decryption is done at the person who is receiving the data.
 - The same algorithm with the same key is used for both the encryption-decryption processes.

---

## Key
- Symmetric-key encryption are algorithms which use the same cryptographic keys for both encryption of plaintext and decryption of ciphertext.
- Asymmetric encryption uses 2 pairs of key for encryption. Public key is available to anyone while the secret key is only made available to the receiver of the message. This boots security.
- Public key cryptography is an encryption system which is based on two pairs of keys. Public keys are used to encrypt messages for a receiver.
- Private key may be part of a public/ private asymmetric key pair. It can be used in asymmetric encryption as you can use the same key to encrypt and decrypt data
- Pre-shared key (PSK) is a shared secret which was earlier shared between the two parties using a secure channel before it is used.

---
## Access Token
- Access tokens are the thing that applications use to make API requests on behalf of a user.
- The access token represents the authorization of a specific application to access specific parts of a user’s data.
- Access tokens must be kept confidential in transit and in storage.

---

## Refresh Token
- For security purposes, access tokens may be valid for a short amount of time.
- Once they expire, client applications can use a refresh token to "refresh" the access token.
- A refresh token is a credential artifact that lets a client application get new access tokens without having to ask the user to log in again

---
# [Google Firebase](https://firebase.google.com/?hl=zh-cn )

![start_google_firebase](https://hackmd.io/_uploads/B10zh_p8p.png)
![firebase_ Authentication](https://hackmd.io/_uploads/S18I3dTIa.png)
![firebase_signin_method](https://hackmd.io/_uploads/Bkp_2Oa86.png)


### [Sign in by password](https://firebase.google.com/docs/reference/rest/auth)
![signin_by_password_doc](https://hackmd.io/_uploads/rkh_pOT8p.png)

```javascript=
{
    "email": "client1@client.com",
    "password": "password",
    "returnSecureToken": "true"
}
```

![login_postman](https://hackmd.io/_uploads/HyV2a_T8T.png)

![how_to_use_auth](https://hackmd.io/_uploads/rkXAJtpUT.png)

---
![Project_Main_page](https://hackmd.io/_uploads/H1-E-CWOa.png)
![Project_popover](https://hackmd.io/_uploads/Hyy4-R-_a.png)
![Project_ProductList](https://hackmd.io/_uploads/SyZE-R-da.png)
![Project_Shopping_Cart](https://hackmd.io/_uploads/Syx4ZC-ua.png)
![Project_Order_Details](https://hackmd.io/_uploads/B167-CW_a.png)
![Project_shipping_address](https://hackmd.io/_uploads/rJyE-0bd6.png)
![Project_Payment_method](https://hackmd.io/_uploads/B11EZCZua.png)
![Project_CheckOut2](https://hackmd.io/_uploads/rJy4WRZ_p.png)
![Project_Checkout](https://hackmd.io/_uploads/H1TQbC-O6.png)






