github.com/hyperledger/aries-framework-go@v0.3.2/pkg/doc/util/jwkkid/kid_creator.go (about) 1 /* 2 Copyright SecureKey Technologies Inc. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package jwkkid 8 9 import ( 10 "github.com/hyperledger/aries-framework-go/component/kmscrypto/doc/jose/jwk" 11 "github.com/hyperledger/aries-framework-go/component/kmscrypto/doc/util/jwkkid" 12 "github.com/hyperledger/aries-framework-go/spi/kms" 13 ) 14 15 // CreateKID creates a KID value based on the marshalled keyBytes of type kt. This function should be called for 16 // asymmetric public keys only (ECDSA DER or IEEE-P1363, ED25519, X25519, BLS12381G2). 17 // returns: 18 // - base64 raw (no padding) URL encoded KID 19 // - error in case of error 20 func CreateKID(keyBytes []byte, kt kms.KeyType) (string, error) { 21 return jwkkid.CreateKID(keyBytes, kt) 22 } 23 24 // BuildJWK builds a go jose JWK from keyBytes with key type kt. 25 func BuildJWK(keyBytes []byte, kt kms.KeyType) (*jwk.JWK, error) { 26 return jwkkid.BuildJWK(keyBytes, kt) 27 }