{"_id":"@dharitri-sdk/native-auth-client","name":"@dharitri-sdk/native-auth-client","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@dharitri-sdk/native-auth-client","version":"0.0.1","description":"Native authentication client-side","main":"lib/src/index.js","types":"lib/src/index.d.ts","scripts":{"test":"jest test/*","build":"tsc","lint":"eslint \"{src,apps,libs,test}/**/*.ts\"","lint:fix":"eslint \"{src,apps,libs,test}/**/*.ts\" --fix"},"repository":{"type":"git","url":"git+https://github.com/DharitriOne/drt-sdk-js-native-auth-client.git"},"keywords":["dharitri","native","auth","client"],"author":{"name":"Dharitri"},"license":"GPL-3.0-or-later","devDependencies":{"@babel/core":"^7.23.6","@babel/preset-env":"^7.23.6","@babel/preset-typescript":"^7.23.3","@types/jest":"^29.5.11","@types/node":"^16.11.10","@typescript-eslint/eslint-plugin":"^5.12.0","@typescript-eslint/parser":"^5.16.0","axios-mock-adapter":"^1.20.0","babel-jest":"^27.5.1","eslint":"^8.9.0","jest":"^29.7.0","typescript":"^4.3.5"},"dependencies":{"axios":"^1.6.5"},"gitHead":"6604a5cb9efbfd5aa7af1e3e06abd1a3ef111f0d","bugs":{"url":"https://github.com/DharitriOne/drt-sdk-js-native-auth-client/issues"},"homepage":"https://github.com/DharitriOne/drt-sdk-js-native-auth-client#readme","_id":"@dharitri-sdk/native-auth-client@0.0.1","_nodeVersion":"16.20.2","_npmVersion":"8.19.4","dist":{"integrity":"sha512-kFrf2tAw5nGrrNI+LUngCpcuhCcP12of9cl7Phlw9l06q5xsuFF2RzOb6tvWI2mTIXIit/N9vkLmuHxdLGm+rQ==","shasum":"7a85a992ad9d8c2237d78b16e22234293e4fd849","tarball":"https://registry.npmjs.org/@dharitri-sdk/native-auth-client/-/native-auth-client-0.0.1.tgz","fileCount":8,"unpackedSize":10137,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDDX3pUl2i1+ZomJdSQgjLBQSaHB5wJ4njVh53r868+YwIgRDqKrKsM3FWdvtx8S0rkcfJqW0ivz22nte833Ts56AQ="}]},"_npmUser":{"name":"xfactor-toml","email":"xfactor.toml@gmail.com"},"directories":{},"maintainers":[{"name":"xfactor-toml","email":"xfactor.toml@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/native-auth-client_0.0.1_1726780736108_0.6385932114589921"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-19T21:18:56.013Z","0.0.1":"2024-09-19T21:18:56.295Z","modified":"2024-09-19T21:18:56.556Z"},"maintainers":[{"name":"xfactor-toml","email":"xfactor.toml@gmail.com"}],"description":"Native authentication client-side","homepage":"https://github.com/DharitriOne/drt-sdk-js-native-auth-client#readme","keywords":["dharitri","native","auth","client"],"repository":{"type":"git","url":"git+https://github.com/DharitriOne/drt-sdk-js-native-auth-client.git"},"author":{"name":"Dharitri"},"bugs":{"url":"https://github.com/DharitriOne/drt-sdk-js-native-auth-client/issues"},"license":"GPL-3.0-or-later","readme":"# Native Authenticator for JavaScript\n\nNative Authenticator for JavaScript and TypeScript (written in TypeScript).\n\n## Distribution\n\n[npm](https://www.npmjs.com/package/@dharitri-sdk/native-auth-client)\n\n## Example\n\n### Client-side\n\n```js\nconst client = new NativeAuthClient();\nconst init = await client.initialize();\n\n// obtain signature by signing the following message: `${address}${init}`\n// Example:\n// - if the address is `moa1qnk2vmuqywfqtdnkmauvpm8ls0xh00k8xeupuaf6cm6cd4rx89qq0h8w50`\n// - and the init string is `YXBpLmVscm9uZC5jb20.066de4ba7df143f2383c3e0cd7ef8eeaf13375d1123ec8bafcef9f7908344b0f.86400.e30`\n// - then the signable message should be `moa1qnk2vmuqywfqtdnkmauvpm8ls0xh00k8xeupuaf6cm6cd4rx89qq0h8w50066de4ba7df143f2383c3e0cd7ef8eeaf13375d1123ec8bafcef9f7908344b0f.86400.e30`\n\nconst accessToken = client.getToken(address, init, signature);\n```\n\n### Client-side config\n\nWhen initializing the client object, an optional config can also be specified with the following properties:\n\n```js\n{\n  // When used from within a browser, will contain the hostname by default.\n  // It can be overridden for special situations\n  // Note: The server-side component will validate the `origin` header, which must\n  // match with the provided origin in the client-side configuration\n  origin: string = 'https://myApp.com';\n\n  // The endpoint from where the current block information will be fetched upon initialization.\n  // The default value points to the mainnet API, but can be overridden to be network-specific\n  // or to point to a self-hosted location\n  apiUrl: string = 'https://api.dharitri.com';\n\n  // TTL that will be encoded in the access token.\n  // This value will also be validated by the server and must not be greater than the maximum ttl allowed.\n  // Default: one day (86400 seconds)\n  expirySeconds: number = 60 * 60 * 24;\n\n  // Optional, to fetch the block hash from a single shard.\n  // Useful in the situations where the server connects directly to a node to fetch block info\n  // and would like a predictable shard for the validation of tokens\n  blockHashShard: 0;\n\n  // Optional, to put custom HTTP headers in the request that is made to the api\n  // Useful in situations where a private api is used and is protected by a JTW token\n  extraRequestHeaders?: { [key: string]: string };\n}\n```\n","readmeFilename":"README.md"}