Skip to main content

my.getAllKeysEncryptedStorage

getAllKeysEncryptedStorage

my.getAllKeysEncryptedStorage là api để lấy toàn bộ key của app.

Quét mã để trải nghiệm

Xem code mẫu trên Tini Studio

Demo

Trải nghiệm thử với trình giả lập bên dưới

API Params

Thuộc tínhKiểu dữ liệuMô tả
configobjectCó thể bật chế độ xác thực trước khi lấy tất cả key
successFunctionCallback function khi dữ liệu được lấy thành công. Trong cấu trúc của response, data là field Array chứa dữ liêu.
failFunctionCallback function khi xoá dữ liệu thất bại
completeFunctionCallback function sau khi thực hiện việc xoá dữ liệu bất kể thành công hay thất bại

config payload

Thuộc tínhKiểu dữ liệuPlatformMô tả
accessControlstringios
- 'BIOMETRY_ANY_OR_DEVICE_PASSCODE'
- 'BIOMETRY_CURRENT_SET_OR_DEVICE_PASSCODE
- 'BIOMETRY_ANY'
authenticationPromptstringiosGhi chú khi người dùng mở khóa bằng sinh trắc học hoặc mật khẩu thiết bị.
servicestringiosTiêu chuẩn khi mã hoá, nếu khi lưu trữ người dùng set giá trị thì khi muốn lấy cần thêm đúng giá trị đã lưu trữ nếu không dữ liệu sẽ trả về null
authenticateTypestringios, androidLoại xác thực:
- DEVICE_PASSCODE_OR_BIOMETRICS (Xác thực bằng sinh trắc học hoặc mật mã thiết bị.)
- BIOMETRICS (Xác thực bằng phương pháp sinh trắc học (Touch ID hoặc Face ID).)
*Note: Default 'DEVICE_PASSCODE_OR_BIOMETRICS'

Sample Code

index.js
Page({
onClearData() {
my.getAllKeysEncryptedStorage({
config: {
authenticationPrompt: 'login with yourself',
accessControl: 'BIOMETRY_ANY_OR_DEVICE_PASSCODE'
},
success: function () {
my.alert({ content: 'Xoá dữ liệu thành công' });
},
fail: function (res) {
my.alert({ content: res.errorMessage });
}
});
}
});