my.bioMetrics.deleteKey
bioMetrics.deleteKey
my.bioMetrics.deleteKey
là API để xoá cặp key đề cập ở JSAPI my.bioMetrics.createKey nếu có.
Quét mã để trải nghiệm
Xem code mẫu trên Tini StudioDemo
Trải nghiệm thử với trình giả lập bên dưới
Khả dụng: Hỗ trợ từ version 1.96.7 trở lên.
API Params
Thuộc tính | Kiểu dữ liệu | Mô tả |
---|---|---|
success | Function | Callback function khi việc xoá key thành công |
fail | Function | Callback function khi việc xoá key thất bại |
complete | Function | Callback function bất kể thành công hay thất bại |
Giá trị trong success callback
Khi việc gọi API thành công, framework sẽ trả về payload là 1 biến boolean và luôn luôn là true
Sample Code
index.xml
<view>
<block-header title="Usage" description="Use Biometrics to authenticate with server" />
<view class="block-content">
<view class="page-section-btns">
<button type="primary" onTap="createKey">Create Key Pair</button>
<button type="primary" onTap="keyExists">Check Key Exists</button>
<button type="primary" onTap="deleteKey">Delete Key</button>
</view>
</view>
<view class="block-content">
<view class="page-section-btns">
<button type="primary" onTap="createSignature">Generate Signature</button>
</view>
</view>
</view>
index.js
Page({
deleteKey() {
my.bioMetrics.deleteKey({
success: () => {
my.alert({ title: 'Success', content: `Key is deleted` });
},
fail: (res) => {
my.alert({ title: 'Fail', content: JSON.stringify(res) });
}
});
}
});