Skip to content

Commit

Permalink
refactor: createKey to createKeyPair
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <timo@animo.id>
  • Loading branch information
TimoGlastra committed Jul 18, 2022
1 parent f908b0d commit c71a77e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { SigningProvider, CreateKeyOptions, SignOptions, VerifyOptions, KeyPair } from './SigningProvider'
import type { SigningProvider, CreateKeyPairOptions, SignOptions, VerifyOptions, KeyPair } from './SigningProvider'

import { bls12381toBbs, verify, sign, generateBls12381G2KeyPair } from '@mattrglobal/bbs-signatures'

Expand All @@ -21,7 +21,7 @@ export class Bls12381g2SigningProvider implements SigningProvider {
*
* @throws {SigningProviderError} When a key could not be created
*/
public async createKey({ seed }: CreateKeyOptions): Promise<KeyPair> {
public async createKeyPair({ seed }: CreateKeyPairOptions): Promise<KeyPair> {
// Generate bytes from the seed as required by the bbs-signatures libraries
const seedBytes = seed ? TypedArrayEncoder.fromString(seed) : undefined

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/crypto/signing-provider/SigningProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export interface VerifyOptions {
signature: Buffer
}

export interface CreateKeyOptions {
export interface CreateKeyPairOptions {
seed?: string
}

export interface SigningProvider {
readonly keyType: KeyType

createKey(options: CreateKeyOptions): Promise<KeyPair>
createKeyPair(options: CreateKeyPairOptions): Promise<KeyPair>
sign(options: SignOptions): Promise<Buffer>
verify(options: VerifyOptions): Promise<boolean>
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SigningProviderRegistry } from '../SigningProviderRegistry'
class SigningProviderMock implements SigningProvider {
public readonly keyType = KeyType.Bls12381g2

public async createKey(): Promise<KeyPair> {
public async createKeyPair(): Promise<KeyPair> {
throw new Error('Method not implemented.')
}
public async sign(): Promise<Buffer> {
Expand Down

0 comments on commit c71a77e

Please sign in to comment.