Socket
Socket
Sign inDemoInstall

@arianee/arianee-access-token

Package Overview
Dependencies
Maintainers
8
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arianee/arianee-access-token - npm Package Compare versions

Comparing version 0.7.0 to 0.9.0

9

package.json
{
"name": "@arianee/arianee-access-token",
"version": "0.7.0",
"version": "0.9.0",
"dependencies": {
"ethers": "6.6.0"
"ethers": "6.6.0",
"node-fetch": "2.6.11"
},
"peerDependencies": {
"@arianee/core": "0.5.0",
"@arianee/common-types": "0.14.0",
"@arianee/core": "0.7.0",
"@arianee/utils": "0.5.0",
"tslib": "2.5.0"

@@ -10,0 +13,0 @@ },

@@ -48,1 +48,6 @@ # @arianee/ArianeeAccessToken

This static method decodes an Arianee Access Token (AAT). It takes an `arianeeAccessToken` parameter as a `string` and returns an object with the decoded AAT, containing the header, payload, and signature.
## Storage
You can pass a `storage` object (that implements the [`Web Storage API`](https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API)) to the constructor under the `params.storage` key. \
This storage will be used for caching the generated arianee access token. Make sure that you do not pass an unsafe / public storage as it may expose the generated arianee access token.

@@ -10,4 +10,7 @@ import { Core } from '@arianee/core';

private core;
private lastAAT;
constructor(core: Core);
private storage;
private static readonly LAST_AAT_KEY;
constructor(core: Core, params?: {
storage?: Storage;
});
getValidWalletAccessToken(payloadOverride?: PayloadOverride, params?: {

@@ -14,0 +17,0 @@ timeBeforeExp?: number;

@@ -8,5 +8,8 @@ "use strict";

const timeBeforeExp_1 = require("./helpers/timeBeforeExp");
const utils_1 = require("@arianee/utils");
class ArianeeAccessToken {
constructor(core) {
constructor(core, params) {
var _a;
this.core = core;
this.storage = (_a = params === null || params === void 0 ? void 0 : params.storage) !== null && _a !== void 0 ? _a : new utils_1.MemoryStorage();
}

@@ -16,6 +19,8 @@ getValidWalletAccessToken(payloadOverride = {}, params) {

const { timeBeforeExp = 10, prefix } = params !== null && params !== void 0 ? params : {};
if (!this.lastAAT || (0, timeBeforeExp_1.isExpInLessThan)(this.lastAAT, timeBeforeExp)) {
this.lastAAT = yield this.createWalletAccessToken(payloadOverride, prefix);
let aat = this.storage.getItem(ArianeeAccessToken.LAST_AAT_KEY);
if (!aat || (0, timeBeforeExp_1.isExpInLessThan)(aat, timeBeforeExp)) {
aat = yield this.createWalletAccessToken(payloadOverride, prefix);
this.storage.setItem(ArianeeAccessToken.LAST_AAT_KEY, aat);
}
return this.lastAAT;
return aat;
});

@@ -67,2 +72,3 @@ }

exports.ArianeeAccessToken = ArianeeAccessToken;
ArianeeAccessToken.LAST_AAT_KEY = 'arianee__lastAAT';
//# sourceMappingURL=arianee-access-token.js.map

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc