AxCryptoService
เซอร์วิสสำหรับเข้ารหัสข้อมูล
When To Use
- ใช้เมื่อต้องการเข้ารหัสข้อมูลที่เป็น
string
import { AxCryptoServiceModule } from '@atlasx/core/crypto-service'Example
import { AxCryptoService } from '@atlasx/core/crypto-service'@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent implements OnInit {
constructor(private cryptoService: AxCryptoService) {}
ngOnInit() {
const encrypted = this.cryptoService.encrypt('Hello World')
console.log(encrypted)
const decrypted = this.cryptoService.decrypt(encrypted)
console.log(decrypted)
}
}Methods
encrypt()
เข้ารหัส string
encrypt(value: string): stringParameters
| Parameter | Description | Type | Default |
|---|---|---|---|
| value | The string to encrypt | string | – |
Returns
string: string ที่เข้ารหัสแล้ว
decrypt()
ถอดรหัส string
decrypt(value: string): stringParameters
| Parameter | Description | Type | Default |
|---|---|---|---|
| value | The string to decrypt | string | – |
Returns
string: string ที่เถอดรหัสแล้ว