import Vnmf from '../../index' declare module '../../index' { /** User encryption module * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.html */ interface UserCryptoManager { /** Get the latest user encryption key * @supported weapp * @example * ```tsx * const userCryptoManager = Vnmf.getUserCryptoManager() * userCryptoManager.getLatestUserKey({ * success: res => { * const { encryptKey, iv, version, expireTime } = res * console.log(encryptKey, iv, version, expireTime) * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getLatestUserKey.html */ getLatestUserKey(option: UserCryptoManager.getLatestUserKey.Option): Promise /** Get cryptographic security random number * @supported weapp * @example * ```tsx * Vnmf.getRandomValues({ * length: 6 // generate 6 Random number of individual byte length , * success: res => { * console.log(Vnmf.arrayBufferToBase64(res.randomValues)) // Convert base64 Print after string * } * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getRandomValues.html */ getRandomValues(option: UserCryptoManager.getRandomValues.Option): Promise } namespace UserCryptoManager { namespace getLatestUserKey { interface Option { /** Interface call successful callback function */ success?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failure recovery function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** The callback function of the interface call (Call success 、Failure will be executed ) */ complete?: (res: SuccessCallbackResult) => void } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** User encryption key */ encryptKey: string /** The initial vector of the key */ iv: string /** Key version */ version: number /** Key expiration time */ expireTime: number } } namespace getRandomValues { interface Option { /** Integer ,The number of bytes that generate random numbers ,maximum 1048576 */ length: number /** Interface call successful callback function */ success?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failure recovery function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** The callback function of the interface call (Call success 、Failure will be executed ) */ complete?: (res: SuccessCallbackResult) => void } interface SuccessCallbackResult extends VnmfGeneral.CallbackResult { /** Random content ,The length of the bytes that pass */ randomValues: ArrayBuffer } } } interface VnmfStatic { /** Get user encryption module * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/wx.getUserCryptoManager.html */ getUserCryptoManager(): UserCryptoManager } }