Skip to content

Commit

Permalink
fix: use hexZeroPad in leaf
Browse files Browse the repository at this point in the history
  • Loading branch information
protodev-rage committed Aug 26, 2023
1 parent 3a40a9d commit b3da05f
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions packages/modules/src/SessionKeyManagerModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,12 @@ export class SessionKeyManagerModule extends BaseValidationModule {
throw new Error('sessionID or sessionValidationModule should be provided.')
}

const leafDataHex = ethers.utils.keccak256(
hexConcat([
sessionSignerData.validUntil,
sessionSignerData.validAfter,
sessionSignerData.sessionValidationModule,
sessionSignerData.sessionKeyData,
])
)
const leafDataHex = hexConcat([
hexZeroPad(ethers.utils.hexlify(sessionSignerData.validUntil), 6),
hexZeroPad(ethers.utils.hexlify(sessionSignerData.validAfter), 6),
hexZeroPad(sessionSignerData.sessionValidationModule, 20),
sessionSignerData.sessionKeyData
])

// Generate the padded signature with (validUntil,validAfter,sessionVerificationModuleAddress,validationData,merkleProof,signature)
let paddedSignature = defaultAbiCoder.encode(
Expand All @@ -159,7 +157,7 @@ export class SessionKeyManagerModule extends BaseValidationModule {
sessionSignerData.validAfter,
sessionSignerData.sessionValidationModule,
sessionSignerData.sessionKeyData,
this.merkleTree.getHexProof(leafDataHex),
this.merkleTree.getHexProof(ethers.utils.keccak256(leafDataHex)),
signature
]
)
Expand Down

0 comments on commit b3da05f

Please sign in to comment.