From 95180b8843bd5041062191df47e9276f711edf8f Mon Sep 17 00:00:00 2001 From: Oleksii Trukhanov Date: Tue, 18 Feb 2025 15:03:54 +0200 Subject: [PATCH 1/4] DASH-1194 Add encrypt content method. --- README.md | 49 +++++++++++- src/index.test.ts | 91 ++++++++++++++++++----- src/index.ts | 2 + src/utils/transaction/cypher-content.ts | 10 +-- src/utils/transaction/sign-transaction.ts | 6 +- 5 files changed, 130 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index b4e2d30..026f722 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,51 @@ async function main() { main(); ``` +## Encrypt Content + +Use this function to encrypt content for [FIO Request](https://dev.fio.net/reference/new_funds_request) or [FIO Data](https://dev.fio.net/reference/record_obt_data).. + +Parameters: +- `content` - **Required**. Content object to encrypt. Must match the schema for the specified `fioContentType`. + +- `encryptionPublicKey` - **Required**. FIO Public key of the recipient wallet that will be used for encryption. This is used for [encryption](https://dev.fio.net/docs/encryption-in-fio-request-and-fio-data). + +- `fioContentType` - **Required**. Set as follows: + - `newfundsreq`: new_funds_content + - `recordobt`: record_obt_data_content + +- `privateKey` - **Required**. FIO Private key of the sender. + +```typescript +import { encryptContent } from '@fioprotocol/fio-sdk-lite'; + +async function main() { + const content = { + payee_public_address: 'purse@alice', + amount: '1', + chain_code: 'FIO', + token_code: 'FIO', + memo: 'Payment for services', + hash: '', + offline_url: '' + }; + + try { + const encryptedContent = encryptContent({ + content, + encryptionPublicKey: 'FIO7MYkz3serGGGanVPnPPupE1xSm7t7t8mWJ3H7KEd2vS2ZZbXBF', + fioContentType: 'new_funds_content', // new_funds_content - FIO Request, or 'record_obt_data_content' - FIO Data + privateKey: '5JTmqev7ZsryGGkN6z4FRzd4ELQJLNZuhtQhobVVsJsBHnXxFCw' + }); + console.log(encryptedContent); + } catch (error) { + console.error("Error:", error); + } +} + +main(); +``` + ## Decrypt Content Use this function to decrypt content in FIO Requests or FIO Data. @@ -135,8 +180,8 @@ Parameters: - `encryptionPublicKey` - **Required**. FIO Public key of the other wallet that was used for encryption. This is returned by [/get_pending_fio_requests](https://dev.fio.net/reference/get_pending_fio_requests) and [/get_obt_data](https://dev.fio.net/reference/get_obt_data). This is used for [decryption](https://dev.fio.net/docs/encryption-in-fio-request-and-fio-data). - `fioContentType` - **Required**. Set as follows: -`newfundsreq`: new_funds_content -`recordobt`: record_obt_data_content + - `newfundsreq`: new_funds_content + - `recordobt`: record_obt_data_content - `privateKey` - **Required**. FIO Private key. diff --git a/src/index.test.ts b/src/index.test.ts index b380ab1..0c6273c 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -1,5 +1,6 @@ import { decryptContent, + encryptContent, getPublicKey, signNonce, signTransaction, @@ -7,8 +8,40 @@ import { } from './index'; const MEMO_PHRASE = 'Hello FIO SDK Lite'; +const MEMO_PHRASE_ENCRYPTED = 'Hello FIO SDK Lite Encrypted'; + +const wallet1 = { + privateKey: '5JTmqev7ZsryGGkN6z4FRzd4ELQJLNZuhtQhobVVsJsBHnXxFCw', + publicKey: 'FIO7MYkz3serGGGanVPnPPupE1xSm1t7t8mWJ3H7KEd2vS2ZZbXBF', + fioHandle: 'fio-sdk-handle@regtest', +}; + +const wallet2 = { + privateKey: '5JpWuB5YbjQBmoBcxbzTTuY9h2NNQNVD5Ct5yKU1d5QCowt1G8X', + publicKey: 'FIO8hnBb7aUDFs6cvCT2TCRQs9vV9jxJbKLCe5q23Zb8Wr36DxsUr', + fioHandle: 'fio-sdk-handle-2@regtest', +}; + +const encryptContentParams = { + content: { + payer_public_address: wallet2.publicKey, + payee_public_address: wallet1.publicKey, + amount: '20', + chain_code: 'FIO', + token_code: 'FIO', + status: 'sent_to_blockchain', + obt_id: '1', + memo: MEMO_PHRASE_ENCRYPTED, + hash: null, + offline_url: null, + }, + fioContentType: 'record_obt_data_content', + privateKey: wallet1.privateKey, + encryptionPublicKey: wallet2.publicKey, +}; const apiUrl = 'https://testnet.fioprotocol.io'; + const transactionActionParams = { apiUrl, actionParams: [ @@ -16,12 +49,11 @@ const transactionActionParams = { action: 'newfundsreq', account: 'fio.reqobt', data: { - payer_fio_address: 'fio-sdk-handle-2@regtest', - payee_fio_address: 'fio-sdk-handle@regtest', + payer_fio_address: wallet2.fioHandle, + payee_fio_address: wallet1.fioHandle, content: { amount: 12, - payee_public_address: - 'FIO7MYkz3serGGGanVPnPPupE1xSm1t7t8mWJ3H7KEd2vS2ZZbXBF', + payee_public_address: wallet1.publicKey, chain_code: 'FIO', token_code: 'FIO', memo: MEMO_PHRASE, @@ -32,29 +64,26 @@ const transactionActionParams = { max_fee: 1500000000000, }, contentType: 'new_funds_content', - payerFioPublicKey: - 'FIO8hnBb7aUDFs6cvCT2TCRQs9vV9jxJbKLCe5q23Zb8Wr36DxsUr', + payerFioPublicKey: wallet2.publicKey, }, ], - privateKey: '5JTmqev7ZsryGGkN6z4FRzd4ELQJLNZuhtQhobVVsJsBHnXxFCw', + privateKey: wallet1.privateKey, }; const decryptContentParams = { content: 'FoyXu0rQyBSbkvI3gJ2FIz6PBylbhxetqTMQpa3BEcogvnFg1EpWEZY+QyQEA2Ckv1/m2bbs+SfCiZXjieFAF9xfUiCQ+MK66Ky1ctn1JNx8BmDFI+1Wnyn2uoxwP55fZK0MUBw0hKTu7WnUHvDWPgFHsNdIyDVlB0lb174U37Hm1c8BS/KMpqjpN/E2xN9D', - encryptionPublicKey: 'FIO8hnBb7aUDFs6cvCT2TCRQs9vV9jxJbKLCe5q23Zb8Wr36DxsUr', + encryptionPublicKey: wallet2.publicKey, fioContentType: 'new_funds_content', - privateKey: '5JTmqev7ZsryGGkN6z4FRzd4ELQJLNZuhtQhobVVsJsBHnXxFCw', + privateKey: wallet1.privateKey, }; describe('Test methods', () => { it('returns FIO Public key generated from private key', async () => { const result = getPublicKey({ - privateKey: '5JTmqev7ZsryGGkN6z4FRzd4ELQJLNZuhtQhobVVsJsBHnXxFCw', + privateKey: wallet1.privateKey, }); - expect(result).toEqual( - 'FIO7MYkz3serGGGanVPnPPupE1xSm1t7t8mWJ3H7KEd2vS2ZZbXBF' - ); + expect(result).toEqual(wallet1.publicKey); }); it('returns signed nonce', async () => { @@ -63,13 +92,13 @@ describe('Test methods', () => { const result = signNonce({ nonce, - privateKey: '5JTmqev7ZsryGGkN6z4FRzd4ELQJLNZuhtQhobVVsJsBHnXxFCw', + privateKey: wallet1.privateKey, }); const isVerified = verifySignature({ data: nonce, signature: result, - publicKey: 'FIO7MYkz3serGGGanVPnPPupE1xSm1t7t8mWJ3H7KEd2vS2ZZbXBF', + publicKey: wallet1.publicKey, }); expect(isVerified).toEqual(true); @@ -100,8 +129,34 @@ describe('Test methods', () => { expect(result.memo).toEqual(MEMO_PHRASE); expect(result.amount).toEqual('12'); - expect(result.payee_public_address).toEqual( - 'FIO7MYkz3serGGGanVPnPPupE1xSm1t7t8mWJ3H7KEd2vS2ZZbXBF' - ); + expect(result.payee_public_address).toEqual(wallet1.publicKey); + }); + + it('check encrypted content', async () => { + const result = encryptContent(encryptContentParams); + + expect(typeof result === 'string').toBe(true); + + const decryptResult = decryptContent({ + content: result, + encryptionPublicKey: wallet2.publicKey, + fioContentType: encryptContentParams.fioContentType, + privateKey: wallet1.privateKey, + }); + + expect(decryptResult.memo).toEqual(encryptContentParams.content.memo); + expect(decryptResult.amount).toEqual(encryptContentParams.content.amount); + expect(decryptResult.payee_public_address).toEqual(wallet1.publicKey); + + const decryptResult2 = decryptContent({ + content: result, + encryptionPublicKey: wallet1.publicKey, + fioContentType: encryptContentParams.fioContentType, + privateKey: wallet2.privateKey, + }); + + expect(decryptResult2.memo).toEqual(encryptContentParams.content.memo); + expect(decryptResult2.amount).toEqual(encryptContentParams.content.amount); + expect(decryptResult2.payee_public_address).toEqual(wallet1.publicKey); }); }); diff --git a/src/index.ts b/src/index.ts index 71f7c93..9828de3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,9 +3,11 @@ import { signNonce } from './utils/signNonce'; import { decryptContent } from './utils/encrypt/decrypt-fio'; import { getPublicKey } from './utils/getKeys'; import { verifySignature } from './utils/encrypt/signature'; +import { encryptContent } from './utils/transaction/cypher-content'; export { decryptContent, + encryptContent, getPublicKey, signNonce, signTransaction, diff --git a/src/utils/transaction/cypher-content.ts b/src/utils/transaction/cypher-content.ts index ff0a8e1..77c3624 100644 --- a/src/utils/transaction/cypher-content.ts +++ b/src/utils/transaction/cypher-content.ts @@ -1,21 +1,21 @@ import { DataParams } from '../../types'; import { getCipherContent } from '../encrypt/encrypt-fio'; -export const cypherContent = ({ +export const encryptContent = ({ content, - contentType, encryptionPublicKey, + fioContentType, privateKey, }: { content: DataParams['content']; - contentType: string; encryptionPublicKey: string; + fioContentType: string; privateKey: string; }): string => { if (!content) { throw new Error('Missing content parameter'); } - if (!contentType) { + if (!fioContentType) { throw new Error('Missing FIO content type'); } if (!encryptionPublicKey) { @@ -24,7 +24,7 @@ export const cypherContent = ({ const cypheredContent = getCipherContent({ content, - fioContentType: contentType, + fioContentType, privateKey, encryptionPublicKey, }); diff --git a/src/utils/transaction/sign-transaction.ts b/src/utils/transaction/sign-transaction.ts index 7126cff..9f2dd86 100644 --- a/src/utils/transaction/sign-transaction.ts +++ b/src/utils/transaction/sign-transaction.ts @@ -11,7 +11,7 @@ import { getPublicKey } from '../getKeys'; import { serializeAction } from '../serialize/serialize-action'; import { serializeTransaction } from '../serialize/serialize-transaction'; import { createTransaction } from './create-transaction'; -import { cypherContent } from './cypher-content'; +import { encryptContent } from './cypher-content'; export const signTransaction = async ( params: RequestParamsTranasction @@ -75,9 +75,9 @@ export const signTransaction = async ( data?.content?.payee_public_address); if (encryptionPublicKey) { - const cypheredContent = cypherContent({ + const cypheredContent = encryptContent({ content: data.content, - contentType, + fioContentType: contentType, encryptionPublicKey, privateKey, }); From df41324a5d60544a0cca7155c53cfee69c9e946e Mon Sep 17 00:00:00 2001 From: Oleksii Trukhanov Date: Tue, 18 Feb 2025 15:04:14 +0200 Subject: [PATCH 2/4] DASH-1194 Update documentation. --- docs/assets/navigation.js | 2 +- docs/assets/search.js | 2 +- docs/functions/index.decryptContent.html | 2 +- docs/functions/index.encryptContent.html | 1 + docs/functions/index.getPublicKey.html | 2 +- docs/functions/index.signNonce.html | 2 +- docs/functions/index.signTransaction.html | 2 +- docs/functions/index.verifySignature.html | 2 +- docs/index.html | 35 ++++++++++++++++--- docs/modules/index.html | 5 +-- docs/modules/types.html | 4 +-- docs/types/types.BlockInfo.html | 2 +- docs/types/types.ChainInfo.html | 2 +- docs/types/types.Content.html | 2 +- docs/types/types.DataParams.html | 2 +- docs/types/types.DecryptedContent.html | 2 +- docs/types/types.ECSignatureType.html | 2 +- docs/types/types.RequestParamsItem.html | 2 +- .../types/types.RequestParamsTranasction.html | 4 +-- docs/types/types.SignNonceParams.html | 4 +-- docs/types/types.SignatureObject.html | 2 +- docs/types/types.SignedTransaction.html | 2 +- docs/types/types.Transaction.html | 2 +- docs/types/types.TransactionAction.html | 2 +- 24 files changed, 58 insertions(+), 31 deletions(-) create mode 100644 docs/functions/index.encryptContent.html diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js index b7eb47a..80e925a 100644 --- a/docs/assets/navigation.js +++ b/docs/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE5XUXW+CMBQG4P/Sa7IPs4+MO6e7MEs2s3lnvKjtUTrhwOhhkSz+92W4VSjQ4m379uG0PWX5zQj2xEKmUMKeBSzjFLGQJaksYtCX1fBFREnMArZTKFk4CpiIVCxzQBYuDSBB5GVGkxQJkE7SpkBBKsV/q5lr0nc3h8CAW6B5sY6VeIayn6unHJhWW3xJUUC/ZCIeZpFz1Lxa6sZqQQf5BbnalO9qi5yK3FGfFWyRqxpKZQa6fZvV8KDbfIxTsZvhJj0h1eI/wkxb2NXD/fXtqFbIJOIK+x0z7XXstmooXb3UNqac+JznPNHdzGneKx17GKSzLDvlU58m5nIXZQbdqBXymW/wWYCm47ZmBEm32oqd5f42OtfWi+jla2nfV8xWX9cfIHqO2QoNMUF2PmJbbcSGuNXvw9ViVshneqs8o75adDxMHDvc1WH1A7YbJUc8BgAA" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE5XUy26DMBAF0H/xGvUR9aGyS5Muokpt1GYXZeHYk+AGBoqHKqjKv1clrQMGbLL1XB/GMGb5zQj2xEKmUMKeBSzjFLGQJaksYtCX1fJFREnMArZTKFk4CpiIVCxzQBYuDSBB5GVGkxQJkE7SpkBBKsV/q5lr0nc3h8CAgMPAZs4BboHmxTpW4hnKfq6ecmBabfElRQH9kol4mEXOUfNqqxurBR3kF+RqU76rLXIqckd/VrBFrmoolRno9nhUy4PG4zFOxW6Gm/SEVJv/CFO2sKuH++vbUa2RScQV9jum7HXssWooXbPUNqac+JznPNHdzKnulY6XAqSzLTvlU58m5uMuygy6USvkM9/gswBNx2PNCJJutRU7y/0ddK6tG9HL19K+p5ijvq4/QPS8Zis0xATZeYlttREb4la/D9eIWSGf6e3yjP5q0fEwcexwV4fVD/IGyFuNBgAA" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index 603c03d..6822de2 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE72d34/jthHH/xf11XVE/ea+pUkKBAWaIE37sjgYPpu+VW9tubJ8uevh/veCkmzPcIbySCv3aRe2ZvgV+eFwNLKor0Fd/XEKnp6/Bh/LwzZ4ihbBYb03wVNQHrbmc7AIzvVr8BTsq+351Zy+az9dvjT712ARbF7Xp5M5BU9B8G1BPTRfjuZEPLSfDnsIda7Sm58fzab+cmzM9ofq0JhDc3XZuuodugcxLSyC47q29hdptyazNI2za4Orlf1e3syfrgYDrRFT0LwKo+Ta+nH9xdSr4/n9a7lZrbfb2pxOo7UsPV7GCFz2pzWg08yik/Eyo871vjqPgeai7Go3o5bNy7o8rDbVdjxdS2Q7o6am+mimakK2M2o6NevmPIGmq92MWqr3zarcjtdytZtRy97sq/FKeqsZdbysTy/j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XFEeDEAVyRLPK4b30AzuCKJIs43VueQJRQcB0SuWgPhx0D6NIyJvyvbAAnB1bISBYmnP36wBQEY5cJz3KH0+8IuIhkIbB/EgPMZJiaCnP4ywvCwJCFMB7InMCXWAFPMLLIlta7owYSuEgWq/yPk4IkB6ZyoUwqfAQUeIJLaygLPcwrKcAZg0GNZWzxrzMEuIIFY7xDd0RA18WyuNW625UVm5skAL9ELq/29h/IxWIZzvxrK4FEoFDu0HvCIEQmsih727ETDCpQlQnHoXt6ytUDOiztL96U8BKey55SgFsmnFrMHpzAISynCQfAO5YxwC2e4sxg2sD0j2UnizpLw/UyvNRPhPm1sy8GCEogEGsZYnRDCzAAICRlfS1ay9as/hqsuzIv27edgLEA+UYslQn8NXDXeQA0OPtEtiqiMdXwSicsLmMiG126USroRxA6M9n5unuAgTQJzP9CqI3fuwv4BFO3kE2O64yt+s0LQD+ixEIW2uE+GoBnWKsMZYviqd2IoYHPJgKH4ES1LNRZfyQDs/e2wFWxbNpePdF6lYYnqoSIlB8OntO0d86APCEl/etsgSrQWSIX/asnqv7VE2BqgqmVyCII2O4XzCQgKRP6qbZ4ndKwNqhktMNXDwOawKyRuTk6F9RgmGLZRPGBDTxp2XgzexiD4grgOxOe3M0f1ZfDvhIOHNrUGEgDp5oJuWyfzYcTBCAg8tA9V8ymKfYuM5hsMqC8GxaCLgMxoZDB4d1mEHgFa3ohCDTvFsGxPBp72Rc8Pb/79u1/MChDAsZ/AAA="; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE72dXa/jthGG/4t66zqiRH3w3KVJCgQFmiBNe2MsDK1N71HXtlxZ3ux2sf+9oCTbM+RQHunIvToHtmb4knw4pIYW9TWoqz/Owcvqa/CxPG6Dl2gRHIuDDl6C8rjVn4NFcKn3wUtwqLaXvT5/1366fG0O+2ARbPbF+azPwUsQfFu4HpovJ312PLSfDnsIVSaSu58f9ab+cmr09ofq2Ohjc3PZuuod2hcRJSyCU1Eb+6u0e5FpksTprc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E0GYgJ+RSv5D5ZBub0nBFo3i2CU3nS5rYveFm9+/btf3xZHG3sgAAA"; \ No newline at end of file diff --git a/docs/functions/index.decryptContent.html b/docs/functions/index.decryptContent.html index c64072f..dac0f6e 100644 --- a/docs/functions/index.decryptContent.html +++ b/docs/functions/index.decryptContent.html @@ -1 +1 @@ -decryptContent | @fioprotocol/fio-sdk-lite - v0.0.2
  • Parameters

    • __namedParameters: {
          content: string;
          encryptionPublicKey: string;
          fioContentType: string;
          privateKey: string;
      }
      • content: string
      • encryptionPublicKey: string
      • fioContentType: string
      • privateKey: string

    Returns DecryptedContent

+decryptContent | @fioprotocol/fio-sdk-lite - v1.0.1
  • Parameters

    • __namedParameters: {
          content: string;
          encryptionPublicKey: string;
          fioContentType: string;
          privateKey: string;
      }
      • content: string
      • encryptionPublicKey: string
      • fioContentType: string
      • privateKey: string

    Returns DecryptedContent

diff --git a/docs/functions/index.encryptContent.html b/docs/functions/index.encryptContent.html new file mode 100644 index 0000000..21cc72a --- /dev/null +++ b/docs/functions/index.encryptContent.html @@ -0,0 +1 @@ +encryptContent | @fioprotocol/fio-sdk-lite - v1.0.1
  • Parameters

    • __namedParameters: {
          content: undefined | Content;
          encryptionPublicKey: string;
          fioContentType: string;
          privateKey: string;
      }
      • content: undefined | Content
      • encryptionPublicKey: string
      • fioContentType: string
      • privateKey: string

    Returns string

diff --git a/docs/functions/index.getPublicKey.html b/docs/functions/index.getPublicKey.html index 9028b10..254a4e8 100644 --- a/docs/functions/index.getPublicKey.html +++ b/docs/functions/index.getPublicKey.html @@ -1 +1 @@ -getPublicKey | @fioprotocol/fio-sdk-lite - v0.0.2
  • Parameters

    • __namedParameters: {
          privateKey: string;
      }
      • privateKey: string

    Returns string

+getPublicKey | @fioprotocol/fio-sdk-lite - v1.0.1
  • Parameters

    • __namedParameters: {
          privateKey: string;
      }
      • privateKey: string

    Returns string

diff --git a/docs/functions/index.signNonce.html b/docs/functions/index.signNonce.html index d4b2d49..7d2a307 100644 --- a/docs/functions/index.signNonce.html +++ b/docs/functions/index.signNonce.html @@ -1 +1 @@ -signNonce | @fioprotocol/fio-sdk-lite - v0.0.2
+signNonce | @fioprotocol/fio-sdk-lite - v1.0.1
diff --git a/docs/functions/index.signTransaction.html b/docs/functions/index.signTransaction.html index a7ded6a..91095cc 100644 --- a/docs/functions/index.signTransaction.html +++ b/docs/functions/index.signTransaction.html @@ -1 +1 @@ -signTransaction | @fioprotocol/fio-sdk-lite - v0.0.2
+signTransaction | @fioprotocol/fio-sdk-lite - v1.0.1
diff --git a/docs/functions/index.verifySignature.html b/docs/functions/index.verifySignature.html index 79edc15..baca1f2 100644 --- a/docs/functions/index.verifySignature.html +++ b/docs/functions/index.verifySignature.html @@ -1 +1 @@ -verifySignature | @fioprotocol/fio-sdk-lite - v0.0.2
  • Parameters

    • __namedParameters: {
          data: string | Buffer;
          encoding?: BufferEncoding;
          publicKey: string;
          signature: string;
      }
      • data: string | Buffer
      • Optionalencoding?: BufferEncoding
      • publicKey: string
      • signature: string

    Returns boolean

+verifySignature | @fioprotocol/fio-sdk-lite - v1.0.1
  • Parameters

    • __namedParameters: {
          data: string | Buffer;
          encoding?: BufferEncoding;
          publicKey: string;
          signature: string;
      }
      • data: string | Buffer
      • Optionalencoding?: BufferEncoding
      • publicKey: string
      • signature: string

    Returns boolean

diff --git a/docs/index.html b/docs/index.html index 4a1c0ce..9dd60df 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,4 +1,4 @@ -@fioprotocol/fio-sdk-lite - v0.0.2

@fioprotocol/fio-sdk-lite - v0.0.2

FIO SDK Lite

FIO SDK Lite is a lightweight library for signing transactions, decrypting FIO Requests, and signing nonces on the FIO blockchain.

+@fioprotocol/fio-sdk-lite - v1.0.1

@fioprotocol/fio-sdk-lite - v1.0.1

FIO SDK Lite

FIO SDK Lite is a lightweight library for signing transactions, decrypting FIO Requests, and signing nonces on the FIO blockchain.

For more information on FIO, visit the FIO website.

To explore the FIO Chain, API, and SDKs, check out the FIO Protocol Developer Hub.

Installation

To install the FIO SDK Lite, run:

@@ -44,6 +44,29 @@
import { signTransaction } from '@fioprotocol/fio-sdk-lite';

async function main() {
// URL of FIO Chain API node, see: https://bpmonitor.fio.net/nodes
const apiUrl = 'https://test.fio.eosusa.io'; // No trailing slashes

// Transaction data, see https://dev.fio.net/reference/fio-chain-actions-api
// actor is omitted as it will be inserted by the SDK.
const params = {
apiUrl,
actionParams: [
{
action: 'regaddress',
account: 'fio.address',
data: {
fio_address: `testing-fio-handle-${Date.now()}@regtest`,
owner_fio_public_key: '',
tpid: '',
max_fee: 1500000000000, // Obtain from https://dev.fio.net/reference/get_fee
},
},
],
privateKey: '5JSTL6nnXztYTD1buYfYSqJkNZTBdS9MDZf5nZsFW7gZd1pxZXo',
// Get one for testing at: http://monitor.testnet.fioprotocol.io:3000/#createKey
// And add tokens from faucet at: http://monitor.testnet.fioprotocol.io:3000/#faucet
};

try {
const signedTransactions = await signTransaction(params);
const signedTransactionsResult = JSON.parse(signedTransactions);

const pushTransactionResult = async (signedTransactionsResult: any) => {
const pushResult = await fetch(
apiUrl+'/v1/chain/push_transaction',
{
body: JSON.stringify(signedTransactionsResult),
method: 'POST',
}
);

if ([400, 403, 500].includes(pushResult.status)) {
const jsonResult = await pushResult.json();
const errorMessage = jsonResult.message || 'Something went wrong';

if (jsonResult.fields) {
const fieldErrors = jsonResult.fields.map(field => ({
name: field.name,
value: field.value,
error: field.error,
}));
throw new Error(`${errorMessage}: ${JSON.stringify(fieldErrors)}`);
} else if (jsonResult.error && jsonResult.error.what) {
throw new Error(jsonResult.error.what);
} else {
throw new Error(errorMessage);
}
}

return await pushResult.json();
};
const results = await Promise.allSettled(
signedTransactionsResult.successed.map(pushTransactionResult)
);
console.log(results);
const processedData = results[0].status === 'fulfilled' ? results[0].value.processed : null;
if (processedData) {
const response = JSON.parse(processedData.action_traces[0].receipt.response);
console.log('Processed Data Response:', JSON.stringify(response, null, 2));
}
} catch (error) {
console.error("Error:", error);
}
}

main();
+

Use this function to encrypt content for FIO Request or FIO Data..

+

Parameters:

+
    +
  • +

    content - Required. Content object to encrypt. Must match the schema for the specified fioContentType.

    +
  • +
  • +

    encryptionPublicKey - Required. FIO Public key of the recipient wallet that will be used for encryption. This is used for encryption.

    +
  • +
  • +

    fioContentType - Required. Set as follows:

    +
      +
    • newfundsreq: new_funds_content
    • +
    • recordobt: record_obt_data_content
    • +
    +
  • +
  • +

    privateKey - Required. FIO Private key of the sender.

    +
  • +
+
import { encryptContent } from '@fioprotocol/fio-sdk-lite';

async function main() {
const content = {
payee_public_address: 'purse@alice',
amount: '1',
chain_code: 'FIO',
token_code: 'FIO',
memo: 'Payment for services',
hash: '',
offline_url: ''
};

try {
const encryptedContent = encryptContent({
content,
encryptionPublicKey: 'FIO7MYkz3serGGGanVPnPPupE1xSm7t7t8mWJ3H7KEd2vS2ZZbXBF',
fioContentType: 'new_funds_content', // new_funds_content - FIO Request, or 'record_obt_data_content' - FIO Data
privateKey: '5JTmqev7ZsryGGkN6z4FRzd4ELQJLNZuhtQhobVVsJsBHnXxFCw'
});
console.log(encryptedContent);
} catch (error) {
console.error("Error:", error);
}
}

main(); +
+

Use this function to decrypt content in FIO Requests or FIO Data.

Parameters:

    @@ -54,9 +77,11 @@

    encryptionPublicKey - Required. FIO Public key of the other wallet that was used for encryption. This is returned by /get_pending_fio_requests and /get_obt_data. This is used for decryption.

  • -

    fioContentType - Required. Set as follows: -newfundsreq: new_funds_content -recordobt: record_obt_data_content

    +

    fioContentType - Required. Set as follows:

    +
      +
    • newfundsreq: new_funds_content
    • +
    • recordobt: record_obt_data_content
    • +
  • privateKey - Required. FIO Private key.

    @@ -108,4 +133,4 @@
    npm run docs
     
    -
+
diff --git a/docs/modules/index.html b/docs/modules/index.html index 0f10e24..2fd9617 100644 --- a/docs/modules/index.html +++ b/docs/modules/index.html @@ -1,6 +1,7 @@ -index | @fioprotocol/fio-sdk-lite - v0.0.2

Index

Functions

decryptContent +index | @fioprotocol/fio-sdk-lite - v1.0.1
+
diff --git a/docs/modules/types.html b/docs/modules/types.html index ec2bb2e..f7f5fa7 100644 --- a/docs/modules/types.html +++ b/docs/modules/types.html @@ -1,4 +1,4 @@ -types | @fioprotocol/fio-sdk-lite - v0.0.2

Index

Type Aliases

BlockInfo +types | @fioprotocol/fio-sdk-lite - v1.0.1
+
diff --git a/docs/types/types.BlockInfo.html b/docs/types/types.BlockInfo.html index 0b9ca54..8fe64ac 100644 --- a/docs/types/types.BlockInfo.html +++ b/docs/types/types.BlockInfo.html @@ -1 +1 @@ -BlockInfo | @fioprotocol/fio-sdk-lite - v0.0.2
BlockInfo: {
    action_mroot: string;
    block_extensions: string[];
    block_num: number;
    confirmed: number;
    header_extensions: string[];
    id: string;
    new_producers: string[] | null;
    previous: string;
    producer: string;
    producer_signature: string;
    ref_block_prefix: number;
    schedule_version: number;
    timestamp: string;
    transaction_mroot: string;
    transactions: string[];
}
+BlockInfo | @fioprotocol/fio-sdk-lite - v1.0.1
BlockInfo: {
    action_mroot: string;
    block_extensions: string[];
    block_num: number;
    confirmed: number;
    header_extensions: string[];
    id: string;
    new_producers: string[] | null;
    previous: string;
    producer: string;
    producer_signature: string;
    ref_block_prefix: number;
    schedule_version: number;
    timestamp: string;
    transaction_mroot: string;
    transactions: string[];
}
diff --git a/docs/types/types.ChainInfo.html b/docs/types/types.ChainInfo.html index d9a0076..4a553d0 100644 --- a/docs/types/types.ChainInfo.html +++ b/docs/types/types.ChainInfo.html @@ -1 +1 @@ -ChainInfo | @fioprotocol/fio-sdk-lite - v0.0.2
ChainInfo: {
    block_cpu_limit: number;
    block_net_limit: number;
    chain_id: string;
    fork_db_head_block_id: string;
    fork_db_head_block_num: number;
    head_block_id: string;
    head_block_num: number;
    head_block_producer: string;
    head_block_time: string;
    last_irreversible_block_id: string;
    last_irreversible_block_num: number;
    server_version: string;
    server_version_string: string;
    virtual_block_cpu_limit: number;
    virtual_block_net_limit: number;
}
+ChainInfo | @fioprotocol/fio-sdk-lite - v1.0.1
ChainInfo: {
    block_cpu_limit: number;
    block_net_limit: number;
    chain_id: string;
    fork_db_head_block_id: string;
    fork_db_head_block_num: number;
    head_block_id: string;
    head_block_num: number;
    head_block_producer: string;
    head_block_time: string;
    last_irreversible_block_id: string;
    last_irreversible_block_num: number;
    server_version: string;
    server_version_string: string;
    virtual_block_cpu_limit: number;
    virtual_block_net_limit: number;
}
diff --git a/docs/types/types.Content.html b/docs/types/types.Content.html index bcee2a9..900d683 100644 --- a/docs/types/types.Content.html +++ b/docs/types/types.Content.html @@ -1 +1 @@ -Content | @fioprotocol/fio-sdk-lite - v0.0.2
Content: DecryptedContent | string
+Content | @fioprotocol/fio-sdk-lite - v1.0.1
Content: DecryptedContent | string
diff --git a/docs/types/types.DataParams.html b/docs/types/types.DataParams.html index e78fc53..942b45a 100644 --- a/docs/types/types.DataParams.html +++ b/docs/types/types.DataParams.html @@ -1 +1 @@ -DataParams | @fioprotocol/fio-sdk-lite - v0.0.2
DataParams: {
    amount?: string | number;
    bundle_sets?: number;
    chain_code?: string;
    content?: Content;
    fio_address?: string;
    fio_domain?: string;
    fio_request_id?: string;
    is_public?: number;
    max_fee: number;
    max_oracle_fee?: string;
    new_owner_fio_public_key?: string;
    nfts?: {
        chain_code: string;
        contract_address: string;
        hash?: string;
        metadata?: string;
        token_id: string;
        url?: string;
    }[];
    owner_fio_public_key?: string;
    payee_fio_address?: string;
    payee_public_key?: string;
    payer_fio_address?: string;
    public_address?: string;
    public_addresses?: {
        chain_code: string;
        public_address: string;
        token_code: string;
    }[];
    tpid: string;
}
+DataParams | @fioprotocol/fio-sdk-lite - v1.0.1
DataParams: {
    amount?: string | number;
    bundle_sets?: number;
    chain_code?: string;
    content?: Content;
    fio_address?: string;
    fio_domain?: string;
    fio_request_id?: string;
    is_public?: number;
    max_fee: number;
    max_oracle_fee?: string;
    new_owner_fio_public_key?: string;
    nfts?: {
        chain_code: string;
        contract_address: string;
        hash?: string;
        metadata?: string;
        token_id: string;
        url?: string;
    }[];
    owner_fio_public_key?: string;
    payee_fio_address?: string;
    payee_public_key?: string;
    payer_fio_address?: string;
    public_address?: string;
    public_addresses?: {
        chain_code: string;
        public_address: string;
        token_code: string;
    }[];
    tpid: string;
}
diff --git a/docs/types/types.DecryptedContent.html b/docs/types/types.DecryptedContent.html index 80500f0..ac1980f 100644 --- a/docs/types/types.DecryptedContent.html +++ b/docs/types/types.DecryptedContent.html @@ -1 +1 @@ -DecryptedContent | @fioprotocol/fio-sdk-lite - v0.0.2
DecryptedContent: {
    amount: string | number;
    chain_code: string;
    hash: string | null;
    memo: string | null;
    obt_id?: string;
    offline_url: string | null;
    payee_public_address: string;
    payer_public_address?: string;
    status?: string;
    token_code: string;
}
+DecryptedContent | @fioprotocol/fio-sdk-lite - v1.0.1
DecryptedContent: {
    amount: string | number;
    chain_code: string;
    hash: string | null;
    memo: string | null;
    obt_id?: string;
    offline_url: string | null;
    payee_public_address: string;
    payer_public_address?: string;
    status?: string;
    token_code: string;
}
diff --git a/docs/types/types.ECSignatureType.html b/docs/types/types.ECSignatureType.html index 2efabb1..93c1ed7 100644 --- a/docs/types/types.ECSignatureType.html +++ b/docs/types/types.ECSignatureType.html @@ -1 +1 @@ -ECSignatureType | @fioprotocol/fio-sdk-lite - v0.0.2
ECSignatureType: {
    r: BigInteger;
    s: BigInteger;
    toDER: (() => Buffer);
}
+ECSignatureType | @fioprotocol/fio-sdk-lite - v1.0.1
ECSignatureType: {
    r: BigInteger;
    s: BigInteger;
    toDER: (() => Buffer);
}
diff --git a/docs/types/types.RequestParamsItem.html b/docs/types/types.RequestParamsItem.html index 18dfd1d..2eeb171 100644 --- a/docs/types/types.RequestParamsItem.html +++ b/docs/types/types.RequestParamsItem.html @@ -1 +1 @@ -RequestParamsItem | @fioprotocol/fio-sdk-lite - v0.0.2
RequestParamsItem: {
    account: string;
    action: string;
    authActor?: string;
    contentType?: string;
    data: DataParams;
    dataActor?: string;
    id?: string;
    payeeFioPublicKey?: string;
    payerFioPublicKey?: string;
    timeoutOffset?: string;
}
+RequestParamsItem | @fioprotocol/fio-sdk-lite - v1.0.1
RequestParamsItem: {
    account: string;
    action: string;
    authActor?: string;
    contentType?: string;
    data: DataParams;
    dataActor?: string;
    id?: string;
    payeeFioPublicKey?: string;
    payerFioPublicKey?: string;
    timeoutOffset?: string;
}
diff --git a/docs/types/types.RequestParamsTranasction.html b/docs/types/types.RequestParamsTranasction.html index 751d05b..abe43ed 100644 --- a/docs/types/types.RequestParamsTranasction.html +++ b/docs/types/types.RequestParamsTranasction.html @@ -1,3 +1,3 @@ -RequestParamsTranasction | @fioprotocol/fio-sdk-lite - v0.0.2
RequestParamsTranasction: {
    actionParams: RequestParamsItem[];
    apiUrl: string;
    privateKey: string;
}

Type declaration

diff --git a/docs/types/types.SignNonceParams.html b/docs/types/types.SignNonceParams.html index f5fada7..9811f33 100644 --- a/docs/types/types.SignNonceParams.html +++ b/docs/types/types.SignNonceParams.html @@ -1,2 +1,2 @@ -SignNonceParams | @fioprotocol/fio-sdk-lite - v0.0.2
SignNonceParams: {
    nonce: string | Buffer;
    privateKey: string;
}

Type declaration

  • nonce: string | Buffer

    The nonce to be signed. Could be generated like this: `crypto.createHmac('sha256', config.secret).update(string).digest('hex');

    -
  • privateKey: string
+SignNonceParams | @fioprotocol/fio-sdk-lite - v1.0.1
SignNonceParams: {
    nonce: string | Buffer;
    privateKey: string;
}

Type declaration

  • nonce: string | Buffer

    The nonce to be signed. Could be generated like this: `crypto.createHmac('sha256', config.secret).update(string).digest('hex');

    +
  • privateKey: string
diff --git a/docs/types/types.SignatureObject.html b/docs/types/types.SignatureObject.html index a1cb77d..0deb1c7 100644 --- a/docs/types/types.SignatureObject.html +++ b/docs/types/types.SignatureObject.html @@ -1 +1 @@ -SignatureObject | @fioprotocol/fio-sdk-lite - v0.0.2
SignatureObject: {
    i: number;
    r: BigInteger;
    s: BigInteger;
}
+SignatureObject | @fioprotocol/fio-sdk-lite - v1.0.1
SignatureObject: {
    i: number;
    r: BigInteger;
    s: BigInteger;
}
diff --git a/docs/types/types.SignedTransaction.html b/docs/types/types.SignedTransaction.html index 84665e5..b3bd9fa 100644 --- a/docs/types/types.SignedTransaction.html +++ b/docs/types/types.SignedTransaction.html @@ -1 +1 @@ -SignedTransaction | @fioprotocol/fio-sdk-lite - v0.0.2
SignedTransaction: {
    compression: number;
    packed_context_free_data: string;
    packed_trx: string;
    signatures: string[];
}
+SignedTransaction | @fioprotocol/fio-sdk-lite - v1.0.1
SignedTransaction: {
    compression: number;
    packed_context_free_data: string;
    packed_trx: string;
    signatures: string[];
}
diff --git a/docs/types/types.Transaction.html b/docs/types/types.Transaction.html index 5177886..323148b 100644 --- a/docs/types/types.Transaction.html +++ b/docs/types/types.Transaction.html @@ -1 +1 @@ -Transaction | @fioprotocol/fio-sdk-lite - v0.0.2
Transaction: {
    actions: TransactionAction[];
    expiration: string;
    ref_block_num: number;
    ref_block_prefix: number;
}
+Transaction | @fioprotocol/fio-sdk-lite - v1.0.1
Transaction: {
    actions: TransactionAction[];
    expiration: string;
    ref_block_num: number;
    ref_block_prefix: number;
}
diff --git a/docs/types/types.TransactionAction.html b/docs/types/types.TransactionAction.html index 1a8a7e4..3700504 100644 --- a/docs/types/types.TransactionAction.html +++ b/docs/types/types.TransactionAction.html @@ -1 +1 @@ -TransactionAction | @fioprotocol/fio-sdk-lite - v0.0.2
TransactionAction: {
    account: string;
    authorization: {
        actor: string;
        permission: string;
    }[];
    data: DataParams | string;
    name: string;
}
+TransactionAction | @fioprotocol/fio-sdk-lite - v1.0.1
TransactionAction: {
    account: string;
    authorization: {
        actor: string;
        permission: string;
    }[];
    data: DataParams | string;
    name: string;
}
From d31e12c054d888993acf0af6ea5d50d566e57875 Mon Sep 17 00:00:00 2001 From: Oleksii Trukhanov Date: Tue, 18 Feb 2025 15:06:27 +0200 Subject: [PATCH 3/4] Update version to 1.0.1 --- package-lock.json | 680 ++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 325 insertions(+), 357 deletions(-) diff --git a/package-lock.json b/package-lock.json index d4513b9..9a6985a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@fioprotocol/fio-sdk-lite", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@fioprotocol/fio-sdk-lite", - "version": "1.0.0", + "version": "1.0.1", "license": "(MIT-0 OR Apache-2.0)", "dependencies": { "bigi": "1.4.2", @@ -59,12 +59,13 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.25.9.tgz", - "integrity": "sha512-z88xeGxnzehn2sqZ8UdGQEvYErF1odv2CftxInpSYJt6uHuPe9YjahKZITGs3l5LeI9d2ROG+obuDAoSlqbNfQ==", + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dev": true, "dependencies": { - "@babel/highlight": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", "picocolors": "^1.0.0" }, "engines": { @@ -72,30 +73,30 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.25.9.tgz", - "integrity": "sha512-yD+hEuJ/+wAJ4Ox2/rpNv5HIuPG82x3ZlQvYVn8iYCprdxzE7P1udpGF1jyjQVBU4dgznN+k2h103vxZ7NdPyw==", + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.8.tgz", + "integrity": "sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.25.9.tgz", - "integrity": "sha512-WYvQviPw+Qyib0v92AwNIrdLISTp7RfDkM7bPqBvpbnhY4wq8HvHBZREVdYDXk98C8BkOIVnHAY3yvj7AVISxQ==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.9.tgz", + "integrity": "sha512-lWBYIrF7qK5+GjY5Uy+/hEgp8OJWOD/rpy74GplYRhEauvbHDeFB8t5hPOZxCZ0Oxf4Cc36tK51/l3ymJysrKw==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.25.9", - "@babel/generator": "^7.25.9", - "@babel/helper-compilation-targets": "^7.25.9", - "@babel/helper-module-transforms": "^7.25.9", - "@babel/helpers": "^7.25.9", - "@babel/parser": "^7.25.9", - "@babel/template": "^7.25.9", - "@babel/traverse": "^7.25.9", - "@babel/types": "^7.25.9", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.9", + "@babel/helper-compilation-targets": "^7.26.5", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.9", + "@babel/parser": "^7.26.9", + "@babel/template": "^7.26.9", + "@babel/traverse": "^7.26.9", + "@babel/types": "^7.26.9", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -120,12 +121,13 @@ } }, "node_modules/@babel/generator": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.25.9.tgz", - "integrity": "sha512-omlUGkr5EaoIJrhLf9CJ0TvjBRpd9+AXRG//0GEQ9THSo8wPiTlbpy1/Ow8ZTrbXpjd9FHXfbFQx32I04ht0FA==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.9.tgz", + "integrity": "sha512-kEWdzjOAUMW4hAyrzJ0ZaTOu9OmpyDIQicIh0zg0EEcEkYXZb2TjtBhnHi2ViX7PKwZqF4xwqfAm299/QMP3lg==", "dev": true, "dependencies": { - "@babel/types": "^7.25.9", + "@babel/parser": "^7.26.9", + "@babel/types": "^7.26.9", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^3.0.2" @@ -135,12 +137,12 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz", - "integrity": "sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz", + "integrity": "sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.25.9", + "@babel/compat-data": "^7.26.5", "@babel/helper-validator-option": "^7.25.9", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", @@ -173,13 +175,12 @@ } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.25.9.tgz", - "integrity": "sha512-TvLZY/F3+GvdRYFZFyxMvnsKi+4oJdgZzU3BoGN9Uc2d9C6zfNwJcKKhjqLAhK8i46mv93jsO74fDh3ih6rpHA==", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", "dev": true, "dependencies": { "@babel/helper-module-imports": "^7.25.9", - "@babel/helper-simple-access": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9", "@babel/traverse": "^7.25.9" }, @@ -191,23 +192,10 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", - "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.25.9.tgz", - "integrity": "sha512-c6WHXuiaRsJTyHYLJV75t9IqsmTbItYfdj99PnzYGQZkYKvan5/2jKJ7gu31J3/BJ/A18grImSPModuyG/Eo0Q==", + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.26.5.tgz", + "integrity": "sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg==", "dev": true, - "dependencies": { - "@babel/traverse": "^7.25.9", - "@babel/types": "^7.25.9" - }, "engines": { "node": ">=6.9.0" } @@ -240,111 +228,25 @@ } }, "node_modules/@babel/helpers": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.25.9.tgz", - "integrity": "sha512-oKWp3+usOJSzDZOucZUAMayhPz/xVjzymyDzUN8dk0Wd3RWMlGLXi07UCQ/CgQVb8LvXx3XBajJH4XGgkt7H7g==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.9.tgz", + "integrity": "sha512-Mz/4+y8udxBKdmzt/UjPACs4G3j5SshJJEFFKxlCGPydG4JAHXxjWjAwjd09tf6oINvl1VfMJo+nB7H2YKQ0dA==", "dev": true, "dependencies": { - "@babel/template": "^7.25.9", - "@babel/types": "^7.25.9" + "@babel/template": "^7.26.9", + "@babel/types": "^7.26.9" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/highlight": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.25.9.tgz", - "integrity": "sha512-llL88JShoCsth8fF8R4SJnIn+WLvR6ccFxu1H3FlMhDontdcmZWf2HgIZ7AIqV3Xcck1idlohrN4EUBQz6klbw==", - "dev": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.25.9", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/@babel/parser": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.9.tgz", - "integrity": "sha512-aI3jjAAO1fh7vY/pBGsn1i9LDbRP43+asrRlkPuTXW5yHXtd1NgTEMudbBoDDxrf1daEEfPJqR+JBMakzrR4Dg==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.9.tgz", + "integrity": "sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A==", "dev": true, "dependencies": { - "@babel/types": "^7.25.9" + "@babel/types": "^7.26.9" }, "bin": { "parser": "bin/babel-parser.js" @@ -405,9 +307,9 @@ } }, "node_modules/@babel/plugin-syntax-import-attributes": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.25.9.tgz", - "integrity": "sha512-u3EN9ub8LyYvgTnrgp8gboElouayiwPdnM7x5tcnW3iSt09/lQYPwMNK40I9IUxo7QOZhAsPHCmmuO7EPdruqg==", + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz", + "integrity": "sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==", "dev": true, "dependencies": { "@babel/helper-plugin-utils": "^7.25.9" @@ -576,30 +478,30 @@ } }, "node_modules/@babel/template": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", - "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.26.9.tgz", + "integrity": "sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.25.9", - "@babel/parser": "^7.25.9", - "@babel/types": "^7.25.9" + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.26.9", + "@babel/types": "^7.26.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.9.tgz", - "integrity": "sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.9.tgz", + "integrity": "sha512-ZYW7L+pL8ahU5fXmNbPF+iZFHCv5scFak7MZ9bwaRPLUhHh7QQEMjZUg0HevihoqCM5iSYHN61EyCoZvqC+bxg==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.25.9", - "@babel/generator": "^7.25.9", - "@babel/parser": "^7.25.9", - "@babel/template": "^7.25.9", - "@babel/types": "^7.25.9", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.9", + "@babel/parser": "^7.26.9", + "@babel/template": "^7.26.9", + "@babel/types": "^7.26.9", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -617,9 +519,9 @@ } }, "node_modules/@babel/types": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.9.tgz", - "integrity": "sha512-OwS2CM5KocvQ/k7dFJa8i5bNGJP0hXWfVCfDkqRFP1IreH1JDC7wG6eCYCi0+McbfT8OR/kNqsI0UU0xP9H6PQ==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.9.tgz", + "integrity": "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.25.9", @@ -658,24 +560,27 @@ } }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", - "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", + "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", "dev": true, "dependencies": { - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^3.4.3" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, + "funding": { + "url": "https://opencollective.com/eslint" + }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "node_modules/@eslint-community/regexpp": { - "version": "4.11.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.1.tgz", - "integrity": "sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q==", + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" @@ -727,9 +632,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", - "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", + "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -781,42 +686,55 @@ } }, "node_modules/@eslint/object-schema": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz", - "integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==", + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz", + "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, "node_modules/@eslint/plugin-kit": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.1.tgz", - "integrity": "sha512-HFZ4Mp26nbWk9d/BpvP0YNL6W4UoZF0VFcTw/aPPA8RpOxeFQgK+ClABGgAUXs9Y/RGX/l1vOmrqz1MQt9MNuw==", + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.5.tgz", + "integrity": "sha512-lB05FkqEdUg2AA0xEbUz0SnkXT1LcCTa438W4IWTUh4hdOnVbQyOJ81OrDXsJk/LSiJHubgGEFoR5EHq1NsH1A==", "dev": true, "dependencies": { + "@eslint/core": "^0.10.0", "levn": "^0.4.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, + "node_modules/@eslint/plugin-kit/node_modules/@eslint/core": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.10.0.tgz", + "integrity": "sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, "node_modules/@humanfs/core": { - "version": "0.19.0", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.0.tgz", - "integrity": "sha512-2cbWIHbZVEweE853g8jymffCA+NCMiuqeECeBBLm8dg2oFdjuGJhgN4UAbI+6v0CKbbhvtXA4qV8YR5Ji86nmw==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", "dev": true, "engines": { "node": ">=18.18.0" } }, "node_modules/@humanfs/node": { - "version": "0.16.5", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.5.tgz", - "integrity": "sha512-KSPA4umqSG4LHYRodq31VDwKAvaTF4xmVlzM8Aeh4PlU1JQ3IG0wiA8C25d3RQ9nJyM3mBHyI53K06VVL/oFFg==", + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", "dev": true, "dependencies": { - "@humanfs/core": "^0.19.0", + "@humanfs/core": "^0.19.1", "@humanwhocodes/retry": "^0.3.0" }, "engines": { @@ -1236,9 +1154,9 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", - "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", "dev": true, "dependencies": { "@jridgewell/set-array": "^1.2.1", @@ -1284,9 +1202,9 @@ } }, "node_modules/@noble/hashes": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", - "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.1.tgz", + "integrity": "sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ==", "engines": { "node": "^14.21.3 || >=16" }, @@ -1342,54 +1260,72 @@ } }, "node_modules/@shikijs/core": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.22.0.tgz", - "integrity": "sha512-S8sMe4q71TJAW+qG93s5VaiihujRK6rqDFqBnxqvga/3LvqHEnxqBIOPkt//IdXVtHkQWKu4nOQNk0uBGicU7Q==", + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.29.2.tgz", + "integrity": "sha512-vju0lY9r27jJfOY4Z7+Rt/nIOjzJpZ3y+nYpqtUZInVoXQ/TJZcfGnNOGnKjFdVZb8qexiCuSlZRKcGfhhTTZQ==", "dev": true, "dependencies": { - "@shikijs/engine-javascript": "1.22.0", - "@shikijs/engine-oniguruma": "1.22.0", - "@shikijs/types": "1.22.0", - "@shikijs/vscode-textmate": "^9.3.0", + "@shikijs/engine-javascript": "1.29.2", + "@shikijs/engine-oniguruma": "1.29.2", + "@shikijs/types": "1.29.2", + "@shikijs/vscode-textmate": "^10.0.1", "@types/hast": "^3.0.4", - "hast-util-to-html": "^9.0.3" + "hast-util-to-html": "^9.0.4" } }, "node_modules/@shikijs/engine-javascript": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.22.0.tgz", - "integrity": "sha512-AeEtF4Gcck2dwBqCFUKYfsCq0s+eEbCEbkUuFou53NZ0sTGnJnJ/05KHQFZxpii5HMXbocV9URYVowOP2wH5kw==", + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-1.29.2.tgz", + "integrity": "sha512-iNEZv4IrLYPv64Q6k7EPpOCE/nuvGiKl7zxdq0WFuRPF5PAE9PRo2JGq/d8crLusM59BRemJ4eOqrFrC4wiQ+A==", "dev": true, "dependencies": { - "@shikijs/types": "1.22.0", - "@shikijs/vscode-textmate": "^9.3.0", - "oniguruma-to-js": "0.4.3" + "@shikijs/types": "1.29.2", + "@shikijs/vscode-textmate": "^10.0.1", + "oniguruma-to-es": "^2.2.0" } }, "node_modules/@shikijs/engine-oniguruma": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.22.0.tgz", - "integrity": "sha512-5iBVjhu/DYs1HB0BKsRRFipRrD7rqjxlWTj4F2Pf+nQSPqc3kcyqFFeZXnBMzDf0HdqaFVvhDRAGiYNvyLP+Mw==", + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.29.2.tgz", + "integrity": "sha512-7iiOx3SG8+g1MnlzZVDYiaeHe7Ez2Kf2HrJzdmGwkRisT7r4rak0e655AcM/tF9JG/kg5fMNYlLLKglbN7gBqA==", + "dev": true, + "dependencies": { + "@shikijs/types": "1.29.2", + "@shikijs/vscode-textmate": "^10.0.1" + } + }, + "node_modules/@shikijs/langs": { + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-1.29.2.tgz", + "integrity": "sha512-FIBA7N3LZ+223U7cJDUYd5shmciFQlYkFXlkKVaHsCPgfVLiO+e12FmQE6Tf9vuyEsFe3dIl8qGWKXgEHL9wmQ==", + "dev": true, + "dependencies": { + "@shikijs/types": "1.29.2" + } + }, + "node_modules/@shikijs/themes": { + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-1.29.2.tgz", + "integrity": "sha512-i9TNZlsq4uoyqSbluIcZkmPL9Bfi3djVxRnofUHwvx/h6SRW3cwgBC5SML7vsDcWyukY0eCzVN980rqP6qNl9g==", "dev": true, "dependencies": { - "@shikijs/types": "1.22.0", - "@shikijs/vscode-textmate": "^9.3.0" + "@shikijs/types": "1.29.2" } }, "node_modules/@shikijs/types": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.22.0.tgz", - "integrity": "sha512-Fw/Nr7FGFhlQqHfxzZY8Cwtwk5E9nKDUgeLjZgt3UuhcM3yJR9xj3ZGNravZZok8XmEZMiYkSMTPlPkULB8nww==", + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.29.2.tgz", + "integrity": "sha512-VJjK0eIijTZf0QSTODEXCqinjBn0joAHQ+aPSBzrv4O2d/QSbsMw+ZeSRx03kV34Hy7NzUvV/7NqfYGRLrASmw==", "dev": true, "dependencies": { - "@shikijs/vscode-textmate": "^9.3.0", + "@shikijs/vscode-textmate": "^10.0.1", "@types/hast": "^3.0.4" } }, "node_modules/@shikijs/vscode-textmate": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-9.3.0.tgz", - "integrity": "sha512-jn7/7ky30idSkd/O5yDBfAnVt+JJpepofP/POZ1iMOxK59cOfqIgg/Dj0eFsjOTMw+4ycJN0uhZH/Eb0bs/EUA==", + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz", + "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==", "dev": true }, "node_modules/@sinclair/typebox": { @@ -1589,12 +1525,12 @@ } }, "node_modules/@types/node": { - "version": "22.7.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.9.tgz", - "integrity": "sha512-jrTfRC7FM6nChvU7X2KqcrgquofrWLFDeYC1hKfwNWomVvrn7JIksqf344WN2X/y8xrgqBd2dJATZV4GbatBfg==", + "version": "22.13.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.4.tgz", + "integrity": "sha512-ywP2X0DYtX3y08eFVx5fNIw7/uIv8hYUKgXoK8oayJlLnKcRfEYCxWMVE1XagUdVtCJlZT1AU4LXEABW+L1Peg==", "dev": true, "dependencies": { - "undici-types": "~6.19.2" + "undici-types": "~6.20.0" } }, "node_modules/@types/randombytes": { @@ -1822,15 +1758,15 @@ } }, "node_modules/@ungap/structured-clone": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", - "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", "dev": true }, "node_modules/acorn": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.13.0.tgz", - "integrity": "sha512-8zSiw54Oxrdym50NlZ9sUusyO1Z1ZchgRLWRaK6c86XJFClyCgFKetdowBg5bKxyp/u+CDBJG4Mpp0m3HLZl9w==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -2137,9 +2073,9 @@ } }, "node_modules/browserslist": { - "version": "4.24.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz", - "integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==", + "version": "4.24.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz", + "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==", "dev": true, "funding": [ { @@ -2156,9 +2092,9 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001669", - "electron-to-chromium": "^1.5.41", - "node-releases": "^2.0.18", + "caniuse-lite": "^1.0.30001688", + "electron-to-chromium": "^1.5.73", + "node-releases": "^2.0.19", "update-browserslist-db": "^1.1.1" }, "bin": { @@ -2250,9 +2186,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001669", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001669.tgz", - "integrity": "sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w==", + "version": "1.0.30001700", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001700.tgz", + "integrity": "sha512-2S6XIXwaE7K7erT8dY+kLQcpa5ms63XlRkMkReXjle+kf6c5g38vyMl+Z5y8dSxOFDhcFe+nxnn261PLxBSQsQ==", "dev": true, "funding": [ { @@ -2340,18 +2276,21 @@ } }, "node_modules/cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.6.tgz", + "integrity": "sha512-3Ek9H3X6pj5TgenXYtNWdaBon1tgYCaebd+XPg0keyjEbEfkD4KkmAxkQ/i1vYvxdcT5nscLBfq9VJRmCBcFSw==", "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" } }, "node_modules/cjs-module-lexer": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz", - "integrity": "sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz", + "integrity": "sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q==", "dev": true }, "node_modules/cliui": { @@ -2477,9 +2416,9 @@ "dev": true }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "dependencies": { "path-key": "^3.1.0", @@ -2491,9 +2430,9 @@ } }, "node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "dev": true, "dependencies": { "ms": "^2.1.3" @@ -2595,9 +2534,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.43", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.43.tgz", - "integrity": "sha512-NxnmFBHDl5Sachd2P46O7UJiMaMHMLSofoIWVJq3mj8NJgG0umiSeljAVP9lGzjI0UDLJJ5jjoGjcrB8RSbjLQ==", + "version": "1.5.102", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.102.tgz", + "integrity": "sha512-eHhqaja8tE/FNpIiBrvBjFV/SSKpyWHLvxuR9dPTdo+3V9ppdLmFB7ZZQ98qNovcngPLYIz0oOBF9P0FfZef5Q==", "dev": true }, "node_modules/emittery": { @@ -2618,6 +2557,12 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "node_modules/emoji-regex-xs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex-xs/-/emoji-regex-xs-1.0.0.tgz", + "integrity": "sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==", + "dev": true + }, "node_modules/entities": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", @@ -2763,9 +2708,9 @@ } }, "node_modules/eslint-scope": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.1.0.tgz", - "integrity": "sha512-14dSvlhaVhKKsa9Fx1l8A17s7ah7Ef7wCakJ10LYk6+GYmP9yDti2oq2SEwcyndt6knfcZyhyxwY3i9yL78EQw==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", + "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", "dev": true, "dependencies": { "esrecurse": "^4.3.0", @@ -2801,9 +2746,9 @@ } }, "node_modules/eslint/node_modules/eslint-visitor-keys": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.1.0.tgz", - "integrity": "sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2825,14 +2770,14 @@ } }, "node_modules/espree": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.2.0.tgz", - "integrity": "sha512-upbkBJbckcCNBDBDXEbuhjbP68n+scUd3k/U2EkyM9nw+I/jPiL4cLF/Al06CF96wRltFda16sxDFrxsI1v0/g==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", "dev": true, "dependencies": { - "acorn": "^8.12.0", + "acorn": "^8.14.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.1.0" + "eslint-visitor-keys": "^4.2.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2842,9 +2787,9 @@ } }, "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.1.0.tgz", - "integrity": "sha512-Q7lok0mqMUSf5a/AdAZkA5a/gHcO6snwQClVNNvFKCAVlxXucdU8pKydU5ZVZjBx5xr37vGbFFWtLQYreLzrZg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", "dev": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -2978,16 +2923,16 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", - "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", - "micromatch": "^4.0.4" + "micromatch": "^4.0.8" }, "engines": { "node": ">=8.6.0" @@ -3018,9 +2963,9 @@ "dev": true }, "node_modules/fastq": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", - "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.0.tgz", + "integrity": "sha512-7SFSRCNjBQIZH/xZR3iy5iQYR8aGBE0h3VG6/cwlbrpdciNYBMotQav8c1XI3HjHH+NikUpP53nPdlZSdWmFzA==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -3089,9 +3034,9 @@ } }, "node_modules/flatted": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", - "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", "dev": true }, "node_modules/fs.realpath": { @@ -3276,9 +3221,9 @@ } }, "node_modules/hast-util-to-html": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.3.tgz", - "integrity": "sha512-M17uBDzMJ9RPCqLMO92gNNUDuBSq10a25SDBI08iCCxmorf4Yy6sYHK57n9WAbRAAaU+DuR4W6GN9K4DFZesYg==", + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.4.tgz", + "integrity": "sha512-wxQzXtdbhiwGAUKrnQJXlOPmHnEehzphwkK7aluUPQ+lEc1xefC8pblMgpp2w5ldBTEfveRIrADcrhGIWrlTDA==", "dev": true, "dependencies": { "@types/hast": "^3.0.0", @@ -3365,9 +3310,9 @@ } }, "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", "dev": true, "dependencies": { "parent-module": "^1.0.0", @@ -3431,9 +3376,9 @@ "dev": true }, "node_modules/is-core-module": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", - "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", "dev": true, "dependencies": { "hasown": "^2.0.2" @@ -4151,9 +4096,9 @@ } }, "node_modules/jsesc": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.0.2.tgz", - "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", "dev": true, "bin": { "jsesc": "bin/jsesc" @@ -4400,9 +4345,9 @@ } }, "node_modules/micromark-util-character": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.0.tgz", - "integrity": "sha512-KvOVV+X1yLBfs9dCBSopq/+G1PcgT3lAK07mC4BzXi5E7ahzMAF8oIupDDJ6mievI6F+lAATkbQQlQixJfT3aQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", "dev": true, "funding": [ { @@ -4420,9 +4365,9 @@ } }, "node_modules/micromark-util-encode": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.0.tgz", - "integrity": "sha512-pS+ROfCXAGLWCOc8egcBvT0kf27GoWMqtdarNfDcjb6YLuV5cM3ioG45Ys2qOVqeqSbjaKg72vU+Wby3eddPsA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", "dev": true, "funding": [ { @@ -4436,9 +4381,9 @@ ] }, "node_modules/micromark-util-sanitize-uri": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.0.tgz", - "integrity": "sha512-WhYv5UEcZrbAtlsnPuChHUAsu/iBPOVaEVsntLBIdpibO0ddy8OzavZz3iL2xVvBZOpolujSliP65Kq0/7KIYw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", "dev": true, "funding": [ { @@ -4457,9 +4402,9 @@ } }, "node_modules/micromark-util-symbol": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.0.tgz", - "integrity": "sha512-8JZt9ElZ5kyTnO94muPxIGS8oyElRJaiJO8EzV6ZSyGQ1Is8xwl4Q45qU5UOg+bGH4AikWziz0iN4sFLWs8PGw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", "dev": true, "funding": [ { @@ -4473,9 +4418,9 @@ ] }, "node_modules/micromark-util-types": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.0.tgz", - "integrity": "sha512-oNh6S2WMHWRZrmutsRmDDfkzKtxF+bc2VxLC9dvtrDIRFln627VsFP6fLMgTryGDljgLPjkrzQSDcPrjPyDJ5w==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.1.tgz", + "integrity": "sha512-534m2WhVTddrcKVepwmVEVnUAmtrx9bfIjNoQHRqfnvdaHQiFytEhJoTgpWJvDEXCO5gLTQh3wYC1PgOJA4NSQ==", "dev": true, "funding": [ { @@ -4544,9 +4489,9 @@ "dev": true }, "node_modules/node-releases": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", - "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", "dev": true }, "node_modules/normalize-path": { @@ -4594,16 +4539,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/oniguruma-to-js": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/oniguruma-to-js/-/oniguruma-to-js-0.4.3.tgz", - "integrity": "sha512-X0jWUcAlxORhOqqBREgPMgnshB7ZGYszBNspP+tS9hPD3l13CdaXcHbgImoHUHlrvGx/7AvFEkTRhAGYh+jzjQ==", + "node_modules/oniguruma-to-es": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-2.3.0.tgz", + "integrity": "sha512-bwALDxriqfKGfUufKGGepCzu9x7nJQuoRoAFp4AnwehhC2crqrDIAP/uN2qdlsAvSMpeRC3+Yzhqc7hLmle5+g==", "dev": true, "dependencies": { - "regex": "^4.3.2" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" + "emoji-regex-xs": "^1.0.0", + "regex": "^5.1.1", + "regex-recursion": "^5.1.1" } }, "node_modules/optionator": { @@ -4983,9 +4927,28 @@ } }, "node_modules/regex": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/regex/-/regex-4.3.3.tgz", - "integrity": "sha512-r/AadFO7owAq1QJVeZ/nq9jNS1vyZt+6t1p/E59B56Rn2GCya+gr1KSyOzNL/er+r+B7phv5jG2xU2Nz1YkmJg==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/regex/-/regex-5.1.1.tgz", + "integrity": "sha512-dN5I359AVGPnwzJm2jN1k0W9LPZ+ePvoOeVMMfqIMFz53sSwXkxaJoxr50ptnsC771lK95BnTrVSZxq0b9yCGw==", + "dev": true, + "dependencies": { + "regex-utilities": "^2.3.0" + } + }, + "node_modules/regex-recursion": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-5.1.1.tgz", + "integrity": "sha512-ae7SBCbzVNrIjgSbh7wMznPcQel1DNlDtzensnFxpiNpXt1U2ju/bHugH422r+4LAVS1FpW1YCwilmnNsjum9w==", + "dev": true, + "dependencies": { + "regex": "^5.1.1", + "regex-utilities": "^2.3.0" + } + }, + "node_modules/regex-utilities": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/regex-utilities/-/regex-utilities-2.3.0.tgz", + "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==", "dev": true }, "node_modules/require-directory": { @@ -4998,18 +4961,21 @@ } }, "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", "dev": true, "dependencies": { - "is-core-module": "^2.13.0", + "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -5045,9 +5011,9 @@ } }, "node_modules/resolve.exports": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", - "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.3.tgz", + "integrity": "sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A==", "dev": true, "engines": { "node": ">=10" @@ -5115,9 +5081,9 @@ ] }, "node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -5160,16 +5126,18 @@ } }, "node_modules/shiki": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.22.0.tgz", - "integrity": "sha512-/t5LlhNs+UOKQCYBtl5ZsH/Vclz73GIqT2yQsCBygr8L/ppTdmpL4w3kPLoZJbMKVWtoG77Ue1feOjZfDxvMkw==", - "dev": true, - "dependencies": { - "@shikijs/core": "1.22.0", - "@shikijs/engine-javascript": "1.22.0", - "@shikijs/engine-oniguruma": "1.22.0", - "@shikijs/types": "1.22.0", - "@shikijs/vscode-textmate": "^9.3.0", + "version": "1.29.2", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.29.2.tgz", + "integrity": "sha512-njXuliz/cP+67jU2hukkxCNuH1yUi4QfdZZY+sMr5PPrIyXSu5iTb/qYC4BiWWB0vZ+7TbdvYUCeL23zpwCfbg==", + "dev": true, + "dependencies": { + "@shikijs/core": "1.29.2", + "@shikijs/engine-javascript": "1.29.2", + "@shikijs/engine-oniguruma": "1.29.2", + "@shikijs/langs": "1.29.2", + "@shikijs/themes": "1.29.2", + "@shikijs/types": "1.29.2", + "@shikijs/vscode-textmate": "^10.0.1", "@types/hast": "^3.0.4" } }, @@ -5458,9 +5426,9 @@ } }, "node_modules/ts-api-utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", - "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz", + "integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==", "dev": true, "engines": { "node": ">=16" @@ -5556,9 +5524,9 @@ } }, "node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true }, "node_modules/type-check": { @@ -5636,9 +5604,9 @@ "dev": true }, "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", "dev": true }, "node_modules/unist-util-is": { @@ -5710,9 +5678,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", - "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.2.tgz", + "integrity": "sha512-PPypAm5qvlD7XMZC3BujecnaOxwhrtoFR+Dqkk5Aa/6DssiH0ibKoketaj9w8LP7Bont1rYeoV5plxD7RTEPRg==", "dev": true, "funding": [ { @@ -5730,7 +5698,7 @@ ], "dependencies": { "escalade": "^3.2.0", - "picocolors": "^1.1.0" + "picocolors": "^1.1.1" }, "bin": { "update-browserslist-db": "cli.js" @@ -5886,9 +5854,9 @@ "dev": true }, "node_modules/yaml": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.0.tgz", - "integrity": "sha512-a6ae//JvKDEra2kdi1qzCyrJW/WZCgFi8ydDV+eXExl95t+5R+ijnqHJbz9tmMh8FUjx3iv2fCQ4dclAQlO2UQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.0.tgz", + "integrity": "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==", "dev": true, "bin": { "yaml": "bin.mjs" diff --git a/package.json b/package.json index b83dcf5..dd9e19b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fioprotocol/fio-sdk-lite", - "version": "1.0.0", + "version": "1.0.1", "description": "", "repository": { "type": "git", From 8b30a3b53a11555ee150fb8a357f3f25b2327d77 Mon Sep 17 00:00:00 2001 From: Oleksii Trukhanov Date: Wed, 19 Feb 2025 14:43:41 +0200 Subject: [PATCH 4/4] DASH-1194 Update tests and readme file. --- .env.example | 9 +++ README.md | 31 +++++++--- docs/functions/index.decryptContent.html | 2 +- docs/functions/index.encryptContent.html | 2 +- docs/functions/index.getPublicKey.html | 2 +- docs/functions/index.signNonce.html | 2 +- docs/functions/index.signTransaction.html | 2 +- docs/functions/index.verifySignature.html | 2 +- docs/index.html | 11 ++-- docs/modules/index.html | 2 +- docs/modules/types.html | 2 +- docs/types/types.BlockInfo.html | 2 +- docs/types/types.ChainInfo.html | 2 +- docs/types/types.Content.html | 2 +- docs/types/types.DataParams.html | 2 +- docs/types/types.DecryptedContent.html | 2 +- docs/types/types.ECSignatureType.html | 2 +- docs/types/types.RequestParamsItem.html | 2 +- .../types/types.RequestParamsTranasction.html | 2 +- docs/types/types.SignNonceParams.html | 2 +- docs/types/types.SignatureObject.html | 2 +- docs/types/types.SignedTransaction.html | 2 +- docs/types/types.Transaction.html | 2 +- docs/types/types.TransactionAction.html | 2 +- package-lock.json | 13 +++++ package.json | 1 + src/index.test.ts | 58 ++++++++++++++++--- 27 files changed, 123 insertions(+), 42 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..eea1c6c --- /dev/null +++ b/.env.example @@ -0,0 +1,9 @@ +WALLET1_PRIVATE_KEY=your_private_key_here +WALLET2_PRIVATE_KEY=your_private_key_here + +# FIO Handles should already exist on appropriate wallet +WALLET1_FIO_HANDLE=your_fio_handle_here +WALLET2_FIO_HANDLE=your_fio_handle_here + +# Encrypted content string to decrypt +ENCRYPTED_CONTENT_STRING=your_encrypted_content_string_here diff --git a/README.md b/README.md index 026f722..411e841 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ async function main() { }, }, ], - privateKey: '5JSTL6nnXztYTD1buYfYSqJkNZTBdS9MDZf5nZsFW7gZd1pxZXo', + privateKey: FIO_PRIVATE_KEY, // Get one for testing at: http://monitor.testnet.fioprotocol.io:3000/#createKey // And add tokens from faucet at: http://monitor.testnet.fioprotocol.io:3000/#faucet }; @@ -157,9 +157,11 @@ async function main() { try { const encryptedContent = encryptContent({ content, - encryptionPublicKey: 'FIO7MYkz3serGGGanVPnPPupE1xSm7t7t8mWJ3H7KEd2vS2ZZbXBF', + encryptionPublicKey: FIO_PUBLIC_KEY_RECIPIENT, // FIO Public key of the recipient wallet that will be used for encryption fioContentType: 'new_funds_content', // new_funds_content - FIO Request, or 'record_obt_data_content' - FIO Data - privateKey: '5JTmqev7ZsryGGkN6z4FRzd4ELQJLNZuhtQhobVVsJsBHnXxFCw' + privateKey: FIO_PRIVATE_KEY_SENDER // FIO Private key of the sender + // Get one for testing at: http://monitor.testnet.fioprotocol.io:3000/#createKey + // And add tokens from faucet at: http://monitor.testnet.fioprotocol.io:3000/#faucet }); console.log(encryptedContent); } catch (error) { @@ -192,7 +194,9 @@ async function main() { // URL of FIO Chain API node, see: https://bpmonitor.fio.net/nodes const apiUrl = 'https://test.fio.eosusa.io'; // No trailing slashes const params = { - fio_public_key: "FIO7MYkz3serGGGanVPnPPupE1xSm1t7t8mWJ3H7KEd2vS2ZZbXBF", + fio_public_key: FIO_PUBLIC_KEY_SENDER, // FIO Public key of the sender wallet that will be used for encryption. + // You need to have pending FIO Request from the sender to the recipient. + // You can make it using [/new_funds_request](https://dev.fio.net/reference/new_funds_request) action. limit: 1, offset: 0, }; @@ -206,15 +210,25 @@ async function main() { ); const sentFioRequests = await response.json(); const fioRequestToDecrypt = sentFioRequests.requests[0]; - const decryptedContent = decryptContent({ + const decryptedContentSender = decryptContent({ content: fioRequestToDecrypt.content, encryptionPublicKey: fioRequestToDecrypt.payer_fio_public_key, fioContentType: 'new_funds_content', // new_funds_content - FIO Request, or 'record_obt_data_content' - FIO Data - privateKey: '5JTmqev7ZsryGGkN6z4FRzd4ELQJLNZuhtQhobVVsJsBHnXxFCw', + privateKey: FIO_PRIVATE_KEY_SENDER, // FIO Private key of the sender // Get one for testing at: http://monitor.testnet.fioprotocol.io:3000/#createKey // And add tokens from faucet at: http://monitor.testnet.fioprotocol.io:3000/#faucet }); - console.log(decryptedContent); + + const decryptedContentRecipient = decryptContent({ + content: fioRequestToDecrypt.content, + encryptionPublicKey: fioRequestToDecrypt.payee_fio_public_key, + fioContentType: 'new_funds_content', // new_funds_content - FIO Request, or 'record_obt_data_content' - FIO Data + privateKey: FIO_PRIVATE_KEY_RECIPIENT, // FIO Private key of the recipient + }); + + // Decrypted content should be the same for both sender and recipient + console.log(decryptedContentSender); + console.log(decryptedContentRecipient); } catch (error) { console.error("Error:", error); } @@ -250,7 +264,7 @@ import { signNonce, getPublicKey, verifySignature} from '@fioprotocol/fio-sdk-li import { createHmac, randomBytes } from 'crypto-browserify'; async function main() { - const privKey = '5JSTL6nnXztYTD1buYfYSqJkNZTBdS9MDZf5nZsFW7gZd1pxZXo'; + const privKey = FIO_PRIVATE_KEY; // Get one for testing at: http://monitor.testnet.fioprotocol.io:3000/#createKey // And add tokens from faucet at: http://monitor.testnet.fioprotocol.io:3000/#faucet const secret = 'nvjrf43dwmcsl'; @@ -287,6 +301,7 @@ main(); # Testing +To run tests, you need to have 2 FIO wallets with FIO Handles already created. Set it in `.env` file using `.env.example` as a template. Run tests using: ```bash diff --git a/docs/functions/index.decryptContent.html b/docs/functions/index.decryptContent.html index dac0f6e..3cf1294 100644 --- a/docs/functions/index.decryptContent.html +++ b/docs/functions/index.decryptContent.html @@ -1 +1 @@ -decryptContent | @fioprotocol/fio-sdk-lite - v1.0.1
  • Parameters

    • __namedParameters: {
          content: string;
          encryptionPublicKey: string;
          fioContentType: string;
          privateKey: string;
      }
      • content: string
      • encryptionPublicKey: string
      • fioContentType: string
      • privateKey: string

    Returns DecryptedContent

+decryptContent | @fioprotocol/fio-sdk-lite - v1.0.1
  • Parameters

    • __namedParameters: {
          content: string;
          encryptionPublicKey: string;
          fioContentType: string;
          privateKey: string;
      }
      • content: string
      • encryptionPublicKey: string
      • fioContentType: string
      • privateKey: string

    Returns DecryptedContent

diff --git a/docs/functions/index.encryptContent.html b/docs/functions/index.encryptContent.html index 21cc72a..8045f02 100644 --- a/docs/functions/index.encryptContent.html +++ b/docs/functions/index.encryptContent.html @@ -1 +1 @@ -encryptContent | @fioprotocol/fio-sdk-lite - v1.0.1
  • Parameters

    • __namedParameters: {
          content: undefined | Content;
          encryptionPublicKey: string;
          fioContentType: string;
          privateKey: string;
      }
      • content: undefined | Content
      • encryptionPublicKey: string
      • fioContentType: string
      • privateKey: string

    Returns string

+encryptContent | @fioprotocol/fio-sdk-lite - v1.0.1
  • Parameters

    • __namedParameters: {
          content: undefined | Content;
          encryptionPublicKey: string;
          fioContentType: string;
          privateKey: string;
      }
      • content: undefined | Content
      • encryptionPublicKey: string
      • fioContentType: string
      • privateKey: string

    Returns string

diff --git a/docs/functions/index.getPublicKey.html b/docs/functions/index.getPublicKey.html index 254a4e8..acc03f8 100644 --- a/docs/functions/index.getPublicKey.html +++ b/docs/functions/index.getPublicKey.html @@ -1 +1 @@ -getPublicKey | @fioprotocol/fio-sdk-lite - v1.0.1
  • Parameters

    • __namedParameters: {
          privateKey: string;
      }
      • privateKey: string

    Returns string

+getPublicKey | @fioprotocol/fio-sdk-lite - v1.0.1
  • Parameters

    • __namedParameters: {
          privateKey: string;
      }
      • privateKey: string

    Returns string

diff --git a/docs/functions/index.signNonce.html b/docs/functions/index.signNonce.html index 7d2a307..2c29ee6 100644 --- a/docs/functions/index.signNonce.html +++ b/docs/functions/index.signNonce.html @@ -1 +1 @@ -signNonce | @fioprotocol/fio-sdk-lite - v1.0.1
+signNonce | @fioprotocol/fio-sdk-lite - v1.0.1
diff --git a/docs/functions/index.signTransaction.html b/docs/functions/index.signTransaction.html index 91095cc..09f9132 100644 --- a/docs/functions/index.signTransaction.html +++ b/docs/functions/index.signTransaction.html @@ -1 +1 @@ -signTransaction | @fioprotocol/fio-sdk-lite - v1.0.1
+signTransaction | @fioprotocol/fio-sdk-lite - v1.0.1
diff --git a/docs/functions/index.verifySignature.html b/docs/functions/index.verifySignature.html index baca1f2..eb0b540 100644 --- a/docs/functions/index.verifySignature.html +++ b/docs/functions/index.verifySignature.html @@ -1 +1 @@ -verifySignature | @fioprotocol/fio-sdk-lite - v1.0.1
  • Parameters

    • __namedParameters: {
          data: string | Buffer;
          encoding?: BufferEncoding;
          publicKey: string;
          signature: string;
      }
      • data: string | Buffer
      • Optionalencoding?: BufferEncoding
      • publicKey: string
      • signature: string

    Returns boolean

+verifySignature | @fioprotocol/fio-sdk-lite - v1.0.1
  • Parameters

    • __namedParameters: {
          data: string | Buffer;
          encoding?: BufferEncoding;
          publicKey: string;
          signature: string;
      }
      • data: string | Buffer
      • Optionalencoding?: BufferEncoding
      • publicKey: string
      • signature: string

    Returns boolean

diff --git a/docs/index.html b/docs/index.html index 9dd60df..5cd225f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -41,7 +41,7 @@

timeoutOffset - Not required. Time offset for transaction expiration in milliseconds. By default, this is set to 60000 milliseconds, equivalent to 1 minute.

-
import { signTransaction } from '@fioprotocol/fio-sdk-lite';

async function main() {
// URL of FIO Chain API node, see: https://bpmonitor.fio.net/nodes
const apiUrl = 'https://test.fio.eosusa.io'; // No trailing slashes

// Transaction data, see https://dev.fio.net/reference/fio-chain-actions-api
// actor is omitted as it will be inserted by the SDK.
const params = {
apiUrl,
actionParams: [
{
action: 'regaddress',
account: 'fio.address',
data: {
fio_address: `testing-fio-handle-${Date.now()}@regtest`,
owner_fio_public_key: '',
tpid: '',
max_fee: 1500000000000, // Obtain from https://dev.fio.net/reference/get_fee
},
},
],
privateKey: '5JSTL6nnXztYTD1buYfYSqJkNZTBdS9MDZf5nZsFW7gZd1pxZXo',
// Get one for testing at: http://monitor.testnet.fioprotocol.io:3000/#createKey
// And add tokens from faucet at: http://monitor.testnet.fioprotocol.io:3000/#faucet
};

try {
const signedTransactions = await signTransaction(params);
const signedTransactionsResult = JSON.parse(signedTransactions);

const pushTransactionResult = async (signedTransactionsResult: any) => {
const pushResult = await fetch(
apiUrl+'/v1/chain/push_transaction',
{
body: JSON.stringify(signedTransactionsResult),
method: 'POST',
}
);

if ([400, 403, 500].includes(pushResult.status)) {
const jsonResult = await pushResult.json();
const errorMessage = jsonResult.message || 'Something went wrong';

if (jsonResult.fields) {
const fieldErrors = jsonResult.fields.map(field => ({
name: field.name,
value: field.value,
error: field.error,
}));
throw new Error(`${errorMessage}: ${JSON.stringify(fieldErrors)}`);
} else if (jsonResult.error && jsonResult.error.what) {
throw new Error(jsonResult.error.what);
} else {
throw new Error(errorMessage);
}
}

return await pushResult.json();
};
const results = await Promise.allSettled(
signedTransactionsResult.successed.map(pushTransactionResult)
);
console.log(results);
const processedData = results[0].status === 'fulfilled' ? results[0].value.processed : null;
if (processedData) {
const response = JSON.parse(processedData.action_traces[0].receipt.response);
console.log('Processed Data Response:', JSON.stringify(response, null, 2));
}
} catch (error) {
console.error("Error:", error);
}
}

main(); +
import { signTransaction } from '@fioprotocol/fio-sdk-lite';

async function main() {
// URL of FIO Chain API node, see: https://bpmonitor.fio.net/nodes
const apiUrl = 'https://test.fio.eosusa.io'; // No trailing slashes

// Transaction data, see https://dev.fio.net/reference/fio-chain-actions-api
// actor is omitted as it will be inserted by the SDK.
const params = {
apiUrl,
actionParams: [
{
action: 'regaddress',
account: 'fio.address',
data: {
fio_address: `testing-fio-handle-${Date.now()}@regtest`,
owner_fio_public_key: '',
tpid: '',
max_fee: 1500000000000, // Obtain from https://dev.fio.net/reference/get_fee
},
},
],
privateKey: FIO_PRIVATE_KEY,
// Get one for testing at: http://monitor.testnet.fioprotocol.io:3000/#createKey
// And add tokens from faucet at: http://monitor.testnet.fioprotocol.io:3000/#faucet
};

try {
const signedTransactions = await signTransaction(params);
const signedTransactionsResult = JSON.parse(signedTransactions);

const pushTransactionResult = async (signedTransactionsResult: any) => {
const pushResult = await fetch(
apiUrl+'/v1/chain/push_transaction',
{
body: JSON.stringify(signedTransactionsResult),
method: 'POST',
}
);

if ([400, 403, 500].includes(pushResult.status)) {
const jsonResult = await pushResult.json();
const errorMessage = jsonResult.message || 'Something went wrong';

if (jsonResult.fields) {
const fieldErrors = jsonResult.fields.map(field => ({
name: field.name,
value: field.value,
error: field.error,
}));
throw new Error(`${errorMessage}: ${JSON.stringify(fieldErrors)}`);
} else if (jsonResult.error && jsonResult.error.what) {
throw new Error(jsonResult.error.what);
} else {
throw new Error(errorMessage);
}
}

return await pushResult.json();
};
const results = await Promise.allSettled(
signedTransactionsResult.successed.map(pushTransactionResult)
);
console.log(results);
const processedData = results[0].status === 'fulfilled' ? results[0].value.processed : null;
if (processedData) {
const response = JSON.parse(processedData.action_traces[0].receipt.response);
console.log('Processed Data Response:', JSON.stringify(response, null, 2));
}
} catch (error) {
console.error("Error:", error);
}
}

main();

Use this function to encrypt content for FIO Request or FIO Data..

@@ -64,7 +64,7 @@

privateKey - Required. FIO Private key of the sender.

-
import { encryptContent } from '@fioprotocol/fio-sdk-lite';

async function main() {
const content = {
payee_public_address: 'purse@alice',
amount: '1',
chain_code: 'FIO',
token_code: 'FIO',
memo: 'Payment for services',
hash: '',
offline_url: ''
};

try {
const encryptedContent = encryptContent({
content,
encryptionPublicKey: 'FIO7MYkz3serGGGanVPnPPupE1xSm7t7t8mWJ3H7KEd2vS2ZZbXBF',
fioContentType: 'new_funds_content', // new_funds_content - FIO Request, or 'record_obt_data_content' - FIO Data
privateKey: '5JTmqev7ZsryGGkN6z4FRzd4ELQJLNZuhtQhobVVsJsBHnXxFCw'
});
console.log(encryptedContent);
} catch (error) {
console.error("Error:", error);
}
}

main(); +
import { encryptContent } from '@fioprotocol/fio-sdk-lite';

async function main() {
const content = {
payee_public_address: 'purse@alice',
amount: '1',
chain_code: 'FIO',
token_code: 'FIO',
memo: 'Payment for services',
hash: '',
offline_url: ''
};

try {
const encryptedContent = encryptContent({
content,
encryptionPublicKey: FIO_PUBLIC_KEY_RECIPIENT, // FIO Public key of the recipient wallet that will be used for encryption
fioContentType: 'new_funds_content', // new_funds_content - FIO Request, or 'record_obt_data_content' - FIO Data
privateKey: FIO_PRIVATE_KEY_SENDER // FIO Private key of the sender
// Get one for testing at: http://monitor.testnet.fioprotocol.io:3000/#createKey
// And add tokens from faucet at: http://monitor.testnet.fioprotocol.io:3000/#faucet
});
console.log(encryptedContent);
} catch (error) {
console.error("Error:", error);
}
}

main();

Use this function to decrypt content in FIO Requests or FIO Data.

@@ -87,7 +87,7 @@

privateKey - Required. FIO Private key.

-
import { decryptContent } from '@fioprotocol/fio-sdk-lite';

async function main() {
// URL of FIO Chain API node, see: https://bpmonitor.fio.net/nodes
const apiUrl = 'https://test.fio.eosusa.io'; // No trailing slashes
const params = {
fio_public_key: "FIO7MYkz3serGGGanVPnPPupE1xSm1t7t8mWJ3H7KEd2vS2ZZbXBF",
limit: 1,
offset: 0,
};

try {
const response = await fetch(apiUrl+'/v1/chain/get_sent_fio_requests',
{
body: JSON.stringify(params),
method: 'POST',
},
);
const sentFioRequests = await response.json();
const fioRequestToDecrypt = sentFioRequests.requests[0];
const decryptedContent = decryptContent({
content: fioRequestToDecrypt.content,
encryptionPublicKey: fioRequestToDecrypt.payer_fio_public_key,
fioContentType: 'new_funds_content', // new_funds_content - FIO Request, or 'record_obt_data_content' - FIO Data
privateKey: '5JTmqev7ZsryGGkN6z4FRzd4ELQJLNZuhtQhobVVsJsBHnXxFCw',
// Get one for testing at: http://monitor.testnet.fioprotocol.io:3000/#createKey
// And add tokens from faucet at: http://monitor.testnet.fioprotocol.io:3000/#faucet
});
console.log(decryptedContent);
} catch (error) {
console.error("Error:", error);
}
}

main(); +
import { decryptContent } from '@fioprotocol/fio-sdk-lite';

async function main() {
// URL of FIO Chain API node, see: https://bpmonitor.fio.net/nodes
const apiUrl = 'https://test.fio.eosusa.io'; // No trailing slashes
const params = {
fio_public_key: FIO_PUBLIC_KEY_SENDER, // FIO Public key of the sender wallet that will be used for encryption.
// You need to have pending FIO Request from the sender to the recipient.
// You can make it using [/new_funds_request](https://dev.fio.net/reference/new_funds_request) action.
limit: 1,
offset: 0,
};

try {
const response = await fetch(apiUrl+'/v1/chain/get_sent_fio_requests',
{
body: JSON.stringify(params),
method: 'POST',
},
);
const sentFioRequests = await response.json();
const fioRequestToDecrypt = sentFioRequests.requests[0];
const decryptedContentSender = decryptContent({
content: fioRequestToDecrypt.content,
encryptionPublicKey: fioRequestToDecrypt.payer_fio_public_key,
fioContentType: 'new_funds_content', // new_funds_content - FIO Request, or 'record_obt_data_content' - FIO Data
privateKey: FIO_PRIVATE_KEY_SENDER, // FIO Private key of the sender
// Get one for testing at: http://monitor.testnet.fioprotocol.io:3000/#createKey
// And add tokens from faucet at: http://monitor.testnet.fioprotocol.io:3000/#faucet
});

const decryptedContentRecipient = decryptContent({
content: fioRequestToDecrypt.content,
encryptionPublicKey: fioRequestToDecrypt.payee_fio_public_key,
fioContentType: 'new_funds_content', // new_funds_content - FIO Request, or 'record_obt_data_content' - FIO Data
privateKey: FIO_PRIVATE_KEY_RECIPIENT, // FIO Private key of the recipient
});

// Decrypted content should be the same for both sender and recipient
console.log(decryptedContentSender);
console.log(decryptedContentRecipient);
} catch (error) {
console.error("Error:", error);
}
}

main();

Parameters getPublicKey:

@@ -118,10 +118,11 @@

encoding - Not required. Is one of Buffer Encoding names: "ascii", "utf8", "utf-8", "utf16le", "utf-16le", "ucs2", "ucs-2", "base64", "base64url", "latin1", "binary", "hex". By default is automatically set as utf8.

-
import { signNonce, getPublicKey, verifySignature} from '@fioprotocol/fio-sdk-lite';
import { createHmac, randomBytes } from 'crypto-browserify';

async function main() {
const privKey = '5JSTL6nnXztYTD1buYfYSqJkNZTBdS9MDZf5nZsFW7gZd1pxZXo';
// Get one for testing at: http://monitor.testnet.fioprotocol.io:3000/#createKey
// And add tokens from faucet at: http://monitor.testnet.fioprotocol.io:3000/#faucet
const secret = 'nvjrf43dwmcsl';

try {
// Get public key from Private key
const publicKey = getPublicKey({ privateKey: privKey });
console.log('Public key', publicKey);

// Generate nonce
const stringToHash = randomBytes(8).toString('hex');
const nonce = createHmac('sha256', secret)
.update(stringToHash)
.digest('hex');

// Sign nonce
const singedNonce = signNonce({ nonce, privateKey: privKey });
console.log('Signed nonce', singedNonce);

// Verify nonce
const isSignatureVerified = verifySignature({
signature: singedNonce,
data: nonce,
publicKey,
});
console.log(isSignatureVerified);
} catch (error) {
console.error('Error:', error);
}
}

main(); +
import { signNonce, getPublicKey, verifySignature} from '@fioprotocol/fio-sdk-lite';
import { createHmac, randomBytes } from 'crypto-browserify';

async function main() {
const privKey = FIO_PRIVATE_KEY;
// Get one for testing at: http://monitor.testnet.fioprotocol.io:3000/#createKey
// And add tokens from faucet at: http://monitor.testnet.fioprotocol.io:3000/#faucet
const secret = 'nvjrf43dwmcsl';

try {
// Get public key from Private key
const publicKey = getPublicKey({ privateKey: privKey });
console.log('Public key', publicKey);

// Generate nonce
const stringToHash = randomBytes(8).toString('hex');
const nonce = createHmac('sha256', secret)
.update(stringToHash)
.digest('hex');

// Sign nonce
const singedNonce = signNonce({ nonce, privateKey: privKey });
console.log('Signed nonce', singedNonce);

// Verify nonce
const isSignatureVerified = verifySignature({
signature: singedNonce,
data: nonce,
publicKey,
});
console.log(isSignatureVerified);
} catch (error) {
console.error('Error:', error);
}
}

main();
-

Testing

Run tests using:

+

Testing

To run tests, you need to have 2 FIO wallets with FIO Handles already created. Set it in .env file using .env.example as a template. +Run tests using:

npm run test
 
diff --git a/docs/modules/index.html b/docs/modules/index.html index 2fd9617..de518c7 100644 --- a/docs/modules/index.html +++ b/docs/modules/index.html @@ -1,4 +1,4 @@ -index | @fioprotocol/fio-sdk-lite - v1.0.1

Index

Functions

decryptContent +index | @fioprotocol/fio-sdk-lite - v1.0.1

Index

Functions

decryptContent encryptContent getPublicKey signNonce diff --git a/docs/modules/types.html b/docs/modules/types.html index f7f5fa7..edb94f9 100644 --- a/docs/modules/types.html +++ b/docs/modules/types.html @@ -1,4 +1,4 @@ -types | @fioprotocol/fio-sdk-lite - v1.0.1

Index

Type Aliases

BlockInfo +types | @fioprotocol/fio-sdk-lite - v1.0.1

Index

Type Aliases

BlockInfo ChainInfo Content DataParams diff --git a/docs/types/types.BlockInfo.html b/docs/types/types.BlockInfo.html index 8fe64ac..4fb36df 100644 --- a/docs/types/types.BlockInfo.html +++ b/docs/types/types.BlockInfo.html @@ -1 +1 @@ -BlockInfo | @fioprotocol/fio-sdk-lite - v1.0.1
BlockInfo: {
    action_mroot: string;
    block_extensions: string[];
    block_num: number;
    confirmed: number;
    header_extensions: string[];
    id: string;
    new_producers: string[] | null;
    previous: string;
    producer: string;
    producer_signature: string;
    ref_block_prefix: number;
    schedule_version: number;
    timestamp: string;
    transaction_mroot: string;
    transactions: string[];
}
+BlockInfo | @fioprotocol/fio-sdk-lite - v1.0.1
BlockInfo: {
    action_mroot: string;
    block_extensions: string[];
    block_num: number;
    confirmed: number;
    header_extensions: string[];
    id: string;
    new_producers: string[] | null;
    previous: string;
    producer: string;
    producer_signature: string;
    ref_block_prefix: number;
    schedule_version: number;
    timestamp: string;
    transaction_mroot: string;
    transactions: string[];
}
diff --git a/docs/types/types.ChainInfo.html b/docs/types/types.ChainInfo.html index 4a553d0..3ecd542 100644 --- a/docs/types/types.ChainInfo.html +++ b/docs/types/types.ChainInfo.html @@ -1 +1 @@ -ChainInfo | @fioprotocol/fio-sdk-lite - v1.0.1
ChainInfo: {
    block_cpu_limit: number;
    block_net_limit: number;
    chain_id: string;
    fork_db_head_block_id: string;
    fork_db_head_block_num: number;
    head_block_id: string;
    head_block_num: number;
    head_block_producer: string;
    head_block_time: string;
    last_irreversible_block_id: string;
    last_irreversible_block_num: number;
    server_version: string;
    server_version_string: string;
    virtual_block_cpu_limit: number;
    virtual_block_net_limit: number;
}
+ChainInfo | @fioprotocol/fio-sdk-lite - v1.0.1
ChainInfo: {
    block_cpu_limit: number;
    block_net_limit: number;
    chain_id: string;
    fork_db_head_block_id: string;
    fork_db_head_block_num: number;
    head_block_id: string;
    head_block_num: number;
    head_block_producer: string;
    head_block_time: string;
    last_irreversible_block_id: string;
    last_irreversible_block_num: number;
    server_version: string;
    server_version_string: string;
    virtual_block_cpu_limit: number;
    virtual_block_net_limit: number;
}
diff --git a/docs/types/types.Content.html b/docs/types/types.Content.html index 900d683..36c8d6b 100644 --- a/docs/types/types.Content.html +++ b/docs/types/types.Content.html @@ -1 +1 @@ -Content | @fioprotocol/fio-sdk-lite - v1.0.1
Content: DecryptedContent | string
+Content | @fioprotocol/fio-sdk-lite - v1.0.1
Content: DecryptedContent | string
diff --git a/docs/types/types.DataParams.html b/docs/types/types.DataParams.html index 942b45a..fb27707 100644 --- a/docs/types/types.DataParams.html +++ b/docs/types/types.DataParams.html @@ -1 +1 @@ -DataParams | @fioprotocol/fio-sdk-lite - v1.0.1
DataParams: {
    amount?: string | number;
    bundle_sets?: number;
    chain_code?: string;
    content?: Content;
    fio_address?: string;
    fio_domain?: string;
    fio_request_id?: string;
    is_public?: number;
    max_fee: number;
    max_oracle_fee?: string;
    new_owner_fio_public_key?: string;
    nfts?: {
        chain_code: string;
        contract_address: string;
        hash?: string;
        metadata?: string;
        token_id: string;
        url?: string;
    }[];
    owner_fio_public_key?: string;
    payee_fio_address?: string;
    payee_public_key?: string;
    payer_fio_address?: string;
    public_address?: string;
    public_addresses?: {
        chain_code: string;
        public_address: string;
        token_code: string;
    }[];
    tpid: string;
}
+DataParams | @fioprotocol/fio-sdk-lite - v1.0.1
DataParams: {
    amount?: string | number;
    bundle_sets?: number;
    chain_code?: string;
    content?: Content;
    fio_address?: string;
    fio_domain?: string;
    fio_request_id?: string;
    is_public?: number;
    max_fee: number;
    max_oracle_fee?: string;
    new_owner_fio_public_key?: string;
    nfts?: {
        chain_code: string;
        contract_address: string;
        hash?: string;
        metadata?: string;
        token_id: string;
        url?: string;
    }[];
    owner_fio_public_key?: string;
    payee_fio_address?: string;
    payee_public_key?: string;
    payer_fio_address?: string;
    public_address?: string;
    public_addresses?: {
        chain_code: string;
        public_address: string;
        token_code: string;
    }[];
    tpid: string;
}
diff --git a/docs/types/types.DecryptedContent.html b/docs/types/types.DecryptedContent.html index ac1980f..8b59a47 100644 --- a/docs/types/types.DecryptedContent.html +++ b/docs/types/types.DecryptedContent.html @@ -1 +1 @@ -DecryptedContent | @fioprotocol/fio-sdk-lite - v1.0.1
DecryptedContent: {
    amount: string | number;
    chain_code: string;
    hash: string | null;
    memo: string | null;
    obt_id?: string;
    offline_url: string | null;
    payee_public_address: string;
    payer_public_address?: string;
    status?: string;
    token_code: string;
}
+DecryptedContent | @fioprotocol/fio-sdk-lite - v1.0.1
DecryptedContent: {
    amount: string | number;
    chain_code: string;
    hash: string | null;
    memo: string | null;
    obt_id?: string;
    offline_url: string | null;
    payee_public_address: string;
    payer_public_address?: string;
    status?: string;
    token_code: string;
}
diff --git a/docs/types/types.ECSignatureType.html b/docs/types/types.ECSignatureType.html index 93c1ed7..7dd2b19 100644 --- a/docs/types/types.ECSignatureType.html +++ b/docs/types/types.ECSignatureType.html @@ -1 +1 @@ -ECSignatureType | @fioprotocol/fio-sdk-lite - v1.0.1
ECSignatureType: {
    r: BigInteger;
    s: BigInteger;
    toDER: (() => Buffer);
}
+ECSignatureType | @fioprotocol/fio-sdk-lite - v1.0.1
ECSignatureType: {
    r: BigInteger;
    s: BigInteger;
    toDER: (() => Buffer);
}
diff --git a/docs/types/types.RequestParamsItem.html b/docs/types/types.RequestParamsItem.html index 2eeb171..fb5b947 100644 --- a/docs/types/types.RequestParamsItem.html +++ b/docs/types/types.RequestParamsItem.html @@ -1 +1 @@ -RequestParamsItem | @fioprotocol/fio-sdk-lite - v1.0.1
RequestParamsItem: {
    account: string;
    action: string;
    authActor?: string;
    contentType?: string;
    data: DataParams;
    dataActor?: string;
    id?: string;
    payeeFioPublicKey?: string;
    payerFioPublicKey?: string;
    timeoutOffset?: string;
}
+RequestParamsItem | @fioprotocol/fio-sdk-lite - v1.0.1
RequestParamsItem: {
    account: string;
    action: string;
    authActor?: string;
    contentType?: string;
    data: DataParams;
    dataActor?: string;
    id?: string;
    payeeFioPublicKey?: string;
    payerFioPublicKey?: string;
    timeoutOffset?: string;
}
diff --git a/docs/types/types.RequestParamsTranasction.html b/docs/types/types.RequestParamsTranasction.html index abe43ed..36853b6 100644 --- a/docs/types/types.RequestParamsTranasction.html +++ b/docs/types/types.RequestParamsTranasction.html @@ -1,3 +1,3 @@ RequestParamsTranasction | @fioprotocol/fio-sdk-lite - v1.0.1
RequestParamsTranasction: {
    actionParams: RequestParamsItem[];
    apiUrl: string;
    privateKey: string;
}

Type declaration

  • actionParams: RequestParamsItem[]
  • apiUrl: string

    The apiUrl is a FIO Action server URL e.g. mainnet - https://fio.blockpane.com;

  • privateKey: string

    The privateKey is a FIO Private key e.g. 5JTmqev7ZsryGGkN6z4FRzd4ELQJLNZuhtQhobVVsJsBHnXxFCw;

    -
+
diff --git a/docs/types/types.SignNonceParams.html b/docs/types/types.SignNonceParams.html index 9811f33..ac0f7de 100644 --- a/docs/types/types.SignNonceParams.html +++ b/docs/types/types.SignNonceParams.html @@ -1,2 +1,2 @@ SignNonceParams | @fioprotocol/fio-sdk-lite - v1.0.1
SignNonceParams: {
    nonce: string | Buffer;
    privateKey: string;
}

Type declaration

  • nonce: string | Buffer

    The nonce to be signed. Could be generated like this: `crypto.createHmac('sha256', config.secret).update(string).digest('hex');

    -
  • privateKey: string
+
  • privateKey: string
  • diff --git a/docs/types/types.SignatureObject.html b/docs/types/types.SignatureObject.html index 0deb1c7..ff69b34 100644 --- a/docs/types/types.SignatureObject.html +++ b/docs/types/types.SignatureObject.html @@ -1 +1 @@ -SignatureObject | @fioprotocol/fio-sdk-lite - v1.0.1
    SignatureObject: {
        i: number;
        r: BigInteger;
        s: BigInteger;
    }
    +SignatureObject | @fioprotocol/fio-sdk-lite - v1.0.1
    SignatureObject: {
        i: number;
        r: BigInteger;
        s: BigInteger;
    }
    diff --git a/docs/types/types.SignedTransaction.html b/docs/types/types.SignedTransaction.html index b3bd9fa..0aec07d 100644 --- a/docs/types/types.SignedTransaction.html +++ b/docs/types/types.SignedTransaction.html @@ -1 +1 @@ -SignedTransaction | @fioprotocol/fio-sdk-lite - v1.0.1
    SignedTransaction: {
        compression: number;
        packed_context_free_data: string;
        packed_trx: string;
        signatures: string[];
    }
    +SignedTransaction | @fioprotocol/fio-sdk-lite - v1.0.1
    SignedTransaction: {
        compression: number;
        packed_context_free_data: string;
        packed_trx: string;
        signatures: string[];
    }
    diff --git a/docs/types/types.Transaction.html b/docs/types/types.Transaction.html index 323148b..a665e2c 100644 --- a/docs/types/types.Transaction.html +++ b/docs/types/types.Transaction.html @@ -1 +1 @@ -Transaction | @fioprotocol/fio-sdk-lite - v1.0.1
    Transaction: {
        actions: TransactionAction[];
        expiration: string;
        ref_block_num: number;
        ref_block_prefix: number;
    }
    +Transaction | @fioprotocol/fio-sdk-lite - v1.0.1
    Transaction: {
        actions: TransactionAction[];
        expiration: string;
        ref_block_num: number;
        ref_block_prefix: number;
    }
    diff --git a/docs/types/types.TransactionAction.html b/docs/types/types.TransactionAction.html index 3700504..aa80210 100644 --- a/docs/types/types.TransactionAction.html +++ b/docs/types/types.TransactionAction.html @@ -1 +1 @@ -TransactionAction | @fioprotocol/fio-sdk-lite - v1.0.1
    TransactionAction: {
        account: string;
        authorization: {
            actor: string;
            permission: string;
        }[];
        data: DataParams | string;
        name: string;
    }
    +TransactionAction | @fioprotocol/fio-sdk-lite - v1.0.1
    TransactionAction: {
        account: string;
        authorization: {
            actor: string;
            permission: string;
        }[];
        data: DataParams | string;
        name: string;
    }
    diff --git a/package-lock.json b/package-lock.json index 9a6985a..2951d12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,6 +31,7 @@ "@types/text-encoding": "0.0.39", "@typescript-eslint/eslint-plugin": "8.8.1", "@typescript-eslint/parser": "8.8.1", + "dotenv": "16.4.7", "eslint": "9.12.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.2.1", @@ -2524,6 +2525,18 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/dotenv": { + "version": "16.4.7", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", + "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/ecurve": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/ecurve/-/ecurve-1.0.6.tgz", diff --git a/package.json b/package.json index dd9e19b..2c970a9 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "@types/text-encoding": "0.0.39", "@typescript-eslint/eslint-plugin": "8.8.1", "@typescript-eslint/parser": "8.8.1", + "dotenv": "16.4.7", "eslint": "9.12.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-prettier": "5.2.1", diff --git a/src/index.test.ts b/src/index.test.ts index 0c6273c..4dcb987 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -1,3 +1,5 @@ +import 'dotenv/config'; + import { decryptContent, encryptContent, @@ -11,15 +13,15 @@ const MEMO_PHRASE = 'Hello FIO SDK Lite'; const MEMO_PHRASE_ENCRYPTED = 'Hello FIO SDK Lite Encrypted'; const wallet1 = { - privateKey: '5JTmqev7ZsryGGkN6z4FRzd4ELQJLNZuhtQhobVVsJsBHnXxFCw', - publicKey: 'FIO7MYkz3serGGGanVPnPPupE1xSm1t7t8mWJ3H7KEd2vS2ZZbXBF', - fioHandle: 'fio-sdk-handle@regtest', + privateKey: process.env.WALLET1_PRIVATE_KEY!, + publicKey: getPublicKey({ privateKey: process.env.WALLET1_PRIVATE_KEY! }), + fioHandle: process.env.WALLET1_FIO_HANDLE!, }; const wallet2 = { - privateKey: '5JpWuB5YbjQBmoBcxbzTTuY9h2NNQNVD5Ct5yKU1d5QCowt1G8X', - publicKey: 'FIO8hnBb7aUDFs6cvCT2TCRQs9vV9jxJbKLCe5q23Zb8Wr36DxsUr', - fioHandle: 'fio-sdk-handle-2@regtest', + privateKey: process.env.WALLET2_PRIVATE_KEY!, + publicKey: getPublicKey({ privateKey: process.env.WALLET2_PRIVATE_KEY! }), + fioHandle: process.env.WALLET2_FIO_HANDLE!, }; const encryptContentParams = { @@ -70,9 +72,19 @@ const transactionActionParams = { privateKey: wallet1.privateKey, }; +/** + * Decrypt Content Parameters + * + * These parameters are used to decrypt content created by the main FIO SDK library. + * + * To create a new FIO request: + * 1. Visit https://dev.fio.net/reference/new_funds_request + * 2. Follow the API documentation instructions + * 3. Use matching FIO keys for sender and recipient wallets in .env file + * - This ensures content encryption/decryption works correctly across environments + */ const decryptContentParams = { - content: - 'FoyXu0rQyBSbkvI3gJ2FIz6PBylbhxetqTMQpa3BEcogvnFg1EpWEZY+QyQEA2Ckv1/m2bbs+SfCiZXjieFAF9xfUiCQ+MK66Ky1ctn1JNx8BmDFI+1Wnyn2uoxwP55fZK0MUBw0hKTu7WnUHvDWPgFHsNdIyDVlB0lb174U37Hm1c8BS/KMpqjpN/E2xN9D', + content: process.env.ENCRYPTED_CONTENT_STRING!, encryptionPublicKey: wallet2.publicKey, fioContentType: 'new_funds_content', privateKey: wallet1.privateKey, @@ -125,6 +137,10 @@ describe('Test methods', () => { }); it('check decrypted content', async () => { + if (!decryptContentParams.content) { + throw new Error('ENCRYPTED_CONTENT_STRING is not set'); + } + const result = decryptContent(decryptContentParams); expect(result.memo).toEqual(MEMO_PHRASE); @@ -147,6 +163,19 @@ describe('Test methods', () => { expect(decryptResult.memo).toEqual(encryptContentParams.content.memo); expect(decryptResult.amount).toEqual(encryptContentParams.content.amount); expect(decryptResult.payee_public_address).toEqual(wallet1.publicKey); + expect(decryptResult.payer_public_address).toEqual(wallet2.publicKey); + expect(decryptResult.chain_code).toEqual( + encryptContentParams.content.chain_code + ); + expect(decryptResult.token_code).toEqual( + encryptContentParams.content.token_code + ); + expect(decryptResult.status).toEqual(encryptContentParams.content.status); + expect(decryptResult.obt_id).toEqual(encryptContentParams.content.obt_id); + expect(decryptResult.hash).toEqual(encryptContentParams.content.hash); + expect(decryptResult.offline_url).toEqual( + encryptContentParams.content.offline_url + ); const decryptResult2 = decryptContent({ content: result, @@ -158,5 +187,18 @@ describe('Test methods', () => { expect(decryptResult2.memo).toEqual(encryptContentParams.content.memo); expect(decryptResult2.amount).toEqual(encryptContentParams.content.amount); expect(decryptResult2.payee_public_address).toEqual(wallet1.publicKey); + expect(decryptResult2.payer_public_address).toEqual(wallet2.publicKey); + expect(decryptResult2.chain_code).toEqual( + encryptContentParams.content.chain_code + ); + expect(decryptResult2.token_code).toEqual( + encryptContentParams.content.token_code + ); + expect(decryptResult2.status).toEqual(encryptContentParams.content.status); + expect(decryptResult2.obt_id).toEqual(encryptContentParams.content.obt_id); + expect(decryptResult2.hash).toEqual(encryptContentParams.content.hash); + expect(decryptResult2.offline_url).toEqual( + encryptContentParams.content.offline_url + ); }); });