Catalog npm
Back to packageRELEASE DETAILS

0.0.0

npm

@0xsequence/google-kms-signer

[GoogleKmsSigner](https://github.com/0xsequence/google-kms-signer) is an [ethers.js](https://ethers.org)- and [sequence.js](https://github.com/0xsequence/sequence.js)-compatible signer using [Google Cloud Key Management Service](https://cloud.google.com/s

0xsequenceethersethers.jsgooglekmssequencesequence.jssigner
Published4 Jan 2024
Direct dependencies25
Transitive dependenciesNot calculated

README

Current package documentation

google-kms-signer

GoogleKmsSigner is an ethers.js- and sequence.js-compatible signer using Google Cloud Key Management Service keys

prerequisites

create google cloud kms key

https://console.cloud.google.com/security/kms/keyrings

  1. create project or use existing one
  2. create key ring or use existing one
  3. create key
  • protection level: hsm
  • key material: hsm-generated
  • purpose: asymmetric sign
  • algorithm: elliptic curve secp256k1 - sha256 digest

set up application default credentials

https://cloud.google.com/kms/docs/reference/libraries#authentication

  1. install gcloud cli
  2. gcloud auth application-default login
  3. authenticate

installation

these instructions assume pnpm, please refer to docs if you use something else

pnpm add @0xsequence/google-kms-signer

usage

integration

create a signer:

import { GoogleKmsSigner } from '@0xsequence/google-kms-signer'

const signer = new GoogleKmsSigner({
  project: 'my-project',
  location: 'my-location',
  keyRing: 'my-key-ring',
  cryptoKey: 'my-crypto-key',
  cryptoKeyVersion: 'my-crypto-key-version'
})

get your signer's address:

const address = await signer.getAddress()
console.log(address)

sign a message:

const message = 'hello world'
const signature = await signer.signMessage(message)

console.log(signature)
console.log(`${ethers.utils.verifyMessage(message, signature)} = ${address}`)

send a transaction:

const provider = new ethers.providers.JsonRpcProvider('https://my-json-rpc-provider.com')
const connectedSigner = signer.connect(provider)

const response = await connectedSigner.sendTransaction({
  to: 'destination address',
  value: 123
})

const receipt = await response.wait()
console.log(receipt)

sign for a sequence wallet:

import { Session } from '@0xsequence/auth'
import { isValidMessageSignature } from '@0xsequence/provider'

const session = await Session.singleSigner({
  signer,
  projectAccessKey: 'my-project-access-key'
})

const message = ethers.utils.toUtf8Bytes('hello world')
const signature = await session.account.signMessage(message, chainId, 'eip6492')

console.log(isValidMessageSignature(session.account.address, message, signature, provider))

running tests

cp .env.sample .env

edit the .env file, then:

pnpm test

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 26

Native requirements
25 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
pkijs
Environment
{
  "local_name": "pkijs",
  "alias": false,
  "peer_metadata": null
}
^3.0.15runtime
asn1js
Environment
{
  "local_name": "asn1js",
  "alias": false,
  "peer_metadata": null
}
^3.0.5runtime
@google-cloud/kms
Environment
{
  "local_name": "@google-cloud/kms",
  "alias": false,
  "peer_metadata": null
}
^4.0.1runtime
tsx
Environment
{
  "local_name": "tsx",
  "alias": false,
  "peer_metadata": null
}
^4.7.0development
chai
Environment
{
  "local_name": "chai",
  "alias": false,
  "peer_metadata": null
}
4development
mocha
Environment
{
  "local_name": "mocha",
  "alias": false,
  "peer_metadata": null
}
^10.2.0development
dotenv
Environment
{
  "local_name": "dotenv",
  "alias": false,
  "peer_metadata": null
}
^16.3.1development
eslint
Environment
{
  "local_name": "eslint",
  "alias": false,
  "peer_metadata": null
}
^8.56.0development
ethers
Environment
{
  "local_name": "ethers",
  "alias": false,
  "peer_metadata": null
}
5development
esbuild
Environment
{
  "local_name": "esbuild",
  "alias": false,
  "peer_metadata": null
}
^0.19.11development
hardhat
Environment
{
  "local_name": "hardhat",
  "alias": false,
  "peer_metadata": null
}
^2.19.4development
wait-on
Environment
{
  "local_name": "wait-on",
  "alias": false,
  "peer_metadata": null
}
^7.2.0development
prettier
Environment
{
  "local_name": "prettier",
  "alias": false,
  "peer_metadata": null
}
^3.1.1development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.3.3development
@types/chai
Environment
{
  "local_name": "@types/chai",
  "alias": false,
  "peer_metadata": null
}
^4.3.11development
@types/mocha
Environment
{
  "local_name": "@types/mocha",
  "alias": false,
  "peer_metadata": null
}
^10.0.6development
concurrently
Environment
{
  "local_name": "concurrently",
  "alias": false,
  "peer_metadata": null
}
^8.2.2development
@0xsequence/auth
Environment
{
  "local_name": "@0xsequence/auth",
  "alias": false,
  "peer_metadata": null
}
^1.6.2development
chai-as-promised
Environment
{
  "local_name": "chai-as-promised",
  "alias": false,
  "peer_metadata": null
}
^7.1.1development
@0xsequence/tests
Environment
{
  "local_name": "@0xsequence/tests",
  "alias": false,
  "peer_metadata": null
}
^1.6.2development
@0xsequence/provider
Environment
{
  "local_name": "@0xsequence/provider",
  "alias": false,
  "peer_metadata": null
}
^1.6.2development
eslint-plugin-import
Environment
{
  "local_name": "eslint-plugin-import",
  "alias": false,
  "peer_metadata": null
}
^2.29.1development
eslint-config-prettier
Environment
{
  "local_name": "eslint-config-prettier",
  "alias": false,
  "peer_metadata": null
}
^9.1.0development
@types/chai-as-promised
Environment
{
  "local_name": "@types/chai-as-promised",
  "alias": false,
  "peer_metadata": null
}
^7.1.8development
@typescript-eslint/eslint-plugin
Environment
{
  "local_name": "@typescript-eslint/eslint-plugin",
  "alias": false,
  "peer_metadata": null
}
^6.16.0development
ethers
Environment
{
  "local_name": "ethers",
  "alias": false,
  "peer_metadata": null
}
5peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "3c6fe310d194ae1fc6e5785d89c44e1d73916097",
  "tarball": "https://registry.npmjs.org/@0xsequence/google-kms-signer/-/google-kms-signer-0.0.0.tgz",
  "fileCount": 19,
  "integrity": "sha512-pK5cTG5jFKgFg7jYkzOO8ug7rwP3Rlovr1CLbOwojCVzt1l2IT6ETEv+OB1ZleSMDiRcPFOO5hrJZmQOA7fxFg==",
  "signatures": [
    {
      "sig": "MEUCIQCEIQhJ1Yn4xSGUBRtykYYLhH1j0lLMxpLVhbHAdGNZagIgQeh2M5nZPE4YfO5WKHLJ9671GgK62rA5I5HOWM/KKTE=",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 14743107
}

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 10:20 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:93acdd8c7a9efcd8aaab8d51ec18d70fc4545754a988ba9da8abab7b7875bb51

Other collected versions

0.3.027 Feb0.2.015 Feb0.0.14 JanView all collected versions →