-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add x25519 and ed25519 to ec module
- Loading branch information
1 parent
53c4e0e
commit b65b6af
Showing
5 changed files
with
235 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ProviderCrypto } from "../provider"; | ||
import { ProviderKeyUsages } from "../types"; | ||
|
||
export abstract class Ed25519Provider extends ProviderCrypto { | ||
|
||
public readonly name: string = "Ed25519"; | ||
|
||
public usages: ProviderKeyUsages = { | ||
privateKey: ["sign"], | ||
publicKey: ["verify"], | ||
}; | ||
|
||
public abstract onSign(algorithm: Algorithm, key: CryptoKey, data: ArrayBuffer, ...args: any[]): Promise<ArrayBuffer>; | ||
public abstract onVerify(algorithm: Algorithm, key: CryptoKey, signature: ArrayBuffer, data: ArrayBuffer, ...args: any[]): Promise<boolean>; | ||
} |
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,2 @@ | ||
export * from "../ed/x25519"; | ||
export * from "../ed/ed25519"; |
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,18 @@ | ||
import { ProviderCrypto } from "../provider"; | ||
import { ProviderKeyUsages } from "../types"; | ||
|
||
export abstract class X25519Provider extends ProviderCrypto { | ||
|
||
public readonly name: string = "X25519"; | ||
|
||
public usages: ProviderKeyUsages = { | ||
privateKey: ["deriveKey", "deriveBits"], | ||
publicKey: [], | ||
}; | ||
|
||
public checkAlgorithmParams(algorithm: EcdhKeyDeriveParams): void { | ||
this.checkRequiredProperty(algorithm, "public"); | ||
} | ||
|
||
public abstract onDeriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>; | ||
} |
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