@arcblock/jwt 1.18.53 → 1.18.55

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.
package/lib/index.d.ts CHANGED
@@ -31,7 +31,8 @@ export declare type JwtVerifyOptions = Partial<{
31
31
  * @param {string} [version='1.0.0']
32
32
  * @return {*} {string} - hex encoded signature
33
33
  */
34
- export declare function sign(signer: string, sk: BytesType, payload?: {}, doSign?: boolean, version?: string): string;
34
+ export declare function sign(signer: string, sk?: BytesType, payload?: {}, doSign?: boolean, version?: string): string;
35
+ export declare function signV2(signer: string, sk?: BytesType, payload?: any): string;
35
36
  export declare function decode(token: string, bodyOnly?: true): JwtBody;
36
37
  export declare function decode(token: string, bodyOnly?: false): JwtToken;
37
38
  /**
package/lib/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.verify = exports.decode = exports.sign = void 0;
6
+ exports.verify = exports.decode = exports.signV2 = exports.sign = void 0;
7
7
  /* eslint-disable @typescript-eslint/ban-ts-comment */
8
8
  const json_stable_stringify_1 = __importDefault(require("json-stable-stringify"));
9
9
  const semver_1 = __importDefault(require("semver"));
@@ -80,6 +80,10 @@ function sign(signer, sk, payload = {}, doSign = true, version = '1.0.0') {
80
80
  return [headerB64, bodyB64, sigB64].join('.');
81
81
  }
82
82
  exports.sign = sign;
83
+ function signV2(signer, sk, payload = {}) {
84
+ return sign(signer, sk, payload, !!sk, '1.1.0');
85
+ }
86
+ exports.signV2 = signV2;
83
87
  function decode(token, bodyOnly = true) {
84
88
  const [headerB64, bodyB64, sigB64] = token.split('.');
85
89
  const header = JSON.parse((0, util_1.fromBase64)(headerB64).toString());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arcblock/jwt",
3
3
  "description": "JSON Web Token variant for arcblock DID solutions",
4
- "version": "1.18.53",
4
+ "version": "1.18.55",
5
5
  "author": {
6
6
  "name": "wangshijun",
7
7
  "email": "shijun@arcblock.io",
@@ -18,9 +18,9 @@
18
18
  "access": "public"
19
19
  },
20
20
  "dependencies": {
21
- "@arcblock/did": "1.18.53",
22
- "@ocap/mcrypto": "1.18.53",
23
- "@ocap/util": "1.18.53",
21
+ "@arcblock/did": "1.18.55",
22
+ "@ocap/mcrypto": "1.18.55",
23
+ "@ocap/util": "1.18.55",
24
24
  "debug": "^4.3.4",
25
25
  "json-stable-stringify": "^1.0.1",
26
26
  "semver": "^7.3.8"
@@ -64,5 +64,5 @@
64
64
  "build:watch": "npm run build -- -w",
65
65
  "build": "tsc"
66
66
  },
67
- "gitHead": "aca89e1a332437703b6019332d75aed4a0ea579f"
67
+ "gitHead": "053a58db1e0a075a7ade9359bbf29275cdcc6188"
68
68
  }