Skip to content

Commit

Permalink
chore: added header to kbJwt
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Sep 17, 2024
1 parent f6f9cac commit e2ad2de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions packages/oid4vci-holder/src/agent/OID4VCIHolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,7 @@ export class OID4VCIHolder implements IAgentPlugin {
if (!issuanceOpt || !issuanceOpt.identifier) {
return Promise.reject(Error('issuanceOpt.identifier must me set in order to store a credential'))
}
const identifier = issuanceOpt.identifier
const { kmsKeyRef, method } = identifier
const { kmsKeyRef, method } = issuanceOpt.identifier

let persist = true
const verifiableCredential = mappedCredentialToAccept.uniformVerifiableCredential as VerifiableCredential
Expand Down
8 changes: 5 additions & 3 deletions packages/ssi-types/src/types/sd-jwt-vc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { OriginalType, WrappedVerifiableCredential, WrappedVerifiablePresentatio
import { decodeSdJwt, decodeSdJwtSync, getClaims, getClaimsSync } from '@sd-jwt/decode'
import { CompactJWT, IVerifiableCredential } from './w3c-vc'
import { IProofPurpose, IProofType } from './did'
import { JWTHeader } from 'did-jwt'

type JsonValue = string | number | boolean | { [x: string]: JsonValue | undefined } | Array<JsonValue>

Expand Down Expand Up @@ -123,8 +124,9 @@ export interface SdJwtDecodedVerifiableCredential {
* Key binding JWT
*/
kbJwt?: {
compact: CompactJWT
header: JWTHeader
payload: SdJwtVcKbJwtPayload
compact?: CompactJWT
}
}

Expand Down Expand Up @@ -276,7 +278,7 @@ export async function decodeSdJwtVcAsync(compactSdJwtVc: CompactSdJwtVc, hasher:
// TODO naive implementation of mapping a sd-jwt onto a IVerifiableCredential. Needs some fixes and further implementation and needs to be moved out of ssi-types
export const sdJwtDecodedCredentialToUniformCredential = (
decoded: SdJwtDecodedVerifiableCredential,
opts?: { maxTimeSkewInMS?: number },
opts?: { maxTimeSkewInMS?: number }
): IVerifiableCredential => {
const { decodedPayload } = decoded // fixme: other params and proof
const { exp, nbf, iss, iat, vct, cnf, status, sub, jti } = decodedPayload
Expand All @@ -292,7 +294,7 @@ export const sdJwtDecodedCredentialToUniformCredential = (

return acc
},
{},
{}
)

const maxSkewInMS = opts?.maxTimeSkewInMS ?? 1500
Expand Down

0 comments on commit e2ad2de

Please sign in to comment.