Skip to content

Commit

Permalink
fix: workaround webpack 5 polyfill migration (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmorency authored Jan 8, 2024
1 parent 5b3675b commit 3fe10c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/identity/ed25519/ed25519-key-pair-identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export class Ed25519KeyPairIdentity extends PublicKeyIdentity {
c.set(3, -8) // alg: EdDSA
c.set(-1, 6) // crv: Ed25519
c.set(4, [2]) // key_ops: [verify]
c.set(-2, this.publicKey) // x: publicKey

// WARN: Buffer.from is required here to avoid array tagging by the cbor library
c.set(-2, Buffer.from(this.publicKey)) // x: publicKey
return new CoseKey(c)
}

Expand Down
6 changes: 3 additions & 3 deletions src/message/cose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ export class CoseMessage {
protectedHeader: CborMap
unprotectedHeader: CborMap
content: CborMap
signature: ArrayBuffer
signature: Buffer

constructor(
protectedHeader: CborMap,
unprotectedHeader: CborMap,
content: CborMap,
signature: ArrayBuffer,
signature: Buffer, // WARN: Buffer required to avoid array tagging by cbor library.
) {
this.protectedHeader = protectedHeader
this.unprotectedHeader = unprotectedHeader
Expand Down Expand Up @@ -81,7 +81,7 @@ export class CoseMessage {
protectedHeader,
unprotectedHeader,
content,
signature,
Buffer.from(signature), // WARN: Buffer required to avoid array tagging by cbor library.
)
}

Expand Down

0 comments on commit 3fe10c7

Please sign in to comment.