Skip to content

Commit

Permalink
Update did public and private keys
Browse files Browse the repository at this point in the history
  • Loading branch information
biscuitdey committed Apr 25, 2024
1 parent 21c09ae commit a0b91c2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
5 changes: 2 additions & 3 deletions examples/bri-3/src/bri/auth/agent/auth.agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ export class AuthAgent {
signature: string,
senderPublicKey: string,
): boolean {
let publicAddressFromSenderPublicKey = '';
let publicAddressFromSignature = '';

try {
publicAddressFromSenderPublicKey = ethers.computeAddress(senderPublicKey);
//publicAddressFromSenderPublicKey = ethers.computeAddress(senderPublicKey);
publicAddressFromSignature = ethers.verifyMessage(message, signature);
} catch (error) {
this.logger.logError(
Expand All @@ -52,7 +51,7 @@ export class AuthAgent {

const isValid =
publicAddressFromSignature.toLowerCase() ===
publicAddressFromSenderPublicKey.toLowerCase();
senderPublicKey.toLowerCase();

if (!isValid) {
this.logger.logWarn(
Expand Down
2 changes: 1 addition & 1 deletion examples/bri-3/src/bri/auth/guards/didJwt.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class DidJwtAuthGuard implements CanActivate {
context: ExecutionContext,
) {
// TODO: store did in bpi subject and remove constant
const didSubstrLength = 13;
const didSubstrLength = 20;
const bpiSubject =
await this.bpiSubjectStorageAgent.getBpiSubjectByPublicKey(
verified.payload.sub!.substring(didSubstrLength),

Check warning on line 47 in examples/bri-3/src/bri/auth/guards/didJwt.guard.ts

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest, 17.0.0)

Forbidden non-null assertion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ describe('DID service', () => {

const did = await didService.createDid(keypair, provider);

await didService.setAuthenticationPublicKey(
did,
supplierBpiSubjectEcdsaPublicKey,
provider,
);
// await didService.setAuthenticationPublicKey(
// did,
// supplierBpiSubjectEcdsaPublicKey,
// provider,
// );

const didResolver = await didService.getDidResolver(provider);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class DidService {

async createDid(keypair: KeyPair, provider: Provider): Promise<EthrDID> {
const did = new EthrDID({
identifier: keypair.publicKey,
identifier: '0x08872e27BC5d78F1FC4590803369492868A1FCCb',
provider,
chainNameOrId: process.env.INFURA_PROVIDER_NETWORK,
registry: process.env.DID_REGISTRY,
Expand Down
4 changes: 2 additions & 2 deletions examples/bri-3/src/shared/testing/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ export const buyerBpiSubjectEcdsaPublicKey =
export const buyerBpiSubjectEcdsaPrivateKey =
'0x32c8d8f4e53cd1920d1ad22b9d51a7b28216337f2b664fb8d33bbcfc3c455c62';
export const internalBpiSubjectEcdsaPublicKey =
'0x044e851fa6118d0d33f11ebf8d4cae2a25dca959f06c1ab87b8fec9ccbf0ca0021b7efc27c786f9480f9f11cfe8df1ae991329654308611148a35a2277ba5909fe';
'0x08872e27BC5d78F1FC4590803369492868A1FCCb';
export const internalBpiSubjectEcdsaPrivateKey =
'0x0fbdb56ab0fecb2f406fa807d9e6558baedacc1c15c0e2703b77d4c08441e4fe';
'2c95d82bcd8851bd3a813c50afafb025228bf8d237e8fd37ba4adba3a7596d58';

0 comments on commit a0b91c2

Please sign in to comment.