Comparing version 1.0.0 to 2.0.0-rc.0
{ | ||
"name": "dag-jose", | ||
"version": "1.0.0", | ||
"version": "2.0.0-rc.0", | ||
"description": "Typescript implementation of the IPLD dag-jose format", | ||
"main": "lib/index.js", | ||
"main": "./lib/index.js", | ||
"type": "module", | ||
"types": "./lib/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./lib/index.js" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "jest --coverage", | ||
"test": "NODE_OPTIONS=--experimental-vm-modules npx jest --coverage", | ||
"build": "./node_modules/.bin/tsc -p tsconfig.json", | ||
@@ -35,32 +42,24 @@ "prepublishOnly": "npm run build", | ||
"@stablelib/x25519": "^1.0.1", | ||
"@types/jest": "^26.0.23", | ||
"@types/jest": "^27.4.1", | ||
"@types/lodash.transform": "^4.6.6", | ||
"@types/node": "^15.9.0", | ||
"@typescript-eslint/eslint-plugin": "^4.26.0", | ||
"@typescript-eslint/parser": "^4.26.0", | ||
"babel-jest": "^27.0.2", | ||
"blockcodec-to-ipld-format": "^1.0.0", | ||
"did-jwt": "^5.5.2", | ||
"enhanced-resolve": "^5.8.2", | ||
"eslint": "^7.27.0", | ||
"eslint-config-3box": "^0.2.0", | ||
"eslint-plugin-jest": "^24.3.6", | ||
"@typescript-eslint/eslint-plugin": "^5.18.0", | ||
"@typescript-eslint/parser": "^5.18.0", | ||
"babel-jest": "^27.5.1", | ||
"blockcodec-to-ipld-format": "^2.0.0", | ||
"did-jwt": "^6.0.0", | ||
"eslint": "^8.12.0", | ||
"eslint-config-3box": "^0.4.1", | ||
"eslint-plugin-jest": "^26.1.4", | ||
"fast-json-stable-stringify": "^2.1.0", | ||
"ipld": "^0.30.0", | ||
"ipld-in-memory": "^8.0.0", | ||
"jest": "^27.0.3", | ||
"jest": "^27.5.1", | ||
"prettier": "^2.3.0", | ||
"typescript": "^4.3.2" | ||
"typescript": "^4.3.2", | ||
"uint8arrays": "^3.0.0" | ||
}, | ||
"jest": { | ||
"resolver": "./test/_export_maps_resolver", | ||
"testPathIgnorePatterns": [ | ||
".*__fixtures__.*" | ||
], | ||
"testEnvironment": "node" | ||
}, | ||
"dependencies": { | ||
"@ipld/dag-cbor": "^6.0.3", | ||
"multiformats": "^9.0.2" | ||
"@ipld/dag-cbor": "^7.0.1", | ||
"multiformats": "^9.6.4" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
import { fromBase64url, toBase64url } from './utils' | ||
import { fromBase64url, toBase64url } from './utils.js' | ||
@@ -33,3 +33,3 @@ interface JWERecipient { | ||
function fromSplit(split: Array<string>): DagJWE { | ||
export function fromSplit(split: Array<string>): DagJWE { | ||
const [protectedHeader, encrypted_key, iv, ciphertext, tag] = split | ||
@@ -53,3 +53,3 @@ const jwe: DagJWE = { | ||
function encode(jwe: DagJWE): EncodedJWE { | ||
export function encode(jwe: DagJWE): EncodedJWE { | ||
const encJwe: EncodedJWE = { | ||
@@ -74,3 +74,3 @@ ciphertext: fromBase64url(jwe.ciphertext), | ||
function decode(encoded: EncodedJWE): DagJWE { | ||
export function decode(encoded: EncodedJWE): DagJWE { | ||
const jwe: DagJWE = { | ||
@@ -87,7 +87,1 @@ ciphertext: toBase64url(encoded.ciphertext), | ||
} | ||
export default { | ||
fromSplit, | ||
decode, | ||
encode, | ||
} |
@@ -1,5 +0,5 @@ | ||
import signing, { DagJWS, EncodedJWS } from './signing' | ||
export type { DagJWS } from './signing' | ||
import encryption, { DagJWE, EncodedJWE } from './encryption' | ||
export type { DagJWE } from './encryption' | ||
import * as signing from './signing.js' | ||
import type { DagJWS, EncodedJWS } from './signing.js' | ||
import * as encryption from './encryption.js' | ||
import type { DagJWE, EncodedJWE } from './encryption.js' | ||
import * as cbor from '@ipld/dag-cbor' | ||
@@ -6,0 +6,0 @@ import type { ByteView } from 'multiformats/codecs/interface' |
@@ -1,2 +0,2 @@ | ||
import { fromBase64url, toBase64url } from './utils' | ||
import { fromBase64url, toBase64url } from './utils.js' | ||
import { CID } from 'multiformats/cid' | ||
@@ -35,3 +35,3 @@ | ||
function fromSplit(split: Array<string>): DagJWS { | ||
export function fromSplit(split: Array<string>): DagJWS { | ||
const [protectedHeader, payload, signature] = split | ||
@@ -54,3 +54,3 @@ return { | ||
function encode(jws: DagJWS): EncodedJWS { | ||
export function encode(jws: DagJWS): EncodedJWS { | ||
const payload = fromBase64url(jws.payload) | ||
@@ -62,7 +62,6 @@ try { | ||
} | ||
const encodedJws: EncodedJWS = { | ||
return { | ||
payload, | ||
signatures: jws.signatures.map(encodeSignature), | ||
} | ||
return encodedJws | ||
} | ||
@@ -79,3 +78,3 @@ | ||
function decode(encoded: EncodedJWS): DagJWS { | ||
export function decode(encoded: EncodedJWS): DagJWS { | ||
const decoded: DagJWS = { | ||
@@ -88,7 +87,1 @@ payload: toBase64url(encoded.payload), | ||
} | ||
export default { | ||
fromSplit, | ||
encode, | ||
decode, | ||
} |
import { bytes } from 'multiformats' | ||
/*eslint-disable */ | ||
const fixtures = { | ||
export const fixtures = { | ||
keys: [ | ||
@@ -143,4 +143,2 @@ bytes.fromHex('278a5de700e29faae8e40e366ec5012b5ec63d36ec77e8a2417154cc1d25383f'), | ||
} | ||
/*eslint-enable */ | ||
export default fixtures | ||
/*eslint-enable */ |
import { CID, bytes } from 'multiformats' | ||
/*eslint-disable */ | ||
const fixtures = { | ||
export const fixtures = { | ||
keys: [{ | ||
@@ -71,4 +71,2 @@ priv: '278a5de700e29faae8e40e366ec5012b5ec63d36ec77e8a2417154cc1d25383f', | ||
} | ||
/*eslint-enable */ | ||
export default fixtures | ||
/*eslint-enable */ |
/* eslint-env jest */ | ||
import encryption from '../src/encryption' | ||
import { DagJWE } from '../src/index' | ||
import fixtures from './__fixtures__/encryption.fixtures' | ||
import * as encryption from '../src/encryption' | ||
import type { DagJWE } from '../src/encryption.js' | ||
import { fixtures } from './__fixtures__/encryption.fixtures' | ||
import { CID } from 'multiformats/cid' | ||
@@ -15,3 +15,3 @@ import { | ||
Encrypter, | ||
Decrypter | ||
Decrypter, | ||
} from 'did-jwt' | ||
@@ -18,0 +18,0 @@ import { generateKeyPairFromSeed } from '@stablelib/x25519' |
/* eslint-env jest */ | ||
import * as dagJose from '../src/index' | ||
import { createDagJWS } from './signing.test' | ||
import sFixtures from './__fixtures__/signing.fixtures' | ||
import eFixtures from './__fixtures__/encryption.fixtures' | ||
import * as dagJose from '../src/index.js' | ||
import { createDagJWS } from './signing.test.js' | ||
import { fixtures as sFixtures } from './__fixtures__/signing.fixtures' | ||
import { fixtures as eFixtures } from './__fixtures__/encryption.fixtures' | ||
import { convert as toLegacyIpld } from 'blockcodec-to-ipld-format' | ||
@@ -48,3 +48,5 @@ import IPLD from 'ipld' | ||
const cid = await ipld.put(dagJws, format.codec) | ||
expect(cid.toString()).toEqual('bagcqcera5p4hvkei322lg3hp3dvrmndlojwcst3gvq2nhledmv4plt2ore2q') | ||
expect(cid.toString()).toEqual( | ||
'bagcqcera5p4hvkei322lg3hp3dvrmndlojwcst3gvq2nhledmv4plt2ore2q' | ||
) | ||
const data = await ipld.get(cid) | ||
@@ -51,0 +53,0 @@ expect(data).toEqual(sFixtures.dagJws.oneSig[0]) |
/* eslint-env jest */ | ||
import signing, { PublicKey} from '../src/signing' | ||
import { DagJWS } from '../src/index' | ||
import * as signing from '../src/signing.js' | ||
import type { PublicKey, DagJWS } from '../src/signing.js' | ||
import { toBase64url } from '../src/utils' | ||
import fixtures from './__fixtures__/signing.fixtures' | ||
import { fixtures } from './__fixtures__/signing.fixtures' | ||
import { CID, bytes } from 'multiformats' | ||
import { ES256KSigner, Signer, createJWS, verifyJWS } from 'did-jwt' | ||
import stringify from 'fast-json-stable-stringify' | ||
import { fromString } from 'uint8arrays' | ||
@@ -41,4 +42,4 @@ export async function createDagJWS( | ||
beforeAll(() => { | ||
signer1 = ES256KSigner(fixtures.keys[0].priv) | ||
signer2 = ES256KSigner(fixtures.keys[1].priv) | ||
signer1 = ES256KSigner(fromString(fixtures.keys[0].priv, 'base16')) | ||
signer2 = ES256KSigner(fromString(fixtures.keys[1].priv, 'base16')) | ||
}) | ||
@@ -45,0 +46,0 @@ |
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"lib": ["dom", "es2017"], | ||
"target": "es6", | ||
"module": "ES2020", | ||
"target": "ES2020", | ||
"declaration": true, | ||
@@ -13,2 +12,5 @@ "noImplicitAny": true, | ||
"sourceMap": true, | ||
"resolveJsonModule": false, | ||
"moduleResolution": "Node", | ||
"allowSyntheticDefaultImports": true, | ||
"outDir": "lib", | ||
@@ -15,0 +17,0 @@ "rootDir": "src" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21
Yes
63580
28
1117
1
1
+ Added@ipld/dag-cbor@7.0.3(transitive)
- Removed@ipld/dag-cbor@6.0.15(transitive)
Updated@ipld/dag-cbor@^7.0.1
Updatedmultiformats@^9.6.4