New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@textile/core-storage

Package Overview
Dependencies
Maintainers
5
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@textile/core-storage - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

9

dist/cjs/token.js

@@ -35,5 +35,6 @@ "use strict";

// UNIX origin time for current time
const now = ~~(Date.now() / 1000);
const oneHour = now + 60 * 10; // Default to ~10 minutes
const payload = Object.assign({ nbf: now, iat: now, exp: oneHour }, claims);
const iat = ~~(Date.now() / 1000);
const exp = iat + 60 * 10; // Default to ~10 minutes
const payload = Object.assign({ nbf: iat - 10, iat,
exp }, claims);
// Optional: https://www.npmjs.com/package/canonicalize

@@ -46,3 +47,3 @@ const encodedHeader = base64_1.encodeURLSafe(encode(stringify(header))).replace(padReg, "");

const jws = `${encodedHeader}.${encodedPayload}.${encodedSignature}`;
return jws;
return { token: jws, claims: payload, header };
});

@@ -49,0 +50,0 @@ }

@@ -32,5 +32,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

// UNIX origin time for current time
const now = ~~(Date.now() / 1000);
const oneHour = now + 60 * 10; // Default to ~10 minutes
const payload = Object.assign({ nbf: now, iat: now, exp: oneHour }, claims);
const iat = ~~(Date.now() / 1000);
const exp = iat + 60 * 10; // Default to ~10 minutes
const payload = Object.assign({ nbf: iat - 10, iat,
exp }, claims);
// Optional: https://www.npmjs.com/package/canonicalize

@@ -43,5 +44,5 @@ const encodedHeader = encodeURLSafe(encode(stringify(header))).replace(padReg, "");

const jws = `${encodedHeader}.${encodedPayload}.${encodedSignature}`;
return jws;
return { token: jws, claims: payload, header };
});
}
//# sourceMappingURL=token.js.map

@@ -16,3 +16,3 @@ /**

/** (issued at time): Time at which the JWT was issued; can be used to determine age of the JWT */
iat?: string;
iat?: number;
}

@@ -43,2 +43,6 @@ /**

*/
export declare function createAndSignToken(signer: Signer, header: Header, claims: StandardClaims): Promise<string>;
export declare function createAndSignToken(signer: Signer, header: Header, claims: StandardClaims): Promise<{
token: string;
claims: StandardClaims;
header: Header;
}>;
{
"name": "@textile/core-storage",
"version": "0.0.1",
"version": "0.0.2",
"description": "Core interfaces for Textile's Filecoin bridge system",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

@@ -18,3 +18,3 @@ import { encodeURLSafe } from "@stablelib/base64";

/** (issued at time): Time at which the JWT was issued; can be used to determine age of the JWT */
iat?: string;
iat?: number;
}

@@ -58,3 +58,3 @@

claims: StandardClaims
): Promise<string> {
): Promise<{ token: string; claims: StandardClaims; header: Header }> {
if (!claims.iss && !header.kid)

@@ -66,8 +66,8 @@ throw new Error("InputError: must include kid header and/or iss claim");

// UNIX origin time for current time
const now = ~~(Date.now() / 1000);
const oneHour = now + 60 * 10; // Default to ~10 minutes
const iat = ~~(Date.now() / 1000);
const exp = iat + 60 * 10; // Default to ~10 minutes
const payload = {
nbf: now,
iat: now,
exp: oneHour,
nbf: iat - 10,
iat,
exp,
...claims,

@@ -88,3 +88,3 @@ };

const jws = `${encodedHeader}.${encodedPayload}.${encodedSignature}`;
return jws;
return { token: jws, claims: payload, header };
}

Sorry, the diff of this file is not supported yet

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