-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c34682f
commit 1ad50b5
Showing
21 changed files
with
279 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ContainerModule } from "inversify"; | ||
|
||
import { HttpPkiCertificateDataSource } from "@/pki/data/HttpPkiCertificateDataSource"; | ||
import { DefaultPkiCertificateLoader } from "@/pki/domain/DefaultPkiCertificateLoader"; | ||
|
||
import { pkiTypes } from "./pkiDiTypes"; | ||
|
||
export const nanoPkiModuleFactory = () => | ||
new ContainerModule((bind, _unbind, _isBound, _rebind) => { | ||
bind(pkiTypes.PkiCertificateDataSource).to(HttpPkiCertificateDataSource); | ||
bind(pkiTypes.PkiCertificateLoader).to(DefaultPkiCertificateLoader); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/signer/context-module/src/pki/domain/model/KeyUsage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export enum KeyUsage { | ||
TrustedName = "trusted_name", | ||
Web3Checks = "web3checks", | ||
//TODO add following Docs https://ledgerhq.atlassian.net/wiki/spaces/BE/pages/4863033373/CAL+-+Raw+signing+NanoPKI+migration | ||
} |
15 changes: 11 additions & 4 deletions
15
packages/signer/context-module/src/pki/domain/pkiCertificateTypes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
import type { KeyUsage } from "./model/KeyUsage"; | ||
|
||
export type PkiCertificate = { | ||
id: string; | ||
descriptor: string; | ||
keyUsageNumber: number; | ||
payload: Uint8Array; | ||
}; | ||
|
||
export type PkiCertificateInfo = { | ||
descriptor: string; | ||
targetDevice: string; | ||
osVersion: string; | ||
keyUsage: KeyUsage; | ||
keyId?: string | undefined; | ||
}; | ||
|
||
/* | ||
Do we re add it to PkiCertificateInfo? | ||
osVersion: string; | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
packages/signer/context-module/src/shared/utils/KeyUsageMapper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
export class KeyUsageMapper { | ||
static mapKeyUsageForFirmware(keyUsageString: string): number { | ||
let keyUsageNumber = -1; | ||
|
||
switch (keyUsageString) { | ||
case "genuine_check": | ||
keyUsageNumber = 1; | ||
break; | ||
case "exchange_payload": | ||
keyUsageNumber = 2; | ||
break; | ||
case "nft_meta": | ||
keyUsageNumber = 3; | ||
break; | ||
case "trusted_name": | ||
keyUsageNumber = 4; | ||
break; | ||
case "backup_provider": | ||
keyUsageNumber = 5; | ||
break; | ||
case "protect_orchestrator": | ||
keyUsageNumber = 6; | ||
break; | ||
case "plugin_meta": | ||
keyUsageNumber = 7; | ||
break; | ||
case "coin_meta": | ||
keyUsageNumber = 8; | ||
break; | ||
case "seed_id_auth": | ||
keyUsageNumber = 9; | ||
break; | ||
case "web3checks": | ||
keyUsageNumber = 10; | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
return keyUsageNumber; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.