Skip to content

Commit

Permalink
fix: make SIWE default to EIP55
Browse files Browse the repository at this point in the history
  • Loading branch information
oed committed Jul 12, 2024
1 parent c8d1de7 commit f771e4a
Show file tree
Hide file tree
Showing 5 changed files with 852 additions and 690 deletions.
10 changes: 5 additions & 5 deletions packages/did-session/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
"uint8arrays": "^5.0.1"
},
"devDependencies": {
"@ceramicnetwork/common": "^3.2.0",
"@ceramicnetwork/stream-model": "^2.2.0",
"@ceramicnetwork/stream-model-instance": "^2.2.0",
"@ceramicnetwork/stream-tile": "^3.2.0",
"@ceramicnetwork/streamid": "^3.2.0",
"@ceramicnetwork/common": "^5.15.0",
"@ceramicnetwork/stream-model": "^4.15.0",
"@ceramicnetwork/stream-model-instance": "^4.16.0",
"@ceramicnetwork/stream-tile": "^5.15.0",
"@ceramicnetwork/streamid": "^5.4.0",
"@didtools/cacao": "workspace:^",
"@didtools/pkh-ethereum": "workspace:^",
"@didtools/pkh-solana": "workspace:^",
Expand Down
8 changes: 7 additions & 1 deletion packages/did-session/test/lib.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @jest-environment ceramic
*/
import type { CeramicApi } from '@ceramicnetwork/common'
import type { StreamWriter } from '@ceramicnetwork/common'
import { TileDocument } from '@ceramicnetwork/stream-tile'
import { EventEmitter } from 'events'
import { Wallet as EthereumWallet, Wallet } from '@ethersproject/wallet'
Expand Down Expand Up @@ -97,6 +97,10 @@ const testResources = [
'`ceramic://*?model=k2t6wyfsu4pgz0ftx664veuaf2qib95zj8je2x7pf89v6g5p7xa7n9eo45g64a',
]

interface CeramicApi extends StreamWriter {
did: DID
}

declare global {
const ceramic: CeramicApi
}
Expand All @@ -113,6 +117,7 @@ describe('did-session', () => {
resolver: getResolver(),
provider: new Ed25519Provider(seed),
})
await did.authenticate()
ceramic.did = did
const authResult = await createEthereumAuthMethod()
authMethod = authResult.authMethod
Expand Down Expand Up @@ -466,6 +471,7 @@ describe('did-session Solana Authmethod', () => {
resolver: getResolver(),
provider: new Ed25519Provider(seed),
})
await did.authenticate()
ceramic.did = did
authMethod = await createSolanaAuthMethod()
model = await Model.create(ceramic, MODEL_DEFINITION)
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-environment-ceramic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"lint": "eslint index.js --fix"
},
"dependencies": {
"@ceramicnetwork/core": "^3.2.0",
"@ceramicnetwork/core": "^5.16.0",
"ipfs-core": "^0.18.1",
"jest-environment-node": "^29.7.0",
"tmp-promise": "^3.0.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/pkh-ethereum/src/authmethod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async function createCACAO(
resources: opts.resources,
})
const signature = await safeSend(ethProvider, 'personal_sign', [
encodeHexStr(siweMessage.signMessage()),
encodeHexStr(siweMessage.signMessage({ eip55: true })),
normAccount.address,
])
siweMessage.signature = signature
Expand Down
Loading

0 comments on commit f771e4a

Please sign in to comment.