minigame-std
Version:
Mini Game Standard Development Library.
58 lines (33 loc) • 1.25 kB
Markdown
[**minigame-std**](../../../README.md)
***
[minigame-std](../../../README.md) / [cryptos](../README.md) / RSAPublicKey
# Interface: RSAPublicKey
Defined in: [src/std/crypto/crypto\_defines.ts:4](https://github.com/JiangJie/minigame-std/blob/fdb22241c47c2e98329a4c62befde728957e03ee/src/std/crypto/crypto_defines.ts#L4)
The RSA public key.
## Methods
### encrypt()
```ts
encrypt(data): Promise<ArrayBuffer>
```
Defined in: [src/std/crypto/crypto\_defines.ts:10](https://github.com/JiangJie/minigame-std/blob/fdb22241c47c2e98329a4c62befde728957e03ee/src/std/crypto/crypto_defines.ts#L10)
Use the RSA-OAEP algorithm to encrypt the data.
#### Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| `data` | `string` | The data to encrypt. |
#### Returns
`Promise`\<`ArrayBuffer`\>
Encrypted data.
***
### encryptToString()
```ts
encryptToString(data): Promise<string>
```
Defined in: [src/std/crypto/crypto\_defines.ts:15](https://github.com/JiangJie/minigame-std/blob/fdb22241c47c2e98329a4c62befde728957e03ee/src/std/crypto/crypto_defines.ts#L15)
`encrypt` then convert to base64 string.
#### Parameters
| Parameter | Type |
| ------ | ------ |
| `data` | `string` |
#### Returns
`Promise`\<`string`\>