Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas.J.Han <[email protected]>
  • Loading branch information
lukasjhan committed Feb 21, 2024
1 parent def85ba commit 4f4ea69
Show file tree
Hide file tree
Showing 31 changed files with 71 additions and 62 deletions.
4 changes: 2 additions & 2 deletions examples/core-example/all.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SDJwtInstance } from '@hopae/sd-jwt-core';
import { DisclosureFrame } from '@hopae/sd-jwt-type';
import { SDJwtInstance } from '@lukas.j.han/sd-jwt-core';
import { DisclosureFrame } from '@lukas.j.han/sd-jwt-type';
import { createSignerVerifier, digest, generateSalt } from './utils';

(async () => {
Expand Down
4 changes: 2 additions & 2 deletions examples/core-example/basic.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SDJwtInstance } from '@hopae/sd-jwt-core';
import { DisclosureFrame } from '@hopae/sd-jwt-type';
import { SDJwtInstance } from '@lukas.j.han/sd-jwt-core';
import { DisclosureFrame } from '@lukas.j.han/sd-jwt-type';
import { createSignerVerifier, digest, generateSalt } from './utils';

(async () => {
Expand Down
4 changes: 2 additions & 2 deletions examples/core-example/custom.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SDJwtInstance } from '@hopae/sd-jwt-core';
import { DisclosureFrame } from '@hopae/sd-jwt-type';
import { SDJwtInstance } from '@lukas.j.han/sd-jwt-core';
import { DisclosureFrame } from '@lukas.j.han/sd-jwt-type';
import { createSignerVerifier, digest, generateSalt } from './utils';

(async () => {
Expand Down
4 changes: 2 additions & 2 deletions examples/core-example/custom_header.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SDJwtInstance } from '@hopae/sd-jwt-core';
import { DisclosureFrame } from '@hopae/sd-jwt-type';
import { SDJwtInstance } from '@lukas.j.han/sd-jwt-core';
import { DisclosureFrame } from '@lukas.j.han/sd-jwt-type';
import { createSignerVerifier, digest, generateSalt } from './utils';

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/core-example/decode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SDJwtInstance } from '@hopae/sd-jwt-core';
import { SDJwtInstance } from '@lukas.j.han/sd-jwt-core';
import { createSignerVerifier, digest, generateSalt } from './utils';

(async () => {
Expand Down
4 changes: 2 additions & 2 deletions examples/core-example/decoy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SDJwtInstance } from '@hopae/sd-jwt-core';
import { DisclosureFrame } from '@hopae/sd-jwt-type';
import { SDJwtInstance } from '@lukas.j.han/sd-jwt-core';
import { DisclosureFrame } from '@lukas.j.han/sd-jwt-type';
import { createSignerVerifier, digest, generateSalt } from './utils';

(async () => {
Expand Down
4 changes: 2 additions & 2 deletions examples/core-example/kb.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SDJwtInstance } from '@hopae/sd-jwt-core';
import { DisclosureFrame } from '@hopae/sd-jwt-type';
import { SDJwtInstance } from '@lukas.j.han/sd-jwt-core';
import { DisclosureFrame } from '@lukas.j.han/sd-jwt-type';
import { createSignerVerifier, digest, generateSalt } from './utils';

(async () => {
Expand Down
4 changes: 2 additions & 2 deletions examples/core-example/sdjwtobject.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SDJwtInstance } from '@hopae/sd-jwt-core';
import { DisclosureFrame } from '@hopae/sd-jwt-type';
import { SDJwtInstance } from '@lukas.j.han/sd-jwt-core';
import { DisclosureFrame } from '@lukas.j.han/sd-jwt-type';
import { createSignerVerifier, digest, generateSalt } from './utils';

(async () => {
Expand Down
2 changes: 1 addition & 1 deletion examples/core-example/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Crypto from 'crypto';
import { Signer, Verifier } from '@hopae/sd-jwt-type';
import { Signer, Verifier } from '@lukas.j.han/sd-jwt-type';

export const createSignerVerifier = () => {
const { privateKey, publicKey } = Crypto.generateKeyPairSync('ed25519');
Expand Down
4 changes: 2 additions & 2 deletions examples/decode-example/decode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { decodeSdJwt, getClaims } from '@hopae/sd-jwt-decode';
import { digest } from '@hopae/sd-jwt-node-crypto';
import { decodeSdJwt, getClaims } from '@lukas.j.han/sd-jwt-decode';
import { digest } from '@lukas.j.han/sd-jwt-node-crypto';

(async () => {
const sdjwt =
Expand Down
6 changes: 3 additions & 3 deletions examples/present-example/present.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { present, presentableKeys } from '@hopae/sd-jwt-present';
import { decodeSdJwt, getClaims } from '@hopae/sd-jwt-decode';
import { digest } from '@hopae/sd-jwt-node-crypto';
import { present, presentableKeys } from '@lukas.j.han/sd-jwt-present';
import { decodeSdJwt, getClaims } from '@lukas.j.han/sd-jwt-decode';
import { digest } from '@lukas.j.han/sd-jwt-node-crypto';

(async () => {
const sdjwt =
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@hopae/sd-jwt",
"name": "@lukas.j.han/sd-jwt",
"version": "2.0.1",
"description": "sd-jwt draft 7 implementation in typescript",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/decoy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HasherAndAlg, SaltGenerator } from '@hopae/sd-jwt-type';
import { Uint8ArrayToBase64Url } from '@hopae/sd-jwt-util';
import { HasherAndAlg, SaltGenerator } from '@lukas.j.han/sd-jwt-type';
import { Uint8ArrayToBase64Url } from '@lukas.j.han/sd-jwt-util';

// This function creates a decoy value that can be used to obscure SD JWT payload.
// The value is basically a hash of a random salt. So the value is not predictable.
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SDJWTException } from '@hopae/sd-jwt-util';
import { SDJWTException } from '@lukas.j.han/sd-jwt-util';
import { Jwt } from './jwt';
import { KBJwt } from './kbjwt';
import { SDJwt, pack } from './sdjwt';
Expand All @@ -9,7 +9,7 @@ import {
SDJWTCompact,
SDJWTConfig,
SD_JWT_TYP,
} from '@hopae/sd-jwt-type';
} from '@lukas.j.han/sd-jwt-type';

export * from './sdjwt';
export * from './kbjwt';
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/jwt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Base64urlEncode, SDJWTException } from '@hopae/sd-jwt-util';
import { Base64urlString, Signer, Verifier } from '@hopae/sd-jwt-type';
import { decodeJwt } from '@hopae/sd-jwt-decode';
import { Base64urlEncode, SDJWTException } from '@lukas.j.han/sd-jwt-util';
import { Base64urlString, Signer, Verifier } from '@lukas.j.han/sd-jwt-type';
import { decodeJwt } from '@lukas.j.han/sd-jwt-decode';

export type JwtData<
Header extends Record<string, any>,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/kbjwt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJWTException } from '@hopae/sd-jwt-util';
import { SDJWTException } from '@lukas.j.han/sd-jwt-util';
import { Jwt } from './jwt';
import { Verifier, kbHeader, kbPayload } from '@hopae/sd-jwt-type';
import { Verifier, kbHeader, kbPayload } from '@lukas.j.han/sd-jwt-type';

export class KBJwt<
Header extends kbHeader = kbHeader,
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/sdjwt.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createDecoy } from './decoy';
import { SDJWTException, Disclosure } from '@hopae/sd-jwt-util';
import { SDJWTException, Disclosure } from '@lukas.j.han/sd-jwt-util';
import { Jwt } from './jwt';
import { KBJwt } from './kbjwt';
import {
Expand All @@ -14,12 +14,12 @@ import {
SaltGenerator,
kbHeader,
kbPayload,
} from '@hopae/sd-jwt-type';
} from '@lukas.j.han/sd-jwt-type';
import {
createHashMapping,
getSDAlgAndPayload,
unpack,
} from '@hopae/sd-jwt-decode';
} from '@lukas.j.han/sd-jwt-decode';

export type SDJwtData<
Header extends Record<string, any>,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/test/decoy.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createDecoy } from '../decoy';
import { describe, expect, test } from 'vitest';
import { Base64urlEncode } from '@hopae/sd-jwt-util';
import { digest, generateSalt } from '@hopae/sd-jwt-node-crypto';
import { Base64urlEncode } from '@lukas.j.han/sd-jwt-util';
import { digest, generateSalt } from '@lukas.j.han/sd-jwt-node-crypto';

const hash = {
hasher: digest,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { SDJwtInstance } from '../index';
import { Signer, Verifier } from '@hopae/sd-jwt-type';
import { Signer, Verifier } from '@lukas.j.han/sd-jwt-type';
import Crypto from 'node:crypto';
import { describe, expect, test } from 'vitest';
import { digest, generateSalt } from '@hopae/sd-jwt-node-crypto';
import { digest, generateSalt } from '@lukas.j.han/sd-jwt-node-crypto';

export const createSignerVerifier = () => {
const { privateKey, publicKey } = Crypto.generateKeyPairSync('ed25519');
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/test/jwt.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SDJWTException } from '@hopae/sd-jwt-util';
import { SDJWTException } from '@lukas.j.han/sd-jwt-util';
import { Jwt } from '../jwt';
import Crypto from 'node:crypto';
import { Signer, Verifier } from '@hopae/sd-jwt-type';
import { Signer, Verifier } from '@lukas.j.han/sd-jwt-type';
import { describe, expect, test } from 'vitest';

describe('JWT', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/test/kbjwt.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJWTException } from '@hopae/sd-jwt-util';
import { SDJWTException } from '@lukas.j.han/sd-jwt-util';
import { KBJwt } from '../kbjwt';
import { KB_JWT_TYP, Signer, Verifier } from '@hopae/sd-jwt-type';
import { KB_JWT_TYP, Signer, Verifier } from '@lukas.j.han/sd-jwt-type';
import Crypto from 'node:crypto';
import { describe, expect, test } from 'vitest';

Expand Down
11 changes: 7 additions & 4 deletions packages/core/src/test/sdjwt.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { Disclosure } from '@hopae/sd-jwt-util';
import { Disclosure } from '@lukas.j.han/sd-jwt-util';
import { Jwt } from '../jwt';
import { SDJwt, listKeys, pack } from '../sdjwt';
import Crypto from 'node:crypto';
import { describe, test, expect } from 'vitest';
import { DisclosureFrame, Signer } from '@hopae/sd-jwt-type';
import { generateSalt, digest as hasher } from '@hopae/sd-jwt-node-crypto';
import { unpack, createHashMapping } from '@hopae/sd-jwt-decode';
import { DisclosureFrame, Signer } from '@lukas.j.han/sd-jwt-type';
import {
generateSalt,
digest as hasher,
} from '@lukas.j.han/sd-jwt-node-crypto';
import { unpack, createHashMapping } from '@lukas.j.han/sd-jwt-decode';

const hash = { alg: 'SHA256', hasher };

Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/app-e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Crypto from 'node:crypto';
import { SDJwtInstance } from '../src';
import { DisclosureFrame, Signer, Verifier } from '@hopae/sd-jwt-type';
import { DisclosureFrame, Signer, Verifier } from '@lukas.j.han/sd-jwt-type';
import fs from 'fs';
import path from 'path';
import { describe, expect, test } from 'vitest';
import { digest, generateSalt } from '@hopae/sd-jwt-node-crypto';
import { digest, generateSalt } from '@lukas.j.han/sd-jwt-node-crypto';

export const createSignerVerifier = () => {
const { privateKey, publicKey } = Crypto.generateKeyPairSync('ed25519');
Expand Down
9 changes: 6 additions & 3 deletions packages/decode/src/decode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ import {
Base64urlDecode,
SDJWTException,
Disclosure,
} from '@hopae/sd-jwt-util';
} from '@lukas.j.han/sd-jwt-util';
import {
Hasher,
HasherAndAlg,
SD_DIGEST,
SD_LIST_KEY,
SD_SEPARATOR,
} from '@hopae/sd-jwt-type';
import { HasherAndAlgSync, HasherSync } from '@hopae/sd-jwt-type/src/type';
} from '@lukas.j.han/sd-jwt-type';
import {
HasherAndAlgSync,
HasherSync,
} from '@lukas.j.han/sd-jwt-type/src/type';

export const decodeJwt = <
H extends Record<string, any>,
Expand Down
2 changes: 1 addition & 1 deletion packages/decode/src/test/decode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
getClaimsSync,
splitSdJwt,
} from '../decode';
import { digest } from '@hopae/sd-jwt-node-crypto';
import { digest } from '@lukas.j.han/sd-jwt-node-crypto';

describe('decode tests', () => {
test('decode jwt', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/hash/src/sha256.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sha256 as nobleSha256 } from '@noble/hashes/sha256';
import { SDJWTException } from '@hopae/sd-jwt-util';
import { SDJWTException } from '@lukas.j.han/sd-jwt-util';

export const sha256 = (text: string): Uint8Array => {
const uint8Array = toUTF8Array(text);
Expand Down
2 changes: 1 addition & 1 deletion packages/hash/src/test/sha256.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { digest } from '@hopae/sd-jwt-node-crypto';
import { digest } from '@lukas.j.han/sd-jwt-node-crypto';
import { bytesToHex } from '@noble/hashes/utils';
import { hasher, sha256 } from '../sha256';
import { describe, expect, test } from 'vitest';
Expand Down
8 changes: 4 additions & 4 deletions packages/present/src/present.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Hasher, SD_SEPARATOR } from '@hopae/sd-jwt-type';
import { Disclosure, SDJWTException } from '@hopae/sd-jwt-util';
import { Hasher, SD_SEPARATOR } from '@lukas.j.han/sd-jwt-type';
import { Disclosure, SDJWTException } from '@lukas.j.han/sd-jwt-util';
import {
createHashMapping,
decodeSdJwt,
Expand All @@ -9,8 +9,8 @@ import {
createHashMappingSync,
decodeSdJwtSync,
unpackSync,
} from '@hopae/sd-jwt-decode';
import { HasherSync } from '@hopae/sd-jwt-type/src/type';
} from '@lukas.j.han/sd-jwt-decode';
import { HasherSync } from '@lukas.j.han/sd-jwt-type/src/type';

// Presentable keys
// The presentable keys are the path of JSON object that are presentable in the SD JWT
Expand Down
4 changes: 2 additions & 2 deletions packages/present/src/test/present.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { describe, expect, test } from 'vitest';
import { digest } from '@hopae/sd-jwt-node-crypto';
import { digest } from '@lukas.j.han/sd-jwt-node-crypto';
import {
present,
presentSync,
presentableKeys,
presentableKeysSync,
} from '../present';
import { decodeSdJwt, decodeSdJwtSync } from '@hopae/sd-jwt-decode';
import { decodeSdJwt, decodeSdJwtSync } from '@lukas.j.han/sd-jwt-decode';

describe('Present tests', () => {
test('presentableKeys', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/disclosure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
HasherAndAlg,
DisclosureData,
HasherAndAlgSync,
} from '@hopae/sd-jwt-type';
} from '@lukas.j.han/sd-jwt-type';

export class Disclosure<T> {
public salt: string;
Expand Down
5 changes: 4 additions & 1 deletion packages/utils/src/test/disclosure.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { generateSalt, digest as hasher } from '@hopae/sd-jwt-node-crypto';
import {
generateSalt,
digest as hasher,
} from '@lukas.j.han/sd-jwt-node-crypto';
import { Disclosure } from '../disclosure';
import { describe, expect, test } from 'vitest';
import { Base64urlEncode, SDJWTException } from '../index';
Expand Down

0 comments on commit 4f4ea69

Please sign in to comment.