Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: header alg value in examples #251

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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