Skip to content

Commit

Permalink
fix: header alg value in examples (#251)
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas.J.Han <lukas.j.han@gmail.com>
  • Loading branch information
lukasjhan authored Oct 16, 2024
1 parent 96e76a9 commit 974efea
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 39 deletions.
4 changes: 2 additions & 2 deletions examples/sd-jwt-example/all.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtInstance } from '@sd-jwt/core';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, generateSalt, ES256 } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-example/basic.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtInstance } from '@sd-jwt/core';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-example/custom.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtInstance } from '@sd-jwt/core';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-example/custom_header.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtInstance } from '@sd-jwt/core';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-example/decode.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { SDJwtInstance } from '@sd-jwt/core';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();

// Create SDJwt instance for use
const sdjwt = new SDJwtInstance({
signer,
signAlg: 'EdDSA',
signAlg: ES256.alg,
verifier,
hasher: digest,
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-example/decoy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtInstance } from '@sd-jwt/core';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
6 changes: 3 additions & 3 deletions examples/sd-jwt-example/kb.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { SDJwtInstance } from '@sd-jwt/core';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();

// Create SDJwt instance for use
const sdjwt = new SDJwtInstance({
signer,
signAlg: 'EdDSA',
signAlg: ES256.alg,
verifier,
hasher: digest,
saltGenerator: generateSalt,
kbSigner: signer,
kbSignAlg: 'EdDSA',
kbSignAlg: ES256.alg,
kbVerifier: verifier,
});
const claims = {
Expand Down
6 changes: 3 additions & 3 deletions examples/sd-jwt-example/sdjwtobject.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { SDJwtInstance } from '@sd-jwt/core';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();

// Create SDJwt instance for use
const sdjwt = new SDJwtInstance({
signer,
signAlg: 'EdDSA',
signAlg: ES256.alg,
verifier,
hasher: digest,
saltGenerator: generateSalt,
kbSigner: signer,
kbSignAlg: 'EdDSA',
kbSignAlg: ES256.alg,
kbVerifier: verifier,
});
// Issuer Define the claims object with the user's information
Expand Down
2 changes: 1 addition & 1 deletion examples/sd-jwt-example/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ES256, digest, generateSalt } from '@sd-jwt/crypto-nodejs';
export { digest, generateSalt };
export { digest, generateSalt, ES256 };

export const createSignerVerifier = async () => {
const { privateKey, publicKey } = await ES256.generateKeyPair();
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-vc-example/all.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtVcInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-vc-example/basic.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtVcInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-vc-example/custom.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtVcInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-vc-example/custom_header.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtVcInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
6 changes: 3 additions & 3 deletions examples/sd-jwt-vc-example/decode.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();

// Create SDJwt instance for use
const sdjwt = new SDJwtVcInstance({
signer,
signAlg: 'EdDSA',
signAlg: ES256.alg,
verifier,
hasher: digest,
saltGenerator: generateSalt,
kbSigner: signer,
kbSignAlg: 'EdDSA',
kbSignAlg: ES256.alg,
kbVerifier: verifier,
});

Expand Down
4 changes: 2 additions & 2 deletions examples/sd-jwt-vc-example/decoy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();
Expand All @@ -9,7 +9,7 @@ import { createSignerVerifier, digest, generateSalt } from './utils';
const sdjwt = new SDJwtVcInstance({
signer,
verifier,
signAlg: 'EdDSA',
signAlg: ES256.alg,
hasher: digest,
hashAlg: 'SHA-256',
saltGenerator: generateSalt,
Expand Down
6 changes: 3 additions & 3 deletions examples/sd-jwt-vc-example/kb.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();

// Create SDJwt instance for use
const sdjwt = new SDJwtVcInstance({
signer,
signAlg: 'EdDSA',
signAlg: ES256.alg,
verifier,
hasher: digest,
saltGenerator: generateSalt,
kbSigner: signer,
kbSignAlg: 'EdDSA',
kbSignAlg: ES256.alg,
kbVerifier: verifier,
});
const claims = {
Expand Down
6 changes: 3 additions & 3 deletions examples/sd-jwt-vc-example/sdjwtobject.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { SDJwtVcInstance } from '@sd-jwt/sd-jwt-vc';
import type { DisclosureFrame } from '@sd-jwt/types';
import { createSignerVerifier, digest, generateSalt } from './utils';
import { createSignerVerifier, digest, ES256, generateSalt } from './utils';

(async () => {
const { signer, verifier } = await createSignerVerifier();

// Create SDJwt instance for use
const sdjwt = new SDJwtVcInstance({
signer,
signAlg: 'EdDSA',
signAlg: ES256.alg,
verifier,
hasher: digest,
saltGenerator: generateSalt,
kbSigner: signer,
kbSignAlg: 'EdDSA',
kbSignAlg: ES256.alg,
kbVerifier: verifier,
});
// Issuer Define the claims object with the user's information
Expand Down
2 changes: 1 addition & 1 deletion examples/sd-jwt-vc-example/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ES256, digest, generateSalt } from '@sd-jwt/crypto-nodejs';
export { digest, generateSalt };
export { digest, generateSalt, ES256 };

export const createSignerVerifier = async () => {
const { privateKey, publicKey } = await ES256.generateKeyPair();
Expand Down

0 comments on commit 974efea

Please sign in to comment.