npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gowl-client-lib

v1.1.0

Published

The client library for GOWL.

Downloads

6

Readme

Disclaimer

I am not a cryptographer, I am a software engineer. This implementation is for educational purposes only. Do not use this implementation in production. If you want to use the OWL aPake protocol, please use the Java implementation provided by the authors of the protocol.

GOWL

GOWL Is a OWL aPake implementation in Go. OWL aPake is an Augmented Password-Authenticated Key Exchange Scheme

Dose it work?

Yes, it works. I have tested it with the Java implementation provided by the authors of the protocol. The implementation is not optimized and it is assumed not secure. It is for educational purposes only. It has tests against the Java implementation provided by the authors of the protocol.

Why GO?

I wanted to learn Go and I thought that implementing the OWL aPake protocol would be a good way to learn Go.

How to use it?

GO Server

Note: The Go library implements both the client and the server. The server component is only used to test the client component.

Each function returns a struct that contains a payload, this payload is the Only Data that should be sent to the other party.

curve := elliptic.P256()
user := "Alice"
pass := "deadbeef"
serverName := "Server"

// -- Register
client, err := owl.ClientInit(user, pass, serverName, curve)
if err != nil {
    fmt.Println(err)
    return
}

clientRegistration := client.Register()

server, err := owl.ServerInit(serverName, curve, clientRegistration.Payload)
if err != nil {
    fmt.Println(err)
    return
}

serverRegistration := server.RegisterUser()

// -- Auth Init
clientInit := client.AuthInit()
serverInit, err := server.AuthInit(serverRegistration, clientInit.Payload)
if err != nil {
    fmt.Println(err)
    return
}

// -- Auth Validate
clientValidate, err := client.AuthValidate(clientInit, serverInit.Payload)
if err != nil {
    fmt.Println(err)
    return
}

serverValidate, err := server.AuthValidate(clientInit.Payload, clientValidate.Payload, serverInit)
if err != nil {
    fmt.Println(err)
    return
}

println("Client Session Key:", clientValidate.ClientSessionKey.String())
println("Server Session Key:", serverValidate.ServerSessionKey.String())

// -- Verify Response (Optional)
err = client.VerifyResponse(
    clientInit,
    clientValidate,
    serverInit.Payload,
    serverValidate.Payload,
)

if err != nil {
fmt.Println(err)
return
}

WEB (TS) Client

There is NO server component in the web client. The server component is only in the Go implementation. If you want a end-to-end implementation in TypeScript, you can use this implementation.

I have also implemented the OWL aPAKE client in TypeScript. You can find it in the web directory. A simple exchange between the Go server and the TypeScript client is shown below.

//
// -- Register
//

let client = new Client('username', 'password', 'server', SupportedCurves.P256);
const register = await client.Register();

const sendRegistrationRequest = await fetch(registerURL, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ ...register, TOS: true })
});

if (!sendRegistrationRequest.ok) {
    const text = await sendRegistrationRequest.text();
    console.error(text);
    throw new Error('Failed to register');
}



//
// -- Login (Init)
//

client = new Client('username', 'password', 'server', SupportedCurves.P256);
const authInit = await client.AuthInit();

const sendAuthInitRequest = await fetch(loginInitURL, {
    method: 'PUT',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(authInit)
});

if (!sendAuthInitRequest.ok) {
    const text = await sendAuthInitRequest.text();
    console.error(text);
    throw new Error('Failed to authenticate (Init)');
}

const authInitResponse = await sendAuthInitRequest.json();

//
// -- Login (Verify)
//

const authVerify = await client.AuthVerify(authInitResponse);
const sendAuthVerifyRequest = await fetch(loginVerifyURL, {
    method: 'PUT',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(authVerify)
});

if (!sendAuthVerifyRequest.ok) {
    const text = await sendAuthVerifyRequest.text();
    console.error(text);
    throw new Error('Failed to authenticate (Verify)');
}

const authVerifyResponse = await sendAuthVerifyRequest.json();

// -- Validate servers KCTag
await client.ValidateServer(authVerifyResponse);

Resources