@keetanetwork/anchor 0.0.23 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/lib/error.d.ts.map +1 -1
  2. package/lib/error.js +2 -1
  3. package/lib/error.js.map +1 -1
  4. package/lib/http-server/common.d.ts +11 -0
  5. package/lib/http-server/common.d.ts.map +1 -1
  6. package/lib/http-server/common.js +110 -1
  7. package/lib/http-server/common.js.map +1 -1
  8. package/lib/http-server/index.js +2 -2
  9. package/lib/http-server/index.js.map +1 -1
  10. package/lib/resolver.d.ts +28 -8
  11. package/lib/resolver.d.ts.map +1 -1
  12. package/lib/resolver.js +543 -302
  13. package/lib/resolver.js.map +1 -1
  14. package/npm-shrinkwrap.json +2 -2
  15. package/package.json +1 -1
  16. package/services/asset-movement/client.d.ts +21 -11
  17. package/services/asset-movement/client.d.ts.map +1 -1
  18. package/services/asset-movement/client.js +396 -89
  19. package/services/asset-movement/client.js.map +1 -1
  20. package/services/asset-movement/common.d.ts +410 -35
  21. package/services/asset-movement/common.d.ts.map +1 -1
  22. package/services/asset-movement/common.js +10176 -1492
  23. package/services/asset-movement/common.js.map +1 -1
  24. package/services/asset-movement/server.d.ts +25 -14
  25. package/services/asset-movement/server.d.ts.map +1 -1
  26. package/services/asset-movement/server.js +247 -75
  27. package/services/asset-movement/server.js.map +1 -1
  28. package/services/fx/common.js +3 -3
  29. package/services/fx/server.d.ts +1 -1
  30. package/services/fx/server.d.ts.map +1 -1
  31. package/services/fx/server.js +1 -1
  32. package/services/fx/server.js.map +1 -1
  33. package/services/kyc/common.generated.js +2 -2
  34. package/services/kyc/server.d.ts +1 -1
  35. package/services/kyc/server.d.ts.map +1 -1
  36. package/services/kyc/server.js +1 -1
  37. package/services/kyc/server.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/services/fx/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,q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,CAAC;YACN,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE;YACxB,UAAU,EAAE,UAAU;SACtB,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["import * as KeetaAnchorHTTPServer from '../../lib/http-server/index.js';\nimport KeetaNet from '@keetanetwork/keetanet-client';\nimport {\n\tKeetaAnchorUserError\n} from '../../lib/error.js';\nimport {\n\tassertConversionInputCanonicalJSON,\n\tassertConversionQuoteJSON,\n\tErrors\n} from './common.js';\nimport type {\n\tConversionInputCanonicalJSON,\n\tKeetaFXAnchorEstimateResponse,\n\tKeetaFXAnchorExchangeResponse,\n\tKeetaFXAnchorQuote,\n\tKeetaFXAnchorQuoteJSON,\n\tKeetaFXAnchorQuoteResponse,\n\tKeetaNetAccount,\n\tKeetaNetStorageAccount\n} from './common.ts';\nimport * as Signing from '../../lib/utils/signing.js';\nimport type { AssertNever } from '../../lib/utils/never.ts';\nimport type { ServiceMetadata } from '../../lib/resolver.js';\n\nexport interface KeetaAnchorFXServerConfig extends KeetaAnchorHTTPServer.KeetaAnchorHTTPServerConfig {\n\t/**\n\t * The data to use for the index page (optional)\n\t */\n\thomepage?: string | (() => Promise<string> | string);\n\n\t/**\n\t * The account to use for performing swaps for a given pair\n\t *\n\t * This may be either a function or a KeetaNet Account instance.\n\t */\n\taccount: KeetaNetAccount | KeetaNetStorageAccount | ((request: ConversionInputCanonicalJSON) => Promise<KeetaNetAccount | KeetaNetStorageAccount> | KeetaNetAccount | KeetaNetStorageAccount);\n\t/**\n\t * Account which can be used to sign transactions\n\t * for the account above (if not supplied the\n\t * account will be used).\n\t *\n\t * This may be either a function or a KeetaNet Account instance.\n\t */\n\tsigner?: InstanceType<typeof KeetaNet.lib.Account> | ((request: ConversionInputCanonicalJSON) => Promise<InstanceType<typeof KeetaNet.lib.Account>> | InstanceType<typeof KeetaNet.lib.Account>);\n\n\t/**\n\t * Account which performs the signing and validation of quotes\n\t */\n\tquoteSigner: Signing.SignableAccount;\n\n\t/**\n\t * Configuration for FX handling\n\t */\n\tfx: {\n\t\t/**\n\t\t * Supported conversions\n\t\t */\n\t\tfrom?: NonNullable<ServiceMetadata['services']['fx']>[string]['from'];\n\t\t/**\n\t\t * Handle the conversion request of one token to another\n\t\t *\n\t\t * This is used to handle quotes and estimates\n\t\t */\n\t\tgetConversionRateAndFee: (request: ConversionInputCanonicalJSON) => Promise<Omit<KeetaFXAnchorQuote, 'request' | 'signed' >>;\n\t\t/**\n\t\t * Optional callback to validate a quote before completing an exchange\n\t\t *\n\t\t * This allows the FX Server operator to reject quotes that are no longer\n\t\t * acceptable (e.g., due to price changes, expiry, or other business logic)\n\t\t *\n\t\t * @param quote The quote to validate\n\t\t * @returns true to accept the quote and proceed with the exchange, false to reject it\n\t\t */\n\t\tvalidateQuote?: (quote: KeetaFXAnchorQuoteJSON) => Promise<boolean> | boolean;\n\t};\n\n\t/**\n\t * The network client to use for submitting blocks\n\t */\n\tclient: { client: KeetaNet.Client; network: bigint; networkAlias: typeof KeetaNet.Client.Config.networksArray[number] } | KeetaNet.UserClient;\n};\n\nasync function formatQuoteSignable(unsignedQuote: Omit<KeetaFXAnchorQuoteJSON, 'signed'>): Promise<Signing.Signable> {\n\tconst retval: Signing.Signable = [\n\t\tunsignedQuote.request.from,\n\t\tunsignedQuote.request.to,\n\t\tunsignedQuote.request.amount,\n\t\tunsignedQuote.request.affinity,\n\t\tunsignedQuote.account,\n\t\tunsignedQuote.convertedAmount,\n\t\tunsignedQuote.cost.token,\n\t\tunsignedQuote.cost.amount\n\t];\n\n\treturn(retval);\n\n\t/**\n\t * This is a static assertion to ensure that this function is updated\n\t * if new fields are added to the KeetaFXAnchorQuote type to ensure\n\t * that we are always signing all the fields.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\ttype _ignore_static_assert = AssertNever<\n\t\t// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n\t\tAssertNever<keyof Omit<typeof unsignedQuote['request'], 'from' | 'to' | 'amount' | 'affinity'>> &\n\t\t// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents,@typescript-eslint/no-duplicate-type-constituents\n\t\tAssertNever<keyof Omit<typeof unsignedQuote['cost'], 'token' | 'amount'>> &\n\t\t// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents,@typescript-eslint/no-duplicate-type-constituents\n\t\tAssertNever<keyof Omit<typeof unsignedQuote, 'request' | 'convertedAmount' | 'cost' | 'account'>>\n\t>;\n}\n\nasync function generateSignedQuote(signer: Signing.SignableAccount, unsignedQuote: Omit<KeetaFXAnchorQuoteJSON, 'signed'>): Promise<KeetaFXAnchorQuoteJSON> {\n\tconst signableQuote = await formatQuoteSignable(unsignedQuote);\n\tconst signed = await Signing.SignData(signer, signableQuote);\n\n\treturn({\n\t\t...unsignedQuote,\n\t\tsigned: signed\n\t});\n}\n\nasync function verifySignedData(signedBy: Signing.VerifableAccount, quote: KeetaFXAnchorQuoteJSON): Promise<boolean> {\n\tconst signableQuote = await formatQuoteSignable(quote);\n\n\treturn(await Signing.VerifySignedData(signedBy, signableQuote, quote.signed));\n}\n\nasync function requestToAccounts(config: KeetaAnchorFXServerConfig, request: ConversionInputCanonicalJSON): Promise<{ signer: Signing.SignableAccount; account: KeetaNetAccount | KeetaNetStorageAccount; }> {\n\tconst account = KeetaNet.lib.Account.isInstance(config.account) ? config.account : await config.account(request);\n\tlet signer: Signing.SignableAccount | null = null;\n\tif (config.signer !== undefined) {\n\t\tsigner = (KeetaNet.lib.Account.isInstance(config.signer) ? config.signer : await config.signer(request)).assertAccount();\n\t}\n\n\tif (signer === null) {\n\t\tsigner = account.assertAccount();\n\t}\n\n\tif (!account.isAccount() && !account.isStorage()) {\n\t\tthrow(new Error('FX Account should be an Account or Storage Account'))\n\t}\n\n\treturn({\n\t\tsigner: signer,\n\t\taccount: account\n\t});\n}\n\nexport class KeetaNetFXAnchorHTTPServer extends KeetaAnchorHTTPServer.KeetaNetAnchorHTTPServer<KeetaAnchorFXServerConfig> implements Required<KeetaAnchorFXServerConfig> {\n\treadonly homepage: NonNullable<KeetaAnchorFXServerConfig['homepage']>;\n\treadonly client: KeetaAnchorFXServerConfig['client'];\n\treadonly account: KeetaAnchorFXServerConfig['account'];\n\treadonly signer: NonNullable<KeetaAnchorFXServerConfig['signer']>;\n\treadonly quoteSigner: KeetaAnchorFXServerConfig['quoteSigner'];\n\treadonly fx: KeetaAnchorFXServerConfig['fx'];\n\n\tconstructor(config: KeetaAnchorFXServerConfig) {\n\t\tsuper(config);\n\n\t\tthis.homepage = config.homepage ?? '';\n\t\tthis.client = config.client;\n\t\tthis.fx = config.fx;\n\t\tthis.account = config.account;\n\t\tthis.signer = config.signer ?? config.account;\n\t\tthis.quoteSigner = config.quoteSigner;\n\t}\n\n\tprotected async initRoutes(config: KeetaAnchorFXServerConfig): Promise<KeetaAnchorHTTPServer.Routes> {\n\t\tconst routes: KeetaAnchorHTTPServer.Routes = {};\n\n\t\t/**\n\t\t * If a homepage is provided, setup the route for it\n\t\t */\n\t\tif ('homepage' in config) {\n\t\t\troutes['GET /'] = async function() {\n\t\t\t\tlet homepageData: string;\n\t\t\t\tif (typeof config.homepage === 'string') {\n\t\t\t\t\thomepageData = config.homepage;\n\t\t\t\t} else {\n\t\t\t\t\tif (!config.homepage) {\n\t\t\t\t\t\tthrow(new Error('internal error: No homepage function provided'));\n\t\t\t\t\t}\n\n\t\t\t\t\thomepageData = await config.homepage();\n\t\t\t\t}\n\n\t\t\t\treturn({\n\t\t\t\t\toutput: homepageData,\n\t\t\t\t\tcontentType: 'text/html'\n\t\t\t\t});\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Setup the request handler for an estimate request\n\t\t */\n\t\troutes['POST /api/getEstimate'] = async function(_ignore_params, postData) {\n\t\t\tif (!postData || typeof postData !== 'object') {\n\t\t\t\tthrow(new Error('No POST data provided'));\n\t\t\t}\n\t\t\tif (!('request' in postData)) {\n\t\t\t\tthrow(new Error('POST data missing request'));\n\t\t\t}\n\n\t\t\tconst conversion = assertConversionInputCanonicalJSON(postData.request);\n\t\t\tconst rateAndFee = await config.fx.getConversionRateAndFee(conversion);\n\t\t\tconst estimateResponse: KeetaFXAnchorEstimateResponse = {\n\t\t\t\tok: true,\n\t\t\t\testimate: KeetaNet.lib.Utils.Conversion.toJSONSerializable({\n\t\t\t\t\trequest: conversion,\n\t\t\t\t\tconvertedAmount: rateAndFee.convertedAmount,\n\t\t\t\t\texpectedCost: {\n\t\t\t\t\t\tmin: rateAndFee.cost.amount,\n\t\t\t\t\t\tmax: rateAndFee.cost.amount,\n\t\t\t\t\t\ttoken: rateAndFee.cost.token\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t};\n\n\t\t\treturn({\n\t\t\t\toutput: JSON.stringify(estimateResponse)\n\t\t\t});\n\t\t}\n\n\t\troutes['POST /api/getQuote'] = async function(_ignore_params, postData) {\n\t\t\tif (!postData || typeof postData !== 'object') {\n\t\t\t\tthrow(new Error('No POST data provided'));\n\t\t\t}\n\t\t\tif (!('request' in postData)) {\n\t\t\t\tthrow(new Error('POST data missing request'));\n\t\t\t}\n\n\t\t\tconst conversion = assertConversionInputCanonicalJSON(postData.request);\n\t\t\tconst rateAndFee = await config.fx.getConversionRateAndFee(conversion);\n\n\t\t\tconst unsignedQuote: Omit<KeetaFXAnchorQuoteJSON, 'signed'> = KeetaNet.lib.Utils.Conversion.toJSONSerializable({\n\t\t\t\trequest: conversion,\n\t\t\t\t...rateAndFee\n\t\t\t});\n\n\t\t\tconst signedQuote = await generateSignedQuote(config.quoteSigner, unsignedQuote);\n\t\t\tconst quoteResponse: KeetaFXAnchorQuoteResponse = {\n\t\t\t\tok: true,\n\t\t\t\tquote: signedQuote\n\t\t\t};\n\n\t\t\treturn({\n\t\t\t\toutput: JSON.stringify(quoteResponse)\n\t\t\t});\n\t\t}\n\n\t\troutes['POST /api/createExchange'] = async function(_ignore_params, postData) {\n\t\t\tif (!postData || typeof postData !== 'object') {\n\t\t\t\tthrow(new Error('No POST data provided'));\n\t\t\t}\n\n\t\t\tif (!('request' in postData)) {\n\t\t\t\tthrow(new Error('POST data missing request'));\n\t\t\t}\n\t\t\tconst request = postData.request;\n\t\t\tif (!request || typeof request !== 'object') {\n\t\t\t\tthrow(new Error('Request is not an object'));\n\t\t\t}\n\n\t\t\tif (!('quote' in request)) {\n\t\t\t\tthrow(new Error('Quote is missing from request'));\n\t\t\t}\n\t\t\tif (!('block' in request) || typeof request.block !== 'string') {\n\t\t\t\tthrow(new Error('Block was not provided in exchange request'));\n\t\t\t}\n\n\t\t\tconst quote = assertConversionQuoteJSON(request.quote);\n\t\t\tconst isValidQuote = await verifySignedData(config.quoteSigner, quote);\n\t\t\tif (!isValidQuote) {\n\t\t\t\tthrow(new Error('Invalid quote signature'));\n\t\t\t}\n\n\t\t\t/* Validate the quote using the optional callback */\n\t\t\tif (config.fx.validateQuote !== undefined) {\n\t\t\t\tconst isAcceptable = await config.fx.validateQuote(quote);\n\t\t\t\tif (!isAcceptable) {\n\t\t\t\t\tthrow(new Errors.QuoteValidationFailed());\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst block = new KeetaNet.lib.Block(request.block);\n\t\t\tlet userClient: KeetaNet.UserClient;\n\t\t\tif (KeetaNet.UserClient.isInstance(config.client)) {\n\t\t\t\tuserClient = config.client;\n\t\t\t} else {\n\t\t\t\tconst { account, signer } = await requestToAccounts(config, quote.request);\n\n\t\t\t\tuserClient = new KeetaNet.UserClient({\n\t\t\t\t\tclient: config.client.client,\n\t\t\t\t\tnetwork: config.client.network,\n\t\t\t\t\tnetworkAlias: config.client.networkAlias,\n\t\t\t\t\taccount: account,\n\t\t\t\t\tsigner: signer\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t/* Get Expected Amount and Token to Verify Swap */\n\t\t\tconst expectedToken = KeetaNet.lib.Account.fromPublicKeyString(quote.request.from);\n\t\t\tlet expectedAmount = quote.request.affinity === 'from' ? BigInt(quote.request.amount) : BigInt(quote.convertedAmount);\n\t\t\t/* If cost is required verify the amounts and token. */\n\t\t\tif (BigInt(quote.cost.amount) > 0) {\n\t\t\t\t/* If swap token matches the cost token the add the amount since they should be combined in one block and will be checked in `acceptSwapRequest` */\n\t\t\t\tif (expectedToken.comparePublicKey(quote.cost.token)) {\n\t\t\t\t\texpectedAmount += BigInt(quote.cost.amount);\n\t\t\t\t/* If token is different then check block operations for matching amount and token */\n\t\t\t\t} else {\n\t\t\t\t\tlet requestIncludesCost = false;\n\t\t\t\t\tfor (const operation of block.operations) {\n\t\t\t\t\t\tif (operation.type === KeetaNet.lib.Block.OperationType.SEND) {\n\t\t\t\t\t\t\tconst recipientMatches = operation.to.comparePublicKey(quote.account);\n\t\t\t\t\t\t\tconst tokenMatches = operation.token.comparePublicKey(quote.cost.token);\n\t\t\t\t\t\t\tconst amountMatches = operation.amount === BigInt(quote.cost.amount);\n\t\t\t\t\t\t\tif (recipientMatches && tokenMatches && amountMatches) {\n\t\t\t\t\t\t\t\trequestIncludesCost = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!requestIncludesCost) {\n\t\t\t\t\t\tthrow(new Error('Exchange missing required cost'));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* Verify Request and Generate the Accept Swap Block */\n\t\t\tconst swapBlocks = await userClient.acceptSwapRequest({ block, expected: { token: expectedToken, amount: BigInt(expectedAmount) }});\n\t\t\tconst publishOptions: Parameters<typeof userClient.client.transmit>[1] = {};\n\t\t\tif (userClient.config.generateFeeBlock !== undefined) {\n\t\t\t\tpublishOptions.generateFeeBlock = userClient.config.generateFeeBlock;\n\t\t\t}\n\t\t\tconst publishResult = await userClient.client.transmit(swapBlocks, publishOptions);\n\t\t\tif (!publishResult.publish) {\n\t\t\t\tthrow(new Error('Exchange Publish Failed'));\n\t\t\t}\n\t\t\tconst exchangeResponse: KeetaFXAnchorExchangeResponse = {\n\t\t\t\tok: true,\n\t\t\t\texchangeID: block.hash.toString()\n\t\t\t};\n\n\t\t\treturn({\n\t\t\t\toutput: JSON.stringify(exchangeResponse)\n\t\t\t});\n\t\t}\n\n\t\troutes['GET /api/getExchangeStatus/:id'] = async function(params) {\n\t\t\tif (params === undefined || params === null) {\n\t\t\t\tthrow(new KeetaAnchorUserError('Expected params'));\n\t\t\t}\n\t\t\tconst exchangeID = params.get('id');\n\t\t\tif (typeof exchangeID !== 'string') {\n\t\t\t\tthrow(new Error('Missing exchangeID in params'));\n\t\t\t}\n\t\t\tconst blockLookup = await config.client.client.getVoteStaple(exchangeID);\n\t\t\tif (blockLookup === null) {\n\t\t\t\tthrow(new Error('Block Not Found'));\n\t\t\t}\n\t\t\tconst exchangeResponse: KeetaFXAnchorExchangeResponse = {\n\t\t\t\tok: true,\n\t\t\t\texchangeID: exchangeID\n\t\t\t};\n\n\t\t\treturn({\n\t\t\t\toutput: JSON.stringify(exchangeResponse)\n\t\t\t});\n\t\t}\n\n\t\treturn(routes);\n\t}\n\n\t/**\n\t * Return the servers endpoints and possible currency conversions metadata\n\t */\n\tasync serviceMetadata(): Promise<NonNullable<ServiceMetadata['services']['fx']>[string]> {\n\t\tconst operations: NonNullable<ServiceMetadata['services']['fx']>[string]['operations'] = {\n\t\t\tgetEstimate: (new URL('/api/getEstimate', this.url)).toString(),\n\t\t\tgetQuote: (new URL('/api/getQuote', this.url)).toString(),\n\t\t\tcreateExchange: (new URL('/api/createExchange', this.url)).toString(),\n\t\t\tgetExchangeStatus: (new URL('/api/getExchangeStatus', this.url)).toString() + '/{id}'\n\t\t};\n\n\t\treturn({\n\t\t\tfrom: this.fx.from ?? [],\n\t\t\toperations: operations\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/services/fx/server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,qBAAqB,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EACN,o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AAU;SACtB,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["import * as KeetaAnchorHTTPServer from '../../lib/http-server/index.js';\nimport { KeetaNet } from '../../client/index.js';\nimport {\n\tKeetaAnchorUserError\n} from '../../lib/error.js';\nimport {\n\tassertConversionInputCanonicalJSON,\n\tassertConversionQuoteJSON,\n\tErrors\n} from './common.js';\nimport type {\n\tConversionInputCanonicalJSON,\n\tKeetaFXAnchorEstimateResponse,\n\tKeetaFXAnchorExchangeResponse,\n\tKeetaFXAnchorQuote,\n\tKeetaFXAnchorQuoteJSON,\n\tKeetaFXAnchorQuoteResponse,\n\tKeetaNetAccount,\n\tKeetaNetStorageAccount\n} from './common.ts';\nimport * as Signing from '../../lib/utils/signing.js';\nimport type { AssertNever } from '../../lib/utils/never.ts';\nimport type { ServiceMetadata } from '../../lib/resolver.js';\n\nexport interface KeetaAnchorFXServerConfig extends KeetaAnchorHTTPServer.KeetaAnchorHTTPServerConfig {\n\t/**\n\t * The data to use for the index page (optional)\n\t */\n\thomepage?: string | (() => Promise<string> | string);\n\n\t/**\n\t * The account to use for performing swaps for a given pair\n\t *\n\t * This may be either a function or a KeetaNet Account instance.\n\t */\n\taccount: KeetaNetAccount | KeetaNetStorageAccount | ((request: ConversionInputCanonicalJSON) => Promise<KeetaNetAccount | KeetaNetStorageAccount> | KeetaNetAccount | KeetaNetStorageAccount);\n\t/**\n\t * Account which can be used to sign transactions\n\t * for the account above (if not supplied the\n\t * account will be used).\n\t *\n\t * This may be either a function or a KeetaNet Account instance.\n\t */\n\tsigner?: InstanceType<typeof KeetaNet.lib.Account> | ((request: ConversionInputCanonicalJSON) => Promise<InstanceType<typeof KeetaNet.lib.Account>> | InstanceType<typeof KeetaNet.lib.Account>);\n\n\t/**\n\t * Account which performs the signing and validation of quotes\n\t */\n\tquoteSigner: Signing.SignableAccount;\n\n\t/**\n\t * Configuration for FX handling\n\t */\n\tfx: {\n\t\t/**\n\t\t * Supported conversions\n\t\t */\n\t\tfrom?: NonNullable<ServiceMetadata['services']['fx']>[string]['from'];\n\t\t/**\n\t\t * Handle the conversion request of one token to another\n\t\t *\n\t\t * This is used to handle quotes and estimates\n\t\t */\n\t\tgetConversionRateAndFee: (request: ConversionInputCanonicalJSON) => Promise<Omit<KeetaFXAnchorQuote, 'request' | 'signed' >>;\n\t\t/**\n\t\t * Optional callback to validate a quote before completing an exchange\n\t\t *\n\t\t * This allows the FX Server operator to reject quotes that are no longer\n\t\t * acceptable (e.g., due to price changes, expiry, or other business logic)\n\t\t *\n\t\t * @param quote The quote to validate\n\t\t * @returns true to accept the quote and proceed with the exchange, false to reject it\n\t\t */\n\t\tvalidateQuote?: (quote: KeetaFXAnchorQuoteJSON) => Promise<boolean> | boolean;\n\t};\n\n\t/**\n\t * The network client to use for submitting blocks\n\t */\n\tclient: { client: KeetaNet.Client; network: bigint; networkAlias: typeof KeetaNet.Client.Config.networksArray[number] } | KeetaNet.UserClient;\n};\n\nasync function formatQuoteSignable(unsignedQuote: Omit<KeetaFXAnchorQuoteJSON, 'signed'>): Promise<Signing.Signable> {\n\tconst retval: Signing.Signable = [\n\t\tunsignedQuote.request.from,\n\t\tunsignedQuote.request.to,\n\t\tunsignedQuote.request.amount,\n\t\tunsignedQuote.request.affinity,\n\t\tunsignedQuote.account,\n\t\tunsignedQuote.convertedAmount,\n\t\tunsignedQuote.cost.token,\n\t\tunsignedQuote.cost.amount\n\t];\n\n\treturn(retval);\n\n\t/**\n\t * This is a static assertion to ensure that this function is updated\n\t * if new fields are added to the KeetaFXAnchorQuote type to ensure\n\t * that we are always signing all the fields.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\ttype _ignore_static_assert = AssertNever<\n\t\t// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n\t\tAssertNever<keyof Omit<typeof unsignedQuote['request'], 'from' | 'to' | 'amount' | 'affinity'>> &\n\t\t// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents,@typescript-eslint/no-duplicate-type-constituents\n\t\tAssertNever<keyof Omit<typeof unsignedQuote['cost'], 'token' | 'amount'>> &\n\t\t// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents,@typescript-eslint/no-duplicate-type-constituents\n\t\tAssertNever<keyof Omit<typeof unsignedQuote, 'request' | 'convertedAmount' | 'cost' | 'account'>>\n\t>;\n}\n\nasync function generateSignedQuote(signer: Signing.SignableAccount, unsignedQuote: Omit<KeetaFXAnchorQuoteJSON, 'signed'>): Promise<KeetaFXAnchorQuoteJSON> {\n\tconst signableQuote = await formatQuoteSignable(unsignedQuote);\n\tconst signed = await Signing.SignData(signer, signableQuote);\n\n\treturn({\n\t\t...unsignedQuote,\n\t\tsigned: signed\n\t});\n}\n\nasync function verifySignedData(signedBy: Signing.VerifableAccount, quote: KeetaFXAnchorQuoteJSON): Promise<boolean> {\n\tconst signableQuote = await formatQuoteSignable(quote);\n\n\treturn(await Signing.VerifySignedData(signedBy, signableQuote, quote.signed));\n}\n\nasync function requestToAccounts(config: KeetaAnchorFXServerConfig, request: ConversionInputCanonicalJSON): Promise<{ signer: Signing.SignableAccount; account: KeetaNetAccount | KeetaNetStorageAccount; }> {\n\tconst account = KeetaNet.lib.Account.isInstance(config.account) ? config.account : await config.account(request);\n\tlet signer: Signing.SignableAccount | null = null;\n\tif (config.signer !== undefined) {\n\t\tsigner = (KeetaNet.lib.Account.isInstance(config.signer) ? config.signer : await config.signer(request)).assertAccount();\n\t}\n\n\tif (signer === null) {\n\t\tsigner = account.assertAccount();\n\t}\n\n\tif (!account.isAccount() && !account.isStorage()) {\n\t\tthrow(new Error('FX Account should be an Account or Storage Account'))\n\t}\n\n\treturn({\n\t\tsigner: signer,\n\t\taccount: account\n\t});\n}\n\nexport class KeetaNetFXAnchorHTTPServer extends KeetaAnchorHTTPServer.KeetaNetAnchorHTTPServer<KeetaAnchorFXServerConfig> implements Required<KeetaAnchorFXServerConfig> {\n\treadonly homepage: NonNullable<KeetaAnchorFXServerConfig['homepage']>;\n\treadonly client: KeetaAnchorFXServerConfig['client'];\n\treadonly account: KeetaAnchorFXServerConfig['account'];\n\treadonly signer: NonNullable<KeetaAnchorFXServerConfig['signer']>;\n\treadonly quoteSigner: KeetaAnchorFXServerConfig['quoteSigner'];\n\treadonly fx: KeetaAnchorFXServerConfig['fx'];\n\n\tconstructor(config: KeetaAnchorFXServerConfig) {\n\t\tsuper(config);\n\n\t\tthis.homepage = config.homepage ?? '';\n\t\tthis.client = config.client;\n\t\tthis.fx = config.fx;\n\t\tthis.account = config.account;\n\t\tthis.signer = config.signer ?? config.account;\n\t\tthis.quoteSigner = config.quoteSigner;\n\t}\n\n\tprotected async initRoutes(config: KeetaAnchorFXServerConfig): Promise<KeetaAnchorHTTPServer.Routes> {\n\t\tconst routes: KeetaAnchorHTTPServer.Routes = {};\n\n\t\t/**\n\t\t * If a homepage is provided, setup the route for it\n\t\t */\n\t\tif ('homepage' in config) {\n\t\t\troutes['GET /'] = async function() {\n\t\t\t\tlet homepageData: string;\n\t\t\t\tif (typeof config.homepage === 'string') {\n\t\t\t\t\thomepageData = config.homepage;\n\t\t\t\t} else {\n\t\t\t\t\tif (!config.homepage) {\n\t\t\t\t\t\tthrow(new Error('internal error: No homepage function provided'));\n\t\t\t\t\t}\n\n\t\t\t\t\thomepageData = await config.homepage();\n\t\t\t\t}\n\n\t\t\t\treturn({\n\t\t\t\t\toutput: homepageData,\n\t\t\t\t\tcontentType: 'text/html'\n\t\t\t\t});\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Setup the request handler for an estimate request\n\t\t */\n\t\troutes['POST /api/getEstimate'] = async function(_ignore_params, postData) {\n\t\t\tif (!postData || typeof postData !== 'object') {\n\t\t\t\tthrow(new Error('No POST data provided'));\n\t\t\t}\n\t\t\tif (!('request' in postData)) {\n\t\t\t\tthrow(new Error('POST data missing request'));\n\t\t\t}\n\n\t\t\tconst conversion = assertConversionInputCanonicalJSON(postData.request);\n\t\t\tconst rateAndFee = await config.fx.getConversionRateAndFee(conversion);\n\t\t\tconst estimateResponse: KeetaFXAnchorEstimateResponse = {\n\t\t\t\tok: true,\n\t\t\t\testimate: KeetaNet.lib.Utils.Conversion.toJSONSerializable({\n\t\t\t\t\trequest: conversion,\n\t\t\t\t\tconvertedAmount: rateAndFee.convertedAmount,\n\t\t\t\t\texpectedCost: {\n\t\t\t\t\t\tmin: rateAndFee.cost.amount,\n\t\t\t\t\t\tmax: rateAndFee.cost.amount,\n\t\t\t\t\t\ttoken: rateAndFee.cost.token\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t};\n\n\t\t\treturn({\n\t\t\t\toutput: JSON.stringify(estimateResponse)\n\t\t\t});\n\t\t}\n\n\t\troutes['POST /api/getQuote'] = async function(_ignore_params, postData) {\n\t\t\tif (!postData || typeof postData !== 'object') {\n\t\t\t\tthrow(new Error('No POST data provided'));\n\t\t\t}\n\t\t\tif (!('request' in postData)) {\n\t\t\t\tthrow(new Error('POST data missing request'));\n\t\t\t}\n\n\t\t\tconst conversion = assertConversionInputCanonicalJSON(postData.request);\n\t\t\tconst rateAndFee = await config.fx.getConversionRateAndFee(conversion);\n\n\t\t\tconst unsignedQuote: Omit<KeetaFXAnchorQuoteJSON, 'signed'> = KeetaNet.lib.Utils.Conversion.toJSONSerializable({\n\t\t\t\trequest: conversion,\n\t\t\t\t...rateAndFee\n\t\t\t});\n\n\t\t\tconst signedQuote = await generateSignedQuote(config.quoteSigner, unsignedQuote);\n\t\t\tconst quoteResponse: KeetaFXAnchorQuoteResponse = {\n\t\t\t\tok: true,\n\t\t\t\tquote: signedQuote\n\t\t\t};\n\n\t\t\treturn({\n\t\t\t\toutput: JSON.stringify(quoteResponse)\n\t\t\t});\n\t\t}\n\n\t\troutes['POST /api/createExchange'] = async function(_ignore_params, postData) {\n\t\t\tif (!postData || typeof postData !== 'object') {\n\t\t\t\tthrow(new Error('No POST data provided'));\n\t\t\t}\n\n\t\t\tif (!('request' in postData)) {\n\t\t\t\tthrow(new Error('POST data missing request'));\n\t\t\t}\n\t\t\tconst request = postData.request;\n\t\t\tif (!request || typeof request !== 'object') {\n\t\t\t\tthrow(new Error('Request is not an object'));\n\t\t\t}\n\n\t\t\tif (!('quote' in request)) {\n\t\t\t\tthrow(new Error('Quote is missing from request'));\n\t\t\t}\n\t\t\tif (!('block' in request) || typeof request.block !== 'string') {\n\t\t\t\tthrow(new Error('Block was not provided in exchange request'));\n\t\t\t}\n\n\t\t\tconst quote = assertConversionQuoteJSON(request.quote);\n\t\t\tconst isValidQuote = await verifySignedData(config.quoteSigner, quote);\n\t\t\tif (!isValidQuote) {\n\t\t\t\tthrow(new Error('Invalid quote signature'));\n\t\t\t}\n\n\t\t\t/* Validate the quote using the optional callback */\n\t\t\tif (config.fx.validateQuote !== undefined) {\n\t\t\t\tconst isAcceptable = await config.fx.validateQuote(quote);\n\t\t\t\tif (!isAcceptable) {\n\t\t\t\t\tthrow(new Errors.QuoteValidationFailed());\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst block = new KeetaNet.lib.Block(request.block);\n\t\t\tlet userClient: KeetaNet.UserClient;\n\t\t\tif (KeetaNet.UserClient.isInstance(config.client)) {\n\t\t\t\tuserClient = config.client;\n\t\t\t} else {\n\t\t\t\tconst { account, signer } = await requestToAccounts(config, quote.request);\n\n\t\t\t\tuserClient = new KeetaNet.UserClient({\n\t\t\t\t\tclient: config.client.client,\n\t\t\t\t\tnetwork: config.client.network,\n\t\t\t\t\tnetworkAlias: config.client.networkAlias,\n\t\t\t\t\taccount: account,\n\t\t\t\t\tsigner: signer\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t/* Get Expected Amount and Token to Verify Swap */\n\t\t\tconst expectedToken = KeetaNet.lib.Account.fromPublicKeyString(quote.request.from);\n\t\t\tlet expectedAmount = quote.request.affinity === 'from' ? BigInt(quote.request.amount) : BigInt(quote.convertedAmount);\n\t\t\t/* If cost is required verify the amounts and token. */\n\t\t\tif (BigInt(quote.cost.amount) > 0) {\n\t\t\t\t/* If swap token matches the cost token the add the amount since they should be combined in one block and will be checked in `acceptSwapRequest` */\n\t\t\t\tif (expectedToken.comparePublicKey(quote.cost.token)) {\n\t\t\t\t\texpectedAmount += BigInt(quote.cost.amount);\n\t\t\t\t/* If token is different then check block operations for matching amount and token */\n\t\t\t\t} else {\n\t\t\t\t\tlet requestIncludesCost = false;\n\t\t\t\t\tfor (const operation of block.operations) {\n\t\t\t\t\t\tif (operation.type === KeetaNet.lib.Block.OperationType.SEND) {\n\t\t\t\t\t\t\tconst recipientMatches = operation.to.comparePublicKey(quote.account);\n\t\t\t\t\t\t\tconst tokenMatches = operation.token.comparePublicKey(quote.cost.token);\n\t\t\t\t\t\t\tconst amountMatches = operation.amount === BigInt(quote.cost.amount);\n\t\t\t\t\t\t\tif (recipientMatches && tokenMatches && amountMatches) {\n\t\t\t\t\t\t\t\trequestIncludesCost = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!requestIncludesCost) {\n\t\t\t\t\t\tthrow(new Error('Exchange missing required cost'));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* Verify Request and Generate the Accept Swap Block */\n\t\t\tconst swapBlocks = await userClient.acceptSwapRequest({ block, expected: { token: expectedToken, amount: BigInt(expectedAmount) }});\n\t\t\tconst publishOptions: Parameters<typeof userClient.client.transmit>[1] = {};\n\t\t\tif (userClient.config.generateFeeBlock !== undefined) {\n\t\t\t\tpublishOptions.generateFeeBlock = userClient.config.generateFeeBlock;\n\t\t\t}\n\t\t\tconst publishResult = await userClient.client.transmit(swapBlocks, publishOptions);\n\t\t\tif (!publishResult.publish) {\n\t\t\t\tthrow(new Error('Exchange Publish Failed'));\n\t\t\t}\n\t\t\tconst exchangeResponse: KeetaFXAnchorExchangeResponse = {\n\t\t\t\tok: true,\n\t\t\t\texchangeID: block.hash.toString()\n\t\t\t};\n\n\t\t\treturn({\n\t\t\t\toutput: JSON.stringify(exchangeResponse)\n\t\t\t});\n\t\t}\n\n\t\troutes['GET /api/getExchangeStatus/:id'] = async function(params) {\n\t\t\tif (params === undefined || params === null) {\n\t\t\t\tthrow(new KeetaAnchorUserError('Expected params'));\n\t\t\t}\n\t\t\tconst exchangeID = params.get('id');\n\t\t\tif (typeof exchangeID !== 'string') {\n\t\t\t\tthrow(new Error('Missing exchangeID in params'));\n\t\t\t}\n\t\t\tconst blockLookup = await config.client.client.getVoteStaple(exchangeID);\n\t\t\tif (blockLookup === null) {\n\t\t\t\tthrow(new Error('Block Not Found'));\n\t\t\t}\n\t\t\tconst exchangeResponse: KeetaFXAnchorExchangeResponse = {\n\t\t\t\tok: true,\n\t\t\t\texchangeID: exchangeID\n\t\t\t};\n\n\t\t\treturn({\n\t\t\t\toutput: JSON.stringify(exchangeResponse)\n\t\t\t});\n\t\t}\n\n\t\treturn(routes);\n\t}\n\n\t/**\n\t * Return the servers endpoints and possible currency conversions metadata\n\t */\n\tasync serviceMetadata(): Promise<NonNullable<ServiceMetadata['services']['fx']>[string]> {\n\t\tconst operations: NonNullable<ServiceMetadata['services']['fx']>[string]['operations'] = {\n\t\t\tgetEstimate: (new URL('/api/getEstimate', this.url)).toString(),\n\t\t\tgetQuote: (new URL('/api/getQuote', this.url)).toString(),\n\t\t\tcreateExchange: (new URL('/api/createExchange', this.url)).toString(),\n\t\t\tgetExchangeStatus: (new URL('/api/getExchangeStatus', this.url)).toString() + '/{id}'\n\t\t};\n\n\t\treturn({\n\t\t\tfrom: this.fx.from ?? [],\n\t\t\toperations: operations\n\t\t});\n\t}\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import * as __typia_transform__assertGuard from "typia/lib/internal/_assertGuard.js";
2
2
  import { createAssert } from 'typia';
3
- export const assertCreateVerificationRequest = (() => { const _iv2 = new Set(["840", "533", "356", "578", "108", "132", "116", "124", "136", "152", "156", "170", "174", "554", "188", "192", "203", "208", "262", "214", "818", "222", "232", "748", "238", "242", "270", "292", "320", "826", "324", "328", "332", "340", "344", "348", "352", "360", "364", "368", "376", "388", "392", "400", "398", "404", "408", "410", "414", "417", "418", "422", "426", "710", "430", "434", "756", "446", "807", "454", "458", "462", "480", "484", "498", "496", "504", "104", "516", "524", "558", "566", "512", "586", "598", "600", "604", "608", "634", "643", "646", "654", "882", "682", "690", "694", "702", "706", "728", "144", "752", "760", "834", "764", "776", "780", "788", "800", "784", "858", "860", "548", "704", "AF", "AX", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BQ", "BA", "BW", "BV", "BR", "IO", "BN", "BG", "BF", "BI", "CV", "KH", "CM", "CA", "KY", "CF", "TD", "CL", "CN", "CX", "CC", "CO", "KM", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CW", "CY", "CZ", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "GQ", "ER", "EE", "SZ", "ET", "FK", "FO", "FJ", "FI", "FR", "GF", "PF", "TF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GG", "GN", "GW", "GY", "HT", "HM", "VA", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KP", "KR", "KW", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MG", "MW", "MY", "MV", "ML", "MT", "MH", "MQ", "MR", "MU", "YT", "MX", "FM", "MD", "MC", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NC", "NZ", "NI", "NE", "NG", "NU", "NF", "MK", "MP", "NO", "OM", "PK", "PW", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RE", "RO", "RU", "RW", "BL", "SH", "KN", "LC", "MF", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SX", "SK", "SI", "SB", "SO", "ZA", "GS", "SS", "ES", "LK", "SD", "SR", "SJ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TL", "TG", "TK", "TO", "TT", "TN", "TR", "TM", "TC", "TV", "UG", "UA", "AE", "GB", "US", "UM", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "WF", "EH", "YE", "ZM", "ZW", "004", "248", "008", "012", "016", "020", "024", "660", "010", "028", "032", "051", "036", "040", "031", "044", "048", "050", "052", "112", "056", "084", "204", "060", "064", "068", "535", "070", "072", "074", "076", "086", "096", "100", "854", "120", "140", "148", "162", "166", "178", "180", "184", "384", "191", "531", "196", "212", "218", "226", "233", "231", "234", "246", "250", "254", "258", "260", "266", "268", "276", "288", "300", "304", "308", "312", "316", "831", "624", "334", "336", "372", "833", "380", "832", "296", "428", "438", "440", "442", "450", "466", "470", "584", "474", "478", "175", "583", "492", "499", "500", "508", "520", "528", "540", "562", "570", "574", "580", "585", "591", "612", "616", "620", "630", "638", "642", "652", "659", "662", "663", "666", "670", "674", "678", "686", "688", "534", "703", "705", "090", "239", "724", "729", "740", "744", "158", "762", "626", "768", "772", "792", "795", "796", "798", "804", "581", "862", "092", "850", "876", "732", "887", "894", "716"]); const _iv3 = new Set(["AF", "AX", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BQ", "BA", "BW", "BV", "BR", "IO", "BN", "BG", "BF", "BI", "CV", "KH", "CM", "CA", "KY", "CF", "TD", "CL", "CN", "CX", "CC", "CO", "KM", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CW", "CY", "CZ", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "GQ", "ER", "EE", "SZ", "ET", "FK", "FO", "FJ", "FI", "FR", "GF", "PF", "TF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GG", "GN", "GW", "GY", "HT", "HM", "VA", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KP", "KR", "KW", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MG", "MW", "MY", "MV", "ML", "MT", "MH", "MQ", "MR", "MU", "YT", "MX", "FM", "MD", "MC", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NC", "NZ", "NI", "NE", "NG", "NU", "NF", "MK", "MP", "NO", "OM", "PK", "PW", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RE", "RO", "RU", "RW", "BL", "SH", "KN", "LC", "MF", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SX", "SK", "SI", "SB", "SO", "ZA", "GS", "SS", "ES", "LK", "SD", "SR", "SJ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TL", "TG", "TK", "TO", "TT", "TN", "TR", "TM", "TC", "TV", "UG", "UA", "AE", "GB", "US", "UM", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "WF", "EH", "YE", "ZM", "ZW"]); const _iv4 = new Set(["BTN", "MKD", "SLE", "CHE", "AFG", "ALA", "ALB", "DZA", "ASM", "AND", "AGO", "AIA", "ATA", "ATG", "ARG", "ARM", "ABW", "AUS", "AUT", "AZE", "BHS", "BHR", "BGD", "BRB", "BLR", "BEL", "BLZ", "BEN", "BMU", "BOL", "BES", "BIH", "BWA", "BVT", "BRA", "IOT", "BRN", "BGR", "BFA", "BDI", "CPV", "KHM", "CMR", "CAN", "CYM", "CAF", "TCD", "CHL", "CHN", "CXR", "CCK", "COL", "COM", "COG", "COD", "COK", "CRI", "CIV", "HRV", "CUB", "CUW", "CYP", "CZE", "DNK", "DJI", "DMA", "DOM", "ECU", "EGY", "SLV", "GNQ", "ERI", "EST", "SWZ", "ETH", "FLK", "FRO", "FJI", "FIN", "FRA", "GUF", "PYF", "ATF", "GAB", "GMB", "GEO", "DEU", "GHA", "GIB", "GRC", "GRL", "GRD", "GLP", "GUM", "GTM", "GGY", "GIN", "GNB", "GUY", "HTI", "HMD", "VAT", "HND", "HKG", "HUN", "ISL", "IND", "IDN", "IRN", "IRQ", "IRL", "IMN", "ISR", "ITA", "JAM", "JPN", "JEY", "JOR", "KAZ", "KEN", "KIR", "PRK", "KOR", "KWT", "KGZ", "LAO", "LVA", "LBN", "LSO", "LBR", "LBY", "LIE", "LTU", "LUX", "MAC", "MDG", "MWI", "MYS", "MDV", "MLI", "MLT", "MHL", "MTQ", "MRT", "MUS", "MYT", "MEX", "FSM", "MDA", "MCO", "MNG", "MNE", "MSR", "MAR", "MOZ", "MMR", "NAM", "NRU", "NPL", "NLD", "NCL", "NZL", "NIC", "NER", "NGA", "NIU", "NFK", "MNP", "NOR", "OMN", "PAK", "PLW", "PAN", "PNG", "PRY", "PER", "PHL", "PCN", "POL", "PRT", "PRI", "QAT", "REU", "ROU", "RUS", "RWA", "BLM", "SHN", "KNA", "LCA", "MAF", "SPM", "VCT", "WSM", "SMR", "STP", "SAU", "SEN", "SRB", "SYC", "SGP", "SXM", "SVK", "SVN", "SLB", "SOM", "ZAF", "SGS", "SSD", "ESP", "LKA", "SDN", "SUR", "SJM", "SWE", "SYR", "TWN", "TJK", "TZA", "THA", "TLS", "TGO", "TKL", "TON", "TTO", "TUN", "TUR", "TKM", "TCA", "TUV", "UGA", "UKR", "ARE", "GBR", "USA", "UMI", "URY", "UZB", "VUT", "VEN", "VNM", "VGB", "VIR", "WLF", "ESH", "YEM", "ZMB", "ZWE"]); const _iv5 = new Set(["840", "533", "356", "578", "108", "132", "116", "124", "136", "152", "156", "170", "174", "554", "188", "192", "203", "208", "262", "214", "818", "222", "232", "748", "238", "242", "270", "292", "320", "826", "324", "328", "332", "340", "344", "348", "352", "360", "364", "368", "376", "388", "392", "400", "398", "404", "408", "410", "414", "417", "418", "422", "426", "710", "430", "434", "756", "446", "807", "454", "458", "462", "480", "484", "498", "496", "504", "104", "516", "524", "558", "566", "512", "586", "598", "600", "604", "608", "634", "643", "646", "654", "882", "682", "690", "694", "702", "706", "728", "144", "752", "760", "834", "764", "776", "780", "788", "800", "784", "858", "860", "548", "704", "004", "248", "008", "012", "016", "020", "024", "660", "010", "028", "032", "051", "036", "040", "031", "044", "048", "050", "052", "112", "056", "084", "204", "060", "064", "068", "535", "070", "072", "074", "076", "086", "096", "100", "854", "120", "140", "148", "162", "166", "178", "180", "184", "384", "191", "531", "196", "212", "218", "226", "233", "231", "234", "246", "250", "254", "258", "260", "266", "268", "276", "288", "300", "304", "308", "312", "316", "831", "624", "334", "336", "372", "833", "380", "832", "296", "428", "438", "440", "442", "450", "466", "470", "584", "474", "478", "175", "583", "492", "499", "500", "508", "520", "528", "540", "562", "570", "574", "580", "585", "591", "612", "616", "620", "630", "638", "642", "652", "659", "662", "663", "666", "670", "674", "678", "686", "688", "534", "703", "705", "090", "239", "724", "729", "740", "744", "158", "762", "626", "768", "772", "792", "795", "796", "798", "804", "581", "862", "092", "850", "876", "732", "887", "894", "716"]); const _av7 = new Set(["840", "533", "356", "578", "108", "132", "116", "124", "136", "152", "156", "170", "174", "554", "188", "192", "203", "208", "262", "214", "818", "222", "232", "748", "238", "242", "270", "292", "320", "826", "324", "328", "332", "340", "344", "348", "352", "360", "364", "368", "376", "388", "392", "400", "398", "404", "408", "410", "414", "417", "418", "422", "426", "710", "430", "434", "756", "446", "807", "454", "458", "462", "480", "484", "498", "496", "504", "104", "516", "524", "558", "566", "512", "586", "598", "600", "604", "608", "634", "643", "646", "654", "882", "682", "690", "694", "702", "706", "728", "144", "752", "760", "834", "764", "776", "780", "788", "800", "784", "858", "860", "548", "704", "AF", "AX", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BQ", "BA", "BW", "BV", "BR", "IO", "BN", "BG", "BF", "BI", "CV", "KH", "CM", "CA", "KY", "CF", "TD", "CL", "CN", "CX", "CC", "CO", "KM", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CW", "CY", "CZ", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "GQ", "ER", "EE", "SZ", "ET", "FK", "FO", "FJ", "FI", "FR", "GF", "PF", "TF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GG", "GN", "GW", "GY", "HT", "HM", "VA", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KP", "KR", "KW", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MG", "MW", "MY", "MV", "ML", "MT", "MH", "MQ", "MR", "MU", "YT", "MX", "FM", "MD", "MC", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NC", "NZ", "NI", "NE", "NG", "NU", "NF", "MK", "MP", "NO", "OM", "PK", "PW", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RE", "RO", "RU", "RW", "BL", "SH", "KN", "LC", "MF", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SX", "SK", "SI", "SB", "SO", "ZA", "GS", "SS", "ES", "LK", "SD", "SR", "SJ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TL", "TG", "TK", "TO", "TT", "TN", "TR", "TM", "TC", "TV", "UG", "UA", "AE", "GB", "US", "UM", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "WF", "EH", "YE", "ZM", "ZW", "004", "248", "008", "012", "016", "020", "024", "660", "010", "028", "032", "051", "036", "040", "031", "044", "048", "050", "052", "112", "056", "084", "204", "060", "064", "068", "535", "070", "072", "074", "076", "086", "096", "100", "854", "120", "140", "148", "162", "166", "178", "180", "184", "384", "191", "531", "196", "212", "218", "226", "233", "231", "234", "246", "250", "254", "258", "260", "266", "268", "276", "288", "300", "304", "308", "312", "316", "831", "624", "334", "336", "372", "833", "380", "832", "296", "428", "438", "440", "442", "450", "466", "470", "584", "474", "478", "175", "583", "492", "499", "500", "508", "520", "528", "540", "562", "570", "574", "580", "585", "591", "612", "616", "620", "630", "638", "642", "652", "659", "662", "663", "666", "670", "674", "678", "686", "688", "534", "703", "705", "090", "239", "724", "729", "740", "744", "158", "762", "626", "768", "772", "792", "795", "796", "798", "804", "581", "862", "092", "850", "876", "732", "887", "894", "716"]); const _av8 = new Set(["AF", "AX", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BQ", "BA", "BW", "BV", "BR", "IO", "BN", "BG", "BF", "BI", "CV", "KH", "CM", "CA", "KY", "CF", "TD", "CL", "CN", "CX", "CC", "CO", "KM", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CW", "CY", "CZ", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "GQ", "ER", "EE", "SZ", "ET", "FK", "FO", "FJ", "FI", "FR", "GF", "PF", "TF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GG", "GN", "GW", "GY", "HT", "HM", "VA", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KP", "KR", "KW", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MG", "MW", "MY", "MV", "ML", "MT", "MH", "MQ", "MR", "MU", "YT", "MX", "FM", "MD", "MC", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NC", "NZ", "NI", "NE", "NG", "NU", "NF", "MK", "MP", "NO", "OM", "PK", "PW", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RE", "RO", "RU", "RW", "BL", "SH", "KN", "LC", "MF", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SX", "SK", "SI", "SB", "SO", "ZA", "GS", "SS", "ES", "LK", "SD", "SR", "SJ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TL", "TG", "TK", "TO", "TT", "TN", "TR", "TM", "TC", "TV", "UG", "UA", "AE", "GB", "US", "UM", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "WF", "EH", "YE", "ZM", "ZW"]); const _av9 = new Set(["BTN", "MKD", "SLE", "CHE", "AFG", "ALA", "ALB", "DZA", "ASM", "AND", "AGO", "AIA", "ATA", "ATG", "ARG", "ARM", "ABW", "AUS", "AUT", "AZE", "BHS", "BHR", "BGD", "BRB", "BLR", "BEL", "BLZ", "BEN", "BMU", "BOL", "BES", "BIH", "BWA", "BVT", "BRA", "IOT", "BRN", "BGR", "BFA", "BDI", "CPV", "KHM", "CMR", "CAN", "CYM", "CAF", "TCD", "CHL", "CHN", "CXR", "CCK", "COL", "COM", "COG", "COD", "COK", "CRI", "CIV", "HRV", "CUB", "CUW", "CYP", "CZE", "DNK", "DJI", "DMA", "DOM", "ECU", "EGY", "SLV", "GNQ", "ERI", "EST", "SWZ", "ETH", "FLK", "FRO", "FJI", "FIN", "FRA", "GUF", "PYF", "ATF", "GAB", "GMB", "GEO", "DEU", "GHA", "GIB", "GRC", "GRL", "GRD", "GLP", "GUM", "GTM", "GGY", "GIN", "GNB", "GUY", "HTI", "HMD", "VAT", "HND", "HKG", "HUN", "ISL", "IND", "IDN", "IRN", "IRQ", "IRL", "IMN", "ISR", "ITA", "JAM", "JPN", "JEY", "JOR", "KAZ", "KEN", "KIR", "PRK", "KOR", "KWT", "KGZ", "LAO", "LVA", "LBN", "LSO", "LBR", "LBY", "LIE", "LTU", "LUX", "MAC", "MDG", "MWI", "MYS", "MDV", "MLI", "MLT", "MHL", "MTQ", "MRT", "MUS", "MYT", "MEX", "FSM", "MDA", "MCO", "MNG", "MNE", "MSR", "MAR", "MOZ", "MMR", "NAM", "NRU", "NPL", "NLD", "NCL", "NZL", "NIC", "NER", "NGA", "NIU", "NFK", "MNP", "NOR", "OMN", "PAK", "PLW", "PAN", "PNG", "PRY", "PER", "PHL", "PCN", "POL", "PRT", "PRI", "QAT", "REU", "ROU", "RUS", "RWA", "BLM", "SHN", "KNA", "LCA", "MAF", "SPM", "VCT", "WSM", "SMR", "STP", "SAU", "SEN", "SRB", "SYC", "SGP", "SXM", "SVK", "SVN", "SLB", "SOM", "ZAF", "SGS", "SSD", "ESP", "LKA", "SDN", "SUR", "SJM", "SWE", "SYR", "TWN", "TJK", "TZA", "THA", "TLS", "TGO", "TKL", "TON", "TTO", "TUN", "TUR", "TKM", "TCA", "TUV", "UGA", "UKR", "ARE", "GBR", "USA", "UMI", "URY", "UZB", "VUT", "VEN", "VNM", "VGB", "VIR", "WLF", "ESH", "YEM", "ZMB", "ZWE"]); const _av10 = new Set(["840", "533", "356", "578", "108", "132", "116", "124", "136", "152", "156", "170", "174", "554", "188", "192", "203", "208", "262", "214", "818", "222", "232", "748", "238", "242", "270", "292", "320", "826", "324", "328", "332", "340", "344", "348", "352", "360", "364", "368", "376", "388", "392", "400", "398", "404", "408", "410", "414", "417", "418", "422", "426", "710", "430", "434", "756", "446", "807", "454", "458", "462", "480", "484", "498", "496", "504", "104", "516", "524", "558", "566", "512", "586", "598", "600", "604", "608", "634", "643", "646", "654", "882", "682", "690", "694", "702", "706", "728", "144", "752", "760", "834", "764", "776", "780", "788", "800", "784", "858", "860", "548", "704", "004", "248", "008", "012", "016", "020", "024", "660", "010", "028", "032", "051", "036", "040", "031", "044", "048", "050", "052", "112", "056", "084", "204", "060", "064", "068", "535", "070", "072", "074", "076", "086", "096", "100", "854", "120", "140", "148", "162", "166", "178", "180", "184", "384", "191", "531", "196", "212", "218", "226", "233", "231", "234", "246", "250", "254", "258", "260", "266", "268", "276", "288", "300", "304", "308", "312", "316", "831", "624", "334", "336", "372", "833", "380", "832", "296", "428", "438", "440", "442", "450", "466", "470", "584", "474", "478", "175", "583", "492", "499", "500", "508", "520", "528", "540", "562", "570", "574", "580", "585", "591", "612", "616", "620", "630", "638", "642", "652", "659", "662", "663", "666", "670", "674", "678", "686", "688", "534", "703", "705", "090", "239", "724", "729", "740", "744", "158", "762", "626", "768", "772", "792", "795", "796", "798", "804", "581", "862", "092", "850", "876", "732", "887", "894", "716"]); const _io0 = input => Array.isArray(input.countryCodes) && input.countryCodes.every(elem => null !== elem && undefined !== elem && (true === _iv2.has(elem) || "object" === typeof elem && null !== elem && _io1(elem))) && ("string" === typeof input.account && (RegExp(/^keeta_am(.*)/).test(input.account) || RegExp(/^keeta_an(.*)/).test(input.account) || RegExp(/^keeta_ao(.*)/).test(input.account) || RegExp(/^keeta_ap(.*)/).test(input.account) || RegExp(/^tyblocks_am(.*)/).test(input.account) || RegExp(/^tyblocks_an(.*)/).test(input.account) || RegExp(/^tyblocks_ao(.*)/).test(input.account) || RegExp(/^tyblocks_ap(.*)/).test(input.account) || RegExp(/^keeta_ai(.*)/).test(input.account) || RegExp(/^keeta_aj(.*)/).test(input.account) || RegExp(/^keeta_ak(.*)/).test(input.account) || RegExp(/^keeta_al(.*)/).test(input.account) || RegExp(/^tyblocks_ai(.*)/).test(input.account) || RegExp(/^tyblocks_aj(.*)/).test(input.account) || RegExp(/^tyblocks_ak(.*)/).test(input.account) || RegExp(/^tyblocks_al(.*)/).test(input.account) || RegExp(/^keeta_at(.*)/).test(input.account) || RegExp(/^keeta_aq(.*)/).test(input.account) || RegExp(/^keeta_ar(.*)/).test(input.account) || RegExp(/^keeta_as(.*)/).test(input.account) || RegExp(/^tyblocks_at(.*)/).test(input.account) || RegExp(/^tyblocks_aq(.*)/).test(input.account) || RegExp(/^tyblocks_ar(.*)/).test(input.account) || RegExp(/^tyblocks_as(.*)/).test(input.account) || RegExp(/^keeta_a4(.*)/).test(input.account) || RegExp(/^keeta_a5(.*)/).test(input.account) || RegExp(/^keeta_a6(.*)/).test(input.account) || RegExp(/^keeta_a7(.*)/).test(input.account) || RegExp(/^tyblocks_a4(.*)/).test(input.account) || RegExp(/^tyblocks_a5(.*)/).test(input.account) || RegExp(/^tyblocks_a6(.*)/).test(input.account) || RegExp(/^tyblocks_a7(.*)/).test(input.account) || RegExp(/^keeta_aa(.*)/).test(input.account) || RegExp(/^keeta_ab(.*)/).test(input.account) || RegExp(/^keeta_ac(.*)/).test(input.account) || RegExp(/^keeta_ad(.*)/).test(input.account) || RegExp(/^tyblocks_aa(.*)/).test(input.account) || RegExp(/^tyblocks_ab(.*)/).test(input.account) || RegExp(/^tyblocks_ac(.*)/).test(input.account) || RegExp(/^tyblocks_ad(.*)/).test(input.account) || RegExp(/^keeta_ay(.*)/).test(input.account) || RegExp(/^keeta_az(.*)/).test(input.account) || RegExp(/^keeta_a2(.*)/).test(input.account) || RegExp(/^keeta_a3(.*)/).test(input.account) || RegExp(/^tyblocks_ay(.*)/).test(input.account) || RegExp(/^tyblocks_az(.*)/).test(input.account) || RegExp(/^tyblocks_a2(.*)/).test(input.account) || RegExp(/^tyblocks_a3(.*)/).test(input.account) || RegExp(/^keeta_ae(.*)/).test(input.account) || RegExp(/^keeta_af(.*)/).test(input.account) || RegExp(/^keeta_ag(.*)/).test(input.account) || RegExp(/^keeta_ah(.*)/).test(input.account) || RegExp(/^tyblocks_ae(.*)/).test(input.account) || RegExp(/^tyblocks_af(.*)/).test(input.account) || RegExp(/^tyblocks_ag(.*)/).test(input.account) || RegExp(/^tyblocks_ah(.*)/).test(input.account))) && ("object" === typeof input.signed && null !== input.signed && _io4(input.signed)); const _io1 = input => true && true === _iv3.has(input.code) && "string" === typeof input.name && true === _iv4.has(input.longCode) && true === _iv5.has(input.numericCode) && "string" === typeof input.dialCode && (undefined === input.region || "object" === typeof input.region && null !== input.region && false === Array.isArray(input.region) && _io2(input.region)); const _io2 = input => (undefined === input.primary || "object" === typeof input.primary && null !== input.primary && _io3(input.primary)) && (undefined === input.subRegion || "object" === typeof input.subRegion && null !== input.subRegion && _io3(input.subRegion)) && (undefined === input.intermediateRegion || "object" === typeof input.intermediateRegion && null !== input.intermediateRegion && _io3(input.intermediateRegion)); const _io3 = input => "string" === typeof input.name && "string" === typeof input.code; const _io4 = input => "string" === typeof input.nonce && "string" === typeof input.timestamp && "string" === typeof input.signature; const _ao0 = (input, _path, _exceptionable = true) => ((Array.isArray(input.countryCodes) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
3
+ export const assertCreateVerificationRequest = (() => { const _iv2 = new Set(["840", "533", "356", "578", "108", "132", "116", "124", "136", "152", "156", "170", "174", "554", "188", "192", "203", "208", "262", "214", "818", "222", "232", "748", "238", "242", "270", "292", "320", "826", "324", "328", "332", "340", "344", "348", "352", "360", "364", "368", "376", "388", "392", "400", "398", "404", "408", "410", "414", "417", "418", "422", "426", "710", "430", "434", "756", "446", "807", "454", "458", "462", "480", "484", "498", "496", "504", "104", "516", "524", "558", "566", "512", "586", "598", "600", "604", "608", "634", "643", "646", "654", "882", "682", "690", "694", "702", "706", "728", "144", "752", "760", "834", "764", "776", "780", "788", "800", "784", "858", "860", "548", "704", "AF", "AX", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BQ", "BA", "BW", "BV", "BR", "IO", "BN", "BG", "BF", "BI", "CV", "KH", "CM", "CA", "KY", "CF", "TD", "CL", "CN", "CX", "CC", "CO", "KM", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CW", "CY", "CZ", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "GQ", "ER", "EE", "SZ", "ET", "FK", "FO", "FJ", "FI", "FR", "GF", "PF", "TF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GG", "GN", "GW", "GY", "HT", "HM", "VA", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KP", "KR", "KW", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MG", "MW", "MY", "MV", "ML", "MT", "MH", "MQ", "MR", "MU", "YT", "MX", "FM", "MD", "MC", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NC", "NZ", "NI", "NE", "NG", "NU", "NF", "MK", "MP", "NO", "OM", "PK", "PW", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RE", "RO", "RU", "RW", "BL", "SH", "KN", "LC", "MF", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SX", "SK", "SI", "SB", "SO", "ZA", "GS", "SS", "ES", "LK", "SD", "SR", "SJ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TL", "TG", "TK", "TO", "TT", "TN", "TR", "TM", "TC", "TV", "UG", "UA", "AE", "GB", "US", "UM", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "WF", "EH", "YE", "ZM", "ZW", "004", "248", "008", "012", "016", "020", "024", "660", "010", "028", "032", "051", "036", "040", "031", "044", "048", "050", "052", "112", "056", "084", "204", "060", "064", "068", "535", "070", "072", "074", "076", "086", "096", "100", "854", "120", "140", "148", "162", "166", "178", "180", "184", "384", "191", "531", "196", "212", "218", "226", "233", "231", "234", "246", "250", "254", "258", "260", "266", "268", "276", "288", "300", "304", "308", "312", "316", "831", "624", "334", "336", "372", "833", "380", "832", "296", "428", "438", "440", "442", "450", "466", "470", "584", "474", "478", "175", "583", "492", "499", "500", "508", "520", "528", "540", "562", "570", "574", "580", "585", "591", "612", "616", "620", "630", "638", "642", "652", "659", "662", "663", "666", "670", "674", "678", "686", "688", "534", "703", "705", "090", "239", "724", "729", "740", "744", "158", "762", "626", "768", "772", "792", "795", "796", "798", "804", "581", "862", "092", "850", "876", "732", "887", "894", "716"]); const _iv3 = new Set(["AF", "AX", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BQ", "BA", "BW", "BV", "BR", "IO", "BN", "BG", "BF", "BI", "CV", "KH", "CM", "CA", "KY", "CF", "TD", "CL", "CN", "CX", "CC", "CO", "KM", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CW", "CY", "CZ", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "GQ", "ER", "EE", "SZ", "ET", "FK", "FO", "FJ", "FI", "FR", "GF", "PF", "TF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GG", "GN", "GW", "GY", "HT", "HM", "VA", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KP", "KR", "KW", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MG", "MW", "MY", "MV", "ML", "MT", "MH", "MQ", "MR", "MU", "YT", "MX", "FM", "MD", "MC", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NC", "NZ", "NI", "NE", "NG", "NU", "NF", "MK", "MP", "NO", "OM", "PK", "PW", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RE", "RO", "RU", "RW", "BL", "SH", "KN", "LC", "MF", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SX", "SK", "SI", "SB", "SO", "ZA", "GS", "SS", "ES", "LK", "SD", "SR", "SJ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TL", "TG", "TK", "TO", "TT", "TN", "TR", "TM", "TC", "TV", "UG", "UA", "AE", "GB", "US", "UM", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "WF", "EH", "YE", "ZM", "ZW"]); const _iv4 = new Set(["BTN", "MKD", "SLE", "CHE", "AFG", "ALA", "ALB", "DZA", "ASM", "AND", "AGO", "AIA", "ATA", "ATG", "ARG", "ARM", "ABW", "AUS", "AUT", "AZE", "BHS", "BHR", "BGD", "BRB", "BLR", "BEL", "BLZ", "BEN", "BMU", "BOL", "BES", "BIH", "BWA", "BVT", "BRA", "IOT", "BRN", "BGR", "BFA", "BDI", "CPV", "KHM", "CMR", "CAN", "CYM", "CAF", "TCD", "CHL", "CHN", "CXR", "CCK", "COL", "COM", "COG", "COD", "COK", "CRI", "CIV", "HRV", "CUB", "CUW", "CYP", "CZE", "DNK", "DJI", "DMA", "DOM", "ECU", "EGY", "SLV", "GNQ", "ERI", "EST", "SWZ", "ETH", "FLK", "FRO", "FJI", "FIN", "FRA", "GUF", "PYF", "ATF", "GAB", "GMB", "GEO", "DEU", "GHA", "GIB", "GRC", "GRL", "GRD", "GLP", "GUM", "GTM", "GGY", "GIN", "GNB", "GUY", "HTI", "HMD", "VAT", "HND", "HKG", "HUN", "ISL", "IND", "IDN", "IRN", "IRQ", "IRL", "IMN", "ISR", "ITA", "JAM", "JPN", "JEY", "JOR", "KAZ", "KEN", "KIR", "PRK", "KOR", "KWT", "KGZ", "LAO", "LVA", "LBN", "LSO", "LBR", "LBY", "LIE", "LTU", "LUX", "MAC", "MDG", "MWI", "MYS", "MDV", "MLI", "MLT", "MHL", "MTQ", "MRT", "MUS", "MYT", "MEX", "FSM", "MDA", "MCO", "MNG", "MNE", "MSR", "MAR", "MOZ", "MMR", "NAM", "NRU", "NPL", "NLD", "NCL", "NZL", "NIC", "NER", "NGA", "NIU", "NFK", "MNP", "NOR", "OMN", "PAK", "PLW", "PAN", "PNG", "PRY", "PER", "PHL", "PCN", "POL", "PRT", "PRI", "QAT", "REU", "ROU", "RUS", "RWA", "BLM", "SHN", "KNA", "LCA", "MAF", "SPM", "VCT", "WSM", "SMR", "STP", "SAU", "SEN", "SRB", "SYC", "SGP", "SXM", "SVK", "SVN", "SLB", "SOM", "ZAF", "SGS", "SSD", "ESP", "LKA", "SDN", "SUR", "SJM", "SWE", "SYR", "TWN", "TJK", "TZA", "THA", "TLS", "TGO", "TKL", "TON", "TTO", "TUN", "TUR", "TKM", "TCA", "TUV", "UGA", "UKR", "ARE", "GBR", "USA", "UMI", "URY", "UZB", "VUT", "VEN", "VNM", "VGB", "VIR", "WLF", "ESH", "YEM", "ZMB", "ZWE"]); const _iv5 = new Set(["840", "533", "356", "578", "108", "132", "116", "124", "136", "152", "156", "170", "174", "554", "188", "192", "203", "208", "262", "214", "818", "222", "232", "748", "238", "242", "270", "292", "320", "826", "324", "328", "332", "340", "344", "348", "352", "360", "364", "368", "376", "388", "392", "400", "398", "404", "408", "410", "414", "417", "418", "422", "426", "710", "430", "434", "756", "446", "807", "454", "458", "462", "480", "484", "498", "496", "504", "104", "516", "524", "558", "566", "512", "586", "598", "600", "604", "608", "634", "643", "646", "654", "882", "682", "690", "694", "702", "706", "728", "144", "752", "760", "834", "764", "776", "780", "788", "800", "784", "858", "860", "548", "704", "004", "248", "008", "012", "016", "020", "024", "660", "010", "028", "032", "051", "036", "040", "031", "044", "048", "050", "052", "112", "056", "084", "204", "060", "064", "068", "535", "070", "072", "074", "076", "086", "096", "100", "854", "120", "140", "148", "162", "166", "178", "180", "184", "384", "191", "531", "196", "212", "218", "226", "233", "231", "234", "246", "250", "254", "258", "260", "266", "268", "276", "288", "300", "304", "308", "312", "316", "831", "624", "334", "336", "372", "833", "380", "832", "296", "428", "438", "440", "442", "450", "466", "470", "584", "474", "478", "175", "583", "492", "499", "500", "508", "520", "528", "540", "562", "570", "574", "580", "585", "591", "612", "616", "620", "630", "638", "642", "652", "659", "662", "663", "666", "670", "674", "678", "686", "688", "534", "703", "705", "090", "239", "724", "729", "740", "744", "158", "762", "626", "768", "772", "792", "795", "796", "798", "804", "581", "862", "092", "850", "876", "732", "887", "894", "716"]); const _av7 = new Set(["840", "533", "356", "578", "108", "132", "116", "124", "136", "152", "156", "170", "174", "554", "188", "192", "203", "208", "262", "214", "818", "222", "232", "748", "238", "242", "270", "292", "320", "826", "324", "328", "332", "340", "344", "348", "352", "360", "364", "368", "376", "388", "392", "400", "398", "404", "408", "410", "414", "417", "418", "422", "426", "710", "430", "434", "756", "446", "807", "454", "458", "462", "480", "484", "498", "496", "504", "104", "516", "524", "558", "566", "512", "586", "598", "600", "604", "608", "634", "643", "646", "654", "882", "682", "690", "694", "702", "706", "728", "144", "752", "760", "834", "764", "776", "780", "788", "800", "784", "858", "860", "548", "704", "AF", "AX", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BQ", "BA", "BW", "BV", "BR", "IO", "BN", "BG", "BF", "BI", "CV", "KH", "CM", "CA", "KY", "CF", "TD", "CL", "CN", "CX", "CC", "CO", "KM", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CW", "CY", "CZ", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "GQ", "ER", "EE", "SZ", "ET", "FK", "FO", "FJ", "FI", "FR", "GF", "PF", "TF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GG", "GN", "GW", "GY", "HT", "HM", "VA", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KP", "KR", "KW", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MG", "MW", "MY", "MV", "ML", "MT", "MH", "MQ", "MR", "MU", "YT", "MX", "FM", "MD", "MC", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NC", "NZ", "NI", "NE", "NG", "NU", "NF", "MK", "MP", "NO", "OM", "PK", "PW", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RE", "RO", "RU", "RW", "BL", "SH", "KN", "LC", "MF", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SX", "SK", "SI", "SB", "SO", "ZA", "GS", "SS", "ES", "LK", "SD", "SR", "SJ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TL", "TG", "TK", "TO", "TT", "TN", "TR", "TM", "TC", "TV", "UG", "UA", "AE", "GB", "US", "UM", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "WF", "EH", "YE", "ZM", "ZW", "004", "248", "008", "012", "016", "020", "024", "660", "010", "028", "032", "051", "036", "040", "031", "044", "048", "050", "052", "112", "056", "084", "204", "060", "064", "068", "535", "070", "072", "074", "076", "086", "096", "100", "854", "120", "140", "148", "162", "166", "178", "180", "184", "384", "191", "531", "196", "212", "218", "226", "233", "231", "234", "246", "250", "254", "258", "260", "266", "268", "276", "288", "300", "304", "308", "312", "316", "831", "624", "334", "336", "372", "833", "380", "832", "296", "428", "438", "440", "442", "450", "466", "470", "584", "474", "478", "175", "583", "492", "499", "500", "508", "520", "528", "540", "562", "570", "574", "580", "585", "591", "612", "616", "620", "630", "638", "642", "652", "659", "662", "663", "666", "670", "674", "678", "686", "688", "534", "703", "705", "090", "239", "724", "729", "740", "744", "158", "762", "626", "768", "772", "792", "795", "796", "798", "804", "581", "862", "092", "850", "876", "732", "887", "894", "716"]); const _av8 = new Set(["AF", "AX", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BQ", "BA", "BW", "BV", "BR", "IO", "BN", "BG", "BF", "BI", "CV", "KH", "CM", "CA", "KY", "CF", "TD", "CL", "CN", "CX", "CC", "CO", "KM", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CW", "CY", "CZ", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "GQ", "ER", "EE", "SZ", "ET", "FK", "FO", "FJ", "FI", "FR", "GF", "PF", "TF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GG", "GN", "GW", "GY", "HT", "HM", "VA", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KP", "KR", "KW", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MG", "MW", "MY", "MV", "ML", "MT", "MH", "MQ", "MR", "MU", "YT", "MX", "FM", "MD", "MC", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NC", "NZ", "NI", "NE", "NG", "NU", "NF", "MK", "MP", "NO", "OM", "PK", "PW", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RE", "RO", "RU", "RW", "BL", "SH", "KN", "LC", "MF", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SX", "SK", "SI", "SB", "SO", "ZA", "GS", "SS", "ES", "LK", "SD", "SR", "SJ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TL", "TG", "TK", "TO", "TT", "TN", "TR", "TM", "TC", "TV", "UG", "UA", "AE", "GB", "US", "UM", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "WF", "EH", "YE", "ZM", "ZW"]); const _av9 = new Set(["BTN", "MKD", "SLE", "CHE", "AFG", "ALA", "ALB", "DZA", "ASM", "AND", "AGO", "AIA", "ATA", "ATG", "ARG", "ARM", "ABW", "AUS", "AUT", "AZE", "BHS", "BHR", "BGD", "BRB", "BLR", "BEL", "BLZ", "BEN", "BMU", "BOL", "BES", "BIH", "BWA", "BVT", "BRA", "IOT", "BRN", "BGR", "BFA", "BDI", "CPV", "KHM", "CMR", "CAN", "CYM", "CAF", "TCD", "CHL", "CHN", "CXR", "CCK", "COL", "COM", "COG", "COD", "COK", "CRI", "CIV", "HRV", "CUB", "CUW", "CYP", "CZE", "DNK", "DJI", "DMA", "DOM", "ECU", "EGY", "SLV", "GNQ", "ERI", "EST", "SWZ", "ETH", "FLK", "FRO", "FJI", "FIN", "FRA", "GUF", "PYF", "ATF", "GAB", "GMB", "GEO", "DEU", "GHA", "GIB", "GRC", "GRL", "GRD", "GLP", "GUM", "GTM", "GGY", "GIN", "GNB", "GUY", "HTI", "HMD", "VAT", "HND", "HKG", "HUN", "ISL", "IND", "IDN", "IRN", "IRQ", "IRL", "IMN", "ISR", "ITA", "JAM", "JPN", "JEY", "JOR", "KAZ", "KEN", "KIR", "PRK", "KOR", "KWT", "KGZ", "LAO", "LVA", "LBN", "LSO", "LBR", "LBY", "LIE", "LTU", "LUX", "MAC", "MDG", "MWI", "MYS", "MDV", "MLI", "MLT", "MHL", "MTQ", "MRT", "MUS", "MYT", "MEX", "FSM", "MDA", "MCO", "MNG", "MNE", "MSR", "MAR", "MOZ", "MMR", "NAM", "NRU", "NPL", "NLD", "NCL", "NZL", "NIC", "NER", "NGA", "NIU", "NFK", "MNP", "NOR", "OMN", "PAK", "PLW", "PAN", "PNG", "PRY", "PER", "PHL", "PCN", "POL", "PRT", "PRI", "QAT", "REU", "ROU", "RUS", "RWA", "BLM", "SHN", "KNA", "LCA", "MAF", "SPM", "VCT", "WSM", "SMR", "STP", "SAU", "SEN", "SRB", "SYC", "SGP", "SXM", "SVK", "SVN", "SLB", "SOM", "ZAF", "SGS", "SSD", "ESP", "LKA", "SDN", "SUR", "SJM", "SWE", "SYR", "TWN", "TJK", "TZA", "THA", "TLS", "TGO", "TKL", "TON", "TTO", "TUN", "TUR", "TKM", "TCA", "TUV", "UGA", "UKR", "ARE", "GBR", "USA", "UMI", "URY", "UZB", "VUT", "VEN", "VNM", "VGB", "VIR", "WLF", "ESH", "YEM", "ZMB", "ZWE"]); const _av10 = new Set(["840", "533", "356", "578", "108", "132", "116", "124", "136", "152", "156", "170", "174", "554", "188", "192", "203", "208", "262", "214", "818", "222", "232", "748", "238", "242", "270", "292", "320", "826", "324", "328", "332", "340", "344", "348", "352", "360", "364", "368", "376", "388", "392", "400", "398", "404", "408", "410", "414", "417", "418", "422", "426", "710", "430", "434", "756", "446", "807", "454", "458", "462", "480", "484", "498", "496", "504", "104", "516", "524", "558", "566", "512", "586", "598", "600", "604", "608", "634", "643", "646", "654", "882", "682", "690", "694", "702", "706", "728", "144", "752", "760", "834", "764", "776", "780", "788", "800", "784", "858", "860", "548", "704", "004", "248", "008", "012", "016", "020", "024", "660", "010", "028", "032", "051", "036", "040", "031", "044", "048", "050", "052", "112", "056", "084", "204", "060", "064", "068", "535", "070", "072", "074", "076", "086", "096", "100", "854", "120", "140", "148", "162", "166", "178", "180", "184", "384", "191", "531", "196", "212", "218", "226", "233", "231", "234", "246", "250", "254", "258", "260", "266", "268", "276", "288", "300", "304", "308", "312", "316", "831", "624", "334", "336", "372", "833", "380", "832", "296", "428", "438", "440", "442", "450", "466", "470", "584", "474", "478", "175", "583", "492", "499", "500", "508", "520", "528", "540", "562", "570", "574", "580", "585", "591", "612", "616", "620", "630", "638", "642", "652", "659", "662", "663", "666", "670", "674", "678", "686", "688", "534", "703", "705", "090", "239", "724", "729", "740", "744", "158", "762", "626", "768", "772", "792", "795", "796", "798", "804", "581", "862", "092", "850", "876", "732", "887", "894", "716"]); const _io0 = input => Array.isArray(input.countryCodes) && input.countryCodes.every(elem => null !== elem && undefined !== elem && (true === _iv2.has(elem) || "object" === typeof elem && null !== elem && _io1(elem))) && ("string" === typeof input.account && (RegExp(/^keeta_am(.*)/).test(input.account) || RegExp(/^keeta_an(.*)/).test(input.account) || RegExp(/^keeta_ao(.*)/).test(input.account) || RegExp(/^keeta_ap(.*)/).test(input.account) || RegExp(/^tyblocks_am(.*)/).test(input.account) || RegExp(/^tyblocks_an(.*)/).test(input.account) || RegExp(/^tyblocks_ao(.*)/).test(input.account) || RegExp(/^tyblocks_ap(.*)/).test(input.account) || RegExp(/^keeta_aa(.*)/).test(input.account) || RegExp(/^keeta_ab(.*)/).test(input.account) || RegExp(/^keeta_ac(.*)/).test(input.account) || RegExp(/^keeta_ad(.*)/).test(input.account) || RegExp(/^tyblocks_aa(.*)/).test(input.account) || RegExp(/^tyblocks_ab(.*)/).test(input.account) || RegExp(/^tyblocks_ac(.*)/).test(input.account) || RegExp(/^tyblocks_ad(.*)/).test(input.account) || RegExp(/^keeta_ae(.*)/).test(input.account) || RegExp(/^keeta_af(.*)/).test(input.account) || RegExp(/^keeta_ag(.*)/).test(input.account) || RegExp(/^keeta_ah(.*)/).test(input.account) || RegExp(/^tyblocks_ae(.*)/).test(input.account) || RegExp(/^tyblocks_af(.*)/).test(input.account) || RegExp(/^tyblocks_ag(.*)/).test(input.account) || RegExp(/^tyblocks_ah(.*)/).test(input.account) || RegExp(/^keeta_ai(.*)/).test(input.account) || RegExp(/^keeta_aj(.*)/).test(input.account) || RegExp(/^keeta_ak(.*)/).test(input.account) || RegExp(/^keeta_al(.*)/).test(input.account) || RegExp(/^tyblocks_ai(.*)/).test(input.account) || RegExp(/^tyblocks_aj(.*)/).test(input.account) || RegExp(/^tyblocks_ak(.*)/).test(input.account) || RegExp(/^tyblocks_al(.*)/).test(input.account) || RegExp(/^keeta_at(.*)/).test(input.account) || RegExp(/^keeta_aq(.*)/).test(input.account) || RegExp(/^keeta_ar(.*)/).test(input.account) || RegExp(/^keeta_as(.*)/).test(input.account) || RegExp(/^tyblocks_at(.*)/).test(input.account) || RegExp(/^tyblocks_aq(.*)/).test(input.account) || RegExp(/^tyblocks_ar(.*)/).test(input.account) || RegExp(/^tyblocks_as(.*)/).test(input.account) || RegExp(/^keeta_ay(.*)/).test(input.account) || RegExp(/^keeta_az(.*)/).test(input.account) || RegExp(/^keeta_a2(.*)/).test(input.account) || RegExp(/^keeta_a3(.*)/).test(input.account) || RegExp(/^tyblocks_ay(.*)/).test(input.account) || RegExp(/^tyblocks_az(.*)/).test(input.account) || RegExp(/^tyblocks_a2(.*)/).test(input.account) || RegExp(/^tyblocks_a3(.*)/).test(input.account) || RegExp(/^keeta_a4(.*)/).test(input.account) || RegExp(/^keeta_a5(.*)/).test(input.account) || RegExp(/^keeta_a6(.*)/).test(input.account) || RegExp(/^keeta_a7(.*)/).test(input.account) || RegExp(/^tyblocks_a4(.*)/).test(input.account) || RegExp(/^tyblocks_a5(.*)/).test(input.account) || RegExp(/^tyblocks_a6(.*)/).test(input.account) || RegExp(/^tyblocks_a7(.*)/).test(input.account))) && ("object" === typeof input.signed && null !== input.signed && _io4(input.signed)); const _io1 = input => true && true === _iv3.has(input.code) && "string" === typeof input.name && true === _iv4.has(input.longCode) && true === _iv5.has(input.numericCode) && "string" === typeof input.dialCode && (undefined === input.region || "object" === typeof input.region && null !== input.region && false === Array.isArray(input.region) && _io2(input.region)); const _io2 = input => (undefined === input.primary || "object" === typeof input.primary && null !== input.primary && _io3(input.primary)) && (undefined === input.subRegion || "object" === typeof input.subRegion && null !== input.subRegion && _io3(input.subRegion)) && (undefined === input.intermediateRegion || "object" === typeof input.intermediateRegion && null !== input.intermediateRegion && _io3(input.intermediateRegion)); const _io3 = input => "string" === typeof input.name && "string" === typeof input.code; const _io4 = input => "string" === typeof input.nonce && "string" === typeof input.timestamp && "string" === typeof input.signature; const _ao0 = (input, _path, _exceptionable = true) => ((Array.isArray(input.countryCodes) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
4
4
  method: "createAssert",
5
5
  path: _path + ".countryCodes",
6
6
  expected: "Array<CountrySearchInput>",
@@ -30,7 +30,7 @@ export const assertCreateVerificationRequest = (() => { const _iv2 = new Set(["8
30
30
  path: _path + ".countryCodes",
31
31
  expected: "Array<CountrySearchInput>",
32
32
  value: input.countryCodes
33
- }, _errorFactory)) && ("string" === typeof input.account && (RegExp(/^keeta_am(.*)/).test(input.account) || RegExp(/^keeta_an(.*)/).test(input.account) || RegExp(/^keeta_ao(.*)/).test(input.account) || RegExp(/^keeta_ap(.*)/).test(input.account) || RegExp(/^tyblocks_am(.*)/).test(input.account) || RegExp(/^tyblocks_an(.*)/).test(input.account) || RegExp(/^tyblocks_ao(.*)/).test(input.account) || RegExp(/^tyblocks_ap(.*)/).test(input.account) || RegExp(/^keeta_ai(.*)/).test(input.account) || RegExp(/^keeta_aj(.*)/).test(input.account) || RegExp(/^keeta_ak(.*)/).test(input.account) || RegExp(/^keeta_al(.*)/).test(input.account) || RegExp(/^tyblocks_ai(.*)/).test(input.account) || RegExp(/^tyblocks_aj(.*)/).test(input.account) || RegExp(/^tyblocks_ak(.*)/).test(input.account) || RegExp(/^tyblocks_al(.*)/).test(input.account) || RegExp(/^keeta_at(.*)/).test(input.account) || RegExp(/^keeta_aq(.*)/).test(input.account) || RegExp(/^keeta_ar(.*)/).test(input.account) || RegExp(/^keeta_as(.*)/).test(input.account) || RegExp(/^tyblocks_at(.*)/).test(input.account) || RegExp(/^tyblocks_aq(.*)/).test(input.account) || RegExp(/^tyblocks_ar(.*)/).test(input.account) || RegExp(/^tyblocks_as(.*)/).test(input.account) || RegExp(/^keeta_a4(.*)/).test(input.account) || RegExp(/^keeta_a5(.*)/).test(input.account) || RegExp(/^keeta_a6(.*)/).test(input.account) || RegExp(/^keeta_a7(.*)/).test(input.account) || RegExp(/^tyblocks_a4(.*)/).test(input.account) || RegExp(/^tyblocks_a5(.*)/).test(input.account) || RegExp(/^tyblocks_a6(.*)/).test(input.account) || RegExp(/^tyblocks_a7(.*)/).test(input.account) || RegExp(/^keeta_aa(.*)/).test(input.account) || RegExp(/^keeta_ab(.*)/).test(input.account) || RegExp(/^keeta_ac(.*)/).test(input.account) || RegExp(/^keeta_ad(.*)/).test(input.account) || RegExp(/^tyblocks_aa(.*)/).test(input.account) || RegExp(/^tyblocks_ab(.*)/).test(input.account) || RegExp(/^tyblocks_ac(.*)/).test(input.account) || RegExp(/^tyblocks_ad(.*)/).test(input.account) || RegExp(/^keeta_ay(.*)/).test(input.account) || RegExp(/^keeta_az(.*)/).test(input.account) || RegExp(/^keeta_a2(.*)/).test(input.account) || RegExp(/^keeta_a3(.*)/).test(input.account) || RegExp(/^tyblocks_ay(.*)/).test(input.account) || RegExp(/^tyblocks_az(.*)/).test(input.account) || RegExp(/^tyblocks_a2(.*)/).test(input.account) || RegExp(/^tyblocks_a3(.*)/).test(input.account) || RegExp(/^keeta_ae(.*)/).test(input.account) || RegExp(/^keeta_af(.*)/).test(input.account) || RegExp(/^keeta_ag(.*)/).test(input.account) || RegExp(/^keeta_ah(.*)/).test(input.account) || RegExp(/^tyblocks_ae(.*)/).test(input.account) || RegExp(/^tyblocks_af(.*)/).test(input.account) || RegExp(/^tyblocks_ag(.*)/).test(input.account) || RegExp(/^tyblocks_ah(.*)/).test(input.account)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
33
+ }, _errorFactory)) && ("string" === typeof input.account && (RegExp(/^keeta_am(.*)/).test(input.account) || RegExp(/^keeta_an(.*)/).test(input.account) || RegExp(/^keeta_ao(.*)/).test(input.account) || RegExp(/^keeta_ap(.*)/).test(input.account) || RegExp(/^tyblocks_am(.*)/).test(input.account) || RegExp(/^tyblocks_an(.*)/).test(input.account) || RegExp(/^tyblocks_ao(.*)/).test(input.account) || RegExp(/^tyblocks_ap(.*)/).test(input.account) || RegExp(/^keeta_aa(.*)/).test(input.account) || RegExp(/^keeta_ab(.*)/).test(input.account) || RegExp(/^keeta_ac(.*)/).test(input.account) || RegExp(/^keeta_ad(.*)/).test(input.account) || RegExp(/^tyblocks_aa(.*)/).test(input.account) || RegExp(/^tyblocks_ab(.*)/).test(input.account) || RegExp(/^tyblocks_ac(.*)/).test(input.account) || RegExp(/^tyblocks_ad(.*)/).test(input.account) || RegExp(/^keeta_ae(.*)/).test(input.account) || RegExp(/^keeta_af(.*)/).test(input.account) || RegExp(/^keeta_ag(.*)/).test(input.account) || RegExp(/^keeta_ah(.*)/).test(input.account) || RegExp(/^tyblocks_ae(.*)/).test(input.account) || RegExp(/^tyblocks_af(.*)/).test(input.account) || RegExp(/^tyblocks_ag(.*)/).test(input.account) || RegExp(/^tyblocks_ah(.*)/).test(input.account) || RegExp(/^keeta_ai(.*)/).test(input.account) || RegExp(/^keeta_aj(.*)/).test(input.account) || RegExp(/^keeta_ak(.*)/).test(input.account) || RegExp(/^keeta_al(.*)/).test(input.account) || RegExp(/^tyblocks_ai(.*)/).test(input.account) || RegExp(/^tyblocks_aj(.*)/).test(input.account) || RegExp(/^tyblocks_ak(.*)/).test(input.account) || RegExp(/^tyblocks_al(.*)/).test(input.account) || RegExp(/^keeta_at(.*)/).test(input.account) || RegExp(/^keeta_aq(.*)/).test(input.account) || RegExp(/^keeta_ar(.*)/).test(input.account) || RegExp(/^keeta_as(.*)/).test(input.account) || RegExp(/^tyblocks_at(.*)/).test(input.account) || RegExp(/^tyblocks_aq(.*)/).test(input.account) || RegExp(/^tyblocks_ar(.*)/).test(input.account) || RegExp(/^tyblocks_as(.*)/).test(input.account) || RegExp(/^keeta_ay(.*)/).test(input.account) || RegExp(/^keeta_az(.*)/).test(input.account) || RegExp(/^keeta_a2(.*)/).test(input.account) || RegExp(/^keeta_a3(.*)/).test(input.account) || RegExp(/^tyblocks_ay(.*)/).test(input.account) || RegExp(/^tyblocks_az(.*)/).test(input.account) || RegExp(/^tyblocks_a2(.*)/).test(input.account) || RegExp(/^tyblocks_a3(.*)/).test(input.account) || RegExp(/^keeta_a4(.*)/).test(input.account) || RegExp(/^keeta_a5(.*)/).test(input.account) || RegExp(/^keeta_a6(.*)/).test(input.account) || RegExp(/^keeta_a7(.*)/).test(input.account) || RegExp(/^tyblocks_a4(.*)/).test(input.account) || RegExp(/^tyblocks_a5(.*)/).test(input.account) || RegExp(/^tyblocks_a6(.*)/).test(input.account) || RegExp(/^tyblocks_a7(.*)/).test(input.account)) || __typia_transform__assertGuard._assertGuard(_exceptionable, {
34
34
  method: "createAssert",
35
35
  path: _path + ".account",
36
36
  expected: "(`keeta_a2${string}` | `keeta_a3${string}` | `keeta_a4${string}` | `keeta_a5${string}` | `keeta_a6${string}` | `keeta_a7${string}` | `keeta_aa${string}` | `keeta_ab${string}` | `keeta_ac${string}` | `keeta_ad${string}` | `keeta_ae${string}` | `keeta_af${string}` | `keeta_ag${string}` | `keeta_ah${string}` | `keeta_ai${string}` | `keeta_aj${string}` | `keeta_ak${string}` | `keeta_al${string}` | `keeta_am${string}` | `keeta_an${string}` | `keeta_ao${string}` | `keeta_ap${string}` | `keeta_aq${string}` | `keeta_ar${string}` | `keeta_as${string}` | `keeta_at${string}` | `keeta_ay${string}` | `keeta_az${string}` | `tyblocks_a2${string}` | `tyblocks_a3${string}` | `tyblocks_a4${string}` | `tyblocks_a5${string}` | `tyblocks_a6${string}` | `tyblocks_a7${string}` | `tyblocks_aa${string}` | `tyblocks_ab${string}` | `tyblocks_ac${string}` | `tyblocks_ad${string}` | `tyblocks_ae${string}` | `tyblocks_af${string}` | `tyblocks_ag${string}` | `tyblocks_ah${string}` | `tyblocks_ai${string}` | `tyblocks_aj${string}` | `tyblocks_ak${string}` | `tyblocks_al${string}` | `tyblocks_am${string}` | `tyblocks_an${string}` | `tyblocks_ao${string}` | `tyblocks_ap${string}` | `tyblocks_aq${string}` | `tyblocks_ar${string}` | `tyblocks_as${string}` | `tyblocks_at${string}` | `tyblocks_ay${string}` | `tyblocks_az${string}`)",
@@ -1,4 +1,4 @@
1
- import KeetaNet from '@keetanetwork/keetanet-client';
1
+ import { KeetaNet } from '../../client/index.js';
2
2
  import * as CurrencyInfo from '@keetanetwork/currency-info';
3
3
  import * as KeetaAnchorHTTPServer from '../../lib/http-server/index.js';
4
4
  import type { KeetaKYCAnchorCreateVerificationRequest, KeetaKYCAnchorCreateVerificationResponse, KeetaKYCAnchorGetCertificateResponse } from './common.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/services/kyc/server.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,+BAA+B,CAAC;AACrD,OAAO,KAAK,YAAY,MAAM,6BAA6B,CAAC;AAE5D,OAAO,KAAK,qBAAqB,MAAM,gCAAgC,CAAC;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AC,eAAe,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;CAezF"}
@@ -1,4 +1,4 @@
1
- import KeetaNet from '@keetanetwork/keetanet-client';
1
+ import { KeetaNet } from '../../client/index.js';
2
2
  import * as CurrencyInfo from '@keetanetwork/currency-info';
3
3
  import * as KeetaAnchorHTTPServer from '../../lib/http-server/index.js';
4
4
  import { KeetaAnchorUserError } from '../../lib/error.js';
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/services/kyc/server.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,+BAA+B,CAAC;AACrD,OAAO,KAAK,YAAY,MAAM,6BAA6B,CAAC;AAE5D,OAAO,KAAK,qBAAqB,MAAM,gCAAgC,CAAC;AACxE,OAAO,EACN,oBAAoB,EACpB,MAAM,oBAAoB,CAAC;AAM5B,OAAO,EACN,+BAA+B,EAC/B,gCAAgC,EAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,gBAAgB,EAChB,MAAM,aAAa,CAAC;AAIrB,MAAM,uBAAuB,GAAG,0DAA0D,CAAC;AA4H1F,CAAC;AAEF,MAAM,OAAO,2BAA4B,SAAQ,qBAAqB,CAAC,wBAAoD;IACjH,QAAQ,CAAsD;IAC9D,MAAM,CAAuC;IAC7C,MAAM,CAAoD;IAC1D,EAAE,CAAmC;IACrC,GAAG,CAAoC;IACvC,cAAc,CAA4D;IAC1E,MAAM,CAAoD;IAC1D,aAAa,CAAsC;IAE5D,YAAY,MAAkC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAA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client';\nimport * as CurrencyInfo from '@keetanetwork/currency-info';\n\nimport * as KeetaAnchorHTTPServer from '../../lib/http-server/index.js';\nimport {\n\tKeetaAnchorUserError\n} from '../../lib/error.js';\nimport type {\n\tKeetaKYCAnchorCreateVerificationRequest,\n\tKeetaKYCAnchorCreateVerificationResponse,\n\tKeetaKYCAnchorGetCertificateResponse\n} from './common.ts';\nimport {\n\tassertCreateVerificationRequest,\n\tassertCreateVerificationResponse\n} from './common.generated.js';\nimport {\n\tverifySignedData\n} from './common.js';\nimport type * as Signing from '../../lib/utils/signing.js';\nimport type { ServiceMetadata } from '../../lib/resolver.ts';\n\nconst kycProviderURLUndefined = 'NO_KYC_PROVIDER_URL:87f0175c-4d0a-4029-a4f3-ba93ef725654';\n\n/**\n * The Base certificate type, from the KeetaNet Client\n *\n * The KYC Certificate type is a subclass of this, so it will also work\n */\ntype BaseCertificate = InstanceType<typeof KeetaNet.lib.Utils.Certificate.Certificate>;\n\nexport interface KeetaAnchorKYCServerConfig extends KeetaAnchorHTTPServer.KeetaAnchorHTTPServerConfig {\n\t/**\n\t * The data to use for the index page (optional)\n\t */\n\thomepage?: string | (() => Promise<string> | string);\n\n\t/**\n\t * The network client to use for submitting blocks\n\t */\n\tclient: { client: KeetaNet.Client; network: bigint; networkAlias: typeof KeetaNet.Client.Config.networksArray[number] } | KeetaNet.UserClient;\n\n\t/**\n\t * Configuration for the KYC Anchor\n\t *\n\t * The flow for a KYC Anchor is as follows:\n\t * 1. Client requests a new verification with a country code and\n\t * account from the KYC Anchor Server\n\t * 2. KYC Anchor Server responds with a verification ID and a URL\n\t * to the KYC provider's web URL, including the verification ID\n\t * 3. Client visits the KYC provider's web URL to complete the\n\t * verification\n\t * 4. KYC provider notifies the Anchor server that the\n\t * verification is complete\n\t * 5. Client requests the certificate for the verification ID\n\t * (polling) from the KYC Anchor Server\n\t * 6. KYC Anchor Server responds with the certificate(s) for the\n\t * verification ID (if complete, pending if still in progress,\n\t * an error if failed)\n\t * 7. Client installs the certificate(s) in their wallet using\n\t * the KeetaNet Client library\n\t *\n\t *\n\t * +-------------------+ +---------------------+ +------------------+\n\t * | Client | | KYC Anchor Server | | KYC Provider |\n\t * +-------------------+ +---------------------+ +------------------+\n\t * | | |\n\t * (1) Create Verification | |\n\t * countryCode, account ---------------------->| |\n\t * | | |\n\t * | (2) Create verification |\n\t * |----------------------------------- verificationID, providerURL |\n\t * | | |\n\t * (3) Open providerURL (with verificationID)------------------------------------>|\n\t * | | |\n\t * | | (4) Notify\n\t * | |<-------- verificationID, verificationStatus, certificates?\n\t * | |\n\t * (5) Poll certificate for verificationID --->|\n\t * | |\n\t * |<-------------------------- (6) Pending / Certificate(s) / Error\n\t * | (repeat #5 until complete)\n\t * |\n\t * (7) Install certificate(s) in wallet using KeetaNet Client library\n\t */\n\tkyc: {\n\t\t/**\n\t\t * Notification that a verification has been started (optional)\n\t\t *\n\t\t * This method can be used to notify the KYC provider that\n\t\t * a verification has been started. It can return additional\n\t\t * information about the verification, such as the web URL\n\t\t * where the user can complete the verification.\n\t\t *\n\t\t * If this method is not provided, the server will generate\n\t\t * a random verification ID and use the `kycProviderURL` from\n\t\t * the server configuration, replacing `{id}` with the\n\t\t * verification ID.\n\t\t */\n\t\tverificationStarted?: (request: KeetaKYCAnchorCreateVerificationRequest) => Promise<Partial<KeetaKYCAnchorCreateVerificationResponse> | undefined>;\n\n\t\t/**\n\t\t * Retrieve the certificate for a verification\n\t\t *\n\t\t * This should return the certificate(s) for the\n\t\t * verification ID. If the verification is still\n\t\t * in progress, it should throw an `CertificateNotFound`\n\t\t * error.\n\t\t * If the verification has failed permanently, it should\n\t\t * throw a `KeetaAnchorUserError` with an appropriate\n\t\t * error message or `VerificationNotFound` if the\n\t\t * verification ID is not found.\n\t\t */\n\t\tgetCertificates: (verificationID: string) => Promise<Extract<KeetaKYCAnchorGetCertificateResponse, { ok: true; }>['results']>;\n\n\t\t/**\n\t\t * Country codes that this KYC provider can service (default is all country codes)\n\t\t */\n\t\tcountryCodes?: (CurrencyInfo.Country | CurrencyInfo.ISOCountryCode)[];\n\t}\n\n\t/**\n\t * The certificate to use for signing certificates\n\t */\n\tca: BaseCertificate;\n\n\t/**\n\t * The account to use for signing certificates\n\t */\n\tsigner: Signing.SignableAccount;\n\n\t/**\n\t * URL for the KYC Provider (optional)\n\t *\n\t * This is the URL that clients will be directed to in order to\n\t * complete the KYC verification process. It is optional because\n\t * the `kyc.verificationStarted` method can also return a `webURL`.\n\t * If both are provided, the URL from `kyc.verificationStarted` takes\n\t * precedence.\n\t */\n\tkycProviderURL?: string | ((verificationID: string) => string);\n\n\t/**\n\t * Additional routes to add to the server (optional)\n\t */\n\troutes?: KeetaAnchorHTTPServer.Routes;\n};\n\nexport class KeetaNetKYCAnchorHTTPServer extends KeetaAnchorHTTPServer.KeetaNetAnchorHTTPServer<KeetaAnchorKYCServerConfig> implements Required<KeetaAnchorKYCServerConfig> {\n\treadonly homepage: NonNullable<KeetaAnchorKYCServerConfig['homepage']>;\n\treadonly client: KeetaAnchorKYCServerConfig['client'];\n\treadonly signer: NonNullable<KeetaAnchorKYCServerConfig['signer']>;\n\treadonly ca: KeetaAnchorKYCServerConfig['ca'];\n\treadonly kyc: KeetaAnchorKYCServerConfig['kyc'];\n\treadonly kycProviderURL: NonNullable<KeetaAnchorKYCServerConfig['kycProviderURL']>;\n\treadonly routes: NonNullable<KeetaAnchorKYCServerConfig['routes']>;\n\treadonly #countryCodes?: CurrencyInfo.Country[] | undefined;\n\n\tconstructor(config: KeetaAnchorKYCServerConfig) {\n\t\tsuper(config);\n\n\t\tthis.homepage = config.homepage ?? '';\n\t\tthis.client = config.client;\n\t\tthis.signer = config.signer;\n\t\tthis.ca = config.ca;\n\t\tthis.kyc = config.kyc;\n\t\tthis.routes = config.routes ?? {};\n\t\tthis.kycProviderURL = config.kycProviderURL ?? kycProviderURLUndefined;\n\n\t\tif (config.kyc.countryCodes) {\n\t\t\tthis.#countryCodes = config.kyc.countryCodes.map(function(inputCode) {\n\t\t\t\tif (CurrencyInfo.Country.isCountryCode(inputCode)) {\n\t\t\t\t\treturn(new CurrencyInfo.Country(inputCode));\n\t\t\t\t}\n\n\t\t\t\treturn(inputCode);\n\t\t\t});\n\t\t}\n\t}\n\n\tprotected async initRoutes(config: KeetaAnchorKYCServerConfig): Promise<KeetaAnchorHTTPServer.Routes> {\n\t\tconst routes: KeetaAnchorHTTPServer.Routes = {};\n\n\t\t/**\n\t\t * If a homepage is provided, setup the route for it\n\t\t */\n\t\tif ('homepage' in config) {\n\t\t\troutes['GET /'] = async function() {\n\t\t\t\tlet homepageData: string;\n\t\t\t\tif (typeof config.homepage === 'string') {\n\t\t\t\t\thomepageData = config.homepage;\n\t\t\t\t} else {\n\t\t\t\t\tif (!config.homepage) {\n\t\t\t\t\t\tthrow(new Error('internal error: No homepage function provided'));\n\t\t\t\t\t}\n\n\t\t\t\t\thomepageData = await config.homepage();\n\t\t\t\t}\n\n\t\t\t\treturn({\n\t\t\t\t\toutput: homepageData,\n\t\t\t\t\tcontentType: 'text/html'\n\t\t\t\t});\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Begin the KYC verification process\n\t\t * with this KYC provider\n\t\t */\n\t\troutes['POST /api/createVerification'] = async function(_ignore_params, bodyInput) {\n\t\t\tif (bodyInput === null || typeof bodyInput !== 'object' || !('request' in bodyInput)) {\n\t\t\t\tthrow(new KeetaAnchorUserError('Invalid request'));\n\t\t\t}\n\n\t\t\tconst body = assertCreateVerificationRequest(bodyInput.request);\n\t\t\tconst valid = await verifySignedData(body);\n\t\t\tif (!valid) {\n\t\t\t\tthrow(new KeetaAnchorUserError('Invalid signature'));\n\t\t\t}\n\n\t\t\t/* XXX:TODO: Validate that the nonce is unique (within a reasonable time frame) */\n\n\t\t\tlet response: Partial<KeetaKYCAnchorCreateVerificationResponse> | undefined = {};\n\t\t\tif (config.kyc.verificationStarted) {\n\t\t\t\tresponse = await config.kyc.verificationStarted(body);\n\t\t\t}\n\n\t\t\tresponse ??= {};\n\n\t\t\tif (response?.ok === false) {\n\t\t\t\tthrow(new KeetaAnchorUserError(response.error ?? 'Unknown error'));\n\t\t\t}\n\n\t\t\tresponse.ok = true;\n\t\t\tif (!response.ok) {\n\t\t\t\tthrow(new Error('internal error: invalid response'));\n\t\t\t}\n\t\t\tresponse.id ??= crypto.randomUUID();\n\n\t\t\tlet defaultWebURL: string;\n\t\t\tif (typeof config.kycProviderURL === 'string') {\n\t\t\t\tdefaultWebURL = config.kycProviderURL.replace('{id}', encodeURIComponent(response.id));\n\t\t\t} else if (config.kycProviderURL !== undefined) {\n\t\t\t\tdefaultWebURL = config.kycProviderURL(response.id);\n\t\t\t} else {\n\t\t\t\tdefaultWebURL = kycProviderURLUndefined;\n\t\t\t}\n\t\t\tresponse.webURL ??= defaultWebURL;\n\n\t\t\tif (!response.webURL || response.webURL === kycProviderURLUndefined) {\n\t\t\t\tthrow(new KeetaAnchorUserError('No webURL provided -- cannot proceed with verification'));\n\t\t\t}\n\n\t\t\tresponse.expectedCost = {\n\t\t\t\tmin: '0',\n\t\t\t\tmax: '0',\n\t\t\t\ttoken: KeetaNet.lib.Account.generateBaseAddresses(config.client.network).baseToken.publicKeyString.get(),\n\t\t\t\t...response.expectedCost\n\t\t\t};\n\n\t\t\tconst responseValidated = assertCreateVerificationResponse(response);\n\n\t\t\treturn({\n\t\t\t\toutput: JSON.stringify(responseValidated)\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Request an estimate for a KYC\n\t\t * verification (optional)\n\t\t *\n\t\t * XXX:TODO\n\t\t */\n\t\t// if (false) {\n\t\t// \troutes['POST /api/createEstimate'] = async function(_ignore_params, _ignore_body) {\n\t\t// \t\tthrow(new Error('not implemented'));\n\t\t// \t};\n\t\t// }\n\n\t\t/**\n\t\t * Get the certificate for the\n\t\t * KYC verification\n\t\t */\n\t\troutes['GET /api/getCertificates/:verificationID'] = async function(params) {\n\t\t\tconst verificationID = params.get('verificationID');\n\t\t\tif (verificationID === undefined) {\n\t\t\t\tthrow(new KeetaAnchorUserError('No verification ID provided'));\n\t\t\t}\n\n\t\t\tconst certificates = await config.kyc.getCertificates(verificationID);\n\n\t\t\tconst response: KeetaKYCAnchorGetCertificateResponse = {\n\t\t\t\tok: true,\n\t\t\t\tresults: certificates\n\t\t\t};\n\n\t\t\treturn({\n\t\t\t\toutput: JSON.stringify(response)\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Check if the KYC provider can\n\t\t * service a more specific locality\n\t\t * (optional)\n\t\t *\n\t\t * XXX:TODO\n\t\t */\n\t\t// if (false) {\n\t\t// \troutes['GET /api/checkLocality'] = async function(_ignore_params, _ignore_body) {\n\t\t// \t\tthrow(new Error('not implemented'));\n\t\t// \t};\n\t\t// }\n\n\t\t/**\n\t\t * Notification that payment has been received for the KYC verification\n\t\t *\n\t\t * XXX:TODO\n\t\t */\n\t\t// if (false) {\n\t\t// \troutes['POST /api/notifyPayment/:verificationID'] = async function(_ignore_params, _ignore_body) {\n\t\t// \t\tthrow(new Error('not implemented'));\n\t\t// \t};\n\t\t// }\n\n\t\treturn({\n\t\t\t...config.routes,\n\t\t\t...routes\n\t\t});\n\t}\n\n\tasync serviceMetadata(): Promise<NonNullable<ServiceMetadata['services']['kyc']>[string]> {\n\t\treturn({\n\t\t\tca: this.ca.toPEM(),\n\t\t\tcountryCodes: this.#countryCodes?.map(function(country) {\n\t\t\t\treturn(country.code);\n\t\t\t}) ?? [],\n\t\t\toperations: {\n\t\t\t\t// checkLocality: (new URL('/api/checkLocality', this.url)).toString(),\n\t\t\t\t// getEstimate: (new URL('/api/createEstimate', this.url)).toString(),\n\t\t\t\t// notifyPayment: (new URL('/api/notifyPayment/{id}', this.url)).toString(),\n\t\t\t\tcreateVerification: (new URL('/api/createVerification', this.url)).toString(),\n\t\t\t\tgetCertificates: (new URL('/api/getCertificates', this.url)).toString() + '/{id}'\n\t\t\t}\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/services/k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AChC,CAAC,CAAC;QACJ,CAAC,CAAC;QAEF;;;;;;WAMG;QACH,eAAe;QACf,qFAAqF;QACrF,yCAAyC;QACzC,MAAM;QACN,IAAI;QAEJ;;;;WAIG;QACH,eAAe;QACf,sGAAsG;QACtG,yCAAyC;QACzC,MAAM;QACN,IAAI;QAEJ,OAAM,CAAC;YACN,GAAG,MAAM,CAAC,MAAM;YAChB,GAAG,MAAM;SACT,CAAC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,eAAe;QACpB,OAAM,CAAC;YACN,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE;YACnB,YAAY,EAAE,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,UAAS,OAAO;gBACrD,OAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC,CAAC,IAAI,EAAE;YACR,UAAU,EAAE;gBACX,uEAAuE;gBACvE,sEAAsE;gBACtE,4EAA4E;gBAC5E,kBAAkB,EAAE,CAAC,IAAI,GAAG,CAAC,yBAAyB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE;gBAC7E,eAAe,EAAE,CAAC,IAAI,GAAG,CAAC,sBAAsB,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,OAAO;aACjF;SACD,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["import { KeetaNet } from '../../client/index.js';\nimport * as CurrencyInfo from '@keetanetwork/currency-info';\n\nimport * as KeetaAnchorHTTPServer from '../../lib/http-server/index.js';\nimport {\n\tKeetaAnchorUserError\n} from '../../lib/error.js';\nimport type {\n\tKeetaKYCAnchorCreateVerificationRequest,\n\tKeetaKYCAnchorCreateVerificationResponse,\n\tKeetaKYCAnchorGetCertificateResponse\n} from './common.ts';\nimport {\n\tassertCreateVerificationRequest,\n\tassertCreateVerificationResponse\n} from './common.generated.js';\nimport {\n\tverifySignedData\n} from './common.js';\nimport type * as Signing from '../../lib/utils/signing.js';\nimport type { ServiceMetadata } from '../../lib/resolver.ts';\n\nconst kycProviderURLUndefined = 'NO_KYC_PROVIDER_URL:87f0175c-4d0a-4029-a4f3-ba93ef725654';\n\n/**\n * The Base certificate type, from the KeetaNet Client\n *\n * The KYC Certificate type is a subclass of this, so it will also work\n */\ntype BaseCertificate = InstanceType<typeof KeetaNet.lib.Utils.Certificate.Certificate>;\n\nexport interface KeetaAnchorKYCServerConfig extends KeetaAnchorHTTPServer.KeetaAnchorHTTPServerConfig {\n\t/**\n\t * The data to use for the index page (optional)\n\t */\n\thomepage?: string | (() => Promise<string> | string);\n\n\t/**\n\t * The network client to use for submitting blocks\n\t */\n\tclient: { client: KeetaNet.Client; network: bigint; networkAlias: typeof KeetaNet.Client.Config.networksArray[number] } | KeetaNet.UserClient;\n\n\t/**\n\t * Configuration for the KYC Anchor\n\t *\n\t * The flow for a KYC Anchor is as follows:\n\t * 1. Client requests a new verification with a country code and\n\t * account from the KYC Anchor Server\n\t * 2. KYC Anchor Server responds with a verification ID and a URL\n\t * to the KYC provider's web URL, including the verification ID\n\t * 3. Client visits the KYC provider's web URL to complete the\n\t * verification\n\t * 4. KYC provider notifies the Anchor server that the\n\t * verification is complete\n\t * 5. Client requests the certificate for the verification ID\n\t * (polling) from the KYC Anchor Server\n\t * 6. KYC Anchor Server responds with the certificate(s) for the\n\t * verification ID (if complete, pending if still in progress,\n\t * an error if failed)\n\t * 7. Client installs the certificate(s) in their wallet using\n\t * the KeetaNet Client library\n\t *\n\t *\n\t * +-------------------+ +---------------------+ +------------------+\n\t * | Client | | KYC Anchor Server | | KYC Provider |\n\t * +-------------------+ +---------------------+ +------------------+\n\t * | | |\n\t * (1) Create Verification | |\n\t * countryCode, account ---------------------->| |\n\t * | | |\n\t * | (2) Create verification |\n\t * |----------------------------------- verificationID, providerURL |\n\t * | | |\n\t * (3) Open providerURL (with verificationID)------------------------------------>|\n\t * | | |\n\t * | | (4) Notify\n\t * | |<-------- verificationID, verificationStatus, certificates?\n\t * | |\n\t * (5) Poll certificate for verificationID --->|\n\t * | |\n\t * |<-------------------------- (6) Pending / Certificate(s) / Error\n\t * | (repeat #5 until complete)\n\t * |\n\t * (7) Install certificate(s) in wallet using KeetaNet Client library\n\t */\n\tkyc: {\n\t\t/**\n\t\t * Notification that a verification has been started (optional)\n\t\t *\n\t\t * This method can be used to notify the KYC provider that\n\t\t * a verification has been started. It can return additional\n\t\t * information about the verification, such as the web URL\n\t\t * where the user can complete the verification.\n\t\t *\n\t\t * If this method is not provided, the server will generate\n\t\t * a random verification ID and use the `kycProviderURL` from\n\t\t * the server configuration, replacing `{id}` with the\n\t\t * verification ID.\n\t\t */\n\t\tverificationStarted?: (request: KeetaKYCAnchorCreateVerificationRequest) => Promise<Partial<KeetaKYCAnchorCreateVerificationResponse> | undefined>;\n\n\t\t/**\n\t\t * Retrieve the certificate for a verification\n\t\t *\n\t\t * This should return the certificate(s) for the\n\t\t * verification ID. If the verification is still\n\t\t * in progress, it should throw an `CertificateNotFound`\n\t\t * error.\n\t\t * If the verification has failed permanently, it should\n\t\t * throw a `KeetaAnchorUserError` with an appropriate\n\t\t * error message or `VerificationNotFound` if the\n\t\t * verification ID is not found.\n\t\t */\n\t\tgetCertificates: (verificationID: string) => Promise<Extract<KeetaKYCAnchorGetCertificateResponse, { ok: true; }>['results']>;\n\n\t\t/**\n\t\t * Country codes that this KYC provider can service (default is all country codes)\n\t\t */\n\t\tcountryCodes?: (CurrencyInfo.Country | CurrencyInfo.ISOCountryCode)[];\n\t}\n\n\t/**\n\t * The certificate to use for signing certificates\n\t */\n\tca: BaseCertificate;\n\n\t/**\n\t * The account to use for signing certificates\n\t */\n\tsigner: Signing.SignableAccount;\n\n\t/**\n\t * URL for the KYC Provider (optional)\n\t *\n\t * This is the URL that clients will be directed to in order to\n\t * complete the KYC verification process. It is optional because\n\t * the `kyc.verificationStarted` method can also return a `webURL`.\n\t * If both are provided, the URL from `kyc.verificationStarted` takes\n\t * precedence.\n\t */\n\tkycProviderURL?: string | ((verificationID: string) => string);\n\n\t/**\n\t * Additional routes to add to the server (optional)\n\t */\n\troutes?: KeetaAnchorHTTPServer.Routes;\n};\n\nexport class KeetaNetKYCAnchorHTTPServer extends KeetaAnchorHTTPServer.KeetaNetAnchorHTTPServer<KeetaAnchorKYCServerConfig> implements Required<KeetaAnchorKYCServerConfig> {\n\treadonly homepage: NonNullable<KeetaAnchorKYCServerConfig['homepage']>;\n\treadonly client: KeetaAnchorKYCServerConfig['client'];\n\treadonly signer: NonNullable<KeetaAnchorKYCServerConfig['signer']>;\n\treadonly ca: KeetaAnchorKYCServerConfig['ca'];\n\treadonly kyc: KeetaAnchorKYCServerConfig['kyc'];\n\treadonly kycProviderURL: NonNullable<KeetaAnchorKYCServerConfig['kycProviderURL']>;\n\treadonly routes: NonNullable<KeetaAnchorKYCServerConfig['routes']>;\n\treadonly #countryCodes?: CurrencyInfo.Country[] | undefined;\n\n\tconstructor(config: KeetaAnchorKYCServerConfig) {\n\t\tsuper(config);\n\n\t\tthis.homepage = config.homepage ?? '';\n\t\tthis.client = config.client;\n\t\tthis.signer = config.signer;\n\t\tthis.ca = config.ca;\n\t\tthis.kyc = config.kyc;\n\t\tthis.routes = config.routes ?? {};\n\t\tthis.kycProviderURL = config.kycProviderURL ?? kycProviderURLUndefined;\n\n\t\tif (config.kyc.countryCodes) {\n\t\t\tthis.#countryCodes = config.kyc.countryCodes.map(function(inputCode) {\n\t\t\t\tif (CurrencyInfo.Country.isCountryCode(inputCode)) {\n\t\t\t\t\treturn(new CurrencyInfo.Country(inputCode));\n\t\t\t\t}\n\n\t\t\t\treturn(inputCode);\n\t\t\t});\n\t\t}\n\t}\n\n\tprotected async initRoutes(config: KeetaAnchorKYCServerConfig): Promise<KeetaAnchorHTTPServer.Routes> {\n\t\tconst routes: KeetaAnchorHTTPServer.Routes = {};\n\n\t\t/**\n\t\t * If a homepage is provided, setup the route for it\n\t\t */\n\t\tif ('homepage' in config) {\n\t\t\troutes['GET /'] = async function() {\n\t\t\t\tlet homepageData: string;\n\t\t\t\tif (typeof config.homepage === 'string') {\n\t\t\t\t\thomepageData = config.homepage;\n\t\t\t\t} else {\n\t\t\t\t\tif (!config.homepage) {\n\t\t\t\t\t\tthrow(new Error('internal error: No homepage function provided'));\n\t\t\t\t\t}\n\n\t\t\t\t\thomepageData = await config.homepage();\n\t\t\t\t}\n\n\t\t\t\treturn({\n\t\t\t\t\toutput: homepageData,\n\t\t\t\t\tcontentType: 'text/html'\n\t\t\t\t});\n\t\t\t};\n\t\t}\n\n\t\t/**\n\t\t * Begin the KYC verification process\n\t\t * with this KYC provider\n\t\t */\n\t\troutes['POST /api/createVerification'] = async function(_ignore_params, bodyInput) {\n\t\t\tif (bodyInput === null || typeof bodyInput !== 'object' || !('request' in bodyInput)) {\n\t\t\t\tthrow(new KeetaAnchorUserError('Invalid request'));\n\t\t\t}\n\n\t\t\tconst body = assertCreateVerificationRequest(bodyInput.request);\n\t\t\tconst valid = await verifySignedData(body);\n\t\t\tif (!valid) {\n\t\t\t\tthrow(new KeetaAnchorUserError('Invalid signature'));\n\t\t\t}\n\n\t\t\t/* XXX:TODO: Validate that the nonce is unique (within a reasonable time frame) */\n\n\t\t\tlet response: Partial<KeetaKYCAnchorCreateVerificationResponse> | undefined = {};\n\t\t\tif (config.kyc.verificationStarted) {\n\t\t\t\tresponse = await config.kyc.verificationStarted(body);\n\t\t\t}\n\n\t\t\tresponse ??= {};\n\n\t\t\tif (response?.ok === false) {\n\t\t\t\tthrow(new KeetaAnchorUserError(response.error ?? 'Unknown error'));\n\t\t\t}\n\n\t\t\tresponse.ok = true;\n\t\t\tif (!response.ok) {\n\t\t\t\tthrow(new Error('internal error: invalid response'));\n\t\t\t}\n\t\t\tresponse.id ??= crypto.randomUUID();\n\n\t\t\tlet defaultWebURL: string;\n\t\t\tif (typeof config.kycProviderURL === 'string') {\n\t\t\t\tdefaultWebURL = config.kycProviderURL.replace('{id}', encodeURIComponent(response.id));\n\t\t\t} else if (config.kycProviderURL !== undefined) {\n\t\t\t\tdefaultWebURL = config.kycProviderURL(response.id);\n\t\t\t} else {\n\t\t\t\tdefaultWebURL = kycProviderURLUndefined;\n\t\t\t}\n\t\t\tresponse.webURL ??= defaultWebURL;\n\n\t\t\tif (!response.webURL || response.webURL === kycProviderURLUndefined) {\n\t\t\t\tthrow(new KeetaAnchorUserError('No webURL provided -- cannot proceed with verification'));\n\t\t\t}\n\n\t\t\tresponse.expectedCost = {\n\t\t\t\tmin: '0',\n\t\t\t\tmax: '0',\n\t\t\t\ttoken: KeetaNet.lib.Account.generateBaseAddresses(config.client.network).baseToken.publicKeyString.get(),\n\t\t\t\t...response.expectedCost\n\t\t\t};\n\n\t\t\tconst responseValidated = assertCreateVerificationResponse(response);\n\n\t\t\treturn({\n\t\t\t\toutput: JSON.stringify(responseValidated)\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Request an estimate for a KYC\n\t\t * verification (optional)\n\t\t *\n\t\t * XXX:TODO\n\t\t */\n\t\t// if (false) {\n\t\t// \troutes['POST /api/createEstimate'] = async function(_ignore_params, _ignore_body) {\n\t\t// \t\tthrow(new Error('not implemented'));\n\t\t// \t};\n\t\t// }\n\n\t\t/**\n\t\t * Get the certificate for the\n\t\t * KYC verification\n\t\t */\n\t\troutes['GET /api/getCertificates/:verificationID'] = async function(params) {\n\t\t\tconst verificationID = params.get('verificationID');\n\t\t\tif (verificationID === undefined) {\n\t\t\t\tthrow(new KeetaAnchorUserError('No verification ID provided'));\n\t\t\t}\n\n\t\t\tconst certificates = await config.kyc.getCertificates(verificationID);\n\n\t\t\tconst response: KeetaKYCAnchorGetCertificateResponse = {\n\t\t\t\tok: true,\n\t\t\t\tresults: certificates\n\t\t\t};\n\n\t\t\treturn({\n\t\t\t\toutput: JSON.stringify(response)\n\t\t\t});\n\t\t};\n\n\t\t/**\n\t\t * Check if the KYC provider can\n\t\t * service a more specific locality\n\t\t * (optional)\n\t\t *\n\t\t * XXX:TODO\n\t\t */\n\t\t// if (false) {\n\t\t// \troutes['GET /api/checkLocality'] = async function(_ignore_params, _ignore_body) {\n\t\t// \t\tthrow(new Error('not implemented'));\n\t\t// \t};\n\t\t// }\n\n\t\t/**\n\t\t * Notification that payment has been received for the KYC verification\n\t\t *\n\t\t * XXX:TODO\n\t\t */\n\t\t// if (false) {\n\t\t// \troutes['POST /api/notifyPayment/:verificationID'] = async function(_ignore_params, _ignore_body) {\n\t\t// \t\tthrow(new Error('not implemented'));\n\t\t// \t};\n\t\t// }\n\n\t\treturn({\n\t\t\t...config.routes,\n\t\t\t...routes\n\t\t});\n\t}\n\n\tasync serviceMetadata(): Promise<NonNullable<ServiceMetadata['services']['kyc']>[string]> {\n\t\treturn({\n\t\t\tca: this.ca.toPEM(),\n\t\t\tcountryCodes: this.#countryCodes?.map(function(country) {\n\t\t\t\treturn(country.code);\n\t\t\t}) ?? [],\n\t\t\toperations: {\n\t\t\t\t// checkLocality: (new URL('/api/checkLocality', this.url)).toString(),\n\t\t\t\t// getEstimate: (new URL('/api/createEstimate', this.url)).toString(),\n\t\t\t\t// notifyPayment: (new URL('/api/notifyPayment/{id}', this.url)).toString(),\n\t\t\t\tcreateVerification: (new URL('/api/createVerification', this.url)).toString(),\n\t\t\t\tgetCertificates: (new URL('/api/getCertificates', this.url)).toString() + '/{id}'\n\t\t\t}\n\t\t});\n\t}\n}\n"]}